﻿    /* =====================================================
       DESIGN TOKENS
    ===================================================== */
    :root {
        --bg:       #0b0f14;
        --bg2:      #111720;
        --bg3:      #18202c;
        --bg4:      #1e2836;
        --border:   rgba(255,255,255,0.06);
        --border2:  rgba(255,255,255,0.10);
        --text:     #dce8f5;
        --muted:    #64748b;
        --muted2:   #94a3b8;

        /* Accent palette */
        --orange:   #f97316;
        --orange-d: #c2410c;
        --orange-g: linear-gradient(135deg,#f97316,#c2410c);
        --sky:      #38bdf8;
        --sky-g:    linear-gradient(135deg,#38bdf8,#0ea5e9);
        --green:    #22c55e;
        --green-g:  linear-gradient(135deg,#22c55e,#16a34a);
        --purple:   #a78bfa;
        --purple-g: linear-gradient(135deg,#a78bfa,#7c3aed);
        --amber:    #fbbf24;
        --amber-g:  linear-gradient(135deg,#fbbf24,#d97706);
        --rose:     #f43f5e;
        --rose-g:   linear-gradient(135deg,#f43f5e,#be123c);
        --lime:     #a3e635;

        /* Shadows */
        --shadow-card: 0 4px 24px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
        --shadow-card-hover: 0 10px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(249,115,22,0.2) inset;
        --shadow-glow-orange: 0 0 30px rgba(249,115,22,0.35);
        --shadow-glow-sky:    0 0 30px rgba(56,189,248,0.3);
        --shadow-glow-green:  0 0 30px rgba(34,197,94,0.3);
        --shadow-glow-purple: 0 0 30px rgba(167,139,250,0.3);

        --nav-w: 250px;
        --topbar-h: 60px;
        --radius: 14px;
        --radius-sm: 9px;

        --font-display: 'Bebas Neue', sans-serif;
        --font-body:    'DM Sans', sans-serif;
        --font-mono:    'JetBrains Mono', monospace;
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html, body { height: 100%; overflow: hidden; background: var(--bg); }
    body { font-family: var(--font-body); color: var(--text); display: flex; }

    /* =====================================================
       SIDEBAR
    ===================================================== */
    .sidebar {
        width: var(--nav-w);
        min-height: 100vh;
        background: var(--bg2);
        border-right: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 200;
        transition: width 0.3s cubic-bezier(.4,0,.2,1);
        overflow: hidden;
    }
    .sidebar.collapsed { width: 64px; }
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .logo-wordmark,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .sidebar-user-info { display: none !important; }
    .sidebar.collapsed .nav-item { justify-content: center; padding: 11px 0; }
    .sidebar.collapsed .nav-badge { display: none; }
    .sidebar.collapsed .logo { justify-content: center; padding: 18px 0; }

    .logo {
        display: flex; align-items: center; gap: 11px;
        padding: 18px 18px 14px;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }
    .logo-icon {
        width: 38px; height: 38px; border-radius: 10px;
        background: var(--orange-g);
        display: flex; align-items: center; justify-content: center;
        font-size: 17px; color: #fff; flex-shrink: 0;
        box-shadow: var(--shadow-glow-orange);
    }
    .logo-wordmark { line-height: 1; }
    .logo-wordmark h1 { font-family: var(--font-display); font-size: 26px; letter-spacing: 1px; color: var(--orange); }
    .logo-wordmark small { font-size: 9px; letter-spacing: 2.5px; color: var(--muted); text-transform: uppercase; }

    .nav-scroll { flex: 1; overflow-y: auto; padding: 10px 0 10px; }
    .nav-scroll::-webkit-scrollbar { width: 3px; }
    .nav-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

    .nav-section-title {
        font-size: 9px; color: var(--muted); letter-spacing: 2px;
        text-transform: uppercase; padding: 14px 18px 5px;
        white-space: nowrap;
    }

    .menu { list-style: none; padding: 0 8px; }
    .menu-item {
        display: flex; align-items: center; gap: 11px;
        padding: 10px 12px;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.18s;
        color: var(--muted2);
        font-size: 13.5px; font-weight: 500;
        margin-bottom: 2px;
        white-space: nowrap;
        position: relative;
    }
    .menu-item i { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; }
    .menu-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
    .menu-item.active {
        background: rgba(249,115,22,0.12);
        color: var(--orange);
        border-left: 3px solid var(--orange);
        padding-left: 9px;
    }
    .menu-item[data-hidden="true"] { display: none; }

    .nav-badge {
        margin-left: auto; background: var(--orange);
        color: #fff; font-size: 9px; font-weight: 700;
        padding: 2px 6px; border-radius: 20px;
    }

    .sidebar-footer {
        border-top: 1px solid var(--border);
        padding: 12px;
        flex-shrink: 0;
    }
    .sidebar-user {
        display: flex; align-items: center; gap: 10px;
        padding: 9px 10px; border-radius: 10px;
        background: var(--bg3); cursor: pointer;
        transition: background 0.2s;
    }
    .sidebar-user:hover { background: var(--bg4); }
    .s-avatar {
        width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
        background: var(--purple-g);
        display: flex; align-items: center; justify-content: center;
        font-size: 13px; font-weight: 700; color: #fff;
    }
    .sidebar-user-info .u-name { font-size: 13px; font-weight: 600; color: var(--text); }
    .sidebar-user-info .u-role { font-size: 10px; color: var(--muted); }

    /* Sidebar toggle button */
    #sidebarToggle {
        position: fixed; top: 18px;
        left: calc(var(--nav-w) - 13px);
        width: 26px; height: 26px; border-radius: 50%;
        background: var(--bg3); border: 1px solid var(--border2);
        color: var(--muted); font-size: 10px;
        display: flex; align-items: center; justify-content: center;
        cursor: pointer; z-index: 300;
        transition: left 0.3s cubic-bezier(.4,0,.2,1);
        box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    }
    body.nav-collapsed #sidebarToggle { left: 51px; }

    /* =====================================================
       MAIN LAYOUT
    ===================================================== */
    .main-content {
        margin-left: var(--nav-w);
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
        transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
    }
    body.nav-collapsed .main-content { margin-left: 64px; }

    /* TOP BAR */
    .header {
        height: var(--topbar-h);
        background: var(--bg2);
        border-bottom: 1px solid var(--border);
        display: flex; align-items: center;
        padding: 0 24px; gap: 14px;
        flex-shrink: 0;
    }
    .search-bar {
        display: flex; align-items: center; gap: 9px;
        background: var(--bg3); border: 1px solid var(--border);
        border-radius: 10px; padding: 8px 14px; width: 240px;
        transition: border-color 0.2s;
    }
    .search-bar:focus-within { border-color: rgba(249,115,22,0.4); }
    .search-bar i { color: var(--muted); font-size: 12px; }
    .search-bar input {
        background: none; border: none; outline: none;
        color: var(--text); font-size: 13px; font-family: var(--font-body); width: 100%;
    }
    .search-bar input::placeholder { color: var(--muted); }

    .user-actions {
        margin-left: auto;
        display: flex; align-items: center; gap: 10px;
    }
    .api-status, .websocket-status {
        display: flex; align-items: center; gap: 6px;
        font-size: 11px; color: var(--muted);
    }
    .status-indicator {
        width: 7px; height: 7px; border-radius: 50%;
        background: var(--muted); flex-shrink: 0;
    }
    .status-connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
    .status-disconnected { background: var(--rose); box-shadow: 0 0 6px var(--rose); }

    #roleSelector {
        padding: 6px 10px; border-radius: 8px;
        border: 1px solid var(--border2);
        background: var(--bg3); color: var(--text);
        font-size: 12px; font-family: var(--font-body);
        outline: none; cursor: pointer;
    }

    .hdr-btn {
        width: 36px; height: 36px; border-radius: 9px;
        background: var(--bg3); border: 1px solid var(--border);
        color: var(--muted); cursor: pointer; font-size: 14px;
        display: flex; align-items: center; justify-content: center;
        transition: all 0.2s; position: relative;
    }
    .hdr-btn:hover { color: var(--text); background: var(--bg4); }
    .hdr-btn.has-dot::after {
        content: ''; position: absolute; top: 7px; right: 7px;
        width: 7px; height: 7px; border-radius: 50%;
        background: var(--orange); box-shadow: 0 0 6px var(--orange);
    }

    .user-profile {
        display: flex; align-items: center; gap: 9px; cursor: pointer;
        padding: 5px 10px; border-radius: 9px;
        background: var(--bg3); border: 1px solid var(--border);
        transition: background 0.2s;
    }
    .user-profile:hover { background: var(--bg4); }
    .avatar {
        width: 30px; height: 30px; border-radius: 50%;
        background: var(--purple-g);
        display: flex; align-items: center; justify-content: center;
        font-size: 11px; font-weight: 700; color: #fff;
    }
    .user-profile span { font-size: 13px; font-weight: 600; }

    /* CONTENT AREA */
    .content {
        flex: 1; overflow-y: auto;
        padding: 26px;
        display: none;
    }
    .content.active { display: block; }
    .content::-webkit-scrollbar { width: 5px; }
    .content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

    /* PAGE HEADER */
    .page-header {
        display: flex; align-items: center; justify-content: space-between;
        margin-bottom: 22px;
    }
    .page-header h2 {
        font-family: var(--font-display); font-size: 30px;
        letter-spacing: 0.5px; color: var(--text);
    }

    /* =====================================================
       BUTTONS
    ===================================================== */
    .btn {
        display: inline-flex; align-items: center; gap: 7px;
        padding: 9px 18px; border-radius: 9px;
        font-family: var(--font-body); font-size: 13px; font-weight: 600;
        cursor: pointer; border: none; transition: all 0.2s;
    }
    .btn-primary {
        background: var(--orange-g);
        color: #fff;
        box-shadow: 0 4px 15px rgba(249,115,22,0.35);
    }
    .btn-primary:hover {
        box-shadow: 0 6px 25px rgba(249,115,22,0.5);
        transform: translateY(-1px);
    }
    .btn-secondary {
        background: var(--bg3); color: var(--text);
        border: 1px solid var(--border2);
    }
    .btn-secondary:hover { background: var(--bg4); }
    .btn-cancel {
        background: var(--bg3); color: var(--muted2);
        border: 1px solid var(--border);
    }
    .btn-cancel:hover { background: var(--bg4); color: var(--text); }
    .btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 7px; }

    /* =====================================================
       CARDS
    ===================================================== */
    .card {
        background: var(--bg2);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-card);
        transition: box-shadow 0.25s, transform 0.2s;
    }
    .card:hover { box-shadow: var(--shadow-card-hover); }
    .card-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 15px 20px;
        border-bottom: 1px solid var(--border);
    }
    .card-title {
        font-weight: 700; font-size: 13.5px;
        display: flex; align-items: center; gap: 8px;
    }
    .card-title i { color: var(--orange); }
    .card-body { padding: 16px 20px; }

    /* =====================================================
       DASHBOARD — STAT CARDS
    ===================================================== */
    .stats-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        margin-bottom: 20px;
    }
    .stat-card {
        border-radius: var(--radius);
        padding: 22px 20px;
        position: relative; overflow: hidden;
        box-shadow: var(--shadow-card);
        border: 1px solid transparent;
        transition: transform 0.2s, box-shadow 0.25s;
        cursor: default;
    }
    .stat-card:hover { transform: translateY(-4px); }
    .stat-card::after {
        content: '';
        position: absolute; top: -40px; right: -40px;
        width: 110px; height: 110px; border-radius: 50%;
        opacity: 0.14;
    }
    .stat-card.sc-orange {
        background: linear-gradient(140deg, #1a0f06, #271505);
        border-color: rgba(249,115,22,0.3);
        box-shadow: var(--shadow-card), inset 0 0 60px rgba(249,115,22,0.04);
    }
    .stat-card.sc-orange::after { background: var(--orange); }
    .stat-card.sc-orange:hover { box-shadow: 0 12px 40px rgba(249,115,22,0.3), 0 4px 15px rgba(0,0,0,0.5); }

    .stat-card.sc-sky {
        background: linear-gradient(140deg, #06121a, #071e2e);
        border-color: rgba(56,189,248,0.25);
        box-shadow: var(--shadow-card), inset 0 0 60px rgba(56,189,248,0.03);
    }
    .stat-card.sc-sky::after { background: var(--sky); }
    .stat-card.sc-sky:hover { box-shadow: 0 12px 40px rgba(56,189,248,0.25), 0 4px 15px rgba(0,0,0,0.5); }

    .stat-card.sc-green {
        background: linear-gradient(140deg, #061209, #071e0e);
        border-color: rgba(34,197,94,0.25);
        box-shadow: var(--shadow-card), inset 0 0 60px rgba(34,197,94,0.03);
    }
    .stat-card.sc-green::after { background: var(--green); }
    .stat-card.sc-green:hover { box-shadow: 0 12px 40px rgba(34,197,94,0.25), 0 4px 15px rgba(0,0,0,0.5); }

    .stat-card.sc-purple {
        background: linear-gradient(140deg, #0e0b1e, #140f2c);
        border-color: rgba(167,139,250,0.25);
        box-shadow: var(--shadow-card), inset 0 0 60px rgba(167,139,250,0.03);
    }
    .stat-card.sc-purple::after { background: var(--purple); }
    .stat-card.sc-purple:hover { box-shadow: 0 12px 40px rgba(167,139,250,0.25), 0 4px 15px rgba(0,0,0,0.5); }

    .stat-card.sc-amber {
        background: linear-gradient(140deg, #1a1206, #2a1c05);
        border-color: rgba(251,191,36,0.3);
        box-shadow: var(--shadow-card), inset 0 0 60px rgba(251,191,36,0.04);
    }
    .stat-card.sc-amber::after { background: var(--amber); }
    .stat-card.sc-amber:hover { box-shadow: 0 12px 40px rgba(251,191,36,0.25), 0 4px 15px rgba(0,0,0,0.5); }

    .stat-card.sc-rose {
        background: linear-gradient(140deg, #1a0609, #2a050c);
        border-color: rgba(244,63,94,0.3);
        box-shadow: var(--shadow-card), inset 0 0 60px rgba(244,63,94,0.04);
    }
    .stat-card.sc-rose::after { background: var(--rose); }
    .stat-card.sc-rose:hover { box-shadow: 0 12px 40px rgba(244,63,94,0.25), 0 4px 15px rgba(0,0,0,0.5); }

    .stat-label {
        font-size: 10px; text-transform: uppercase; letter-spacing: 1.8px;
        color: var(--muted); margin-bottom: 8px;
    }
    .stat-value {
        font-family: var(--font-display); font-size: 46px; line-height: 1;
        margin-bottom: 6px;
    }
    .sc-orange .stat-value { color: var(--orange); text-shadow: 0 0 30px rgba(249,115,22,0.5); }
    .sc-sky .stat-value    { color: var(--sky);    text-shadow: 0 0 30px rgba(56,189,248,0.4); }
    .sc-green .stat-value  { color: var(--green);  text-shadow: 0 0 30px rgba(34,197,94,0.4); }
    .sc-purple .stat-value { color: var(--purple); text-shadow: 0 0 30px rgba(167,139,250,0.4); }
    .sc-amber .stat-value  { color: var(--amber);  text-shadow: 0 0 30px rgba(251,191,36,0.4); }
    .sc-rose .stat-value   { color: var(--rose);   text-shadow: 0 0 30px rgba(244,63,94,0.4); }

    .stat-delta { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
    .delta-up { color: var(--green); }
    .delta-down { color: var(--rose); }
    .stat-icon {
        position: absolute; bottom: 14px; right: 16px;
        font-size: 32px; opacity: 0.08;
    }

    /* =====================================================
       DASHBOARD GRID
    ===================================================== */
    .dash-grid {
        display: grid;
        grid-template-columns: 1fr 1fr 320px;
        gap: 16px;
    }
    .dash-grid .span2 { grid-column: span 2; }
    .dash-grid .span3 { grid-column: span 3; }

    /* Schedule list */
    .sched-list { display: flex; flex-direction: column; gap: 8px; }
    .sched-item {
        display: flex; align-items: center; gap: 12px;
        padding: 11px 14px; border-radius: var(--radius-sm);
        background: var(--bg3); border: 1px solid var(--border);
        cursor: pointer; transition: all 0.18s;
    }
    .sched-item:hover { border-color: rgba(249,115,22,0.4); background: rgba(249,115,22,0.05); transform: translateX(3px); }
    .sched-time { font-family: var(--font-mono); font-size: 11px; color: var(--orange); min-width: 52px; }
    .sched-info { flex: 1; min-width: 0; }
    .sched-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sched-svc { font-size: 11px; color: var(--muted); }
    .sched-dot {
        width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    }

    /* Priority items */
    .priority-list { display: flex; flex-direction: column; gap: 8px; }
    .prio-item {
        display: flex; align-items: flex-start; gap: 10px;
        padding: 11px 13px; border-radius: var(--radius-sm);
        border-left: 3px solid transparent;
    }
    .prio-item.high { background: rgba(244,63,94,0.07); border-left-color: var(--rose); }
    .prio-item.med  { background: rgba(251,191,36,0.07); border-left-color: var(--amber); }
    .prio-item.low  { background: rgba(34,197,94,0.07);  border-left-color: var(--green); }
    .prio-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
    .high .prio-dot { background: var(--rose); box-shadow: 0 0 6px var(--rose); }
    .med .prio-dot  { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
    .low .prio-dot  { background: var(--green); box-shadow: 0 0 6px var(--green); }
    .prio-title { font-size: 12px; font-weight: 600; }
    .prio-sub   { font-size: 11px; color: var(--muted); }

    /* Bulletin */
    .bulletin-list { display: flex; flex-direction: column; gap: 10px; }
    .bull-item { padding: 13px 15px; border-radius: var(--radius-sm); background: var(--bg3); border: 1px solid var(--border); }
    .bull-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
    .bull-tag {
        font-size: 9px; text-transform: uppercase; letter-spacing: 1px;
        padding: 2px 8px; border-radius: 20px; font-weight: 700; flex-shrink: 0;
    }
    .bull-tag.critical { background: rgba(244,63,94,0.18); color: var(--rose); }
    .bull-tag.info     { background: rgba(56,189,248,0.15); color: var(--sky); }
    .bull-tag.update   { background: rgba(163,230,53,0.15); color: var(--lime); }
    .bull-date { font-size: 10px; color: var(--muted); margin-left: auto; }
    .bull-del-btn {
        background: none; border: none; color: var(--muted); cursor: pointer;
        padding: 2px 4px; border-radius: 4px; font-size: 11px; line-height: 1;
        transition: color 0.15s, background 0.15s; margin-left: 4px; flex-shrink: 0;
    }
    .bull-del-btn:hover { color: var(--rose); background: rgba(244,63,94,0.12); }
    .bull-text { font-size: 12px; line-height: 1.55; color: var(--text); }
    .bull-author { font-size: 10px; color: var(--muted); margin-top: 5px; }

    /* Mini calendar */
    .mini-cal { }
    .cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
    .cal-month { font-weight: 700; font-size: 14px; }
    .cal-nav { width: 26px; height: 26px; border-radius: 7px; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 11px; transition: all 0.2s; }
    .cal-nav:hover { background: var(--bg4); color: var(--text); }
    .cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; text-align: center; }
    .cal-dow { font-size: 10px; color: var(--muted); padding: 4px 0; }
    .cal-day { font-size: 12px; padding: 5px 2px; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
    .cal-day:hover { background: var(--bg3); }
    .cal-day.today { background: var(--orange-g); color: #fff; font-weight: 700; box-shadow: 0 0 12px rgba(249,115,22,0.5); }
    .cal-day.has-job { position: relative; }
    .cal-day.has-job::after { content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--sky); }
    .cal-day.other-month { color: var(--muted); opacity: 0.4; }

    /* =====================================================
       BADGES / TAGS
    ===================================================== */
    .badge {
        display: inline-flex; align-items: center; gap: 4px;
        font-size: 10px; font-weight: 700; padding: 3px 9px;
        border-radius: 20px;
    }
    .badge-orange { background: rgba(249,115,22,0.15); color: var(--orange); }
    .badge-sky    { background: rgba(56,189,248,0.15);  color: var(--sky); }
    .badge-green  { background: rgba(34,197,94,0.15);   color: var(--green); }
    .badge-purple { background: rgba(167,139,250,0.15); color: var(--purple); }
    .badge-amber  { background: rgba(251,191,36,0.15);  color: var(--amber); }
    .badge-rose   { background: rgba(244,63,94,0.15);   color: var(--rose); }
    .badge-lime   { background: rgba(163,230,53,0.15);  color: var(--lime); }
    .badge-muted  { background: rgba(100,116,139,0.15); color: var(--muted2); }

    /* Status badges */
    .status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
    .status-open        { background: rgba(56,189,248,0.15);  color: var(--sky);    }
    .status-pending     { background: rgba(251,191,36,0.15);  color: var(--amber);  }
    .status-closed      { background: rgba(100,116,139,0.15); color: var(--muted2); }
    .status-active      { background: rgba(34,197,94,0.15);   color: var(--green);  }
    .status-in_progress { background: rgba(167,139,250,0.15); color: var(--purple); }
    .status-resolved    { background: rgba(34,197,94,0.15);   color: var(--green);  }
    .priority-low    { background: rgba(34,197,94,0.15); color: var(--green); }
    .priority-medium { background: rgba(251,191,36,0.15); color: var(--amber); }
    .priority-high   { background: rgba(244,63,94,0.15); color: var(--rose); }

    /* =====================================================
       CUSTOMER CARDS
    ===================================================== */
    #customersContainer {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 20px;
        padding-bottom: 20px;
    }
    .customer-card {
        background: var(--bg2);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 20px;
        box-shadow: var(--shadow-card);
        position: relative; overflow: hidden;
        transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s;
        cursor: pointer;
    }
    .customer-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(249,115,22,0.2);
        border-color: rgba(249,115,22,0.25);
    }
    .customer-card::before {
        content: '';
        position: absolute; top: 0; left: 0; right: 0; height: 3px;
        background: linear-gradient(90deg, var(--orange), transparent);
        opacity: 0;
        transition: opacity 0.2s;
    }
    .customer-card:hover::before { opacity: 1; }

    .vip-badge {
        position: absolute; top: 12px; right: 12px;
        font-size: 10px; font-weight: 700; padding: 3px 9px;
        border-radius: 20px; display: flex; align-items: center; gap: 4px;
    }
    .vip-badge.Bronze  { background: rgba(180,100,20,0.2);  color: #cd7f32; border: 1px solid rgba(180,100,20,0.3); }
    .vip-badge.Silver  { background: rgba(150,150,160,0.2); color: #c0c0c0; border: 1px solid rgba(150,150,160,0.3); }
    .vip-badge.Gold    { background: rgba(200,165,0,0.2);   color: #ffd700; border: 1px solid rgba(200,165,0,0.3); }
    .vip-badge.Diamond { background: rgba(180,100,255,0.15); color: #b9f2ff; border: 1px solid rgba(100,200,255,0.3); }

    .card-avatar {
        width: 48px; height: 48px; border-radius: 12px;
        display: flex; align-items: center; justify-content: center;
        font-size: 20px; flex-shrink: 0;
    }
    .card-avatar.individual { background: linear-gradient(135deg,rgba(56,189,248,0.2),rgba(56,189,248,0.05)); color: var(--sky); border: 1px solid rgba(56,189,248,0.2); }
    .card-avatar.business   { background: linear-gradient(135deg,rgba(249,115,22,0.2),rgba(249,115,22,0.05)); color: var(--orange); border: 1px solid rgba(249,115,22,0.2); }

    .customer-card h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
    .c-type { font-size: 11px; color: var(--muted); }
    .c-contact { display: flex; flex-direction: column; gap: 5px; margin: 12px 0; font-size: 12px; color: var(--muted2); }
    .c-contact i { width: 16px; color: var(--muted); }
    .c-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
    .svc-tag { font-size: 10px; padding: 3px 8px; border-radius: 6px; background: var(--bg3); color: var(--muted2); border: 1px solid var(--border); }
    .card-actions { display: flex; gap: 6px; margin-top: 14px; }
    .action-btn {
        width: 32px; height: 32px; border-radius: 8px;
        background: var(--bg3); border: 1px solid var(--border);
        color: var(--muted); cursor: pointer; font-size: 13px;
        display: flex; align-items: center; justify-content: center;
        transition: all 0.18s;
    }
    .action-btn:hover { background: var(--bg4); color: var(--text); }
    .action-btn.orange:hover { background: rgba(249,115,22,0.15); color: var(--orange); border-color: rgba(249,115,22,0.3); }
    .action-btn.sky:hover { background: rgba(56,189,248,0.15); color: var(--sky); border-color: rgba(56,189,248,0.3); }
    .action-btn.green:hover { background: rgba(34,197,94,0.15); color: var(--green); border-color: rgba(34,197,94,0.3); }
    .action-btn.rose:hover { background: rgba(244,63,94,0.15); color: var(--rose); border-color: rgba(244,63,94,0.3); }
    .action-btn.purple:hover { background: rgba(167,139,250,0.15); color: var(--purple); border-color: rgba(167,139,250,0.3); }
    .action-btn.amber:hover { background: rgba(251,191,36,0.15); color: var(--amber); border-color: rgba(251,191,36,0.3); }
    .ml-auto { margin-left: auto; }
    .c-since { font-size: 10px; color: var(--muted); margin-left: auto; }

    /* =====================================================
       CUSTOMER DETAIL OVERLAY
    ===================================================== */
    .customer-detail-overlay {
        position: fixed; inset: 0; z-index: 1000;
        background: rgba(0,0,0,0.7);
        display: none; align-items: stretch; justify-content: flex-end;
        backdrop-filter: blur(4px);
    }
    .customer-detail-overlay.active { display: flex; }
    .customer-detail-panel {
        width: 680px; max-width: 90vw;
        background: var(--bg2);
        border-left: 1px solid var(--border);
        display: flex; flex-direction: column;
        overflow: hidden;
        animation: slideInRight 0.3s cubic-bezier(.4,0,.2,1);
    }
    @keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

    .detail-hero {
        padding: 24px;
        background: linear-gradient(135deg,#1a0f06,#271505);
        border-bottom: 1px solid rgba(249,115,22,0.2);
        flex-shrink: 0;
        position: relative;
    }
    .close-detail {
        position: absolute; top: 16px; right: 16px;
        width: 32px; height: 32px; border-radius: 8px;
        background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
        color: var(--muted2); cursor: pointer; font-size: 14px;
        display: flex; align-items: center; justify-content: center;
        transition: all 0.2s;
    }
    .close-detail:hover { background: rgba(244,63,94,0.2); color: var(--rose); }
    .detail-avatar {
        width: 64px; height: 64px; border-radius: 16px;
        display: flex; align-items: center; justify-content: center;
        font-size: 26px; flex-shrink: 0;
        border: 2px solid rgba(249,115,22,0.3);
    }
    .detail-hero-name { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
    .detail-hero-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted2); flex-wrap: wrap; }
    .detail-hero-meta span { display: flex; align-items: center; gap: 4px; }

    .detail-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
    .det-btn {
        display: inline-flex; align-items: center; gap: 6px;
        padding: 7px 14px; border-radius: 8px;
        font-size: 12px; font-weight: 600; cursor: pointer;
        border: 1px solid transparent; transition: all 0.2s; text-decoration: none;
    }
    .det-btn.phone   { background: rgba(34,197,94,0.12);  color: var(--green);  border-color: rgba(34,197,94,0.25); }
    .det-btn.sms     { background: rgba(56,189,248,0.12); color: var(--sky);   border-color: rgba(56,189,248,0.25); }
    .det-btn.email   { background: rgba(167,139,250,0.12); color: var(--purple); border-color: rgba(167,139,250,0.25); }
    .det-btn.maps    { background: rgba(249,115,22,0.12); color: var(--orange); border-color: rgba(249,115,22,0.25); }
    .det-btn.edit    { background: rgba(251,191,36,0.12); color: var(--amber); border-color: rgba(251,191,36,0.25); }
    .det-btn.ticket  { background: rgba(167,139,250,0.12); color: var(--purple); border-color: rgba(167,139,250,0.25); }
    .det-btn:hover { filter: brightness(1.2); transform: translateY(-1px); }

    /* =====================================================
       TICKET LIFECYCLE BAR
    ===================================================== */
    .ticket-lifecycle-bar {
        display: flex;
        align-items: flex-start;
        padding: 16px 0 12px;
        margin: 10px 0;
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }
    .lc-step {
        display: flex;
        flex-direction: column;
        align-items: center;
        flex: 1;
        position: relative;
        text-align: center;
    }
    .lc-step:not(:last-child)::after {
        content: '';
        position: absolute;
        top: 13px;
        left: 50%;
        width: 100%;
        height: 2px;
        background: var(--border2);
        z-index: 0;
    }
    .lc-step.lc-done:not(:last-child)::after { background: var(--green); }
    .lc-dot {
        width: 28px; height: 28px;
        border-radius: 50%;
        background: var(--bg3);
        border: 2px solid var(--border2);
        display: flex; align-items: center; justify-content: center;
        font-size: 11px;
        color: var(--muted);
        position: relative;
        z-index: 1;
        transition: all 0.2s;
    }
    .lc-step.lc-done .lc-dot {
        background: var(--green);
        border-color: var(--green);
        color: #fff;
    }
    .lc-label {
        margin-top: 6px;
        font-size: 9px;
        color: var(--muted);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        line-height: 1.3;
    }
    .lc-step.lc-done .lc-label { color: var(--text); }

    .detail-body {
        flex: 1; overflow-y: auto; padding: 20px;
        display: grid; grid-template-columns: 1fr 1fr;
        gap: 16px; align-content: start;
    }
    .detail-body::-webkit-scrollbar { width: 4px; }
    .detail-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
    .detail-section {
        background: var(--bg3); border: 1px solid var(--border);
        border-radius: var(--radius-sm); padding: 14px 16px;
    }
    .detail-section h4 {
        font-size: 12px; font-weight: 700; color: var(--muted2);
        text-transform: uppercase; letter-spacing: 1px;
        margin-bottom: 12px; display: flex; align-items: center; gap: 7px;
    }
    .detail-section h4 i { color: var(--orange); font-size: 12px; }
    .detail-section.full { grid-column: span 2; }

    .contact-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text); padding: 6px 0; border-bottom: 1px solid var(--border); }
    .contact-row:last-child { border-bottom: none; }
    .contact-row i { color: var(--muted); width: 16px; text-align: center; flex-shrink: 0; }

    .prop-img-box {
        width: 100%; height: 110px;
        background: var(--bg4); border-radius: 8px;
        display: flex; align-items: center; justify-content: center;
        color: var(--muted); font-size: 12px; gap: 8px;
        border: 1px dashed var(--border2); margin-bottom: 10px;
        overflow: hidden;
    }
    .prop-img-box img { width: 100%; height: 100%; object-fit: cover; }

    .history-timeline { display: flex; flex-direction: column; gap: 0; }
    .hist-item {
        display: flex; gap: 12px;
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
        font-size: 12px;
    }
    .hist-item:last-child { border-bottom: none; }
    .hist-dot {
        width: 8px; height: 8px; border-radius: 50%;
        background: var(--orange); margin-top: 4px; flex-shrink: 0;
        box-shadow: 0 0 6px rgba(249,115,22,0.5);
    }
    .hist-date { font-family: var(--font-mono); font-size: 10px; color: var(--muted); min-width: 80px; }
    .hist-info { flex: 1; }
    .hist-svc { font-weight: 600; color: var(--text); }
    .hist-note { color: var(--muted); font-size: 11px; }

    /* =====================================================
       MODALS
    ===================================================== */
    .modal {
        display: none; position: fixed; inset: 0; z-index: 3000;
        background: rgba(0,0,0,0.75);
        align-items: center; justify-content: center;
        backdrop-filter: blur(4px);
    }
    .modal.show { display: flex; }
    .modal-content {
        background: var(--bg2); border: 1px solid var(--border);
        border-radius: var(--radius); width: 90%; max-width: 600px;
        max-height: 85vh; display: flex; flex-direction: column;
        box-shadow: 0 24px 80px rgba(0,0,0,0.8);
        animation: modalIn 0.25s cubic-bezier(.4,0,.2,1);
    }
    @keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
    .modal-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
    }
    .modal-header h3 { font-size: 16px; font-weight: 700; }
    .close { font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; transition: color 0.2s; }
    .close:hover { color: var(--rose); }
    .modal-body { padding: 20px; overflow-y: auto; flex: 1; }
    .modal-body::-webkit-scrollbar { width: 4px; }
    .modal-body::-webkit-scrollbar-thumb { background: var(--border2); }

    /* Forms */
    .form-group { margin-bottom: 16px; }
    .form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--muted2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
    .form-control, .form-group input, .form-group textarea, .form-group select {
        width: 100%; padding: 10px 13px;
        background: var(--bg3); border: 1px solid var(--border2);
        border-radius: 9px; color: var(--text);
        font-size: 13px; font-family: var(--font-body);
        outline: none; transition: border-color 0.2s;
    }
    .form-control:focus, .form-group input:focus, .form-group textarea:focus, .form-group select:focus {
        border-color: rgba(249,115,22,0.5);
        box-shadow: 0 0 0 3px rgba(249,115,22,0.08);
    }
    .form-control::placeholder, .form-group input::placeholder { color: var(--muted); }
    .form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
    .form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

    .upload-zone {
        border: 2px dashed var(--border2); padding: 24px;
        text-align: center; border-radius: 10px;
        background: var(--bg3); color: var(--muted);
        cursor: pointer; transition: all 0.2s;
    }
    .upload-zone:hover { border-color: rgba(249,115,22,0.4); color: var(--orange); }
    .upload-zone i { font-size: 24px; margin-bottom: 8px; display: block; }

    .services-checkboxes {
        display: flex; flex-wrap: wrap; gap: 10px;
        padding: 14px; background: var(--bg3); border-radius: 9px;
        border: 1px solid var(--border);
    }
    .svc-check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
    .svc-check input { accent-color: var(--orange); width: 15px; height: 15px; }

    /* =====================================================
       TABLE-STYLE LISTS (Tickets, Users, Teams, etc.)
    ===================================================== */
    .data-table { width: 100%; }
    .list-header {
        display: grid; padding: 10px 16px;
        font-size: 10px; font-weight: 700;
        color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
        border-bottom: 1px solid var(--border); margin-bottom: 4px;
    }
    .ticket-header { grid-template-columns: 2fr 1.5fr 1fr 1fr 1.2fr 110px 80px; }
    .team-header   { grid-template-columns: 1.5fr 1.5fr 2fr 120px; }
    .user-header   { grid-template-columns: 1.5fr 2fr 1fr 0.8fr 130px; }

    .ticket-row, .team-row, .user-row {
        display: grid; padding: 12px 16px;
        background: var(--bg2); border: 1px solid var(--border);
        border-radius: 10px; margin-bottom: 6px;
        align-items: center; font-size: 13px;
        transition: all 0.18s;
    }
    .ticket-row:hover, .team-row:hover, .user-row:hover {
        border-color: var(--border2); background: var(--bg3);
    }
    .ticket-row-clickable:hover {
        border-color: var(--sky) !important;
        background: var(--bg3) !important;
    }
    .ticket-row { grid-template-columns: 2fr 1.5fr 1fr 1fr 1.2fr 110px 80px; }
    .team-row   { grid-template-columns: 1.5fr 1.5fr 2fr 120px; }
    .user-row   { grid-template-columns: 1.5fr 2fr 1fr 0.8fr 130px; }

    .row-actions { display: flex; gap: 5px; }

    /* User role filter pills */
    .user-role-filters {
        display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
    }
    .user-role-filter-btn {
        padding: 5px 16px; border-radius: 20px; font-size: 11px; font-weight: 700;
        border: 1px solid var(--border2); background: var(--bg3); color: var(--muted);
        cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.6px;
    }
    .user-role-filter-btn:hover { color: var(--text); background: var(--bg4); }
    .user-role-filter-btn.active { background: var(--sky); color: #fff; border-color: var(--sky); }

    /* =====================================================
       TICKET CARD VIEW
    ===================================================== */
    .ticket-cards-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 14px;
        padding: 4px 2px;
    }
    .ticket-card {
        background: var(--bg3);
        border: 1px solid var(--border2);
        border-radius: 12px;
        padding: 14px 16px;
        cursor: pointer;
        transition: box-shadow 0.15s, border-color 0.15s;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .ticket-card:hover {
        border-color: var(--orange);
        box-shadow: 0 4px 18px rgba(249,115,22,0.12);
    }
    .ticket-card-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
    }
    .ticket-card-title {
        font-weight: 600;
        font-size: 13px;
        color: var(--text);
        line-height: 1.4;
    }
    .ticket-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        font-size: 11px;
        color: var(--muted2);
        align-items: center;
    }
    .ticket-card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-top: 1px solid var(--border);
        padding-top: 8px;
        margin-top: 2px;
    }

    /* =====================================================
       FAB
    ===================================================== */
    .fab {
        position: fixed; bottom: 28px; right: 28px;
        width: 52px; height: 52px; border-radius: 50%;
        background: var(--orange-g); border: none; color: #fff;
        font-size: 20px; cursor: pointer;
        box-shadow: 0 6px 24px rgba(249,115,22,0.5);
        display: flex; align-items: center; justify-content: center;
        transition: all 0.2s; z-index: 100;
    }
    .fab:hover { transform: scale(1.1) rotate(90deg); box-shadow: 0 10px 32px rgba(249,115,22,0.6); }

    /* =====================================================
       SPINNERS / LOADING
    ===================================================== */
    .spinner {
        width: 36px; height: 36px; border-radius: 50%;
        border: 3px solid var(--border2);
        border-top-color: var(--orange);
        animation: spin 0.8s linear infinite;
        margin: 30px auto;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* =====================================================
       NOTIFICATION TOAST
    ===================================================== */
    .notification {
        position: fixed; bottom: -80px; right: 24px;
        display: flex; align-items: center; gap: 10px;
        padding: 13px 20px; border-radius: 12px;
        font-size: 13px; font-weight: 600;
        z-index: 9999; transition: bottom 0.35s cubic-bezier(.4,0,.2,1);
        box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    }
    .notification.show { bottom: 24px; }
    .notification.success { background: linear-gradient(135deg,#052a12,#083018); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
    .notification.error   { background: linear-gradient(135deg,#250614,#350a1e); border: 1px solid rgba(244,63,94,0.3); color: var(--rose); }

    /* Bell badge */
    .bell-badge {
        position: absolute; top: -4px; right: -4px;
        min-width: 17px; height: 17px; border-radius: 9px;
        background: var(--rose); color: #fff;
        font-size: 9px; font-weight: 800;
        display: flex; align-items: center; justify-content: center;
        padding: 0 4px; border: 2px solid var(--bg2);
        pointer-events: none;
    }

    /* Notification dropdown panel */
    .notif-panel {
        display: none; position: absolute; top: calc(100% + 10px); right: 0;
        width: 340px; background: var(--bg2);
        border: 1px solid var(--border2); border-radius: var(--radius);
        box-shadow: 0 24px 60px rgba(0,0,0,0.7);
        z-index: 5000; overflow: hidden;
        animation: fadeSlideDown 0.18s ease;
    }
    .notif-panel.open { display: block; }
    @keyframes fadeSlideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
    .notif-panel-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 13px 16px; border-bottom: 1px solid var(--border);
        font-size: 12px; font-weight: 700; color: var(--muted2);
        text-transform: uppercase; letter-spacing: 1px;
    }
    .notif-item {
        display: flex; align-items: flex-start; gap: 11px;
        padding: 12px 16px; border-bottom: 1px solid var(--border);
        cursor: pointer; transition: background 0.15s;
        font-size: 12px;
    }
    .notif-item:last-child { border-bottom: none; }
    .notif-item:hover { background: var(--bg3); }
    .notif-icon {
        width: 30px; height: 30px; border-radius: 8px;
        display: flex; align-items: center; justify-content: center;
        font-size: 12px; flex-shrink: 0;
    }
    .notif-icon.bulletin  { background: rgba(249,115,22,0.15); color: var(--orange); }
    .notif-icon.overdue   { background: rgba(244,63,94,0.15);  color: var(--rose); }
    .notif-icon.ticket    { background: rgba(251,191,36,0.15); color: var(--amber); }
    .notif-icon.schedule  { background: rgba(56,189,248,0.15); color: var(--sky); }
    .notif-title { font-weight: 600; color: var(--text); margin-bottom: 2px; line-height: 1.35; }
    .notif-sub   { color: var(--muted); font-size: 11px; }
    .notif-section-label {
        padding: 8px 16px 4px; font-size: 10px; font-weight: 700;
        text-transform: uppercase; letter-spacing: 1px;
        color: var(--muted); background: var(--bg3);
        border-bottom: 1px solid var(--border);
    }
    .notif-more {
        padding: 8px 16px; font-size: 11px; color: var(--orange);
        cursor: pointer; text-align: center;
        border-bottom: 1px solid var(--border);
    }
    .notif-more:hover { background: var(--bg3); }

    /* Global search dropdown */
    .global-search-results {
        display: none; position: absolute; top: calc(100% + 6px); left: 0;
        width: 380px; background: var(--bg2);
        border: 1px solid var(--border2); border-radius: var(--radius);
        box-shadow: 0 24px 60px rgba(0,0,0,0.7); z-index: 5000; overflow: hidden;
        animation: fadeSlideDown 0.15s ease;
    }
    .global-search-results.open { display: block; }
    .search-group-label {
        font-size: 9px; text-transform: uppercase; letter-spacing: 2px;
        color: var(--muted); padding: 10px 14px 4px;
    }
    .search-result-item {
        display: flex; align-items: center; gap: 10px;
        padding: 9px 14px; cursor: pointer; transition: background 0.15s; font-size: 12px;
    }
    .search-result-item:hover { background: var(--bg3); }
    .search-result-icon {
        width: 26px; height: 26px; border-radius: 7px;
        display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0;
    }
    .sri-customer { background: rgba(56,189,248,0.15); color: var(--sky); }
    .sri-ticket   { background: rgba(251,191,36,0.15);  color: var(--amber); }
    .sri-invoice  { background: rgba(34,197,94,0.15);   color: var(--green); }
    .search-result-name  { font-weight: 600; color: var(--text); }
    .search-result-sub   { font-size: 10px; color: var(--muted); }

    /* =====================================================
       SETTINGS PANEL
    ===================================================== */
    .settings-section {
        background: var(--bg2); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 22px;
        margin-bottom: 18px; box-shadow: var(--shadow-card);
    }
    .settings-section h3 {
        font-size: 14px; font-weight: 700; margin-bottom: 6px;
        display: flex; align-items: center; gap: 8px; color: var(--text);
        padding-bottom: 12px; border-bottom: 1px solid var(--border);
    }
    .settings-section h3 i { color: var(--orange); }
    .settings-section p { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
    .toggle-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
    .toggle-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
    .sla-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 4px; }
    .toggle-label {
        display: flex; align-items: center; gap: 10px;
        background: var(--bg3); padding: 10px 14px;
        border-radius: var(--radius-sm); border: 1px solid var(--border);
        cursor: pointer; font-size: 13px; transition: border-color 0.2s;
    }
    .toggle-label:hover { border-color: rgba(249,115,22,0.3); }
    .toggle-label input[type="checkbox"] { accent-color: var(--orange); width: 16px; height: 16px; }

    .service-type-row {
        display: flex; align-items: center; justify-content: space-between;
        padding: 10px 14px; background: var(--bg3); border-radius: var(--radius-sm);
        border: 1px solid var(--border); margin-bottom: 8px; font-size: 13px;
    }
    .service-type-row .svc-actions { display: flex; align-items: center; gap: 10px; }
    .toggle-switch {
        position: relative; width: 36px; height: 20px;
        display: inline-block;
    }
    .toggle-switch input { opacity: 0; width: 0; height: 0; }
    .toggle-switch .slider {
        position: absolute; inset: 0; background: var(--bg4);
        border-radius: 20px; cursor: pointer; transition: background 0.3s;
        border: 1px solid var(--border2);
    }
    .toggle-switch .slider::before {
        content: ''; position: absolute;
        width: 14px; height: 14px; border-radius: 50%;
        background: var(--muted); bottom: 2px; left: 2px; transition: all 0.3s;
    }
    .toggle-switch input:checked + .slider { background: rgba(249,115,22,0.2); border-color: rgba(249,115,22,0.4); }
    .toggle-switch input:checked + .slider::before { transform: translateX(16px); background: var(--orange); box-shadow: 0 0 8px rgba(249,115,22,0.6); }

    /* =====================================================
       ANALYTICS CHARTS
    ===================================================== */
    .analytics-range-btn {
        padding: 4px 12px; font-size: 12px; border-radius: 20px;
        border: 1px solid var(--border); background: var(--bg3); color: var(--muted);
        cursor: pointer; transition: all 0.15s;
    }
    .analytics-range-btn.active,
    .analytics-range-btn:hover {
        background: var(--orange); color: #fff; border-color: var(--orange);
    }
    .analytics-kpi {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }
    .kpi-card {
        background: var(--bg2); border: 1px solid var(--border);
        border-radius: var(--radius-sm); padding: 14px 16px;
        display: flex; flex-direction: column; gap: 4px;
    }
    .kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
    .kpi-value { font-family: var(--font-display); font-size: 28px; line-height: 1; }
    .kpi-sub   { font-size: 11px; color: var(--muted2); }
    .analytics-grid {
        display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
    }
    .analytics-grid-wide { grid-template-columns: 2fr 1fr; }
    .chart-card {
        background: var(--bg2); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 20px;
        box-shadow: var(--shadow-card);
    }
    .chart-card h3 { font-size: 13px; font-weight: 700; color: var(--muted2); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }

    /* =====================================================
       INVOICES / JOBS / COMMS
    ===================================================== */
    .job-form {
        background: var(--bg2); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 24px;
        box-shadow: var(--shadow-card); max-width: 820px;
    }
    .job-form h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
    .job-form p { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

    /* ---- Jobs Grid ---- */
    .jobs-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 16px;
    }
    .job-card {
        background: var(--bg2);
        border: 1px solid var(--border);
        border-left: 4px solid var(--muted);
        border-radius: var(--radius);
        padding: 18px;
        box-shadow: var(--shadow-card);
        display: flex;
        flex-direction: column;
        gap: 10px;
        transition: box-shadow 0.18s, transform 0.18s;
    }
    .job-card:hover {
        box-shadow: var(--shadow-card-hover);
        transform: translateY(-2px);
    }
    .job-card[data-status="open"]        { border-left-color: var(--sky); }
    .job-card[data-status="in_progress"] { border-left-color: var(--amber); }
    .job-card[data-status="completed"]   { border-left-color: var(--green); }
    .jc-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .jc-actions { display: flex; gap: 6px; align-items: center; }
    .jc-customer { font-size: 16px; font-weight: 700; line-height: 1.2; }
    .jc-service {
        font-size: 12px; color: var(--muted2);
        display: flex; align-items: center; gap: 6px;
    }
    .jc-divider { height: 1px; background: var(--border); margin: 2px 0; }
    .jc-meta {
        display: flex; flex-wrap: wrap; gap: 12px;
        font-size: 12px; color: var(--muted);
    }
    .jc-meta span { display: flex; align-items: center; gap: 5px; }
    .jc-notes {
        font-size: 12px; color: var(--text);
        background: var(--bg3); border-radius: 8px;
        padding: 9px 11px; line-height: 1.6;
    }
    .jc-rec {
        font-size: 12px; color: var(--sky);
        background: rgba(56,189,248,0.07);
        border-radius: 8px; padding: 9px 11px;
        line-height: 1.5; display: flex; gap: 7px;
    }
    .jc-photos { display: flex; flex-wrap: wrap; gap: 6px; }
    .jc-photos img {
        width: 62px; height: 62px; object-fit: cover;
        border-radius: 7px; border: 1px solid var(--border); cursor: pointer;
        transition: transform 0.15s;
    }
    .jc-photos img:hover { transform: scale(1.07); }
    .jc-workflow {
        display: flex; gap: 6px; flex-wrap: wrap;
        padding-top: 10px; border-top: 1px solid var(--border);
        margin-top: auto;
    }

    /* ---- Jobs List view ---- */
    .job-list-header {
        grid-template-columns: 100px 1.4fr 1.4fr 1.1fr 120px 200px !important;
    }
    .job-list-row {
        display: grid;
        grid-template-columns: 100px 1.4fr 1.4fr 1.1fr 120px 200px;
        padding: 12px 16px;
        background: var(--bg2); border: 1px solid var(--border);
        border-left: 4px solid var(--muted);
        border-radius: 10px; margin-bottom: 6px;
        align-items: center; font-size: 13px;
        transition: all 0.18s; cursor: pointer;
    }
    .job-list-row:hover { border-color: var(--orange); background: var(--bg3); }
    .job-list-row[data-status="open"]        { border-left-color: var(--sky); }
    .job-list-row[data-status="in_progress"] { border-left-color: var(--amber); }
    .job-list-row[data-status="completed"]   { border-left-color: var(--green); }
    .jlr-date { font-family: var(--font-mono); color: var(--orange); font-size: 12px; }
    .jlr-customer { font-weight: 700; }
    .jlr-service { font-size: 12px; color: var(--muted2); }
    .jlr-agent { font-size: 12px; color: var(--muted); }
    .jlr-actions { display: flex; gap: 4px; flex-wrap: nowrap; }

    /* =====================================================
       TICKET FILTER BAR
    ===================================================== */
    .ticket-filter-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
        margin-bottom: 14px;
        padding: 12px 16px;
        background: var(--bg2);
        border: 1px solid var(--border);
        border-radius: 12px;
    }
    .tf-control {
        padding: 8px 12px;
        background: var(--bg3);
        border: 1px solid var(--border2);
        border-radius: 8px;
        color: var(--text);
        font-size: 13px;
        font-family: var(--font-body);
        outline: none;
        min-width: 110px;
        transition: border-color 0.15s;
    }
    .tf-control:focus { border-color: var(--orange); }
    .tf-date-group {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .tf-date-group .tf-control { min-width: 130px; }
    .tf-reset {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* =====================================================
       SCHEDULE VIEW
    ===================================================== */
    .schedule-filters {
        display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
    }
    .schedule-filters input, .schedule-filters select {
        padding: 9px 13px; background: var(--bg3);
        border: 1px solid var(--border2); border-radius: 9px;
        color: var(--text); font-size: 13px; font-family: var(--font-body);
        outline: none;
    }
    .sched-row {
        display: grid;
        grid-template-columns: 90px 1.5fr 2fr 1.5fr 200px;
        padding: 12px 16px;
        background: var(--bg2); border: 1px solid var(--border);
        border-radius: 10px; margin-bottom: 6px;
        align-items: center; font-size: 13px;
        transition: all 0.18s; cursor: pointer;
    }
    .sched-row:hover { border-color: var(--orange); background: var(--bg3); }
    .sched-row-header {
        grid-template-columns: 90px 1.5fr 2fr 1.5fr 200px;
        font-size: 10px; color: var(--muted); text-transform: uppercase;
        letter-spacing: 1px; font-weight: 700;
        display: grid; padding: 8px 16px; margin-bottom: 4px;
        border-bottom: 1px solid var(--border);
    }

    /* ---- SCHEDULE CARDS ---- */
    .sched-cards-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 14px;
    }
    .sched-card {
        background: var(--bg2);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 16px;
        cursor: pointer;
        transition: border-color 0.18s, transform 0.18s;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .sched-card:hover { border-color: var(--orange); transform: translateY(-2px); }
    .sched-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
    .sched-card-time { font-family: var(--font-mono); color: var(--orange); font-size: 13px; font-weight: 600; }
    .sched-card-name { font-weight: 700; font-size: 14px; }
    .sched-card-svc  { font-size: 12px; color: var(--muted); }
    .sched-card-addr { font-size: 12px; color: var(--muted2); display: flex; align-items: center; gap: 5px; }
    .sched-card-agent { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
    .sched-card-actions { display: flex; gap: 7px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }

    /* =====================================================
       COMMS PAGE
    ===================================================== */
    .comm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    .comm-log li {
        padding: 12px 0; border-bottom: 1px solid var(--border);
        font-size: 13px;
    }
    .comm-log li:last-child { border-bottom: none; }
    .comm-log .c-name { font-weight: 600; }
    .comm-log .c-time { font-size: 11px; color: var(--muted); }
    .comm-log ul { list-style: none; padding: 0; }

    /* =====================================================
       UTILITY
    ===================================================== */
    .flex { display: flex; }
    .flex-col { flex-direction: column; }
    .items-center { align-items: center; }
    .gap-2 { gap: 8px; }
    .gap-3 { gap: 12px; }
    .mb-4 { margin-bottom: 16px; }
    .text-muted { color: var(--muted); }
    .text-sm { font-size: 12px; }
    .fw-bold { font-weight: 700; }
    .empty-state {
        text-align: center; padding: 50px 20px;
        color: var(--muted); grid-column: 1 / -1;
    }
    .empty-state i { font-size: 36px; margin-bottom: 12px; opacity: 0.4; display: block; }
    .empty-state p { font-size: 14px; }

    /* Scroll-lock when detail open */
    body.detail-open { overflow: hidden; }

    /* =====================================================
       MOBILE SIDEBAR BACKDROP
    ===================================================== */
    #mobileBackdrop {
        display: none; position: fixed; inset: 0;
        background: rgba(0,0,0,0.6); z-index: 190;
        backdrop-filter: blur(2px);
    }
    #mobileBackdrop.active { display: block; }

    /* Hamburger button — hidden on desktop */
    #mobileMenuBtn {
        display: none; align-items: center; justify-content: center;
        width: 36px; height: 36px; border-radius: 9px;
        background: var(--bg3); border: 1px solid var(--border2);
        color: var(--text); cursor: pointer; font-size: 14px;
        flex-shrink: 0; transition: background 0.2s;
    }
    #mobileMenuBtn:hover { background: var(--bg4); }

    /* =====================================================
       RESPONSIVE BREAKPOINTS
    ===================================================== */
    @media (max-width: 1200px) {
        .stats-row { grid-template-columns: repeat(3, 1fr); }
        .analytics-grid-wide { grid-template-columns: 1fr 1fr; }
    }
    @media (max-width: 1100px) {
        .stats-row { grid-template-columns: repeat(2, 1fr); }
        .dash-grid { grid-template-columns: 1fr 1fr; }
        .dash-grid .span3 { grid-column: span 2; }
        .analytics-kpi { grid-template-columns: repeat(2, 1fr); }
        .analytics-grid, .analytics-grid-wide { grid-template-columns: 1fr; }
    }
    @media (max-width: 768px) {
        /* ---- Ticket rows ---- */
        .ticket-header { display: none; }
        .ticket-row {
            grid-template-columns: 1fr auto;
            grid-template-rows: auto auto;
            gap: 4px 8px;
        }
        /* col order on mobile: title spans full, rest inline */
        .ticket-row > div:nth-child(1) { grid-column: 1 / -1; font-weight: 700; } /* title */
        .ticket-row > div:nth-child(2),
        .ticket-row > div:nth-child(3),
        .ticket-row > div:nth-child(4),
        .ticket-row > div:nth-child(5) { font-size: 11px; color: var(--muted); }
        .ticket-row > div:nth-child(6) { grid-column: 1; }
        .ticket-row > div:nth-child(7) { grid-column: 2; justify-self: end; }

        /* ---- Customer list ---- */
        .customer-list-header { display: none; }
        .customer-list-row {
            grid-template-columns: 44px 1fr auto;
            grid-template-rows: auto auto;
        }
        .customer-list-row > div:nth-child(3),  /* email */
        .customer-list-row > div:nth-child(4) { display: none; } /* phone */
        .customer-list-row > div:nth-child(5) { font-size: 11px; color: var(--muted); grid-column: 2; } /* level */
        .customer-list-row > div:nth-child(6) { grid-column: 3; grid-row: 1 / 3; align-self: center; } /* actions */

        /* ---- Invoice rows ---- */
        .invoice-row {
            grid-template-columns: 1fr auto;
            grid-template-rows: auto auto auto;
        }
        .inv-col-num  { grid-column: 1; font-size: 11px; }
        .inv-col-cust { grid-column: 1; font-weight: 600; }
        .inv-col-amt  { grid-column: 1; font-size: 12px; }
        .inv-col-status { display: none; } /* status visible via amount color */
        .invoice-row .row-actions { grid-column: 2; grid-row: 1 / 4; align-self: center; flex-direction: column; }

        /* ---- Job list rows ---- */
        .job-list-row {
            grid-template-columns: 1fr auto;
            grid-template-rows: auto auto;
        }
        .job-list-row > div:nth-child(1) { font-size: 11px; color: var(--orange); grid-column: 1; } /* date */
        .job-list-row > div:nth-child(2) { font-weight: 700; grid-column: 1; }   /* customer */
        .job-list-row > div:nth-child(3) { font-size: 11px; color: var(--muted2); grid-column: 1; } /* service */
        .job-list-row > div:nth-child(4) { display: none; } /* agent — hidden */
        .job-list-row > div:nth-child(5) { display: none; } /* status badge — hidden */
        .job-list-row .jlr-actions { grid-column: 2; grid-row: 1 / 3; align-self: center; flex-direction: column; }

        /* ---- User / Team rows ---- */
        .user-header, .team-header { display: none; }
        .user-row {
            grid-template-columns: 1fr auto;
            grid-template-rows: auto auto;
        }
        .user-row > div:nth-child(3),
        .user-row > div:nth-child(4) { font-size: 11px; color: var(--muted); }
        .user-row > div:nth-child(5) { grid-column: 2; grid-row: 1 / 3; align-self: center; }
        .team-row {
            grid-template-columns: 1fr auto;
            grid-template-rows: auto auto;
        }
        .team-row > div:nth-child(3) { font-size: 11px; color: var(--muted); grid-column: 1; }
        .team-row > div:nth-child(4) { grid-column: 2; grid-row: 1 / 3; align-self: center; }

        /* ---- Schedule week view ---- */
        .week-grid { grid-template-columns: repeat(3, 1fr); }
        .week-grid > .week-col:nth-child(n+4) { display: none; } /* show Mon–Wed only; nav handles rest */

        /* ---- Settings grids ---- */
        .sla-grid { grid-template-columns: 1fr; }
        .toggle-grid { grid-template-columns: repeat(2, 1fr); }

        /* ---- Modals — full width on mobile ---- */
        .modal-content, .modal-content-wide {
            width: 96%; max-width: 96%;
            max-height: 92vh;
            border-radius: 14px;
        }
        .modal-body { padding: 14px; }
        .modal-header { padding: 13px 16px; }
        .form-actions {
            flex-direction: column-reverse;
            gap: 8px;
        }
        .form-actions .btn { width: 100%; justify-content: center; }

        /* ---- Ticket filter bar ---- */
        .ticket-filter-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
        .tf-control, .tf-reset { width: 100%; min-width: 0; box-sizing: border-box; }
        .tf-date-group { flex-direction: column; gap: 6px; }
        .tf-date-group .tf-control { min-width: 0; width: 100%; }

        /* ---- Schedule + Job filter bars ---- */
        .schedule-filters { flex-direction: column; gap: 8px; }
        .schedule-filters input,
        .schedule-filters select { width: 100%; box-sizing: border-box; }

        /* ---- Invoice list header hidden ---- */
        .invoice-list-header { display: none; }

        /* ---- Analytics range buttons wrap ---- */
        .page-header .analytics-range-btn { font-size: 11px; padding: 3px 9px; }

        /* Sidebar: hidden off-screen by default, overlay on mobile */
        .sidebar {
            transform: translateX(-100%);
            width: var(--nav-w) !important;
            transition: transform 0.3s cubic-bezier(.4,0,.2,1);
            z-index: 195;
        }
        .sidebar.mobile-open { transform: translateX(0); }
        /* Keep nav labels visible when sidebar is full-width overlay */
        .sidebar.mobile-open .nav-label,
        .sidebar.mobile-open .logo-wordmark,
        .sidebar.mobile-open .nav-section-title,
        .sidebar.mobile-open .sidebar-user-info { display: block !important; }
        /* Desktop collapse toggle hidden on mobile */
        #sidebarToggle { display: none; }
        /* Hamburger shown on mobile */
        #mobileMenuBtn { display: flex; }
        /* Main content fills full width */
        .main-content { margin-left: 0 !important; }
        /* Stats row: 2 columns on mobile */
        .stats-row { grid-template-columns: repeat(2, 1fr); }
        .stat-value { font-size: 36px; }
        /* Dashboard grid: single column */
        .dash-grid { grid-template-columns: 1fr; }
        .dash-grid .span2, .dash-grid .span3 { grid-column: span 1; }
        /* Forms: single column */
        .form-grid-2 { grid-template-columns: 1fr; }
        /* Comms */
        .comm-grid { grid-template-columns: 1fr; }
        /* Analytics */
        .analytics-kpi { grid-template-columns: repeat(2, 1fr); }
        .analytics-grid, .analytics-grid-wide { grid-template-columns: 1fr; }
        /* Page header: wraps */
        .page-header { flex-wrap: wrap; gap: 10px; }
        .page-header > div { flex-wrap: wrap; }
        /* Header search bar: smaller */
        .search-bar { max-width: 160px; }
        .search-bar input { width: 120px; }
        /* Table rows: hide less critical columns */
        .sched-row-header { display: none; }
        .sched-row { grid-template-columns: 80px 1fr 100px; }
        .sched-row > div:nth-child(3),
        .sched-row > div:nth-child(4) { display: none; }
        /* Customer detail panel: full width */
        .customer-detail-panel { width: 100vw; max-width: 100vw; }
        .detail-body { grid-template-columns: 1fr; }
        .detail-section.full { grid-column: span 1; }
    }
    @media (max-width: 480px) {
        .stats-row { grid-template-columns: 1fr; }
        .header { padding: 0 12px; gap: 8px; }
        .search-bar { display: none; }
        .user-actions { gap: 6px; }
        #roleSelector { display: none; }
        /* KPI cards: 1 column on small phones */
        .analytics-kpi { grid-template-columns: 1fr; }
        /* Toggle grids: 1 column */
        .toggle-grid { grid-template-columns: 1fr; }
        .toggle-grid-2 { grid-template-columns: 1fr; }
        /* SLA already 1-col from 768px rule */
        /* Ticket cards: single column */
        .ticket-cards-grid { grid-template-columns: 1fr; }
        /* Page header stacks tightly */
        .page-header { padding: 10px 12px; }
        .page-header h2 { font-size: 16px; }
    }

/* =====================================================
   PHASE 3 — TOUCH TARGETS & POLISH
===================================================== */

/* ---- Touch devices: 44×44px minimum tap targets ---- */
@media (hover: none) and (pointer: coarse) {
    .action-btn { width: 44px; height: 44px; border-radius: 10px; }
    .hdr-btn { width: 44px; height: 44px; }
    .btn { min-height: 44px; }
    .cal-nav { width: 44px; height: 44px; }
    .bull-del-btn { min-height: 36px; padding: 6px 12px; }
}

/* ---- Very small phones (360px): trim header clutter ---- */
@media (max-width: 360px) {
    .api-status, .websocket-status { display: none; }
    #headerName { display: none; }
    .header { gap: 4px; padding: 0 8px; }
}

/* ---- Week grid ≤480px: horizontal scroll with snap ---- */
@media (max-width: 480px) {
    .week-grid {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding-bottom: 8px;
        scroll-snap-type: x mandatory;
    }
    .week-grid > .week-col {
        flex: 0 0 220px;
        display: block !important; /* un-hide cols hidden by 768px rule */
        scroll-snap-align: start;
    }
}

/* ---- iOS safe-area insets ---- */
@supports (padding: env(safe-area-inset-bottom)) {
    .sidebar-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .main-content { padding-bottom: env(safe-area-inset-bottom); }
}

/* =====================================================
   LOGIN OVERLAY
===================================================== */
.login-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: url('foundrybk.jpg') center center / cover no-repeat;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.login-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10,12,18,0.38);
}
.login-overlay.show { display: flex; }

.login-card {
    background: rgba(18,22,30,0.92);
    border: 1px solid rgba(251,146,60,0.25);
    border-radius: 18px;
    padding: 40px 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(251,146,60,0.1);
    position: relative;
    z-index: 1;
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
    display: none;
}
.login-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--orange);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    margin: 0 auto 14px;
    box-shadow: 0 8px 24px rgba(251,146,60,0.35);
}
.login-brand h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--orange);
    margin: 0 0 4px;
    letter-spacing: 3px;
}
.login-brand small {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.login-error {
    color: var(--rose);
    font-size: 12px;
    margin-bottom: 10px;
    min-height: 16px;
}
/* =====================================================
   LIGHT MODE — data-theme="light"
===================================================== */
[data-theme="light"] {
    --bg:       #eef2f7;
    --bg2:      #ffffff;
    --bg3:      #f3f6fa;
    --bg4:      #dde3ed;
    --border:   rgba(0,0,0,0.10);
    --border2:  rgba(0,0,0,0.16);
    --text:     #0f172a;
    --muted:    #7e8fa8;
    --muted2:   #4f6278;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-card-hover: 0 8px 28px rgba(0,0,0,0.13), 0 0 0 1px rgba(249,115,22,0.15) inset;
}
/* Page background — visible body differentiated from white cards */
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .main-content { background: var(--bg); }
/* Sidebar */
[data-theme="light"] .sidebar {
    background: var(--bg2);
    border-right: 1px solid var(--border2);
    box-shadow: 2px 0 12px rgba(0,0,0,0.07);
}
/* Topbar */
[data-theme="light"] .topbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
/* Cards */
[data-theme="light"] .card {
    background: var(--bg2);
    border: 1px solid var(--border2);
    box-shadow: var(--shadow-card);
}
[data-theme="light"] .card:hover { box-shadow: var(--shadow-card-hover); }
/* Modals */
[data-theme="light"] .modal-content {
    background: var(--bg2);
    border: 1px solid var(--border2);
    box-shadow: 0 16px 48px rgba(0,0,0,0.18);
}
/* Form controls */
[data-theme="light"] .form-control {
    background: var(--bg2);
    color: var(--text);
    border-color: var(--border2);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) inset;
}
[data-theme="light"] .form-control:focus {
    background: var(--bg2);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}
/* Tables */
[data-theme="light"] .data-table { background: var(--bg2); }
[data-theme="light"] .list-header {
    background: var(--bg3);
    border-bottom: 1px solid var(--border2);
}
[data-theme="light"] .ticket-row,
[data-theme="light"] .customer-row {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
[data-theme="light"] .ticket-row:hover,
[data-theme="light"] .customer-row:hover { background: var(--bg3); }
/* Stat cards (dashboard) */
[data-theme="light"] .stat-card {
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border2);
}
[data-theme="light"] .stat-card.sc-orange,
[data-theme="light"] .stat-card.sc-sky,
[data-theme="light"] .stat-card.sc-green,
[data-theme="light"] .stat-card.sc-purple,
[data-theme="light"] .stat-card.sc-amber,
[data-theme="light"] .stat-card.sc-rose {
    background: var(--bg2);
    box-shadow: var(--shadow-card);
}
/* Job cards */
[data-theme="light"] .job-card {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-left-width: 4px;
    box-shadow: var(--shadow-card);
}
[data-theme="light"] .jc-notes {
    background: var(--bg3);
}
[data-theme="light"] .jc-rec {
    background: rgba(56,189,248,0.10);
}
/* Job form area */
[data-theme="light"] .job-form {
    background: var(--bg2);
    border: 1px solid var(--border2);
    box-shadow: var(--shadow-card);
}
/* Notification / search panels */
[data-theme="light"] .notif-panel {
    background: var(--bg2);
    border: 1px solid var(--border2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
[data-theme="light"] .global-search-results {
    background: var(--bg2);
    border: 1px solid var(--border2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
/* Nav items */
[data-theme="light"] .menu-item:hover { background: rgba(0,0,0,0.05); }
[data-theme="light"] .menu-item.active {
    background: rgba(249,115,22,0.10);
}
/* Buttons */
[data-theme="light"] .btn-cancel {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--muted2);
}
[data-theme="light"] .wf-btn {
    background: var(--bg3);
    border-color: var(--border2);
}
/* Page headers */
[data-theme="light"] .page-header { border-bottom: 1px solid var(--border2); }

/* =====================================================
   TICKET BADGE & WIDE MODAL
===================================================== */
.ticket-id-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--sky);
    background: rgba(56,189,248,0.12);
    border: 1px solid rgba(56,189,248,0.3);
    padding: 3px 9px;
    border-radius: 6px;
    letter-spacing: 1px;
    white-space: nowrap;
}
.modal-content-wide { max-width: 700px; }

/* Ticket meta grid */
.ticket-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.ticket-meta-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 600;
}
.ticket-desc-block {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 20px;
}

/* Comment section */
.comment-section-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.comment-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}
.comment-thread::-webkit-scrollbar { width: 4px; }
.comment-thread::-webkit-scrollbar-track { background: transparent; }
.comment-thread::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--orange-g);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.comment-body {
    flex: 1;
}
.comment-bubble {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 0 10px 10px 10px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}
.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}
.comment-meta strong { color: var(--muted2); }
/* Comment edit/delete actions */
.comment-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s;
}
.comment-item:hover .comment-actions { opacity: 1; }
.comment-action-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--muted);
    padding: 2px 7px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.comment-action-btn:hover { color: var(--sky); border-color: var(--sky); background: rgba(56,189,248,0.08); }
.comment-action-btn.rose:hover { color: var(--rose); border-color: var(--rose); background: rgba(244,63,94,0.08); }
/* Activity events in comment thread */
.activity-event-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    font-size: 11px;
    color: var(--muted);
    margin: 2px 0;
}
.activity-event-row::before,
.activity-event-row::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.activity-event-icon { color: var(--orange); font-size: 10px; flex-shrink: 0; }
.activity-event-text { font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-event-time { font-size: 10px; white-space: nowrap; flex-shrink: 0; }
/* Thumbnail cursor */
.attachment-thumb { cursor: zoom-in; }
.comment-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg4);
    border: 1px solid var(--border2);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--sky);
    text-decoration: none;
    transition: background 0.15s;
}
.attachment-chip:hover { background: rgba(56,189,248,0.12); }
.attachment-chip i { font-size: 12px; }
.attachment-thumb {
    width: 72px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border2);
    cursor: pointer;
}

/* Add comment zone */
.add-comment-box {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}
.attachment-upload-zone {
    border: 2px dashed var(--border2);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.attachment-upload-zone:hover {
    border-color: var(--sky);
    background: rgba(56,189,248,0.05);
    color: var(--sky);
}
.attachment-preview-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.file-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg4);
    border: 1px solid var(--border2);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text);
}
.file-preview-chip .remove-file {
    cursor: pointer;
    color: var(--rose);
    margin-left: 2px;
    font-size: 10px;
}

/* =====================================================
   DARK / LIGHT SWITCH TOGGLE (settings)
===================================================== */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch-toggle input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg4);
    border-radius: 24px;
    transition: background 0.3s;
}
.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--muted2);
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}
.switch-toggle input:checked + .switch-slider { background: rgba(56,189,248,0.3); }
.switch-toggle input:checked + .switch-slider::before { transform: translateX(20px); background: var(--sky); }

/* =====================================================
   RBAC SETTINGS GRID
===================================================== */

/* User Management stat mini-cards */
.user-mgmt-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.um-stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg3);
}
.um-stat-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.um-stat-count {
    font-size: 22px; font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
}
.um-stat-label {
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--muted); font-weight: 600;
    margin-top: 2px;
}
.um-admin      .um-stat-icon { background: rgba(244,63,94,0.12);   color: var(--rose);   }
.um-manager    .um-stat-icon { background: rgba(251,191,36,0.12);  color: var(--amber);  }
.um-supervisor .um-stat-icon { background: rgba(167,139,250,0.12); color: var(--purple); }
.um-agent      .um-stat-icon { background: rgba(56,189,248,0.12);  color: var(--sky);    }
.um-inactive   .um-stat-icon { background: rgba(100,116,139,0.12); color: var(--muted);  }
.um-admin      .um-stat-count { color: var(--rose);   }
.um-manager    .um-stat-count { color: var(--amber);  }
.um-supervisor .um-stat-count { color: var(--purple); }
.um-agent      .um-stat-count { color: var(--sky);    }
.um-inactive   .um-stat-count { color: var(--muted);  }

.rbac-role-block {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.rbac-role-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rbac-role-title.admin      { color: var(--rose); }
.rbac-role-title.manager    { color: var(--amber); }
.rbac-role-title.supervisor { color: var(--purple); }
.rbac-role-title.agent      { color: var(--sky); }
.rbac-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.rbac-toggle-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted2);
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.rbac-toggle-grid label:hover { background: var(--bg4); color: var(--text); }
.rbac-toggle-grid input[type=checkbox] { accent-color: var(--sky); cursor: pointer; }

/* =====================================================
   TICKET STATUS WORKFLOW BAR
===================================================== */
.ticket-workflow-bar {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
}
.workflow-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.wf-btn {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border2);
    background: var(--bg4);
    color: var(--muted2);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s;
}
.wf-btn:hover { background: var(--bg2); color: var(--text); }
.wf-open.wf-active        { background: rgba(56,189,248,0.15);  border-color: var(--sky);    color: var(--sky);    }
.wf-in_progress.wf-active { background: rgba(167,139,250,0.15); border-color: var(--purple); color: var(--purple); }
.wf-pending.wf-active     { background: rgba(251,191,36,0.15);  border-color: var(--amber);  color: var(--amber);  }
.wf-resolved.wf-active    { background: rgba(34,197,94,0.15);   border-color: var(--green);  color: var(--green);  }
.wf-closed.wf-active      { background: rgba(244,63,94,0.15);   border-color: var(--rose);   color: var(--rose);   }
.wf-completed.wf-active   { background: rgba(34,197,94,0.15);   border-color: var(--green);  color: var(--green);  }
.wf-done-label { font-size: 11px; color: var(--green); font-weight: 600; padding: 5px 0; text-align: center; display: block; }
.wf-done-label i { margin-right: 4px; }

/* =====================================================
   INVOICE PRINT LAYOUT
===================================================== */
.inv-print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border2);
}
.inv-brand {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--orange);
    letter-spacing: 3px;
}
.inv-bill-to {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}
.inv-line-items {
    margin-bottom: 16px;
}
.inv-line-header {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 700;
    padding: 6px 0;
    border-bottom: 1px solid var(--border2);
    margin-bottom: 4px;
}
.inv-line-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.inv-total-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0 0;
    font-weight: 700;
    font-size: 15px;
    color: var(--green);
    border-top: 2px solid var(--border2);
    margin-top: 4px;
}
.inv-status-row {
    display: flex;
    align-items: center;
    margin-top: 14px;
}

/* =====================================================
   COMM SEND STATUS
===================================================== */
.comm-send-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 8px 12px;
    background: var(--bg4);
    border: 1px solid var(--border2);
    border-radius: 8px;
    line-height: 1.4;
}

/* ---- SLA BADGE ---- */
.sla-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 6px;
    white-space: nowrap;
}
.sla-ok      { background: rgba(34,197,94,0.15);  color: var(--green); }
.sla-warn    { background: rgba(251,191,36,0.18); color: var(--amber); }
.sla-breach  { background: rgba(244,63,94,0.18);  color: var(--rose);  animation: sla-pulse 2s infinite; }
@keyframes sla-pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

/* ---- CUSTOMER LIST VIEW ---- */
.customer-list-header {
    display: grid;
    grid-template-columns: 44px 2fr 1.5fr 1.2fr 1fr 120px;
    padding: 8px 16px;
    font-size: 10px; font-weight: 700;
    color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.customer-list-row {
    display: grid;
    grid-template-columns: 44px 2fr 1.5fr 1.2fr 1fr 120px;
    align-items: center;
    gap: 0;
    padding: 10px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.customer-list-row:hover { background: var(--bg3); }
.customer-list-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.customer-list-avatar.individual { background: rgba(56,189,248,0.15); color: var(--sky); }
.customer-list-avatar.business   { background: rgba(249,115,22,0.15);  color: var(--orange); }

/* ---- SCHEDULE WEEK VIEW ---- */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    min-height: 400px;
}
.week-col {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-height: 200px;
    transition: border-color 0.15s;
}
.week-col.drag-over {
    border-color: var(--sky);
    background: rgba(56,189,248,0.06);
}
.week-col-header {
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
}
.week-col-header.today-col {
    color: var(--orange);
    background: rgba(249,115,22,0.08);
    border-bottom-color: rgba(249,115,22,0.3);
}
.week-col-body { padding: 6px; }
.week-card {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 7px;
    padding: 7px 9px;
    margin-bottom: 5px;
    font-size: 12px;
    cursor: grab;
    transition: opacity 0.15s, box-shadow 0.15s;
    user-select: none;
}
.week-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.35); }
.week-card.dragging { opacity: 0.4; cursor: grabbing; }
.week-card-time { font-family: var(--font-mono); color: var(--orange); font-size: 11px; margin-bottom: 2px; }
.week-card-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-card-svc  { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-card-status { display: inline-block; margin-top: 4px; }

/* ---- OVERDUE TICKETS WIDGET ---- */
.overdue-tick-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    cursor: pointer;
}
.overdue-tick-item:last-child { border-bottom: none; }
.overdue-tick-item:hover .overdue-tick-title { color: var(--sky); }
.overdue-tick-days {
    min-width: 42px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--rose);
    border-radius: 6px;
    padding: 3px 5px;
}
.overdue-tick-title { font-weight: 600; flex: 1; }
.overdue-tick-sub   { font-size: 11px; color: var(--muted); }

/* ---- INVOICE LIST ROWS ---- */
.invoice-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr 1fr 160px;
    padding: 12px 16px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; margin-bottom: 6px;
    align-items: center; font-size: 13px;
    transition: background 0.15s;
}
.invoice-row:hover { background: var(--bg3); border-color: var(--border2); }

/* ---- INVOICE BUILDER ---- */
.inv-builder-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}
.inv-builder-right { position: sticky; top: 24px; }
.inv-preview-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
    min-height: 220px;
}
.inv-item-row {
    display: grid;
    grid-template-columns: 2fr 60px 80px 80px 32px;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}
.inv-item-row input {
    padding: 6px 8px;
    font-size: 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
}
.inv-item-desc { background: var(--bg3) !important; }
.inv-item-row input:focus { outline: none; border-color: var(--orange); }
.inv-item-amount { font-size: 12px; font-weight: 600; color: var(--text); text-align: right; padding: 6px 4px; }
.inv-preview-items-hdr {
    display: grid;
    grid-template-columns: 2fr 60px 80px 80px;
    gap: 8px;
    padding: 6px 0;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.inv-preview-item-row {
    display: grid;
    grid-template-columns: 2fr 60px 80px 80px;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.inv-preview-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; padding-top: 10px; font-size: 13px; }
.inv-preview-total-line  { display: flex; gap: 48px; }
.inv-preview-total-final { display: flex; gap: 48px; font-size: 15px; font-weight: 700; color: var(--sky); padding-top: 8px; border-top: 1px solid var(--border); min-width: 220px; justify-content: space-between; }
.inv-saved-client-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg3);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}
.inv-saved-client-row:hover { border-color: var(--orange); }
@media (max-width: 900px) {
    .inv-builder-grid { grid-template-columns: 1fr; }
    .inv-builder-right { position: static; }
}

@media print {
    body > *:not(#invoicePrintArea) { display: none !important; }
    #invoicePrintArea { display: block !important; color: #0f172a !important; background: #fff !important; }
}

/* =====================================================
   CSV IMPORT
   ===================================================== */
.csv-import-tab { font-size: 12px; padding: 6px 14px; }
.csv-import-tab.active { background: var(--orange); color: #fff; border-color: var(--orange); }
.csv-table-wrap {
    overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm);
    max-height: 320px; overflow-y: auto;
}
.csv-table-wrap table { width: 100%; border-collapse: collapse; font-size: 12px; }
.csv-table-wrap th {
    background: var(--bg3); color: var(--muted2); font-weight: 600;
    padding: 7px 10px; text-align: left; position: sticky; top: 0; z-index: 1;
    border-bottom: 1px solid var(--border);
}
.csv-table-wrap td { padding: 6px 10px; border-bottom: 1px solid var(--border2); color: var(--text); }
.csv-table-wrap tr:last-child td { border-bottom: none; }
.csv-row-valid td:first-child { border-left: 3px solid var(--green); }
.csv-row-error td:first-child { border-left: 3px solid var(--rose); }
.csv-error-msg { color: var(--rose); font-size: 11px; }

/* =====================================================
   AUDIT LOG
===================================================== */
.audit-log-table { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.audit-log-header {
    display: grid; grid-template-columns: 130px 160px 160px 1fr;
    gap: 12px; padding: 8px 14px;
    background: var(--bg3); border-bottom: 1px solid var(--border);
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--muted2);
}
.audit-log-row {
    display: grid; grid-template-columns: 130px 160px 160px 1fr;
    gap: 12px; padding: 10px 14px;
    background: var(--bg2); border-bottom: 1px solid var(--border2);
    align-items: center; font-size: 13px;
    transition: background 0.15s;
}
.audit-log-row:last-child { border-bottom: none; }
.audit-log-row:hover { background: var(--bg3); }
.audit-time { font-size: 12px; color: var(--muted); line-height: 1.4; }
.audit-time-sub { font-size: 11px; color: var(--muted2); }
.audit-actor { display: flex; flex-direction: column; gap: 3px; }
.audit-detail { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) {
    .audit-log-header { display: none; }
    .audit-log-row {
        grid-template-columns: 1fr; gap: 4px; padding: 10px 12px;
    }
    .audit-detail { white-space: normal; }
}

/* =====================================================
   IMPERSONATION BANNER
===================================================== */
.impersonate-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg,#a78bfa,#7c3aed);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.impersonate-banner .badge {
    font-size: 11px;
}
.impersonate-banner > i.fa-user-secret {
    font-size: 22px;
}
.impersonate-exit-btn {
    margin-left: auto;
    background: rgba(0,0,0,0.25);
    border: none;
    border-radius: 6px;
    color: #fff;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}
.impersonate-exit-btn:hover { background: rgba(0,0,0,0.45); }
body:has(#impersonateBanner[style*="flex"]) .main-content,
body:has(#impersonateBanner[style*="flex"]) .sidebar {
    padding-top: 44px;
}

