/* ============================================================
   ANALYTICS PLATFORM — style.css
   Aesthetic: Industrial dark, data-forward, amber accents
   Fonts: Sora (UI) + IBM Plex Mono (data/code)
   ============================================================ */

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

   /* ── CSS Variables ──────────────────────────────────────── */
   :root {
       --bg-base:       #0d0f14;
       --bg-surface:    #13161e;
       --bg-elevated:   #1a1e2a;
       --bg-hover:      #202433;
   
       --border:        #252a38;
       --border-light:  #2e3447;
   
       --amber:         #f5a623;
       --amber-dim:     #c4821a;
       --amber-glow:    rgba(245, 166, 35, 0.15);
   
       --text-primary:  #e8eaf0;
       --text-secondary:#8b92a8;
       --text-muted:    #4e5568;
   
       --green:         #3ecf8e;
       --red:           #e05c5c;
       --blue:          #4a9eff;
   
       --font-ui:       'Sora', sans-serif;
       --font-mono:     'IBM Plex Mono', monospace;
   
       --radius-sm:     4px;
       --radius-md:     8px;
       --radius-lg:     12px;
   
       --shadow-card:   0 2px 16px rgba(0,0,0,0.4);
       --shadow-elevated: 0 8px 32px rgba(0,0,0,0.5);
   
       --nav-width:     220px;
       --transition:    0.18s ease;
   }
   
   /* ── Reset & Base ───────────────────────────────────────── */
   *, *::before, *::after {
       box-sizing: border-box;
       margin: 0;
       padding: 0;
   }
   
   html { font-size: 15px; scroll-behavior: smooth; }
   
   body {
       font-family: var(--font-ui);
       background: var(--bg-base);
       color: var(--text-primary);
       line-height: 1.6;
       min-height: 100vh;
       -webkit-font-smoothing: antialiased;
   }
   
   a {
       color: var(--amber);
       text-decoration: none;
       transition: opacity var(--transition);
   }
   a:hover { opacity: 0.8; }
   
   /* ── Layout: App Shell ──────────────────────────────────── */
   .app-shell {
       display: flex;
       min-height: 100vh;
   }
   
   .main-content {
       flex: 1;
       margin-left: var(--nav-width);
       display: flex;
       flex-direction: column;
       min-height: 100vh;
       max-width: 100%;
       overflow-x: hidden;
   }
   
   .page-body {
       flex: 1;
       padding: 2rem 2.5rem;
   }
   
   /* ── Sidebar Navigation ─────────────────────────────────── */
   .sidebar {
       width: var(--nav-width);
       background: var(--bg-surface);
       border-right: 1px solid var(--border);
       position: fixed;
       top: 0; left: 0;
       height: 100vh;
       display: flex;
       flex-direction: column;
       z-index: 100;
       overflow-y: auto;
   }
   
   .sidebar-logo {
       padding: 1.5rem 1.25rem 1.25rem;
       border-bottom: 1px solid var(--border);
   }
   
   .sidebar-logo .logo-mark {
       font-family: var(--font-mono);
       font-size: 0.7rem;
       font-weight: 600;
       color: var(--amber);
       letter-spacing: 0.12em;
       text-transform: uppercase;
       display: block;
       margin-bottom: 0.2rem;
   }
   
   .sidebar-logo .logo-name {
       font-size: 1rem;
       font-weight: 700;
       color: var(--text-primary);
       letter-spacing: -0.02em;
   }
   
   .sidebar-section {
       padding: 1.25rem 0 0.5rem;
   }
   
   .sidebar-section-label {
       font-family: var(--font-mono);
       font-size: 0.62rem;
       font-weight: 600;
       letter-spacing: 0.14em;
       text-transform: uppercase;
       color: var(--text-muted);
       padding: 0 1.25rem 0.5rem;
       display: block;
   }
   
   .nav-item {
       display: flex;
       align-items: center;
       gap: 0.65rem;
       padding: 0.55rem 1.25rem;
       color: var(--text-secondary);
       font-size: 0.85rem;
       font-weight: 500;
       transition: all var(--transition);
       border-left: 2px solid transparent;
       cursor: pointer;
   }
   
   .nav-item:hover {
       background: var(--bg-hover);
       color: var(--text-primary);
       border-left-color: var(--border-light);
   }
   
   .nav-item.active {
       background: var(--amber-glow);
       color: var(--amber);
       border-left-color: var(--amber);
   }
   
   .nav-item .nav-icon {
       width: 16px;
       height: 16px;
       opacity: 0.7;
       flex-shrink: 0;
   }
   
   .nav-item.active .nav-icon { opacity: 1; }
   
   .sidebar-footer {
       margin-top: auto;
       padding: 1rem 1.25rem;
       border-top: 1px solid var(--border);
   }
   
   .sidebar-user {
       display: flex;
       align-items: center;
       gap: 0.65rem;
   }
   
   .user-avatar {
       width: 30px; height: 30px;
       border-radius: 50%;
       background: var(--amber-glow);
       border: 1px solid var(--amber-dim);
       display: flex; align-items: center; justify-content: center;
       font-family: var(--font-mono);
       font-size: 0.65rem;
       font-weight: 600;
       color: var(--amber);
       flex-shrink: 0;
   }
   
   .user-info { flex: 1; min-width: 0; }
   
   .user-name {
       font-size: 0.8rem;
       font-weight: 600;
       color: var(--text-primary);
       white-space: nowrap;
       overflow: hidden;
       text-overflow: ellipsis;
   }
   
   .user-role {
       font-family: var(--font-mono);
       font-size: 0.6rem;
       color: var(--text-muted);
       text-transform: uppercase;
       letter-spacing: 0.08em;
   }
   
   .logout-btn {
       color: var(--text-muted);
       font-size: 0.75rem;
       transition: color var(--transition);
       white-space: nowrap;
   }
   .logout-btn:hover { color: var(--red); opacity: 1; }
   
   /* ── Top Bar ────────────────────────────────────────────── */
   .topbar {
       background: var(--bg-surface);
       border-bottom: 1px solid var(--border);
       padding: 0.9rem 2.5rem;
       display: flex;
       align-items: center;
       justify-content: space-between;
       position: sticky;
       top: 0;
       z-index: 50;
   }
   
   .page-title {
       font-size: 1.05rem;
       font-weight: 700;
       color: var(--text-primary);
       letter-spacing: -0.02em;
   }
   
   .page-breadcrumb {
       font-family: var(--font-mono);
       font-size: 0.65rem;
       color: var(--text-muted);
       margin-top: 0.1rem;
       letter-spacing: 0.05em;
   }
   
   .topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
   
   /* ── Cards ──────────────────────────────────────────────── */
   .card {
       background: var(--bg-surface);
       border: 1px solid var(--border);
       border-radius: var(--radius-lg);
       padding: 1.5rem;
       box-shadow: var(--shadow-card);
   }
   
   .card-header {
       display: flex;
       align-items: flex-start;
       justify-content: space-between;
       margin-bottom: 1.25rem;
       gap: 1rem;
   }
   
   .card-title {
       font-size: 0.85rem;
       font-weight: 600;
       color: var(--text-primary);
       letter-spacing: -0.01em;
   }
   
   .card-subtitle {
       font-family: var(--font-mono);
       font-size: 0.65rem;
       color: var(--text-muted);
       margin-top: 0.15rem;
   }
   
   /* ── Stat Cards ─────────────────────────────────────────── */
   .stats-grid {
       display: grid;
       grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
       gap: 1rem;
       margin-bottom: 2rem;
   }
   
   .stat-card {
       background: var(--bg-surface);
       border: 1px solid var(--border);
       border-radius: var(--radius-lg);
       padding: 1.25rem 1.5rem;
       position: relative;
       overflow: hidden;
       transition: border-color var(--transition);
   }
   
   .stat-card::before {
       content: '';
       position: absolute;
       top: 0; left: 0; right: 0;
       height: 2px;
       background: linear-gradient(90deg, var(--amber), transparent);
       opacity: 0;
       transition: opacity var(--transition);
   }
   
   .stat-card:hover { border-color: var(--border-light); }
   .stat-card:hover::before { opacity: 1; }
   
   .stat-label {
       font-family: var(--font-mono);
       font-size: 0.62rem;
       font-weight: 600;
       letter-spacing: 0.12em;
       text-transform: uppercase;
       color: var(--text-muted);
       margin-bottom: 0.5rem;
   }
   
   .stat-value {
       font-family: var(--font-mono);
       font-size: 1.75rem;
       font-weight: 600;
       color: var(--text-primary);
       line-height: 1;
       letter-spacing: -0.03em;
   }
   
   .stat-delta {
       font-family: var(--font-mono);
       font-size: 0.65rem;
       margin-top: 0.4rem;
       display: flex;
       align-items: center;
       gap: 0.3rem;
   }
   
   .stat-delta.up { color: var(--green); }
   .stat-delta.down { color: var(--red); }
   
   /* ── Grid Layouts ───────────────────────────────────────── */
   .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
   .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
   .grid-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: 1.25rem; }
   
   /* ── Tables ─────────────────────────────────────────────── */
   .data-table-wrap {
       overflow-x: auto;
       border-radius: var(--radius-md);
   }
   
   .data-table {
       width: 100%;
       border-collapse: collapse;
       font-size: 0.82rem;
   }
   
   .data-table thead th {
       font-family: var(--font-mono);
       font-size: 0.62rem;
       font-weight: 600;
       letter-spacing: 0.1em;
       text-transform: uppercase;
       color: var(--text-muted);
       padding: 0.65rem 1rem;
       text-align: left;
       border-bottom: 1px solid var(--border);
       white-space: nowrap;
   }
   
   .data-table tbody tr {
       border-bottom: 1px solid var(--border);
       transition: background var(--transition);
   }
   
   .data-table tbody tr:last-child { border-bottom: none; }
   .data-table tbody tr:hover { background: var(--bg-hover); }
   
   .data-table tbody td {
       padding: 0.7rem 1rem;
       color: var(--text-primary);
       vertical-align: middle;
   }
   
   .data-table .mono {
       font-family: var(--font-mono);
       font-size: 0.78rem;
   }
   
   /* ── Badges & Tags ──────────────────────────────────────── */
   .badge {
       display: inline-flex;
       align-items: center;
       padding: 0.2rem 0.55rem;
       border-radius: 100px;
       font-family: var(--font-mono);
       font-size: 0.6rem;
       font-weight: 600;
       letter-spacing: 0.07em;
       text-transform: uppercase;
   }
   
   .badge-amber  { background: var(--amber-glow); color: var(--amber); border: 1px solid var(--amber-dim); }
   .badge-green  { background: rgba(62,207,142,0.12); color: var(--green); border: 1px solid rgba(62,207,142,0.3); }
   .badge-red    { background: rgba(224,92,92,0.12);  color: var(--red);   border: 1px solid rgba(224,92,92,0.3); }
   .badge-blue   { background: rgba(74,158,255,0.12); color: var(--blue);  border: 1px solid rgba(74,158,255,0.3); }
   .badge-muted  { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
   
   /* ── Buttons ────────────────────────────────────────────── */
   .btn {
       display: inline-flex;
       align-items: center;
       gap: 0.45rem;
       padding: 0.55rem 1.1rem;
       border-radius: var(--radius-md);
       font-family: var(--font-ui);
       font-size: 0.82rem;
       font-weight: 600;
       cursor: pointer;
       border: none;
       transition: all var(--transition);
       white-space: nowrap;
       text-decoration: none;
   }
   
   .btn-primary {
       background: var(--amber);
       color: #0d0f14;
   }
   .btn-primary:hover {
       background: #fdb740;
       opacity: 1;
       transform: translateY(-1px);
       box-shadow: 0 4px 16px rgba(245,166,35,0.35);
   }
   
   .btn-secondary {
       background: var(--bg-elevated);
       color: var(--text-primary);
       border: 1px solid var(--border-light);
   }
   .btn-secondary:hover {
       background: var(--bg-hover);
       opacity: 1;
       border-color: var(--text-muted);
   }
   
   .btn-danger {
       background: rgba(224,92,92,0.15);
       color: var(--red);
       border: 1px solid rgba(224,92,92,0.3);
   }
   .btn-danger:hover {
       background: rgba(224,92,92,0.25);
       opacity: 1;
   }
   
   .btn-ghost {
       background: transparent;
       color: var(--text-secondary);
       border: 1px solid var(--border);
   }
   .btn-ghost:hover {
       color: var(--text-primary);
       background: var(--bg-elevated);
       opacity: 1;
   }
   
   .btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
   .btn-lg { padding: 0.75rem 1.5rem; font-size: 0.9rem; }
   
   /* ── Forms ──────────────────────────────────────────────── */
   .form-group { margin-bottom: 1.25rem; }
   
   .form-label {
       display: block;
       font-family: var(--font-mono);
       font-size: 0.65rem;
       font-weight: 600;
       letter-spacing: 0.1em;
       text-transform: uppercase;
       color: var(--text-muted);
       margin-bottom: 0.45rem;
   }
   
   .form-input,
   .form-select,
   .form-textarea {
       width: 100%;
       background: var(--bg-base);
       border: 1px solid var(--border-light);
       border-radius: var(--radius-md);
       padding: 0.65rem 0.9rem;
       font-family: var(--font-ui);
       font-size: 0.85rem;
       color: var(--text-primary);
       transition: border-color var(--transition), box-shadow var(--transition);
       outline: none;
   }
   
   .form-input::placeholder,
   .form-textarea::placeholder { color: var(--text-muted); }
   
   .form-input:focus,
   .form-select:focus,
   .form-textarea:focus {
       border-color: var(--amber-dim);
       box-shadow: 0 0 0 3px var(--amber-glow);
   }
   
   .form-select { cursor: pointer; }
   .form-select option { background: var(--bg-elevated); }
   
   .form-textarea { resize: vertical; min-height: 100px; }
   
   .form-hint {
       font-size: 0.72rem;
       color: var(--text-muted);
       margin-top: 0.35rem;
   }
   
   .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
   
   /* ── Checkboxes ─────────────────────────────────────────── */
   .checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; }
   
   .checkbox-item {
       display: flex;
       align-items: center;
       gap: 0.6rem;
       cursor: pointer;
       font-size: 0.85rem;
       color: var(--text-secondary);
       transition: color var(--transition);
   }
   
   .checkbox-item:hover { color: var(--text-primary); }
   
   .checkbox-item input[type="checkbox"] {
       width: 15px; height: 15px;
       accent-color: var(--amber);
       cursor: pointer;
   }
   
   /* ── Login Page ─────────────────────────────────────────── */
   .login-page {
       min-height: 100vh;
       display: flex;
       align-items: center;
       justify-content: center;
       background: var(--bg-base);
       position: relative;
       overflow: hidden;
   }
   
   .login-page::before {
       content: '';
       position: absolute;
       width: 600px; height: 600px;
       background: radial-gradient(circle, rgba(245,166,35,0.06) 0%, transparent 70%);
       top: 50%; left: 50%;
       transform: translate(-50%, -50%);
       pointer-events: none;
   }
   
   .login-box {
       width: 100%;
       max-width: 380px;
       background: var(--bg-surface);
       border: 1px solid var(--border);
       border-radius: var(--radius-lg);
       padding: 2.5rem;
       box-shadow: var(--shadow-elevated);
       position: relative;
       z-index: 1;
   }
   
   .login-header { text-align: center; margin-bottom: 2rem; }
   
   .login-logo-mark {
       font-family: var(--font-mono);
       font-size: 0.65rem;
       letter-spacing: 0.2em;
       text-transform: uppercase;
       color: var(--amber);
       margin-bottom: 0.75rem;
       display: block;
   }
   
   .login-title {
       font-size: 1.3rem;
       font-weight: 700;
       color: var(--text-primary);
       letter-spacing: -0.03em;
   }
   
   .login-subtitle {
       font-size: 0.8rem;
       color: var(--text-muted);
       margin-top: 0.3rem;
   }
   
   /* ── Alerts / Flash Messages ────────────────────────────── */
   .alert {
       padding: 0.8rem 1rem;
       border-radius: var(--radius-md);
       font-size: 0.82rem;
       margin-bottom: 1.25rem;
       border-left: 3px solid;
       display: flex;
       align-items: flex-start;
       gap: 0.6rem;
   }
   
   .alert-error   { background: rgba(224,92,92,0.1);  border-color: var(--red);   color: #f09090; }
   .alert-success { background: rgba(62,207,142,0.1); border-color: var(--green); color: #78dbb0; }
   .alert-info    { background: rgba(74,158,255,0.1); border-color: var(--blue);  color: #85bcff; }
   .alert-warning { background: var(--amber-glow);    border-color: var(--amber); color: var(--amber); }
   
   /* ── Error Pages ────────────────────────────────────────── */
   .error-page {
       min-height: 100vh;
       display: flex;
       align-items: center;
       justify-content: center;
       text-align: center;
       padding: 2rem;
       flex-direction: column;
       gap: 1rem;
   }
   
   .error-code {
       font-family: var(--font-mono);
       font-size: 5rem;
       font-weight: 600;
       color: var(--border-light);
       line-height: 1;
       letter-spacing: -0.05em;
   }
   
   .error-title {
       font-size: 1.2rem;
       font-weight: 600;
       color: var(--text-primary);
   }
   
   .error-msg {
       font-size: 0.85rem;
       color: var(--text-muted);
       max-width: 360px;
   }
   
   /* ── User Management Table ──────────────────────────────── */
   .role-super_admin { color: var(--amber); }
   .role-analyst     { color: var(--blue); }
   .role-viewer      { color: var(--green); }
   
   /* ── Section Pills (for analyst access) ─────────────────── */
   .section-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
   
   .section-pill {
       font-family: var(--font-mono);
       font-size: 0.6rem;
       padding: 0.15rem 0.5rem;
       border-radius: 100px;
       background: var(--bg-elevated);
       color: var(--text-secondary);
       border: 1px solid var(--border-light);
       text-transform: uppercase;
       letter-spacing: 0.07em;
   }
   
   /* ── Dashboard Header ───────────────────────────────────── */
   .dashboard-greeting {
       margin-bottom: 1.75rem;
   }
   
   .dashboard-greeting h1 {
       font-size: 1.4rem;
       font-weight: 700;
       color: var(--text-primary);
       letter-spacing: -0.03em;
   }
   
   .dashboard-greeting p {
       font-size: 0.82rem;
       color: var(--text-muted);
       margin-top: 0.2rem;
       font-family: var(--font-mono);
   }
   
   /* ── Report Sections ────────────────────────────────────── */
   .section-nav {
       display: flex;
       gap: 0.5rem;
       margin-bottom: 1.5rem;
       border-bottom: 1px solid var(--border);
       padding-bottom: 0;
       overflow-x: auto;
   }
   
   .section-tab {
       padding: 0.6rem 1rem;
       font-size: 0.8rem;
       font-weight: 600;
       color: var(--text-muted);
       border-bottom: 2px solid transparent;
       cursor: pointer;
       transition: all var(--transition);
       white-space: nowrap;
       text-decoration: none;
       display: inline-block;
       margin-bottom: -1px;
   }
   
   .section-tab:hover { color: var(--text-primary); opacity: 1; }
   .section-tab.active { color: var(--amber); border-bottom-color: var(--amber); }
   
   /* ── Divider ────────────────────────────────────────────── */
   .divider {
       border: none;
       border-top: 1px solid var(--border);
       margin: 1.5rem 0;
   }
   
   /* ── Utilities ──────────────────────────────────────────── */
   .text-mono    { font-family: var(--font-mono); }
   .text-muted   { color: var(--text-muted); }
   .text-amber   { color: var(--amber); }
   .text-green   { color: var(--green); }
   .text-red     { color: var(--red); }
   .text-right   { text-align: right; }
   .text-center  { text-align: center; }
   .text-sm      { font-size: 0.78rem; }
   .text-xs      { font-size: 0.68rem; }
   
   .flex         { display: flex; }
   .flex-center  { display: flex; align-items: center; }
   .flex-between { display: flex; align-items: center; justify-content: space-between; }
   .gap-sm       { gap: 0.5rem; }
   .gap-md       { gap: 1rem; }
   .gap-lg       { gap: 1.5rem; }
   .flex-wrap    { flex-wrap: wrap; }
   
   .mt-1  { margin-top: 0.5rem; }
   .mt-2  { margin-top: 1rem; }
   .mt-3  { margin-top: 1.5rem; }
   .mb-1  { margin-bottom: 0.5rem; }
   .mb-2  { margin-bottom: 1rem; }
   .mb-3  { margin-bottom: 1.5rem; }
   
   .w-full { width: 100%; }
   
   /* ── Responsive ─────────────────────────────────────────── */
   @media (max-width: 900px) {
       :root { --nav-width: 0px; }
   
       .sidebar {
           transform: translateX(-220px);
           transition: transform 0.25s ease;
       }
       .sidebar.open { transform: translateX(0); width: 220px; }
   
       .main-content { margin-left: 0; }
       .page-body { padding: 1.25rem 1rem; }
   
       .grid-2, .grid-3, .grid-3-1, .form-row {
           grid-template-columns: 1fr;
       }
   
       .topbar { padding: 0.9rem 1rem; }
   }
   
   /* ── Scrollbar ──────────────────────────────────────────── */
   ::-webkit-scrollbar { width: 6px; height: 6px; }
   ::-webkit-scrollbar-track { background: var(--bg-base); }
   ::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
   ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
   /* ── Print / PDF Export ─────────────────────────────────── */
    @media print {
        .sidebar, .topbar, .no-print { display: none !important; }
        .main-content { margin-left: 0 !important; }
        .page-body { padding: 0 !important; }
        body { background: #fff !important; color: #000 !important; }
        .card {
            background: #fff !important;
            border: 1px solid #ccc !important;
            box-shadow: none !important;
            break-inside: avoid;
        }
        .card-title, .stat-label, .stat-value { color: #000 !important; }
        .text-muted, .text-secondary { color: #555 !important; }
        .badge { border: 1px solid #999 !important; color: #333 !important; background: #eee !important; }
        .data-table thead th, .data-table tbody td { color: #000 !important; border-color: #ccc !important; }
        a { color: #000 !important; }
}