@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   PERFECT DUAL-THEME ENGINE (DARK & LIGHT MODE)
   ========================================================================== */

/* DARK MODE (Default) */
:root, [data-theme="dark"] {
    --bg: #0b0f19;
    --surface: #131b2e;
    --surface2: #1a243b;
    --surface3: #222f4d;
    --border: #243254;
    --border2: #34446e;
    --text: #f1f5f9;
    --text2: #94a3b8;
    --text3: #64748b;
    --accent: #38bdf8;
    --accent-hover: #0284c7;
    --accent-bg: rgba(56, 189, 248, 0.15);
    --accent-border: rgba(56, 189, 248, 0.35);
    --accent2: #818cf8;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.15);
    --green-border: rgba(34, 197, 94, 0.3);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.15);
    --yellow-border: rgba(245, 158, 11, 0.3);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.15);
    --red-border: rgba(239, 68, 68, 0.3);
    --orange: #f97316;
    --cyan: #06b6d4;
    --purple: #a855f7;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.3);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* LIGHT MODE (Clean, High Contrast, Non-Washed Out) */
[data-theme="light"] {
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface2: #f8fafc;
    --surface3: #e2e8f0;
    --border: #cbd5e1;
    --border2: #94a3b8;
    --text: #0f172a;
    --text2: #334155;
    --text3: #64748b;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --accent-bg: #e0f2fe;
    --accent-border: #7dd3fc;
    --accent2: #4f46e5;
    --green: #15803d;
    --green-bg: #dcfce7;
    --green-border: #86efac;
    --yellow: #b45309;
    --yellow-bg: #fef3c7;
    --yellow-border: #fde68a;
    --red: #b91c1c;
    --red-bg: #fee2e2;
    --red-border: #fca5a5;
    --orange: #c2410c;
    --cyan: #0e7490;
    --purple: #7e22ce;
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Base resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Custom Institutional Scrollbars */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}
::-webkit-scrollbar-track {
    background: var(--surface2);
    border-radius: 6px;
}
::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 6px;
    border: 2px solid var(--surface);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
    margin-right: 18px;
    flex-shrink: 0;
    letter-spacing: -0.3px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}

.logo span {
    color: var(--accent);
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text2);
    border: 1px solid transparent;
    background: transparent;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}
.nav-tab:hover {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border);
}
.nav-tab.active {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: var(--accent-border);
    font-weight: 700;
}
.nav-tab .badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}
.nav-tab .badge.red { background: var(--red); color: #fff; }
.nav-tab .badge.yellow { background: var(--yellow); color: #fff; }
.nav-tab .badge.green { background: var(--green); color: #fff; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Search Box (Protected against auto-fill) */
.search-box {
    position: relative;
}
.search-box input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px 6px 30px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    width: 160px;
    font-family: inherit;
    outline: none;
    transition: border 0.15s, width 0.2s;
}
.search-box input:focus {
    border-color: var(--accent);
    width: 220px;
}
.search-box input::placeholder {
    color: var(--text3);
}
.search-box .si {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text3);
    font-size: 12px;
}

/* Generic topbar buttons */
.topbar-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 11px;
    color: var(--text2);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.topbar-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--surface);
}
.topbar-btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-color: var(--accent);
    color: #fff;
    font-weight: 800;
}
.topbar-btn.primary:hover {
    filter: brightness(1.08);
}
.topbar-btn.danger {
    background: var(--red-bg);
    border-color: var(--red-border);
    color: var(--red);
}
.topbar-btn.danger:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.topbar-btn.success {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}
.topbar-btn.success:hover {
    background: var(--green);
    color: #fff;
}

/* User Avatar */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    border: 2px solid var(--border);
}

/* Form Controls & Dropdowns */
.filter-select, select.filter-select {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--text) !important;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: border 0.12s;
}
.filter-select:focus {
    border-color: var(--accent) !important;
}
select option {
    background: var(--surface) !important;
    color: var(--text) !important;
}

.filter-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
}
.filter-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}
.filter-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent-border);
    color: var(--accent);
    font-weight: 800;
}
.filter-spacer {
    flex: 1;
}

/* ==========================================================================
   LAYOUT & SIDEBAR
   ========================================================================== */
.layout {
    display: flex;
    padding-top: 60px;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 10px;
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}
.sidebar-section {
    margin-bottom: 22px;
}
.sidebar-label {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 8px;
    margin-bottom: 6px;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.12s;
    margin-bottom: 2px;
    border: 1px solid transparent;
}
.sidebar-item:hover {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border);
}
.sidebar-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: var(--accent-border);
    font-weight: 800;
}
.sidebar-item .si {
    width: 16px;
    text-align: center;
}
.sidebar-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 1px 7px;
    border-radius: 10px;
}
.sidebar-count.alert {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red-border);
}

.content {
    margin-left: 220px;
    flex: 1;
    padding: 24px;
    min-height: calc(100vh - 60px);
}

/* ==========================================================================
   PAGE HEADER & STATS CARDS
   ========================================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -0.4px;
    color: var(--text);
}
.page-sub {
    font-size: 13px;
    color: var(--text2);
    margin-top: 2px;
    font-weight: 500;
}
.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    border-color: var(--border2);
    transform: translateY(-1px);
}
.stat-label {
    font-size: 10.5px;
    color: var(--text3);
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.stat-value {
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
    color: var(--text);
}
.stat-value.green { color: var(--green) !important; }
.stat-value.red { color: var(--red) !important; }
.stat-value.yellow { color: var(--yellow) !important; }
.stat-value.accent { color: var(--accent) !important; }
.stat-value.cyan { color: var(--cyan) !important; }
.stat-change {
    font-size: 11px;
    color: var(--text3);
    margin-top: 5px;
    font-weight: 600;
}
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ==========================================================================
   DASHBOARD CARDS & PROGRESS
   ========================================================================== */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dash-card:hover {
    border-color: var(--border2);
}
.dash-card-title {
    font-size: 13.5px;
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}
.workflow-tag {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    font-weight: 800;
    font-family: var(--font-mono);
}

.progress-bar {
    height: 6px;
    background: var(--surface3);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: var(--accent); }
.progress-fill.cyan { background: var(--cyan); }

/* ==========================================================================
   TABLES & WRAPPERS
   ========================================================================== */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: auto;
    max-height: calc(100vh - 215px);
    margin-bottom: 20px;
    scrollbar-gutter: stable;
}
.table-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.table-wrap::-webkit-scrollbar-track {
    background: var(--surface2);
    border-radius: 6px;
}
.table-wrap::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 6px;
    border: 2px solid var(--surface);
}
.table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
.table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
    flex-wrap: wrap;
    background: var(--surface);
}
.table-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
}
table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    background: var(--surface2);
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
tbody tr:hover {
    background: var(--surface2);
}
tbody tr:last-child {
    border-bottom: none;
}
td {
    padding: 11px 16px;
    font-size: 13px;
    vertical-align: middle;
    color: var(--text);
}
.td-mono {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text2);
    font-weight: 600;
}

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-blue { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-cyan { background: rgba(6, 182, 212, 0.15); color: var(--cyan); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--purple); border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-gray { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.badge-orange { background: rgba(249, 115, 22, 0.15); color: var(--orange); border: 1px solid rgba(249, 115, 22, 0.3); }

/* Live Pulsing Indicator Dot */
.call-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.call-dot.pulse {
    background: var(--green);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    animation: pulse-anim 2s infinite;
}
.call-dot.idle { background: var(--text3); }
.call-dot.error { background: var(--red); }
@keyframes pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.row-actions { display: flex; gap: 4px; align-items: center; }
.row-btn {
    padding: 4px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text2);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
    white-space: nowrap;
}
.row-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.row-btn.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.row-btn.success:hover { border-color: var(--green); color: var(--green); background: var(--green-bg); }

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 14px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: modal-in 0.18s ease;
}
.modal-lg { max-width: 800px; }
@keyframes modal-in {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.modal-title { font-size: 16px; font-weight: 800; color: var(--text); }
.modal-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.modal-close {
    background: var(--surface2);
    border: 1px solid var(--border);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text2);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-body { padding: 18px 22px; }
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Form Styles */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-row.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }
.form-input {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text) !important;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border 0.12s;
}
.form-input:focus { border-color: var(--accent) !important; }
textarea.form-input { resize: vertical; min-height: 80px; }

/* Detail section */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.detail-key { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 2px; }
.detail-val { font-size: 13px; color: var(--text); font-weight: 700; }
.detail-val.mono { font-family: var(--font-mono); font-size: 12px; }

/* AI / Execution Log Terminal */
.ai-log {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text);
    line-height: 1.6;
    max-height: 220px;
    overflow-y: auto;
}
.ai-log .log-line { display: flex; gap: 8px; }
.ai-log .log-time { color: var(--text3); flex-shrink: 0; }
.ai-log .log-msg.success { color: var(--green); }
.ai-log .log-msg.info { color: var(--accent); }
.ai-log .log-msg.warn { color: var(--yellow); }
.ai-log .log-msg.error { color: var(--red); }

.section-divider {
    font-size: 11px;
    font-weight: 800;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

/* Inner Tabs */
.inner-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.inner-tab {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text2);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.12s;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: inherit;
}
.inner-tab:hover { color: var(--text); }
.inner-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Settings 2-Column Grid & Guides */
.settings-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 960px) {
    .settings-grid { grid-template-columns: 1fr; }
}
.guide-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.guide-step {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    align-items: flex-start;
}
.guide-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.guide-text {
    font-size: 12.5px;
    color: var(--text2);
    line-height: 1.5;
}
.guide-text strong {
    color: var(--text);
}
.guide-text code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 11.5px;
    border: 1px solid var(--border);
}
.qr-box {
    width: 170px;
    height: 170px;
    background: #ffffff;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ==========================================================================
   NOTIFICATION TOAST
   ========================================================================== */
#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow);
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 380px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-left: 4px solid var(--green); }
#toast.error { border-left: 4px solid var(--red); }
#toast.info { border-left: 4px solid var(--accent); }

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Documentation & User Guide Portal */
.doc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.doc-chapter-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.doc-p {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.65;
    margin-bottom: 12px;
}
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin: 14px 0;
}
.doc-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.doc-box-title {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.doc-box-desc {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.5;
}
.doc-callout {
    background: rgba(59, 130, 246, 0.08);
    border-left: 4px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 12.5px;
    color: var(--text);
    line-height: 1.55;
    margin: 14px 0;
}
.doc-callout.warning {
    background: rgba(234, 179, 8, 0.08);
    border-left-color: var(--yellow);
}
.doc-callout.success {
    background: rgba(34, 197, 94, 0.08);
    border-left-color: var(--green);
}

/* ==========================================================================
   CLIENT AUTHENTICATION GATE (LOGIN SCREEN)
   ========================================================================== */
#client-login-screen {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 36px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
}
.login-input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    background: var(--surface2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.login-input:focus { border-color: var(--accent) !important; }
.login-btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.login-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 16px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 12px; }
}