/* ============================================================
   WORDCRAFT CRM v2 — Main Stylesheet
   Matches KPI design system: Navy sidebar, teal accent
   Font: Plus Jakarta Sans + Space Grotesk
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --primary:        #0A2463;
    --primary-light:  #1E3A8A;
    --primary-dark:   #061640;
    --accent:         #00B4A6;
    --accent-light:   #4ECDC4;
    --accent-dark:    #008E82;
    --success:        #27AE60;
    --warning:        #F4D03F;
    --danger:         #E74C3C;
    --info:           #3B82F6;
    --purple:         #8B5CF6;
    --orange:         #F59E0B;
    --sidebar-w:      260px;
    --topbar-h:       64px;
    --bg:             #F0F4F8;
    --surface:        #FFFFFF;
    --surface2:       #F8FAFC;
    --border:         #E2E8F0;
    --border2:        #CBD5E1;
    --text-primary:   #1A202C;
    --text-secondary: #64748B;
    --text-muted:     #94A3B8;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
    --radius:         12px;
    --radius-sm:      8px;
    --radius-lg:      16px;
    --radius-xl:      20px;
    --transition:     0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
}

/* ===== SIDEBAR ===================================================== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    overflow: hidden;
    box-shadow: 4px 0 20px rgba(6,22,64,0.3);
}

.sidebar-brand {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-brand img {
    height: 64px; width: auto;
    display: block; margin: 0 auto 10px;
    filter: brightness(1.1);
}

.sidebar-brand-label {
    font-size: 9px; font-weight: 700;
    color: rgba(255,255,255,0.5);
    letter-spacing: 2.5px; text-transform: uppercase;
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 8px;
    display: block;
}

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-list { list-style: none; }

.nav-section {
    padding: 14px 20px 5px;
    font-size: 9.5px; font-weight: 700;
    color: rgba(255,255,255,0.3);
    letter-spacing: 1.5px; text-transform: uppercase;
}

.nav-item { list-style: none; }

.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 20px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}

.nav-link.active {
    color: white;
    background: rgba(0,180,166,0.2);
    border-right: 3px solid var(--accent);
    font-weight: 600;
}

.nav-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; gap: 10px;
}

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: white; flex-shrink: 0;
    font-family: 'Space Grotesk', sans-serif;
}

.user-details { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; color: rgba(255,255,255,0.45); text-transform: capitalize; }

.logout-btn {
    color: rgba(255,255,255,0.35);
    font-size: 20px; text-decoration: none;
    transition: color var(--transition); cursor: pointer;
}
.logout-btn:hover { color: var(--danger); }

/* ===== TOPBAR ====================================================== */
.topbar {
    position: fixed; top: 0;
    left: var(--sidebar-w); right: 0;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px; gap: 16px;
    z-index: 999; box-shadow: var(--shadow-sm);
    transition: left var(--transition);
}

.sidebar-toggle {
    display: none; background: none; border: none;
    font-size: 22px; cursor: pointer;
    color: var(--text-secondary); padding: 4px;
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.topbar-date { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

.topbar-user {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--text-primary);
}

.user-avatar-sm {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: white;
    font-family: 'Space Grotesk', sans-serif;
}

.wa-indicator {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 100px;
    border: 1px solid var(--border);
    font-size: 12px; font-weight: 500;
    color: var(--text-muted);
}
.wa-indicator.on { color: var(--success); border-color: rgba(39,174,96,0.3); background: rgba(39,174,96,0.05); }
.wa-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.wa-indicator.on .wa-dot { background: var(--success); box-shadow: 0 0 6px rgba(39,174,96,0.5); }

/* ===== MAIN CONTENT ================================================ */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 28px;
    min-height: calc(100vh - var(--topbar-h));
    transition: margin-left var(--transition);
}

/* ===== PAGE LOADER ================================================= */
#page-loader {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
#page-loader.loading { opacity: 1; pointer-events: all; }
.loader-spinner {
    width: 44px; height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== CARDS ======================================================= */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.card-title {
    font-size: 15px; font-weight: 700;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}

.card-body { padding: 20px 22px; }

/* ===== STAT CARDS ================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card::before {
    content: '';
    position: absolute; top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    opacity: 0.1;
    transform: translate(20px, -20px);
}
.stat-card.blue::before   { background: var(--info); }
.stat-card.green::before  { background: var(--success); }
.stat-card.amber::before  { background: var(--warning); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.teal::before   { background: var(--accent); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 14px;
}
.stat-icon.blue   { background: rgba(59,130,246,0.12); }
.stat-icon.green  { background: rgba(39,174,96,0.12); }
.stat-icon.amber  { background: rgba(244,208,63,0.15); }
.stat-icon.red    { background: rgba(231,76,60,0.12); }
.stat-icon.purple { background: rgba(139,92,246,0.12); }
.stat-icon.teal   { background: rgba(0,180,166,0.12); }

.stat-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); font-family: 'Space Grotesk', sans-serif; line-height: 1; margin-bottom: 4px; }
.stat-sub   { font-size: 12px; color: var(--text-muted); }
.stat-trend { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ===== BUTTONS ===================================================== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13.5px; font-weight: 600;
    cursor: pointer; border: none;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap; line-height: 1.4;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover  { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(10,36,99,0.3); }
.btn-accent   { background: var(--accent); color: white; }
.btn-accent:hover   { background: var(--accent-dark); }
.btn-success  { background: var(--success); color: white; }
.btn-success:hover  { opacity: 0.9; }
.btn-danger   { background: var(--danger); color: white; }
.btn-danger:hover   { opacity: 0.9; }
.btn-warning  { background: var(--warning); color: #1a1a00; }
.btn-ghost    { background: var(--surface2); color: var(--text-secondary); border: 1px solid var(--border2); }
.btn-ghost:hover    { border-color: var(--primary); color: var(--primary); background: white; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ===== FORMS ======================================================= */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-label {
    display: block; font-size: 12px; font-weight: 700;
    color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 6px;
}
.form-label .req { color: var(--danger); }

.form-control {
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px; font-weight: 400;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,180,166,0.12);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ===== TAGS / BADGES ============================================== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 100px;
    font-size: 11.5px; font-weight: 700; letter-spacing: 0.2px;
}
.badge-primary { background: rgba(10,36,99,0.1); color: var(--primary); }
.badge-accent  { background: rgba(0,180,166,0.12); color: var(--accent-dark); }
.badge-success { background: rgba(39,174,96,0.12); color: #1a7a43; }
.badge-warning { background: rgba(244,208,63,0.2); color: #7a5a00; }
.badge-danger  { background: rgba(231,76,60,0.12); color: #c0392b; }
.badge-purple  { background: rgba(139,92,246,0.12); color: #6d28d9; }
.badge-gray    { background: rgba(100,116,139,0.1); color: var(--text-secondary); }
.badge-info    { background: rgba(59,130,246,0.12); color: #1d4ed8; }

.tag {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 100px;
    font-size: 11px; font-weight: 600;
}

/* Priority badges */
.priority-low    { background: rgba(100,116,139,0.1); color: var(--text-secondary); }
.priority-medium { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.priority-high   { background: rgba(244,208,63,0.2); color: #7a5a00; }
.priority-urgent { background: rgba(231,76,60,0.12); color: #c0392b; }

/* ===== TABLE ======================================================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }

table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--surface2);
    padding: 11px 16px;
    text-align: left;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--primary); }

tbody tr { border-top: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: var(--surface2); }
tbody tr:first-child { border-top: none; }

td {
    padding: 12px 16px;
    font-size: 13.5px; color: var(--text-primary);
    vertical-align: middle;
}
td a { color: var(--primary); text-decoration: none; font-weight: 600; }
td a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ===== KANBAN ====================================================== */
.kanban-wrap { overflow-x: auto; padding-bottom: 20px; }

.kanban-board {
    display: flex; gap: 16px;
    align-items: flex-start;
    min-width: max-content;
}

.kanban-col {
    width: 270px; flex-shrink: 0;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
}

.kanban-col-header {
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.kanban-col-name {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 13px;
    font-family: 'Space Grotesk', sans-serif;
}

.kanban-col-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-count { font-size: 11px; background: var(--surface2); padding: 2px 7px; border-radius: 100px; color: var(--text-muted); font-weight: 600; }
.kanban-col-value { font-size: 11px; color: var(--accent-dark); font-weight: 600; }

.kanban-col-body {
    padding: 10px;
    flex: 1;
    display: flex; flex-direction: column; gap: 8px;
    min-height: 80px;
}

.kanban-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none; display: block;
}
.kanban-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,180,166,0.15);
    transform: translateY(-1px);
}

.kanban-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.kanban-card-name { font-weight: 700; font-size: 13.5px; color: var(--text-primary); }
.kanban-card-company { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.kanban-card-meta { font-size: 11.5px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 3px; }
.kanban-card-value { font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 700; color: var(--success); margin-top: 8px; }
.kanban-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

.wa-chip {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 10.5px; color: var(--success);
    background: rgba(39,174,96,0.1); padding: 2px 6px;
    border-radius: 4px; font-weight: 600;
}

/* ===== MODALS ====================================================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10,36,99,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%; max-width: 580px;
    max-height: 92vh; overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 780px; }

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; background: var(--surface); z-index: 1;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 700; color: var(--text-primary); }

.modal-close {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 50%; width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-muted); font-size: 16px;
    transition: all var(--transition); flex-shrink: 0;
}
.modal-close:hover { background: var(--danger); border-color: var(--danger); color: white; }

.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end;
    background: var(--surface2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== ALERTS ====================================================== */
.alert {
    padding: 13px 16px; border-radius: var(--radius-sm);
    font-size: 13.5px; margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px;
    border: 1px solid transparent;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(39,174,96,0.1); border-color: rgba(39,174,96,0.25); color: #1a7a43; }
.alert-danger  { background: rgba(231,76,60,0.1); border-color: rgba(231,76,60,0.25); color: #c0392b; }
.alert-warning { background: rgba(244,208,63,0.15); border-color: rgba(244,208,63,0.3); color: #7a5a00; }
.alert-info    { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.25); color: #1d4ed8; }

/* ===== FILTERS BAR ================================================= */
.filter-bar {
    display: flex; gap: 10px; align-items: center;
    flex-wrap: wrap; margin-bottom: 20px;
    background: var(--surface);
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.filter-bar .form-control { width: auto; background: var(--surface2); }
.filter-bar label { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.filter-sep { width: 1px; height: 28px; background: var(--border); }

/* ===== EMPTY STATE ================================================= */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 14px; max-width: 340px; margin: 0 auto 20px; }

/* ===== WA THREAD =================================================== */
.wa-thread-wrap {
    background: #ECE5DD;
    border-radius: var(--radius);
    padding: 16px;
    max-height: 420px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px;
}

.wa-bubble {
    max-width: 75%;
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 13.5px; line-height: 1.5;
}
.wa-bubble.in {
    background: white;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.wa-bubble.out {
    background: #DCF8C6;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.wa-bubble-time { font-size: 10.5px; color: #94A3B8; margin-top: 4px; text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.wa-status-icon { font-size: 12px; }
.wa-status-icon.read { color: #34B7F1; }

/* ===== ACTIVITY TIMELINE =========================================== */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.timeline-item:not(:last-child)::before {
    content: ''; position: absolute;
    left: 15px; top: 36px;
    width: 2px; bottom: -4px;
    background: var(--border);
}
.timeline-dot {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--surface2); border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0; z-index: 1;
}
.timeline-content { flex: 1; min-width: 0; }
.timeline-text { font-size: 13.5px; color: var(--text-primary); }
.timeline-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ===== GRID HELPERS ================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-sidebar { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-700 { font-weight: 700; }
.font-mono { font-family: monospace; }

/* ===== REPORT CHART PLACEHOLDER =================================== */
.chart-placeholder {
    background: var(--surface2);
    border-radius: var(--radius-sm);
    height: 200px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 13px;
    border: 1px dashed var(--border2);
}

/* ===== SCROLLBAR GLOBAL =========================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ================================================= */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .grid-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar { left: 0; }
    .sidebar-toggle { display: block; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .kanban-board { min-width: unset; flex-direction: column; }
    .kanban-col { width: 100%; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .main-content { padding: 16px; }
}

/* ===== LOGIN PAGE ================================================= */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    position: relative; overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 48px 44px;
    width: 100%; max-width: 440px;
    box-shadow: 0 32px 80px rgba(6,22,64,0.5);
    position: relative;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    height: 72px; width: auto; display: block; margin: 0 auto 12px;
}

.login-logo-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px; font-weight: 700; color: var(--text-primary);
}

.login-logo-sub {
    font-size: 13px; color: var(--text-muted); margin-top: 2px;
}

/* ===== MISC ======================================================== */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.section-title { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pointer { cursor: pointer; }

/* Role color codes */
.role-superadmin { color: #c0392b; }
.role-ceo        { color: #8B5CF6; }
.role-branch_manager { color: #1d4ed8; }
.role-manager    { color: var(--accent-dark); }
.role-staff      { color: var(--text-secondary); }
