/**
 * Rakson Group v2 — Global Design System
 * Mobile-first · Dark/Light themes · Fintech aesthetic
 */

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

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
a { text-decoration: none; }

/* ── Dark Theme (default) ─────────────────────────────────────────── */
:root,
[data-theme="dark"] {
    /* Backgrounds */
    --bg:          #070d1a;
    --bg2:         #080e1c;
    --surface:     #0c1525;
    --surface2:    #111f35;
    --surface3:    #162540;
    --surface4:    #1a2d4a;

    /* Borders */
    --border:      #1c2e48;
    --border2:     #243a5e;

    /* Brand */
    --gold:        #c9973a;
    --gold2:       #e8b84b;
    --gold3:       #f5d070;

    /* Status */
    --green:       #10b981;
    --green2:      #34d399;
    --red:         #f43f5e;
    --red2:        #fb7185;
    --amber:       #f59e0b;
    --amber2:      #fbbf24;
    --blue:        #3b82f6;
    --blue2:       #60a5fa;
    --purple:      #8b5cf6;
    --teal:        #0ea5e9;

    /* Text */
    --text:        #e2f0ff;
    --text2:       #6b8aaa;
    --text3:       #334d6b;
    --text-inv:    #070d1a;

    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
    --shadow:      0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:   0 12px 32px rgba(0,0,0,0.5);
    --shadow-gold: 0 0 20px rgba(201,151,58,0.25);

    /* Spacing scale */
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   16px;
    --r-xl:   20px;
    --r-2xl:  24px;

    /* PWA safe areas */
    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Light Theme ─────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg:          #f0f4f8;
    --bg2:         #e8edf5;
    --surface:     #ffffff;
    --surface2:    #f8fafc;
    --surface3:    #f1f5f9;
    --surface4:    #e2e8f0;
    --border:      #e2e8f0;
    --border2:     #cbd5e1;
    --gold:        #2563eb;
    --gold2:       #3b82f6;
    --gold3:       #60a5fa;
    --green:       #16a34a;
    --green2:      #22c55e;
    --red:         #dc2626;
    --red2:        #ef4444;
    --amber:       #d97706;
    --amber2:      #f59e0b;
    --blue:        #2563eb;
    --blue2:       #3b82f6;
    --text:        #0f172a;
    --text2:       #475569;
    --text3:       #94a3b8;
    --text-inv:    #ffffff;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
    --shadow:      0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg:   0 12px 32px rgba(0,0,0,0.12);
    --shadow-gold: 0 0 20px rgba(37,99,235,0.2);
}

/* ── Base ─────────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* ── Typography ──────────────────────────────────────────────────── */
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }

/* ── Layout ──────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding-bottom: var(--safe-bottom);
}

/* Mobile: sidebar hidden by default */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open {
        transform: translateX(0);
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Sidebar Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 60px;
}
.logo-gem {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-gold);
    flex-shrink: 0;
}
.logo-name {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}
.logo-name span { color: var(--gold2); }
.logo-version {
    font-size: 0.6rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text3);
    margin-left: auto;
    flex-shrink: 0;
}

/* Sidebar Wallet Card */
.sidebar-wallet {
    margin: 0.9rem;
    background: linear-gradient(135deg, var(--surface2), var(--surface3));
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.sidebar-wallet::before {
    content: '';
    position: absolute;
    top: -30px; right: -20px;
    width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(201,151,58,0.15), transparent);
    border-radius: 50%;
    pointer-events: none;
}
.wallet-label { font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text2); margin-bottom: 0.25rem; font-weight: 500; }
.wallet-amount { font-family: 'JetBrains Mono', monospace; font-size: 1.35rem; font-weight: 700; color: var(--gold2); letter-spacing: -0.02em; line-height: 1; margin-bottom: 0.6rem; }
.wallet-row { display: flex; gap: 1rem; }
.wallet-item .wi-label { font-size: 0.62rem; color: var(--text3); }
.wallet-item .wi-val   { font-size: 0.78rem; color: var(--text2); font-weight: 500; }
.today-profit-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.2);
    color: var(--green2);
    font-size: 0.68rem; font-weight: 600;
    padding: 0.22rem 0.6rem;
    border-radius: 50px; margin-top: 0.5rem;
}
.today-profit-badge::before { content: '▲'; font-size: 0.55rem; }

/* Nav Items */
.nav-section-label {
    padding: 0.75rem 1.1rem 0.2rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text3);
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem 0.65rem 1.1rem;
    margin: 0.1rem 0.6rem;
    border-radius: 10px;
    color: var(--text2);
    font-size: 0.875rem;
    font-weight: 400;
    transition: all 0.18s;
    position: relative;
    cursor: pointer;
    min-height: 44px; /* iOS minimum tap target */
}
.nav-item:hover   { background: var(--surface2); color: var(--text); }
.nav-item.active  { background: rgba(201,151,58,0.1); color: var(--gold2); font-weight: 600; }
[data-theme="light"] .nav-item.active { background: #eff6ff; color: var(--blue); }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.6rem; top: 25%; bottom: 25%;
    width: 3px;
    background: var(--gold);
    border-radius: 0 3px 3px 0;
}
[data-theme="light"] .nav-item.active::before { background: var(--blue); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 50px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar User Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 0.85rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.user-chip {
    display: flex; align-items: center; gap: 0.65rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 0.7rem 0.9rem;
}
.avatar {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 800;
    color: white; flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}
.user-info { min-width: 0; flex: 1; }
.user-name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.65rem; color: var(--green); display: flex; align-items: center; gap: 0.3rem; }
.user-role::before { content: ''; width: 5px; height: 5px; background: var(--green); border-radius: 50%; display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.logout-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    width: 100%; margin-top: 0.55rem;
    padding: 0.55rem;
    background: var(--surface3); border: 1px solid var(--border2);
    border-radius: 9px; color: var(--text2); font-size: 0.8rem; font-weight: 500;
    transition: all 0.2s; cursor: pointer; min-height: 44px;
}
.logout-btn:hover { background: rgba(244,63,94,0.08); color: var(--red); border-color: rgba(244,63,94,0.25); }

/* ── Main Content ─────────────────────────────────────────────────── */
.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 260px;
    transition: margin-left 0.3s;
}
@media (max-width: 768px) {
    .main-wrap { margin-left: 0; }
}

/* ── Top Bar ──────────────────────────────────────────────────────── */
.topbar {
    height: 60px;
    background: rgba(12, 21, 37, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: var(--safe-top);
}
[data-theme="light"] .topbar { background: rgba(255,255,255,0.9); }

.menu-btn {
    width: 38px; height: 38px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text2); font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.2s;
}
.menu-btn:hover { background: var(--surface3); color: var(--text); }

/* Desktop: hide menu btn */
@media (min-width: 769px) { .menu-btn { display: none; } }

.topbar-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    display: none;
}
@media (max-width: 768px) { .topbar-title { display: block; } }

.topbar-space { flex: 1; }

.topbar-profit {
    display: flex; align-items: center; gap: 0.4rem;
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.18);
    border-radius: 50px;
    padding: 0.3rem 0.85rem;
    font-size: 0.75rem; font-weight: 600; color: var(--green2);
    white-space: nowrap;
}
@media (max-width: 480px) { .topbar-profit { display: none; } }

.icon-btn {
    width: 38px; height: 38px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text2); font-size: 1rem;
    position: relative; flex-shrink: 0; transition: all 0.2s;
    text-decoration: none;
}
.icon-btn:hover { background: var(--surface3); color: var(--text); }
.notif-dot {
    position: absolute; top: 6px; right: 6px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--red); border: 2px solid var(--bg);
}

.theme-toggle { /* inherits icon-btn */ }

/* ── Page Content ────────────────────────────────────────────────── */
.page-content {
    padding: 1.25rem;
    flex: 1;
}
@media (min-width: 769px) {
    .page-content { padding: 1.75rem 2rem; }
}

/* ── Page Header ─────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.page-title    { font-size: clamp(1.3rem, 4vw, 1.75rem); font-weight: 800; letter-spacing: -0.03em; }
.page-subtitle { color: var(--text2); font-size: 0.82rem; margin-top: 0.2rem; }

/* ── Stats Grid ──────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
@media (min-width: 640px)  { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stats-grid-3  { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .stats-grid-3 { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.4s ease both;
    transition: border-color 0.25s, transform 0.25s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.stat-icon {
    width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; margin-bottom: 0.85rem;
}
.stat-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2); margin-bottom: 0.3rem; }
.stat-value { font-family: 'JetBrains Mono', monospace; font-size: clamp(1.1rem, 3vw, 1.45rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 0.3rem; }
.stat-sub   { font-size: 0.72rem; color: var(--text2); display: flex; align-items: center; gap: 0.3rem; }
.stat-sub.up   { color: var(--green); }
.stat-sub.down { color: var(--red); }
.stat-accent { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; }

/* ── Card / Panel ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    animation: fadeUp 0.4s ease both;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem; flex-wrap: wrap;
}
.card-title { font-size: 0.9rem; font-weight: 700; }
.card-body  { padding: 1.25rem; }
.card-body-flush { /* no padding — for tables */ }

/* ── Table ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    min-width: 500px;
}
.data-table th {
    font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--text3);
    padding: 0.75rem 1.25rem; text-align: left;
    border-bottom: 1px solid var(--border); white-space: nowrap;
    background: var(--surface2);
}
.data-table td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.td-mono { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.2rem 0.6rem; border-radius: 6px;
    font-size: 0.67rem; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
    white-space: nowrap;
}
.badge-green  { background:rgba(16,185,129,0.1);  color:var(--green);  border:1px solid rgba(16,185,129,0.2); }
.badge-red    { background:rgba(244,63,94,0.1);   color:var(--red);    border:1px solid rgba(244,63,94,0.2); }
.badge-amber  { background:rgba(245,158,11,0.1);  color:var(--amber);  border:1px solid rgba(245,158,11,0.2); }
.badge-blue   { background:rgba(59,130,246,0.1);  color:var(--blue);   border:1px solid rgba(59,130,246,0.2); }
.badge-gold   { background:rgba(201,151,58,0.1);  color:var(--gold2);  border:1px solid rgba(201,151,58,0.2); }
.badge-purple { background:rgba(139,92,246,0.1);  color:var(--purple); border:1px solid rgba(139,92,246,0.2); }
.badge-grey   { background:var(--surface3);        color:var(--text2);  border:1px solid var(--border2); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    padding: 0.65rem 1.2rem;
    border-radius: 10px;
    font-size: 0.875rem; font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer; border: none;
    transition: all 0.2s; white-space: nowrap;
    text-decoration: none;
    min-height: 44px; /* iOS tap target */
    -webkit-tap-highlight-color: transparent;
}
.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #070d1a; font-weight: 700;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(201,151,58,0.3); }
[data-theme="light"] .btn-primary { background: linear-gradient(135deg, #2563eb, #3b82f6); color: white; }
[data-theme="light"] .btn-primary:hover { box-shadow: 0 8px 24px rgba(37,99,235,0.3); }

.btn-ghost {
    background: var(--surface2); border: 1px solid var(--border2); color: var(--text2);
}
.btn-ghost:hover { background: var(--surface3); color: var(--text); }
.btn-danger {
    background: rgba(244,63,94,0.1); border: 1px solid rgba(244,63,94,0.25); color: var(--red);
}
.btn-danger:hover { background: rgba(244,63,94,0.18); }
.btn-success {
    background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: var(--green);
}
.btn-success:hover { background: rgba(16,185,129,0.18); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; min-height: 36px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.85rem; }
@media (max-width: 640px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block; font-size: 0.75rem; font-weight: 600;
    color: var(--text2); margin-bottom: 0.4rem; letter-spacing: 0.01em;
}
.form-control {
    display: block; width: 100%;
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: 10px; padding: 0.72rem 1rem;
    color: var(--text); font-size: 0.875rem;
    font-family: 'Inter', sans-serif; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; appearance: none;
    min-height: 44px;
}
.form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,151,58,0.1);
}
[data-theme="light"] .form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-control::placeholder { color: var(--text3); }
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%236b8aaa' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.72rem; color: var(--text3); margin-top: 0.3rem; }

/* ── Flash / Alerts ──────────────────────────────────────────────── */
.flash {
    display: flex; align-items: flex-start; gap: 0.6rem;
    padding: 0.9rem 1.1rem; border-radius: 11px;
    font-size: 0.85rem; margin-bottom: 1.1rem;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }
.flash-success { background:rgba(16,185,129,0.07); border:1px solid rgba(16,185,129,0.2); color:#34d399; }
.flash-error   { background:rgba(244,63,94,0.07);  border:1px solid rgba(244,63,94,0.2);  color:#fb7185; }
.flash-warning { background:rgba(245,158,11,0.07); border:1px solid rgba(245,158,11,0.2); color:#fbbf24; }
.flash-info    { background:rgba(59,130,246,0.07); border:1px solid rgba(59,130,246,0.2); color:#60a5fa; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 300;
    display: none; align-items: flex-end; justify-content: center;
    padding: 0;
}
.modal-overlay.open { display: flex; }
@media (min-width: 640px) {
    .modal-overlay { align-items: center; padding: 1rem; }
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 20px 20px 0 0;
    width: 100%; max-width: 540px;
    max-height: 90vh; overflow-y: auto;
    animation: modalSlideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
    padding-bottom: var(--safe-bottom);
}
@media (min-width: 640px) {
    .modal { border-radius: 18px; animation: modalIn 0.28s ease; }
}
@keyframes modalSlideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
@keyframes modalIn { from{opacity:0;transform:scale(0.95) translateY(10px)} to{opacity:1;transform:scale(1) translateY(0)} }
.modal-handle { width: 40px; height: 4px; background: var(--border2); border-radius: 2px; margin: 0.75rem auto 0; }
@media (min-width: 640px) { .modal-handle { display: none; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 1.1rem; cursor: pointer; padding: 0.3rem; border-radius: 6px; transition: all 0.2s; min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body   { padding: 1.4rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.65rem; padding: 1rem 1.4rem; border-top: 1px solid var(--border); }

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 0.3rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pg-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 7px; font-size: 0.82rem; color: var(--text2); background: var(--surface2); border: 1px solid var(--border); transition: all 0.18s; text-decoration: none; }
.pg-btn:hover, .pg-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
[data-theme="light"] .pg-btn:hover, [data-theme="light"] .pg-btn.active { background: #2563eb; border-color: #2563eb; }
.pg-info { margin-left: auto; font-size: 0.72rem; color: var(--text3); }

/* ── Filter Chips ────────────────────────────────────────────────── */
.chips { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.chip { padding: 0.38rem 0.85rem; border-radius: 50px; font-size: 0.78rem; font-weight: 500; transition: all 0.18s; border: 1px solid var(--border2); color: var(--text2); background: var(--surface2); text-decoration: none; min-height: 36px; display: flex; align-items: center; }
.chip.active, .chip:hover { background: rgba(201,151,58,0.1); border-color: rgba(201,151,58,0.3); color: var(--gold2); }
[data-theme="light"] .chip.active { background: #eff6ff; border-color: #bfdbfe; color: #2563eb; }

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text3); }
.empty-icon  { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.5; }
.empty-text  { font-size: 0.88rem; line-height: 1.6; }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes fadeUp { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
.ani-1 { animation-delay: 0.05s; }
.ani-2 { animation-delay: 0.10s; }
.ani-3 { animation-delay: 0.15s; }
.ani-4 { animation-delay: 0.20s; }
.ani-5 { animation-delay: 0.25s; }

/* ── Smooth theme transition ─────────────────────────────────────── */
*, *::before, *::after {
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.no-transition * { transition: none !important; }

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── PWA Install Banner ──────────────────────────────────────────── */
.pwa-banner {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border2);
    padding: 1rem 1.25rem calc(1rem + var(--safe-bottom));
    display: flex; align-items: center; gap: 0.85rem;
    z-index: 400;
    animation: slideUp 0.4s ease;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
.pwa-icon { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), var(--gold2)); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.pwa-text { flex: 1; min-width: 0; }
.pwa-title { font-weight: 700; font-size: 0.88rem; }
.pwa-sub   { font-size: 0.75rem; color: var(--text2); }
.pwa-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ── Utility ─────────────────────────────────────────────────────── */
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-gold    { color: var(--gold2); }
.text-amber   { color: var(--amber); }
.text-muted   { color: var(--text2); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }
.gap-sm       { gap: 0.5rem; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100        { width: 100%; }
.mt-1         { margin-top: 0.5rem; }
.mt-2         { margin-top: 1rem; }
.mb-1         { margin-bottom: 0.5rem; }
.mb-2         { margin-bottom: 1rem; }
