/* ============================================================
   B-Roll Admin Panel — Styles
   Premium dark theme with glassmorphism and micro-animations 
   ============================================================ */

/* ─── Reset & Foundation ─── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Core Palette */
    --bg-darkest: #0a0a12;
    --bg-dark: #0f0f1e;
    --bg-card: #151528;
    --bg-card-hover: #1a1a35;
    --bg-elevated: #1e1e3a;
    --bg-input: #12122580;

    /* Accent */
    --accent: #6c63ff;
    --accent-hover: #7b73ff;
    --accent-soft: rgba(108, 99, 255, 0.12);
    --accent-glow: rgba(108, 99, 255, 0.25);

    /* Status Colors */
    --success: #4caf50;
    --success-soft: rgba(76, 175, 80, 0.1);
    --warning: #ff9800;
    --warning-soft: rgba(255, 152, 0, 0.1);
    --danger: #f44336;
    --danger-soft: rgba(244, 67, 54, 0.1);
    --info: #29b6f6;
    --info-soft: rgba(41, 182, 246, 0.1);

    /* Text */
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a85;

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.15);
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-darkest);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 600px at 20% 30%, rgba(108, 99, 255, 0.08), transparent),
        radial-gradient(ellipse 500px 500px at 80% 70%, rgba(41, 182, 246, 0.06), transparent);
    animation: floatBg 15s ease-in-out infinite alternate;
}

@keyframes floatBg {
    0% { transform: scale(1) translate(0,0); }
    100% { transform: scale(1.05) translate(10px, -10px); }
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 48px 40px 36px;
    background: rgba(21, 21, 40, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

.login-logo-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.35);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #e8e8f0, #b0b0cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── Form Controls ─── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.login-error {
    padding: 10px 14px;
    background: var(--danger-soft);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.72rem;
    color: var(--text-muted);
}


/* ─── Buttons ─── */
.btn {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    padding: 11px 20px;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    box-shadow: 0 4px 14px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #9b8cff);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #66bb6a);
    color: white;
}

.btn-success:hover { opacity: 0.9; }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #e57373);
    color: white;
}

.btn-danger:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-hover);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-full { width: 100%; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}


/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-app {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--transition-slow), width var(--transition-slow);
}

.sidebar-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
}

.sidebar-logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.88rem;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.admin-details { overflow: hidden; }
.admin-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-role { font-size: 0.72rem; color: var(--text-muted); }

.btn-logout {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}

/* ─── Main Area ─── */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}

.topbar {
    height: 60px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 18, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-left h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
}

.server-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.server-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-normal);
}

.server-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.server-dot.offline { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.content-area {
    flex: 1;
    padding: 28px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}


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

.stat-card {
    padding: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.purple::before  { background: linear-gradient(90deg, var(--accent), #8b5cf6); }
.stat-card.green::before   { background: linear-gradient(90deg, var(--success), #66bb6a); }
.stat-card.orange::before  { background: linear-gradient(90deg, var(--warning), #ffb74d); }
.stat-card.blue::before    { background: linear-gradient(90deg, var(--info), #4fc3f7); }
.stat-card.red::before     { background: linear-gradient(90deg, var(--danger), #e57373); }

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}


/* ============================================================
   DATA TABLES
   ============================================================ */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.table-title {
    font-size: 1rem;
    font-weight: 600;
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.table-search {
    padding: 7px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    outline: none;
    transition: border var(--transition-fast);
    width: 200px;
}

.table-search:focus {
    border-color: var(--accent);
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

thead th {
    text-align: left;
    padding: 12px 18px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Badges ─── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-active   { background: var(--success-soft); color: var(--success); border: 1px solid rgba(76,175,80,0.2); }
.badge-inactive { background: var(--danger-soft);  color: var(--danger);  border: 1px solid rgba(244,67,54,0.2); }
.badge-admin    { background: var(--accent-soft);  color: var(--accent);  border: 1px solid rgba(108,99,255,0.2); }
.badge-user     { background: var(--info-soft);    color: var(--info);    border: 1px solid rgba(41,182,246,0.2); }

.badge-completed { background: var(--success-soft); color: var(--success); }
.badge-pending   { background: var(--warning-soft); color: var(--warning); }
.badge-failed    { background: var(--danger-soft);  color: var(--danger); }
.badge-running   { background: var(--info-soft);    color: var(--info); }

/* ─── Action Buttons (inline in table) ─── */
.action-btn {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.action-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn.danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger);
}

.action-btn.success:hover {
    background: var(--success-soft);
    border-color: var(--success);
    color: var(--success);
}

.action-group {
    display: flex;
    gap: 6px;
}


/* ============================================================
   DETAIL SECTIONS
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
}

.detail-card h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.detail-row:last-child { border-bottom: none; }
.detail-key { color: var(--text-muted); }
.detail-val { color: var(--text-primary); font-weight: 500; }
.detail-val.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.78rem; }


/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    transition: color var(--transition-fast);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 24px;
}


/* ============================================================
   ACTIVITY LOG
   ============================================================ */
.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.activity-content { flex: 1; min-width: 0; }

.activity-title {
    font-size: 0.84rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.activity-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.activity-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}


/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-state-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}


/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
}

.filter-bar select:focus,
.filter-bar input:focus {
    border-color: var(--accent);
}

/* ─── Date Filter Group ─── */
.date-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-input {
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    outline: none;
    width: 130px;
    transition: border var(--transition-fast);
    color-scheme: dark;
}

.date-input:focus {
    border-color: var(--accent);
}

.btn-date-quick {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 14px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-date-quick:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-date-quick.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.btn-date-clear {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-date-clear:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}


/* ============================================================
   USER DETAIL CARD IN SIDEBAR
   ============================================================ */
.user-card-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-mini {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
}


/* ============================================================
   COST BREAKDOWN (modal)
   ============================================================ */
.cost-bar {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 16px;
    margin-bottom: 8px;
}

.cost-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.cost-item:last-child { border-bottom: none; }
.cost-item .cost-name { color: var(--text-secondary); }
.cost-item .cost-amount { color: var(--text-primary); font-weight: 600; font-family: 'SF Mono', 'Fira Code', monospace; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 840px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-area {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        margin: 16px;
        padding: 32px 24px 28px;
    }
}


/* ============================================================
   MOBILE OVERLAY (when sidebar is open on mobile)
   ============================================================ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
}

.sidebar-overlay.visible {
    display: block;
}


/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

/* ============================================================
   TRUNCATE TEXT IN TABLE
   ============================================================ */
.truncate {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.settings-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border);
}

.settings-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.settings-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.settings-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: var(--bg-card-hover); }

.settings-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.settings-info {
    flex: 1;
    min-width: 0;
}

.settings-label {
    font-weight: 600;
    font-size: 0.92rem;
}

.settings-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.settings-status {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-masked {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.settings-edit-area {
    margin-top: 12px;
}

.settings-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    outline: none;
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

.settings-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.settings-btn-group {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.settings-actions {
    flex-shrink: 0;
    padding-top: 4px;
}

.settings-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

.settings-footer-text {
    font-size: 0.72rem;
    color: var(--text-muted);
}


/* ─── Multi-Key Rotation UI ─── */
.multi-key-list {
    margin-top: 12px;
    border-top: 1px solid var(--border);
}

.multi-key-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.multi-key-row:last-child { border-bottom: none; }
.multi-key-row:hover { background: rgba(255,255,255,0.02); }

.multi-key-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.multi-key-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.multi-key-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.multi-key-add {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    align-items: center;
}

.multi-key-add .settings-input {
    font-size: 0.8rem;
    padding: 8px 12px;
}
