/* ================================================================
   CommandCenter — Design System
   Enterprise-grade, mobile-first, dark theme
   ================================================================ */

/* ---- Design Tokens ---- */
:root {
    /* Color Palette */
    --c-bg-0: #09090b;          /* deepest background */
    --c-bg-1: #111114;          /* page background */
    --c-bg-2: #18181b;          /* card background */
    --c-bg-3: #1f1f23;          /* elevated surface */
    --c-bg-hover: #27272a;      /* hover state */
    --c-bg-active: #2d2d31;     /* active/pressed */
    --c-bg-input: #111114;      /* input background */

    --c-border: #27272a;        /* default border */
    --c-border-light: #1f1f23;  /* subtle border */
    --c-border-focus: #3b82f6;  /* focus ring */

    --c-text-0: #fafafa;        /* primary text */
    --c-text-1: #a1a1aa;        /* secondary text */
    --c-text-2: #71717a;        /* muted text */
    --c-text-3: #52525b;        /* disabled text */

    --c-accent: #3b82f6;        /* primary accent */
    --c-accent-hover: #2563eb;
    --c-accent-muted: rgba(59, 130, 246, 0.12);
    --c-success: #22c55e;
    --c-success-muted: rgba(34, 197, 94, 0.12);
    --c-warning: #f59e0b;
    --c-warning-muted: rgba(245, 158, 11, 0.12);
    --c-danger: #ef4444;
    --c-danger-muted: rgba(239, 68, 68, 0.12);

    /* Platform Colors */
    --c-telegram: #0088cc;
    --c-tiktok: #ff0050;
    --c-instagram: #e4405f;
    --c-website: #8b5cf6;

    /* Spacing (4px base) */
    --s-1: 0.25rem;   /* 4px */
    --s-2: 0.5rem;    /* 8px */
    --s-3: 0.75rem;   /* 12px */
    --s-4: 1rem;      /* 16px */
    --s-5: 1.25rem;   /* 20px */
    --s-6: 1.5rem;    /* 24px */
    --s-8: 2rem;      /* 32px */
    --s-10: 2.5rem;   /* 40px */
    --s-12: 3rem;     /* 48px */

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fs-xs: 0.6875rem;   /* 11px */
    --fs-sm: 0.75rem;     /* 12px */
    --fs-base: 0.8125rem; /* 13px */
    --fs-md: 0.875rem;    /* 14px */
    --fs-lg: 1rem;        /* 16px */
    --fs-xl: 1.125rem;    /* 18px */
    --fs-2xl: 1.375rem;   /* 22px */
    --fs-3xl: 1.75rem;    /* 28px */
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --lh-tight: 1.2;
    --lh-base: 1.5;

    /* Radius */
    --r-sm: 0.375rem;   /* 6px */
    --r-md: 0.5rem;     /* 8px */
    --r-lg: 0.75rem;    /* 12px */
    --r-xl: 1rem;       /* 16px */
    --r-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    /* Transitions */
    --transition: 150ms ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: var(--fs-base);
    font-weight: var(--fw-regular);
    line-height: var(--lh-base);
    color: var(--c-text-0);
    background: var(--c-bg-1);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-2); }

[x-cloak] { display: none !important; }

/* ---- Typography ---- */
h1 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
h3 { font-size: var(--fs-base); font-weight: var(--fw-medium); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-md { font-size: var(--fs-md); }
.text-lg { font-size: var(--fs-lg); }
.text-2xl { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.text-3xl { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.text-muted { color: var(--c-text-2); }
.text-secondary { color: var(--c-text-1); }
.text-success { color: var(--c-success); }
.text-danger { color: var(--c-danger); }
.text-warning { color: var(--c-warning); }
.font-medium { font-weight: var(--fw-medium); }
.font-semibold { font-weight: var(--fw-semibold); }
.font-bold { font-weight: var(--fw-bold); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-through { text-decoration: line-through; opacity: 0.5; }

/* ---- Layout ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.self-center { align-self: center; }
.whitespace-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Grid */
.grid { display: grid; gap: var(--s-3); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .md-grid-1 { grid-template-columns: 1fr; }
}

/* Spacing */
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-5 { margin-bottom: var(--s-5); }
.mb-6 { margin-bottom: var(--s-6); }
.mb-8 { margin-bottom: var(--s-8); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.ml-2 { margin-left: var(--s-2); }
.p-3 { padding: var(--s-3); }
.p-4 { padding: var(--s-4); }
.p-5 { padding: var(--s-5); }
.py-2 { padding-top: var(--s-2); padding-bottom: var(--s-2); }
.py-4 { padding-top: var(--s-4); padding-bottom: var(--s-4); }
.py-8 { padding-top: var(--s-8); padding-bottom: var(--s-8); }
.py-12 { padding-top: var(--s-12); padding-bottom: var(--s-12); }
.px-3 { padding-left: var(--s-3); padding-right: var(--s-3); }
.px-4 { padding-left: var(--s-4); padding-right: var(--s-4); }
.space-y-1 > * + * { margin-top: var(--s-1); }
.space-y-2 > * + * { margin-top: var(--s-2); }
.space-y-3 > * + * { margin-top: var(--s-3); }

/* ---- Card ---- */
.card {
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: var(--s-5);
}
.card-sm {
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: var(--s-4);
}
.card-interactive {
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.card-interactive:hover {
    border-color: var(--c-text-2);
    background: var(--c-bg-3);
}

/* ---- Summary Stat Card ---- */
.stat-card {
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: var(--s-4) var(--s-5);
}
.stat-card .stat-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--s-1);
}
.stat-card .stat-value {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    letter-spacing: -0.02em;
    line-height: var(--lh-tight);
}
.stat-card .stat-delta {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    margin-top: 2px;
}
.delta-up { color: var(--c-success); }
.delta-down { color: var(--c-danger); }

/* ---- Inputs ---- */
input[type="text"], input[type="password"], input[type="email"],
input[type="url"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="file"],
select, textarea {
    width: 100%;
    background: var(--c-bg-input);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-text-0);
    font-family: var(--font);
    font-size: var(--fs-base);
    padding: var(--s-2) var(--s-3);
    line-height: var(--lh-base);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--c-border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
input::placeholder, textarea::placeholder { color: var(--c-text-3); }
textarea { resize: vertical; min-height: 4rem; }
select { cursor: pointer; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1;
    padding: var(--s-2) var(--s-4);
    border-radius: var(--r-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
}
.btn-primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }

.btn-secondary {
    background: var(--c-bg-3);
    color: var(--c-text-0);
    border-color: var(--c-border);
}
.btn-secondary:hover { background: var(--c-bg-hover); border-color: var(--c-text-2); }

.btn-ghost {
    background: transparent;
    color: var(--c-text-1);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--c-bg-hover); color: var(--c-text-0); }

.btn-danger {
    background: var(--c-danger-muted);
    color: var(--c-danger);
    border-color: transparent;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-sm {
    font-size: var(--fs-xs);
    padding: 5px var(--s-3);
    border-radius: var(--r-sm);
}

.btn-icon {
    padding: var(--s-2);
    border-radius: var(--r-md);
}

/* Toggle Button (replaces checkboxes) */
.toggle-group {
    display: inline-flex;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.toggle-btn {
    font-family: var(--font);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    padding: 5px var(--s-3);
    background: var(--c-bg-2);
    color: var(--c-text-2);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}
.toggle-btn:hover { color: var(--c-text-0); background: var(--c-bg-3); }
.toggle-btn.active {
    background: var(--c-accent);
    color: #fff;
}
.toggle-btn + .toggle-btn { border-left: 1px solid var(--c-border); }

/* Pill toggle (on/off) */
.pill-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    cursor: pointer;
    font-size: var(--fs-sm);
    color: var(--c-text-1);
}
.pill-toggle-track {
    width: 2.25rem;
    height: 1.25rem;
    background: var(--c-bg-hover);
    border: 1px solid var(--c-border);
    border-radius: var(--r-full);
    position: relative;
    transition: all var(--transition);
}
.pill-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 0.875rem;
    height: 0.875rem;
    background: var(--c-text-2);
    border-radius: 50%;
    transition: all var(--transition);
}
.pill-toggle.on .pill-toggle-track {
    background: var(--c-accent);
    border-color: var(--c-accent);
}
.pill-toggle.on .pill-toggle-track::after {
    left: calc(100% - 1rem);
    background: #fff;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--s-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    line-height: 1.4;
    white-space: nowrap;
}
.badge-telegram { background: rgba(0,136,204,0.15); color: var(--c-telegram); }
.badge-tiktok { background: rgba(255,0,80,0.15); color: var(--c-tiktok); }
.badge-instagram { background: rgba(228,64,95,0.15); color: var(--c-instagram); }
.badge-website { background: rgba(139,92,246,0.15); color: var(--c-website); }

.badge-completed, .badge-success { background: var(--c-success-muted); color: var(--c-success); }
.badge-refunded, .badge-danger { background: var(--c-danger-muted); color: var(--c-danger); }
.badge-pending, .badge-warning { background: var(--c-warning-muted); color: var(--c-warning); }

.badge-urgent { background: var(--c-danger-muted); color: #fca5a5; }
.badge-high { background: var(--c-warning-muted); color: #fcd34d; }
.badge-medium { background: var(--c-accent-muted); color: #93c5fd; }
.badge-low { background: rgba(113,113,122,0.15); color: var(--c-text-2); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th {
    text-align: left;
    padding: var(--s-2) var(--s-3);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--c-border);
}
td {
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--c-border-light);
    color: var(--c-text-1);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.015); }

/* ---- Sidebar (Desktop) ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 13rem;
    background: var(--c-bg-0);
    border-right: 1px solid var(--c-border);
    padding: var(--s-5) var(--s-3);
    display: none;
    flex-direction: column;
    z-index: 30;
}
@media (min-width: 768px) { .sidebar { display: flex; } }

.sidebar-logo {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    color: var(--c-accent);
    padding: 0 var(--s-3);
    margin-bottom: var(--s-6);
    letter-spacing: -0.02em;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer {
    border-top: 1px solid var(--c-border);
    padding-top: var(--s-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-text-2);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
}
.nav-item:hover { background: var(--c-bg-hover); color: var(--c-text-0); }
.nav-item.active { background: var(--c-accent-muted); color: var(--c-accent); }
.nav-item svg, .nav-item i { width: 16px; height: 16px; flex-shrink: 0; }

/* ---- Mobile Bottom Nav ---- */
.mobile-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--c-bg-0);
    border-top: 1px solid var(--c-border);
    display: flex;
    justify-content: space-around;
    padding: var(--s-1) 0 calc(var(--s-1) + env(safe-area-inset-bottom));
    z-index: 30;
}
@media (min-width: 768px) { .mobile-nav { display: none; } }

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--s-1) var(--s-2);
    font-size: 10px;
    font-weight: var(--fw-medium);
    color: var(--c-text-3);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition);
}
.mobile-nav-item:hover, .mobile-nav-item.active { color: var(--c-accent); }
.mobile-nav-item svg { width: 20px; height: 20px; }

/* ---- Main Content ---- */
.main-content {
    padding: var(--s-5);
    padding-bottom: calc(var(--s-12) + env(safe-area-inset-bottom));
}
@media (min-width: 768px) {
    .main-content {
        margin-left: 13rem;
        padding: var(--s-6) var(--s-8);
        padding-bottom: var(--s-6);
    }
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s-6);
}
.page-header h1 { margin: 0; }

/* ---- Modal / Drawer ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: var(--s-4);
}
@media (min-width: 640px) {
    .modal-backdrop { align-items: center; }
}
.modal {
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--s-6);
    box-shadow: var(--shadow-lg);
}
@media (min-width: 640px) {
    .modal {
        border-radius: var(--r-xl);
        max-width: 28rem;
    }
}
.modal-wide {
    max-width: 40rem;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s-5);
}
.modal-header h2 { font-size: var(--fs-lg); }
.modal-close {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    border: none;
    background: transparent;
    color: var(--c-text-2);
    font-size: var(--fs-lg);
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.modal-close:hover { background: var(--c-bg-hover); color: var(--c-text-0); }

/* ---- Form ---- */
.form-stack { display: flex; flex-direction: column; gap: var(--s-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.form-label {
    display: block;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-text-2);
    margin-bottom: var(--s-1);
}
.form-actions {
    display: flex;
    gap: var(--s-2);
    padding-top: var(--s-2);
}

/* ---- FAB ---- */
.fab {
    position: fixed;
    bottom: calc(var(--s-12) + var(--s-4) + env(safe-area-inset-bottom));
    right: var(--s-5);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--c-accent);
    color: #fff;
    border: none;
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition), background var(--transition);
}
@media (min-width: 768px) {
    .fab { bottom: var(--s-6); right: var(--s-6); }
}
.fab:hover { transform: scale(1.08); background: var(--c-accent-hover); }

.fab-menu {
    position: fixed;
    bottom: calc(var(--s-12) + var(--s-4) + 3.5rem + env(safe-area-inset-bottom));
    right: var(--s-5);
    z-index: 39;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    align-items: flex-end;
}
@media (min-width: 768px) {
    .fab-menu { bottom: calc(var(--s-6) + 3.5rem); right: var(--s-6); }
}
.fab-item {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-2) var(--s-4);
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-text-0);
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}
.fab-item:hover { background: var(--c-bg-3); border-color: var(--c-text-2); }

/* ---- Kanban ---- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-3);
}
@media (max-width: 768px) { .kanban-board { grid-template-columns: 1fr; } }

.kanban-column {
    background: var(--c-bg-1);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: var(--s-3);
    min-height: 12rem;
}
.kanban-column-header {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 var(--s-1);
    margin-bottom: var(--s-3);
}

.kanban-card {
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: var(--s-3);
    margin-bottom: var(--s-2);
    cursor: grab;
    transition: all var(--transition);
}
.kanban-card:hover { border-color: var(--c-text-2); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.done { opacity: 0.5; }

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: var(--s-4);
    right: var(--s-4);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.toast {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    min-width: 12rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.25s ease;
}
.toast-success { background: #14532d; color: #bbf7d0; border: 1px solid #166534; }
.toast-error { background: #7f1d1d; color: #fecaca; border: 1px solid #991b1b; }
.toast-info { background: #1e3a5f; color: #bfdbfe; border: 1px solid #1e40af; }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Spinner ---- */
.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--c-border);
    border-top-color: var(--c-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-sm { width: 0.875rem; height: 0.875rem; border-width: 1.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Offline Banner ---- */
.offline-banner {
    background: var(--c-warning);
    color: #000;
    text-align: center;
    padding: var(--s-1) var(--s-4);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
}

/* ---- Chart Containers ---- */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { width: 100% !important; }

/* ---- Markdown Content ---- */
.markdown-content { color: var(--c-text-1); font-size: var(--fs-sm); line-height: 1.7; }
.markdown-content h1 { font-size: var(--fs-lg); margin: var(--s-5) 0 var(--s-3); color: var(--c-text-0); }
.markdown-content h2 { font-size: var(--fs-md); margin: var(--s-4) 0 var(--s-2); color: var(--c-accent); }
.markdown-content h3 { font-size: var(--fs-base); margin: var(--s-3) 0 var(--s-2); color: var(--c-text-0); }
.markdown-content p { margin: var(--s-2) 0; }
.markdown-content ul, .markdown-content ol { padding-left: var(--s-5); margin: var(--s-2) 0; }
.markdown-content li { margin: var(--s-1) 0; }
.markdown-content code {
    background: var(--c-bg-0);
    padding: 1px var(--s-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
}
.markdown-content pre {
    background: var(--c-bg-0);
    padding: var(--s-4);
    border-radius: var(--r-md);
    overflow-x: auto;
    margin: var(--s-3) 0;
}
.markdown-content strong { color: var(--c-text-0); }

/* ---- Section Label ---- */
.section-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--c-text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--s-3);
}

/* ---- Item Row (generic list item) ---- */
.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s-3);
    border-radius: var(--r-md);
    transition: background var(--transition);
}
.item-row:hover { background: rgba(255,255,255,0.02); }

/* ---- Heatmap ---- */
.heatmap-cell {
    width: 2rem;
    height: 2rem;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--c-text-2);
}

/* ---- Login ---- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-4);
}
.login-card {
    background: var(--c-bg-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    padding: var(--s-8);
    width: 100%;
    max-width: 22rem;
    text-align: center;
}
.login-logo {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--c-accent);
    margin-bottom: var(--s-1);
    letter-spacing: -0.02em;
}
.login-subtitle {
    font-size: var(--fs-sm);
    color: var(--c-text-2);
    margin-bottom: var(--s-6);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--s-12) var(--s-4);
    color: var(--c-text-2);
    font-size: var(--fs-sm);
}

/* ---- Loading ---- */
.loading-center {
    display: flex;
    justify-content: center;
    padding: var(--s-12) 0;
}

/* ---- Period Selector ---- */
.period-selector {
    display: inline-flex;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.period-btn {
    font-family: var(--font);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    padding: 5px var(--s-3);
    background: transparent;
    color: var(--c-text-2);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}
.period-btn:hover { color: var(--c-text-0); background: var(--c-bg-3); }
.period-btn.active { background: var(--c-accent); color: #fff; }
.period-btn + .period-btn { border-left: 1px solid var(--c-border); }

/* ---- Funnel ---- */
.funnel-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-4);
    flex-wrap: wrap;
}
.funnel-step { text-align: center; }
.funnel-value {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
}
.funnel-label {
    font-size: var(--fs-xs);
    color: var(--c-text-2);
    margin-top: 2px;
}
.funnel-arrow {
    font-size: var(--fs-lg);
    color: var(--c-text-3);
}

/* ---- Scrollable Container ---- */
.scroll-y {
    overflow-y: auto;
    max-height: 15rem;
}
.scroll-y-lg {
    overflow-y: auto;
    max-height: 25rem;
}
