/* ============================================================
   SwiftBuild AI v3.0 — Main Stylesheet
   Light / Dark theme via html.theme-dark class
   Sidebar appearance via body.sidebar-dark / body.sidebar-light
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens (Light) ── */
:root {
    --primary:           #6366f1;
    --primary-rgb:       99, 102, 241;
    --primary-hover:     #4f46e5;
    --primary-light:     rgba(99,102,241,.1);

    --bg-body:           #f1f5f9;
    --bg-card:           #ffffff;
    --bg-surface:        #f8fafc;
    --bg-input:          #ffffff;
    --bg-hover:          #f1f5f9;
    --bg-dropdown:       #ffffff;

    --text-1:            #0f172a;
    --text-2:            #334155;
    --text-3:            #64748b;
    --text-4:            #94a3b8;

    --border:            #e2e8f0;
    --border-strong:     #cbd5e1;

    --shadow-xs:         0 1px 2px rgba(0,0,0,.05);
    --shadow-sm:         0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:         0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:         0 8px 32px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.04);

    --topbar-bg:         rgba(255,255,255,.88);
    --topbar-border:     #e2e8f0;

    --sidebar-width:     240px;
    --topbar-height:     58px;
    --card-radius:       12px;
    --input-radius:      8px;
    --transition:        .16s ease;

    /* Sidebar dark (default sidebar style) */
    --sidebar-bg:        #0f172a;
    --sidebar-border:    #1e293b;
    --sidebar-text:      #94a3b8;
    --sidebar-hover-bg:  rgba(255,255,255,.06);
    --sidebar-hover-txt: #e2e8f0;
    --sidebar-active-bg: rgba(var(--primary-rgb),.18);
    --sidebar-active-txt:var(--primary);
    --sidebar-brand-txt: #f1f5f9;
}

/* ── Dark Theme Overrides ── */
html.theme-dark {
    --bg-body:           #0d1117;
    --bg-card:           #161b22;
    --bg-surface:        #1c2128;
    --bg-input:          #1c2128;
    --bg-hover:          rgba(255,255,255,.05);
    --bg-dropdown:       #1c2128;

    --text-1:            #e6edf3;
    --text-2:            #c9d1d9;
    --text-3:            #8b949e;
    --text-4:            #484f58;

    --border:            #21262d;
    --border-strong:     #30363d;

    --shadow-xs:         0 1px 2px rgba(0,0,0,.3);
    --shadow-sm:         0 2px 8px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.2);
    --shadow-md:         0 4px 16px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.2);
    --shadow-lg:         0 8px 32px rgba(0,0,0,.5), 0 4px 8px rgba(0,0,0,.25);

    --topbar-bg:         rgba(13,17,23,.88);
    --topbar-border:     #21262d;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-body);
    color: var(--text-1);
    transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: var(--primary); }
a:hover { opacity: .85; }

h1, h2, h3, h4, h5, h6 { color: var(--text-1); }

hr { border-color: var(--border); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ── Layout ── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ──────────────────────────────────────────────
   SIDEBAR (dark variant — body.sidebar-dark)
   ────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    overflow: hidden;
}
.sidebar.collapsed { transform: translateX(-100%); }

/* Dark sidebar (default) */
.sidebar-dark .sidebar {
    background: #0f172a;
    border-right: 1px solid #1e293b;
}
.sidebar-dark .sidebar .nav-item      { color: #94a3b8; }
.sidebar-dark .sidebar .nav-item:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.sidebar-dark .sidebar .nav-item.active { background: rgba(var(--primary-rgb),.2); color: var(--primary); }
.sidebar-dark .sidebar-brand { border-bottom: 1px solid #1e293b; }
.sidebar-dark .sidebar-footer { border-top: 1px solid #1e293b; }
.sidebar-dark .brand-name  { color: #f1f5f9; }
.sidebar-dark .brand-sub   { color: #475569; }

/* Light sidebar */
.sidebar-light .sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 12px rgba(0,0,0,.04);
}
.sidebar-light .sidebar .nav-item      { color: #475569; }
.sidebar-light .sidebar .nav-item:hover { background: #f1f5f9; color: #0f172a; }
.sidebar-light .sidebar .nav-item.active { background: rgba(var(--primary-rgb),.1); color: var(--primary); font-weight: 600; }
.sidebar-light .sidebar-brand { border-bottom: 1px solid #e2e8f0; }
.sidebar-light .sidebar-footer { border-top: 1px solid #e2e8f0; }
.sidebar-light .brand-name  { color: #0f172a; }
.sidebar-light .brand-sub   { color: #94a3b8; }

/* Sidebar brand */
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    min-height: var(--topbar-height);
}
.brand-icon {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 17px; flex-shrink: 0;
}
.workspace-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.brand-name { font-weight: 700; font-size: .84rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub  { font-size: .66rem; opacity: .5; }

/* Sidebar nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 8px; }
.sidebar-nav::-webkit-scrollbar { width: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.07); }

.sidebar-section-label {
    font-size: .62rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #475569;
    padding: 16px 10px 4px;
    user-select: none;
}
.sidebar-dark .sidebar-section-label { color: #64748b; }
.sidebar-light .sidebar-section-label { color: #94a3b8; }

.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px; border-radius: 8px; cursor: pointer;
    font-size: .83rem; font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap; overflow: hidden;
    border: none; background: none; width: 100%; text-align: left;
}
.nav-item i { font-size: 15px; flex-shrink: 0; width: 16px; text-align: center; }
.nav-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
    background: var(--primary); color: #fff;
    border-radius: 20px; padding: 1px 7px;
    font-size: .64rem; font-weight: 700; flex-shrink: 0;
}
.nav-badge.danger { background: #ef4444; }

.sidebar-footer { padding: 6px 8px; }
.sidebar-footer .nav-item { margin: 0; }

/* Avatars */
.avatar-xs { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.avatar-md { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }

/* ──────────────────────────────────────────────
   TOPBAR
   ────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 900;
    display: flex; align-items: center; gap: 10px;
    height: var(--topbar-height); padding: 0 24px;
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--topbar-border);
    transition: background var(--transition), border-color var(--transition);
}
.topbar-title {
    font-weight: 600; font-size: .92rem;
    flex: 1; color: var(--text-1);
}
.topbar-right { display: flex; align-items: center; gap: 3px; }

.btn-icon {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: none; border-radius: 8px;
    cursor: pointer; color: var(--text-3);
    transition: background var(--transition), color var(--transition);
    padding: 0; flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-1); }

/* Theme toggle button */
.theme-toggle-btn { font-size: 16px; }

.notif-badge {
    position: absolute; top: 3px; right: 2px;
    font-size: .6rem; padding: 1px 4px;
    min-width: 16px; text-align: center;
    line-height: 1.2;
}

/* ──────────────────────────────────────────────
   PAGE CONTENT
   ────────────────────────────────────────────── */
.page-content { padding: 26px 28px 52px; }

/* ──────────────────────────────────────────────
   BOOTSTRAP OVERRIDES (respect theme)
   ────────────────────────────────────────────── */
.card {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    border-radius: var(--card-radius) !important;
    box-shadow: var(--shadow-sm);
    color: var(--text-1);
}
.card-header {
    background: transparent !important;
    border-bottom-color: var(--border) !important;
    color: var(--text-1);
}
.card-footer {
    background: transparent !important;
    border-top-color: var(--border) !important;
}

.modal-content {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    border-radius: 14px !important;
    color: var(--text-1);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    border-bottom-color: var(--border) !important;
    background: var(--bg-card);
}
.modal-footer {
    border-top-color: var(--border) !important;
    background: var(--bg-card);
}
.modal-title { color: var(--text-1); font-weight: 700; }

.dropdown-menu {
    background: var(--bg-dropdown) !important;
    border-color: var(--border) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-md) !important;
    color: var(--text-1);
    padding: 4px;
}
.dropdown-item {
    border-radius: 7px;
    color: var(--text-2) !important;
    font-size: .83rem;
    padding: 7px 12px;
    transition: background var(--transition);
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--bg-hover) !important; color: var(--text-1) !important; }
.dropdown-item.active { background: rgba(var(--primary-rgb),.12) !important; color: var(--primary) !important; }
.dropdown-divider { border-color: var(--border) !important; margin: 3px 0; }
.dropdown-header { color: var(--text-3) !important; font-size: .74rem; }

.form-control, .form-select {
    background: var(--bg-input) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-1) !important;
    border-radius: var(--input-radius) !important;
    font-size: .85rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
    background: var(--bg-input) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.15) !important;
    color: var(--text-1) !important;
}
.form-control::placeholder { color: var(--text-4); }
.form-label { font-weight: 500; font-size: .82rem; color: var(--text-2); margin-bottom: 5px; }
.form-text  { color: var(--text-3); font-size: .76rem; }

.input-group-text {
    background: var(--bg-surface) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-3) !important;
}

.table {
    font-size: .83rem;
    color: var(--text-1);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--bg-hover);
    --bs-table-hover-bg: var(--bg-hover);
    --bs-table-color: var(--text-1);
}
.table thead th {
    font-weight: 600; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-3) !important;
    border-bottom: 2px solid var(--border) !important;
    background: transparent;
    white-space: nowrap;
    padding: 10px 12px;
}
.table td { padding: 10px 12px; vertical-align: middle; border-bottom-color: var(--border) !important; color: var(--text-1); }
.table-bordered { border-color: var(--border) !important; }
.table > :not(:last-child) > :last-child > * { border-bottom-color: var(--border) !important; }

.list-group-item {
    background: transparent !important;
    border-color: var(--border) !important;
    color: var(--text-1);
}
.list-group-item:hover { background: var(--bg-hover) !important; }

.nav-tabs { border-bottom-color: var(--border) !important; }
.nav-tabs .nav-link { color: var(--text-3); border-color: transparent; border-radius: 8px 8px 0 0; font-size: .84rem; font-weight: 500; }
.nav-tabs .nav-link:hover { color: var(--text-1); border-color: var(--border) transparent; background: var(--bg-hover); }
.nav-tabs .nav-link.active { color: var(--primary); border-color: var(--border) var(--border) var(--bg-card); background: var(--bg-card); font-weight: 600; }

.nav-pills .nav-link { color: var(--text-3); border-radius: 8px; font-size: .83rem; font-weight: 500; }
.nav-pills .nav-link:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-pills .nav-link.active { background: rgba(var(--primary-rgb),.12); color: var(--primary); font-weight: 600; }

.badge { font-size: .7rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; }

.alert { border-radius: 10px !important; border: none; }

.btn { border-radius: 8px !important; font-size: .84rem; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-secondary {
    color: var(--text-2);
    border-color: var(--border-strong);
    background: transparent;
}
.btn-outline-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-1);
}

/* ──────────────────────────────────────────────
   KPI CARDS
   ────────────────────────────────────────────── */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 10px;
    height: 100%;
    transition: background var(--transition), box-shadow var(--transition);
    position: relative; overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-card-inner { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; flex-shrink: 0;
}
.kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--text-1); letter-spacing: -.03em; }
.kpi-label { font-size: .73rem; color: var(--text-3); font-weight: 500; letter-spacing: .01em; }
.kpi-change { font-size: .73rem; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.kpi-change.up   { color: #22c55e; }
.kpi-change.down { color: #ef4444; }
.kpi-accent { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; border-radius: 0 0 var(--card-radius) var(--card-radius); background: var(--primary); opacity: .5; }

/* ──────────────────────────────────────────────
   SECTIONS & PANELS
   ────────────────────────────────────────────── */
.panel {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.panel-title { font-weight: 700; font-size: .88rem; color: var(--text-1); }
.panel-body { padding: 18px; }

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}
.form-section-title {
    font-weight: 700; color: var(--text-3);
    text-transform: uppercase; letter-spacing: .05em;
    font-size: .71rem; margin-bottom: 16px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border);
}

/* ──────────────────────────────────────────────
   NOTIFICATION DROPDOWN
   ────────────────────────────────────────────── */
.notif-dropdown { width: 340px; padding: 0 !important; }
.notif-header {
    border-bottom: 1px solid var(--border) !important;
    padding: 12px 16px;
    font-size: .84rem; font-weight: 600; color: var(--text-1);
    background: var(--bg-card);
    border-radius: 10px 10px 0 0;
}
.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 16px; font-size: .8rem;
    transition: background var(--transition);
    color: var(--text-2) !important;
}
.notif-item:hover { background: var(--bg-hover) !important; color: var(--text-1) !important; }
.notif-item.unread { background: rgba(var(--primary-rgb),.05) !important; }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-title { font-weight: 600; line-height: 1.35; color: var(--text-1); }
.notif-msg { color: var(--text-3); font-size: .75rem; margin-top: 1px; }
.notif-time { font-size: .69rem; color: var(--text-4); margin-top: 3px; }
.notif-footer {
    border-top: 1px solid var(--border) !important;
    padding: 6px; text-align: center;
    background: var(--bg-card);
    border-radius: 0 0 10px 10px;
}

/* ──────────────────────────────────────────────
   WORKSPACE DOT
   ────────────────────────────────────────────── */
.ws-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* ──────────────────────────────────────────────
   KANBAN BOARD
   ────────────────────────────────────────────── */
.kanban-board {
    display: flex; gap: 14px;
    overflow-x: auto; padding-bottom: 16px;
    align-items: flex-start;
    min-height: 300px;
}
.kanban-board::-webkit-scrollbar { height: 6px; }

.kanban-column { min-width: 260px; max-width: 274px; flex-shrink: 0; }

.kanban-col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 13px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--stage-color, var(--primary));
    border-radius: 10px 10px 0 0;
    font-weight: 700; font-size: .76rem;
    color: var(--text-2);
    letter-spacing: .01em;
}
.kanban-col-header .col-count {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-3);
    border-radius: 20px; padding: 1px 7px;
    font-size: .68rem; font-weight: 600;
}

.kanban-col-body {
    display: flex; flex-direction: column; gap: 8px;
    padding: 8px 0; min-height: 80px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 10px 8px;
}

.kanban-card {
    background: var(--bg-card);
    border-radius: 9px;
    padding: 12px 13px;
    box-shadow: var(--shadow-xs);
    cursor: grab;
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid var(--border);
    position: relative;
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kanban-card.dragging { opacity: .35; transform: rotate(1deg); }
.kanban-card-title { font-weight: 600; font-size: .83rem; color: var(--text-1); margin-bottom: 6px; line-height: 1.35; }
.kanban-card-meta { font-size: .72rem; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.drop-zone { min-height: 60px; border-radius: 8px; transition: background var(--transition), border var(--transition); }
.drop-zone.drag-over { background: rgba(var(--primary-rgb),.06); border: 2px dashed var(--primary); }

/* ──────────────────────────────────────────────
   COMMUNICATION TIMELINE
   ────────────────────────────────────────────── */
.timeline-list { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { display: flex; align-items: flex-start; gap: 10px; }
.comm-icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.timeline-content { flex: 1; min-width: 0; }

.comm-timeline { position: relative; padding-left: 40px; }
.comm-timeline::before {
    content: ''; position: absolute;
    left: 14px; top: 8px; bottom: 0;
    width: 2px; background: var(--border);
}
.comm-entry { position: relative; margin-bottom: 16px; }
.comm-entry .comm-icon { position: absolute; left: -40px; top: 2px; }
.comm-body {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: var(--shadow-xs);
}
.comm-summary { font-size: .83rem; font-weight: 600; color: var(--text-1); }
.comm-body-text { font-size: .8rem; color: var(--text-2); margin-top: 4px; line-height: 1.5; }
.comm-meta { font-size: .69rem; color: var(--text-4); margin-top: 6px; }

/* ──────────────────────────────────────────────
   PRIORITY BORDERS
   ────────────────────────────────────────────── */
.priority-urgent { border-left: 3px solid #ef4444 !important; }
.priority-high   { border-left: 3px solid #f59e0b !important; }
.priority-medium { border-left: 3px solid #6366f1 !important; }
.priority-low    { border-left: 3px solid #94a3b8 !important; }

/* ──────────────────────────────────────────────
   STAT / INFO ROWS (used in project_view etc.)
   ────────────────────────────────────────────── */
.info-row { display: flex; gap: 6px; align-items: flex-start; font-size: .82rem; margin-bottom: 8px; }
.info-row .info-label { color: var(--text-3); width: 100px; flex-shrink: 0; font-weight: 500; }
.info-row .info-val { color: var(--text-1); font-weight: 500; }

/* ──────────────────────────────────────────────
   PROPOSAL PUBLIC PREVIEW
   ────────────────────────────────────────────── */
.proposal-preview-page { background: var(--bg-body); min-height: 100vh; padding: 32px 16px; }
.proposal-doc {
    max-width: 740px; margin: 0 auto;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}
.proposal-doc-header { padding: 32px 40px; border-bottom: 3px solid var(--primary); }
.proposal-doc-body   { padding: 32px 40px; }
.proposal-items-table th, .proposal-items-table td { vertical-align: middle; }
.proposal-totals { max-width: 290px; margin-left: auto; }

/* ──────────────────────────────────────────────
   PROGRESS BARS
   ────────────────────────────────────────────── */
.progress {
    background: var(--bg-surface);
    border-radius: 99px;
}

/* ──────────────────────────────────────────────
   PAGE HEADER UTILITY
   ────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.page-header-title { font-size: 1.15rem; font-weight: 800; color: var(--text-1); margin: 0; }
.page-header-sub   { font-size: .78rem; color: var(--text-3); margin: 0; }

/* ──────────────────────────────────────────────
   STAGE / STATUS BADGES
   ────────────────────────────────────────────── */
.stage-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: .69rem; font-weight: 700;
    color: #fff; letter-spacing: .02em;
    white-space: nowrap;
}
.status-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 5px;
}

/* ──────────────────────────────────────────────
   ATTENDANCE CALENDAR
   ────────────────────────────────────────────── */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.att-day {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 600;
    cursor: default;
    border: 1px solid transparent;
    background: var(--bg-surface);
    color: var(--text-3);
    transition: transform .1s;
}
.att-day:hover { transform: scale(1.05); }
.att-day.present  { background: #22c55e1a; border-color: #22c55e40; color: #16a34a; }
.att-day.half     { background: #f59e0b1a; border-color: #f59e0b40; color: #d97706; }
.att-day.leave    { background: #3b82f61a; border-color: #3b82f640; color: #2563eb; }
.att-day.absent   { background: #ef44441a; border-color: #ef444440; color: #dc2626; }
.att-day.holiday  { background: #a855f71a; border-color: #a855f740; color: #9333ea; }
.att-day.today    { border-color: var(--primary) !important; font-weight: 800; }
.att-day.empty    { visibility: hidden; }

/* ──────────────────────────────────────────────
   UTILITIES
   ────────────────────────────────────────────── */
.min-w-0 { min-width: 0; }
.cursor-pointer { cursor: pointer; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-muted { color: var(--text-3) !important; }
.text-body  { color: var(--text-1) !important; }
.border-top { border-top-color: var(--border) !important; }
.border-bottom { border-bottom-color: var(--border) !important; }
.border { border-color: var(--border) !important; }
.bg-light { background: var(--bg-surface) !important; }
.bg-white { background: var(--bg-card) !important; }

/* ──────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-wrapper { margin-left: 0; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.25); }
    .page-content { padding: 14px 14px 40px; }
    .kanban-board { flex-direction: column; }
    .kanban-column { min-width: 100%; max-width: 100%; }
    .topbar { padding: 0 12px; }
    .topbar-title { font-size: .85rem; }
    .kpi-value { font-size: 1.3rem; }
}

/* ──────────────────────────────────────────────
   VIEW TOGGLE (unified / single workspace)
   Used on Projects, Tasks, Deadlines, CRM,
   Expenses, Notifications, Dashboard pages
   ────────────────────────────────────────────── */
.dash-toggle {
    display: inline-flex;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}
.dash-toggle a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-3);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.dash-toggle a.active {
    background: var(--primary);
    color: #fff;
}
.dash-toggle a:not(.active):hover {
    background: var(--bg-body);
}

/* Workspace badge pill — small coloured pill for workspace name */
.ws-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .63rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    line-height: 1.4;
    vertical-align: middle;
}
