/* ═══════════════════════════════════════════════════════════════════
   Nexus — Premium Dark UI with Liquid Animations
   Senior UI/UX Design · Glassmorphism · Micro-interactions
   ═══════════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ────────────────────────────────────────────── */
:root {
    /* Surfaces */
    --bg-void: #05050a;
    --bg-primary: #0a0a12;
    --bg-secondary: #0e0e18;
    --bg-card: rgba(18, 18, 30, 0.7);
    --bg-card-solid: #12121e;
    --bg-card-hover: rgba(24, 24, 40, 0.8);
    --bg-input: rgba(22, 22, 36, 0.8);
    --bg-glass: rgba(16, 16, 28, 0.4);

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-glow: rgba(6, 182, 212, 0.3);

    /* Text */
    --text-primary: #ededf4;
    --text-secondary: #8b8ba0;
    --text-muted: #55556b;

    /* Accents */
    --accent: #06b6d4;
    --accent-bright: #22d3ee;
    --accent-glow: rgba(6, 182, 212, 0.12);
    --accent-gradient: linear-gradient(135deg, #06b6d4, #14b8a6, #0ea5e9);
    --accent-gradient-subtle: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(20,184,166,0.08));

    /* Status */
    --success: #34d399;
    --success-glow: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-glow: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-glow: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;

    /* Core */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --blur: blur(20px);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg-void);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════════════════════
   LIQUID BACKGROUND ANIMATION
   ══════════════════════════════════════════════════════════════════ */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(20, 184, 166, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(14, 165, 233, 0.03) 0%, transparent 50%);
    animation: liquidDrift 20s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes liquidDrift {
    0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
    33%  { transform: translate(2%, -3%) rotate(2deg) scale(1.02); }
    66%  { transform: translate(-1%, 2%) rotate(-1deg) scale(0.98); }
    100% { transform: translate(1%, -1%) rotate(1deg) scale(1.01); }
}

/* ── Floating orbs ──────────────────────────────────────────── */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.12), transparent 70%);
    top: -10%;
    right: -5%;
    animation: orbFloat1 25s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.08), transparent 70%);
    bottom: -5%;
    left: 10%;
    animation: orbFloat2 30s ease-in-out infinite;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.06), transparent 70%);
    top: 40%;
    left: 50%;
    animation: orbFloat3 22s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-60px, 40px); }
}
@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(40px, -60px); }
}
@keyframes orbFloat3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, -40px); }
}

/* ══════════════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════════════ */
.layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    background: var(--bg-glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-right: 1px solid var(--border);
    padding: 28px 16px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 8px 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
    text-decoration: none;
}

.sidebar-brand-logo {
    display: block;
    width: 100%;
    max-width: 200px;
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 4px 24px rgba(34, 211, 238, 0.18));
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
    position: relative;
    overflow: hidden;
}

.sidebar-brand-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    border-radius: inherit;
}

.sidebar-brand-icon:has(img) {
    background: transparent;
    box-shadow: none;
}

.sidebar-brand-icon:has(img)::after { display: none; }

.sidebar-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-brand-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.nav-section { margin-bottom: 12px; }

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    padding: 6px 14px;
    margin-bottom: 0;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-section-title:hover { color: var(--text-secondary); }

.nav-section-title::after {
    content: '';
    width: 6px; height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 200ms ease;
    flex-shrink: 0;
}
.nav-section.open .nav-section-title::after { transform: rotate(-135deg); }

.nav-section .nav-links {
    max-height: 0;
    overflow: hidden;
    transition: max-height 250ms ease;
}
.nav-section.open .nav-links {
    max-height: 600px;
}

.nav-section.no-collapse .nav-section-title { cursor: default; }
.nav-section.no-collapse .nav-section-title::after { display: none; }
.nav-section.no-collapse .nav-links { max-height: none; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    transform: translateX(2px);
}

.nav-link.active {
    background: var(--accent-glow);
    color: var(--accent-bright);
}

.nav-link.active::before { transform: scaleY(1); }

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link:hover svg, .nav-link.active svg { opacity: 1; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 36px 40px;
    max-width: 1240px;
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════════════════ */
.page-header {
    margin-bottom: 36px;
    animation: slideDown 0.5s var(--transition) both;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════
   GLASS CARDS — with shimmer border
   ══════════════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(6,182,212,0.1), transparent, rgba(20,184,166,0.05));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card:hover::before { opacity: 1; }

.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 40px rgba(6, 182, 212, 0.08);
}

/* ══════════════════════════════════════════════════════════════════
   STAT CARDS — with animated gradient borders
   ══════════════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: cardEnter 0.6s var(--transition) both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.02), transparent);
    transition: 0.6s ease;
}

.stat-card:hover::after { left: 100%; }

.stat-card:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 30px var(--accent-glow), inset 0 0 30px rgba(6,182,212,0.03);
    transform: translateY(-4px);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-value.accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════
   TABLES — glass effect with row animations
   ══════════════════════════════════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: var(--blur);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: rgba(0, 0, 0, 0.3);
    padding: 14px 18px;
    text-align: left;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
    transition: var(--transition-fast);
}

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

tbody tr:hover {
    background: rgba(6, 182, 212, 0.03);
}

tbody tr:hover td { color: var(--text-primary); }
tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════════════════════════
   BADGES — glowing status indicators
   ══════════════════════════════════════════════════════════════════ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-active {
    background: var(--success-glow);
    color: var(--success);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.15);
}

.status-active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.status-inactive {
    background: var(--danger-glow);
    color: var(--danger);
}

.status-inactive::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    opacity: 0.5;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

.tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.tier-free {
    background: rgba(139, 139, 160, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(139, 139, 160, 0.15);
}

.tier-premium {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-bright);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.tier-premium_plus {
    background: linear-gradient(135deg, rgba(6,182,212,0.1), rgba(20,184,166,0.1));
    color: #5eead4;
    border: 1px solid rgba(20, 184, 166, 0.2);
}

/* ══════════════════════════════════════════════════════════════════
   BUTTONS — with liquid hover effects
   ══════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}

.btn:hover::before { opacity: 1; }

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
    background: var(--accent-bright);
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

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

.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger-glow);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.15);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.15);
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.1);
}

.btn-success {
    background: var(--success-glow);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.15);
}

.btn-success:hover {
    background: rgba(52, 211, 153, 0.15);
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.1);
}

.btn-sm { padding: 7px 14px; font-size: 12px; }

/* ══════════════════════════════════════════════════════════════════
   FORMS — floating label style
   ══════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 22px; }

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12), 0 0 20px rgba(6, 182, 212, 0.12);
}

.form-input::placeholder { color: var(--text-muted); }
.form-select option { background: var(--bg-card-solid); }

/* ══════════════════════════════════════════════════════════════════
   MODAL — with backdrop blur and spring animation
   ══════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 10, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.25s ease;
}

.modal {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 80px var(--accent-glow);
    animation: modalSpring 0.4s var(--transition-bounce);
    position: relative;
}

.modal::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: var(--accent-gradient);
    opacity: 0.08;
    z-index: -1;
}

.modal h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 28px;
    letter-spacing: -0.5px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSpring {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════
   API KEY DISPLAY — premium reveal
   ══════════════════════════════════════════════════════════════════ */
.api-key-box {
    background: var(--bg-void);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 18px;
    margin: 16px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 500;
    word-break: break-all;
    color: var(--accent-bright);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    box-shadow: 0 0 20px var(--accent-glow), inset 0 0 20px rgba(6, 182, 212, 0.03);
}

.api-key-box:hover {
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.2), inset 0 0 30px rgba(6, 182, 212, 0.05);
}

.api-key-box::after {
    content: 'Click to copy';
    position: absolute;
    top: -8px;
    right: 12px;
    background: var(--accent);
    color: white;
    font-size: 9px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-key-warning {
    background: var(--warning-glow);
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 13px;
    color: var(--warning);
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════════════════════════════════════════
   TOASTS — slide in from right
   ══════════════════════════════════════════════════════════════════ */
.toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    animation: toastSlide 0.4s var(--transition-bounce);
}

.toast-success {
    background: var(--success-glow);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.15);
}

.toast-error {
    background: var(--danger-glow);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.15);
}

@keyframes toastSlide {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════════════════════════════════
   PROGRESS BARS — animated liquid fill
   ══════════════════════════════════════════════════════════════════ */
.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-fill.green {
    background: linear-gradient(90deg, #059669, var(--success));
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.3);
}

.progress-fill.yellow {
    background: linear-gradient(90deg, #d97706, var(--warning));
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

.progress-fill.red {
    background: linear-gradient(90deg, #dc2626, var(--danger));
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

/* ══════════════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 28px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.pagination a {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent-bright);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.12);
}

.pagination .active {
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
}

/* ══════════════════════════════════════════════════════════════════
   BREAKDOWNS / GRID
   ══════════════════════════════════════════════════════════════════ */
.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 28px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 13px;
    transition: var(--transition-fast);
}

.breakdown-item:hover {
    padding-left: 6px;
    border-color: rgba(6, 182, 212, 0.1);
}

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

.breakdown-label { color: var(--text-secondary); font-weight: 500; }
.breakdown-value {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════════════
   HTMX LOADING STATE — smooth skeleton animation
   ══════════════════════════════════════════════════════════════════ */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator { display: inline-block; }

.htmx-request.btn {
    pointer-events: none;
    opacity: 0.7;
}

.htmx-request.btn::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 6px;
}

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

/* Content that was swapped fades in */
[hx-swap-oob], [hx-target] > * {
    animation: htmxFadeIn 0.3s ease;
}

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

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR VERSION / FOOTER
   ══════════════════════════════════════════════════════════════════ */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 14px 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════════
   DETAILS / COLLAPSIBLE
   ══════════════════════════════════════════════════════════════════ */
details summary {
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
    transition: var(--transition);
    font-weight: 600;
}

details summary:hover { color: var(--text-secondary); }

details[open] summary { color: var(--accent-bright); }

details[open] > *:not(summary) {
    animation: htmxFadeIn 0.3s ease;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .breakdown-grid { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 24px; }
}

/* ══════════════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* ── Code / Mono ──────────────────────────────────────────── */
code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: rgba(6, 182, 212, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-bright);
}

/* ══════════════════════════════════════════════════════════════════
   DAILY USAGE CHART
   ══════════════════════════════════════════════════════════════════ */
.chart-container {
    padding: 8px 0;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 0 4px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 180px;
    padding: 0 4px;
    border-bottom: 1px solid var(--border);
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
    animation: barGrow 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes barGrow {
    from { opacity: 0; transform: scaleY(0); transform-origin: bottom; }
    to { opacity: 1; transform: scaleY(1); transform-origin: bottom; }
}

.chart-bar-stack {
    width: 100%;
    max-width: 40px;
    min-width: 8px;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.chart-bar-stack:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

.chart-bar-segment {
    width: 100%;
    transition: height 0.5s ease;
    min-height: 1px;
}

.chart-bar-label {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 600;
    white-space: nowrap;
}

.chart-bar-value {
    font-size: 9px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    position: absolute;
    top: -16px;
    opacity: 0;
    transition: var(--transition);
    font-weight: 600;
}

.chart-bar-group:hover .chart-bar-value {
    opacity: 1;
    color: var(--accent-bright);
}

/* ── Spinner for HTMX buttons ────────────────────────────── */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

/* ── Fade out animation ──────────────────────────────────── */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ── Inline override-mode select + micro-interaction ─────── */
.override-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 4px 24px 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    background: var(--bg-input) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1l4 4 4-4' stroke='%2306b6d4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 8px center;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
    cursor: pointer;
}
.override-select:hover { border-color: var(--accent); }
.override-select:focus {
    outline: none;
    border-color: var(--accent-bright);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.override-select.pulse { animation: soft-pulse 1s ease infinite; }
.override-select.flash-ok { box-shadow: 0 0 0 3px var(--success-glow); border-color: var(--success); }
.override-select.flash-err { box-shadow: 0 0 0 3px var(--danger-glow); border-color: var(--danger); }
@keyframes soft-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50%      { box-shadow: 0 0 0 6px var(--accent-glow); }
}

/* ── Modern reveal + hover lift (shared with customer portal) ── */
@keyframes reveal-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.reveal { animation: reveal-up .5s cubic-bezier(.2,.8,.2,1) both; }
.reveal-stagger > * { animation: reveal-up .55s cubic-bezier(.2,.8,.2,1) both; }
.reveal-stagger > *:nth-child(1) { animation-delay: 40ms; }
.reveal-stagger > *:nth-child(2) { animation-delay: 90ms; }
.reveal-stagger > *:nth-child(3) { animation-delay: 140ms; }
.reveal-stagger > *:nth-child(4) { animation-delay: 190ms; }
.reveal-stagger > *:nth-child(5) { animation-delay: 240ms; }

.lift {
    transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, border-color .25s ease;
}
.lift:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 28px -12px var(--accent-glow);
}

