/* ============================================================
   GASTROSMART SURAKARTA — MAIN STYLESHEET
   Theme: Refined Dark · Javanese Gold · Modern Dashboard
   ============================================================ */

:root {
    /* Core palette */
    --bg-base: #0C0D0F;
    --bg-surface: #131416;
    --bg-elevated: #1A1B1E;
    --bg-overlay: #222428;
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-medium: rgba(255, 255, 255, 0.12);

    /* Brand */
    --gold: #F59E0B;
    --gold-dim: #B45309;
    --gold-glow: rgba(245, 158, 11, 0.15);
    --gold-subtle: rgba(245, 158, 11, 0.08);

    /* Text */
    --text-primary: #F0F0F0;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --text-gold: #FCD34D;

    /* Semantic */
    --green: #10B981;
    --blue: #3B82F6;
    --purple: #8B5CF6;
    --red: #EF4444;
    --orange: #F97316;
    --cyan: #06B6D4;

    /* Layout */
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'DM Mono', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --glow-gold: 0 0 24px rgba(245, 158, 11, 0.25);
}

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

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

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    /* Prevent iOS scroll zoom */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-icon svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.brand-name {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-gold);
    letter-spacing: 0.02em;
}

.brand-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: -2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 8px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.18s ease;
    margin-bottom: 2px;
    position: relative;
}

.nav-item i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.nav-item.active {
    background: var(--gold-subtle);
    color: var(--gold);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

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

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

.tkt-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tkt-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {

    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 7px;
    cursor: pointer;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
}

.menu-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.menu-btn i {
    width: 18px;
    height: 18px;
    display: block;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.breadcrumb-root {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

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

.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--green);
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--green);
}

/* ── PAGE MAIN ───────────────────────────────────────────── */
.page-main {
    flex: 1;
    padding: 28px 28px 40px;
}

.page-footer {
    padding: 14px 28px;
    border-top: 1px solid var(--border-subtle);
}

.footer-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.footer-divider {
    opacity: 0.4;
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-title span {
    color: var(--gold);
}

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

/* ── CARDS ───────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: var(--border-medium);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

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

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent, var(--gold));
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

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

.stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
}

.stat-icon i {
    width: 16px;
    height: 16px;
}

/* ── GRID LAYOUTS ────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead tr {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-medium);
}

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.data-table th.center,
.data-table td.center {
    text-align: center;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

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

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--bg-elevated);
}

.data-table tbody tr.highlight-row {
    background: var(--gold-subtle);
}

.data-table tbody tr.highlight-row td {
    color: var(--text-primary);
}

/* ── MONO VALUE ──────────────────────────────────────────── */
.mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

/* ── SCORE BAR ───────────────────────────────────────────── */
.score-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.score-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-overlay);
    border-radius: 999px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
    transition: width 0.5s ease;
}

.score-val {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-gold);
    min-width: 48px;
}

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-gold {
    background: rgba(245, 158, 11, 0.15);
    color: #FCD34D;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-green {
    background: rgba(16, 185, 129, 0.12);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-blue {
    background: rgba(59, 130, 246, 0.12);
    color: #93C5FD;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-orange {
    background: rgba(249, 115, 22, 0.12);
    color: #FDBA74;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-gray {
    background: rgba(113, 113, 122, 0.15);
    color: #A1A1AA;
    border: 1px solid rgba(113, 113, 122, 0.3);
}

/* ── RANK NUMBER ─────────────────────────────────────────── */
.rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.rank-1 {
    background: linear-gradient(135deg, #B45309, #F59E0B);
    color: #fff;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.rank-2 {
    background: linear-gradient(135deg, #374151, #9CA3AF);
    color: #fff;
}

.rank-3 {
    background: linear-gradient(135deg, #78350F, #D97706);
    color: #fff;
}

.rank-other {
    background: var(--bg-overlay);
    color: var(--text-muted);
    border: 1px solid var(--border-medium);
}

/* ── PROGRESS RING ───────────────────────────────────────── */
.progress-ring-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.progress-ring-text {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-gold);
}

/* ── KRITERIA PILLS ──────────────────────────────────────── */
.kriteria-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    text-decoration: none;
    font-family: var(--font-body);
    /* Mobile: ensure minimum touch target size (44x44px) */
    min-height: 44px;
}

.btn i {
    width: 15px;
    height: 15px;
}

.btn-primary {
    background: var(--gold);
    color: #0C0D0F;
}

.btn-primary:hover {
    background: #FBBF24;
    box-shadow: var(--glow-gold);
}

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

.btn-outline:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

/* ── SECTION TITLE ───────────────────────────────────────── */
.section-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.section-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}

/* ── FORMULA STEP ────────────────────────────────────────── */
.formula-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.formula-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold-subtle);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.step-formula {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-gold);
    background: var(--bg-overlay);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    display: inline-block;
    border-left: 3px solid var(--gold);
}

/* ── DESTINATION CARD ────────────────────────────────────── */
.dest-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.dest-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-color, var(--gold));
    transform: scaleX(0);
    transition: transform 0.3s;
    transform-origin: left;
}

.dest-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.dest-card:hover::after {
    transform: scaleX(1);
}

/* ── RADAR CHART WRAPPER ─────────────────────────────────── */
.chart-container {
    position: relative;
    width: 100%;
}

/* ── TOOLTIP ─────────────────────────────────────────────── */
.tooltip-trigger {
    position: relative;
    cursor: help;
}

.tooltip-text {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-overlay);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
    max-width: 220px;
    white-space: normal;
    text-align: center;
}

.tooltip-trigger:hover .tooltip-text {
    display: block;
}

/* ── SENSITIVITY MATRIX ──────────────────────────────────── */
.sens-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.sens-stabil {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
}

.sens-sensitif {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
}

/* ── SCROLL CUSTOM ───────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-overlay);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-medium);
}

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.4s ease both;
}

.delay-1 {
    animation-delay: 0.05s;
}

.delay-2 {
    animation-delay: 0.10s;
}

.delay-3 {
    animation-delay: 0.15s;
}

.delay-4 {
    animation-delay: 0.20s;
}

.delay-5 {
    animation-delay: 0.25s;
}

/* ── HERO GRADIENT ORBS (Dashboard only) ────────────────── */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

.orb-gold {
    width: 300px;
    height: 300px;
    background: rgba(245, 158, 11, 0.12);
    top: -50px;
    right: -80px;
}

.orb-purple {
    width: 250px;
    height: 250px;
    background: rgba(139, 92, 246, 0.08);
    bottom: 30px;
    left: -60px;
}

/* ── HERO BANNER ─────────────────────────────────────────── */
.hero-banner {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 32px 36px;
    position: relative;
    overflow: hidden;
    margin-bottom: 28px;
}

.hero-banner-content {
    position: relative;
    z-index: 1;
}

.hero-eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 8px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 10px;
}

.hero-title em {
    color: var(--gold);
    font-style: normal;
}

.hero-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 560px;
    line-height: 1.7;
}

.hero-pattern {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 45%;
    background-image: repeating-linear-gradient(45deg,
            transparent,
            transparent 12px,
            rgba(245, 158, 11, 0.03) 12px,
            rgba(245, 158, 11, 0.03) 13px);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
/* ── RESPONSIVE: Tablet (≤ 900px) ──────────────────────── */
@media (max-width: 900px) {
    :root {
        --sidebar-w: 240px;
    }

    .sidebar {
        width: min(82vw, 280px);
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

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

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

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

    .menu-btn {
        display: flex;
        width: 40px;
        height: 40px;
        padding: 0;
        background: var(--bg-elevated);
        border-color: var(--border-subtle);
        box-shadow: var(--shadow-sm);
        z-index: 140;
    }

    .page-main {
        padding: 20px 16px 32px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .hero-banner {
        padding: 24px;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

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

    .stat-card {
        padding: 14px 12px;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .topbar {
        padding: 0 16px;
        height: 56px;
        z-index: 130;
    }

    .topbar-breadcrumb {
        gap: 4px;
        min-width: 0;
    }

    .topbar-right {
        min-width: 0;
    }

    .card {
        border-radius: var(--radius-md);
        padding: 16px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .admin-tabs {
        gap: 6px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .dest-card {
        padding: 14px;
    }
}

/* ── RESPONSIVE: Small Tablet/Large Phone (≤ 768px) ────── */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .topbar-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .breadcrumb-current {
        max-width: calc(100vw - 100px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .formula-steps {
        gap: 10px;
    }

    .formula-step {
        gap: 12px;
    }

    .modal-box {
        max-width: 90vw;
        padding: 20px;
    }

    .auth-card {
        max-width: 90vw;
    }

    .admin-form-grid {
        column-count: 1;
    }
}

/* ── RESPONSIVE: Phone (≤ 600px) ──────────────────────── */
@media (max-width: 600px) {
    :root {
        --topbar-h: 56px;
        --radius-lg: 12px;
    }

    html {
        font-size: 14px;
    }

    body {
        font-size: 14px;
    }

    .page-main {
        padding: 14px 12px 24px;
    }

    .hero-banner {
        padding: 18px;
        border-radius: var(--radius-md);
        margin-bottom: 18px;
    }

    .hero-eyebrow {
        font-size: 0.65rem;
    }

    .hero-title {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .hero-desc {
        font-size: 0.8rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .section-subtitle {
        font-size: 0.75rem;
        margin-bottom: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-sub {
        font-size: 0.7rem;
    }

    .topbar {
        height: 56px;
        padding: 0 12px;
        gap: 12px;
    }

    .menu-btn {
        padding: 6px;
    }

    .topbar-breadcrumb {
        gap: 2px;
    }

    .breadcrumb-root {
        display: none;
    }

    .breadcrumb-current {
        font-size: 0.8rem;
    }

    .status-pill {
        font-size: 0.7rem;
        padding: 4px 8px;
        flex-shrink: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 150px;
    }

    .card {
        border-radius: var(--radius-md);
        padding: 14px;
        margin-bottom: 12px;
    }

    .card-header {
        gap: 8px;
        margin-bottom: 12px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .admin-tabs {
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .btn {
        padding: 7px 12px;
        font-size: 0.75rem;
        gap: 5px;
    }

    .btn-sm {
        padding: 5px 10px;
    }

    .auth-card {
        padding: 18px;
    }

    .auth-title {
        font-size: 1.3rem;
    }

    .auth-subtitle {
        font-size: 0.78rem;
    }

    .auth-form input,
    .admin-form-grid input,
    .admin-form-grid textarea {
        font-size: 16px;
        padding: 10px;
    }

    .auth-form label,
    .admin-form-grid label {
        font-size: 0.72rem;
    }

    .table {
        font-size: 0.72rem;
    }

    .table th {
        padding: 7px 8px;
        font-size: 0.65rem;
    }

    .table td {
        padding: 7px 8px;
    }

    .table th,
    .table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }

    .dest-card {
        padding: 12px;
    }

    .dest-card::after {
        height: 2px;
    }

    .modal-box {
        max-width: 95vw;
        max-height: 85vh;
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-close {
        width: 28px;
        height: 28px;
        top: 12px;
        right: 12px;
    }

    .import-hint {
        font-size: 0.72rem;
        padding: 8px;
    }

    .import-hint a {
        color: var(--gold);
        text-decoration: underline;
    }

    .alert-error,
    .alert-success {
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    .info-box {
        font-size: 0.76rem;
        padding: 10px 12px;
        gap: 8px;
    }

    .info-box i {
        width: 14px;
        height: 14px;
    }

    .chart-container {
        height: 200px !important;
    }

    .rank-num {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .badge {
        padding: 2px 8px;
        font-size: 0.65rem;
    }

    .divider {
        margin: 16px 0;
    }
}

/* ── RESPONSIVE: Small Phone (≤ 480px) ──────────────────── */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .sidebar-brand {
        padding: 16px 12px 14px;
        gap: 8px;
    }

    .brand-name {
        font-size: 1rem;
    }

    .brand-sub {
        font-size: 0.65rem;
    }

    .nav-item {
        padding: 8px 10px;
        font-size: 0.8rem;
        gap: 8px;
    }

    .nav-item i {
        width: 16px;
        height: 16px;
    }

    .page-main {
        padding: 10px 10px 20px;
    }

    .hero-title {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .hero-banner {
        padding: 14px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .topbar {
        height: 52px;
        padding: 0 10px;
    }

    .breadcrumb-current {
        font-size: 0.75rem;
        max-width: calc(100vw - 80px);
    }

    .card {
        padding: 12px;
        margin-bottom: 10px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .modal-box {
        max-width: 98vw;
        padding: 14px;
    }

    .table td,
    .table th {
        padding: 6px 6px;
        max-width: 60px;
        font-size: 0.7rem;
    }

    .dest-card {
        padding: 10px;
    }

    .auth-card {
        padding: 16px;
    }

    .formula-step {
        gap: 10px;
    }

    .step-num {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .step-title {
        font-size: 0.8rem;
    }

    .step-formula {
        font-size: 0.72rem;
        padding: 4px 8px;
    }
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 24px 0;
}

/* ── INFO BOX ────────────────────────────────────────────── */
.info-box {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 0.83rem;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.info-box i {
    color: var(--gold);
    flex-shrink: 0;
    margin-top: 1px;
    width: 16px;
    height: 16px;
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 500;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.open {
    display: flex;
}

.modal-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    animation: fadeInUp 0.25s ease;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: 1px solid var(--border-medium);
    color: var(--text-muted);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
}

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

.modal-close i {
    width: 16px;
    height: 16px;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ── AUTH & ADMIN ───────────────────────────────────────── */
.auth-page {
    margin: 0;
    width: 100%;
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(245, 158, 11, 0.15), transparent 35%), var(--bg-base);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.auth-form,
.admin-form-grid {
    display: grid;
    gap: 10px;
}

.auth-form label,
.admin-form-grid label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
}

.auth-form input,
.admin-form-grid input,
.admin-form-grid textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    /* Mobile: prevent zoom on focus + improve touch targets */
    font-size: max(0.85rem, 16px);
}

.auth-form input:focus,
.admin-form-grid input:focus,
.admin-form-grid textarea:focus {
    outline: 1px solid rgba(245, 158, 11, 0.5);
    border-color: rgba(245, 158, 11, 0.5);
    outline-offset: 2px;
}

.auth-submit {
    margin-top: 8px;
    justify-content: center;
}

.auth-help {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: grid;
    gap: 4px;
}

.muted {
    color: var(--text-muted);
}

.alert-error,
.alert-success {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin-bottom: 10px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.import-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 10px;
}

/* ── TABLE ───────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--bg-elevated);
}

/* ── RANK NUM ────────────────────────────────────────────── */
.rank-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.rank-1 {
    background: rgba(245, 158, 11, 0.2);
    border: 2px solid var(--gold);
    color: var(--gold);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.rank-2 {
    background: rgba(156, 163, 175, 0.15);
    border: 2px solid #9CA3AF;
    color: #9CA3AF;
}

.rank-3 {
    background: rgba(205, 127, 50, 0.15);
    border: 2px solid #CD7F32;
    color: #CD7F32;
}

.rank-other {
    background: var(--bg-overlay);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* ── BADGE ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-gold {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ── CARD ────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.card-title {
    font-weight: 700;
    font-size: 0.95rem;
}

/* ── SCORE BAR ───────────────────────────────────────────── */
.score-bar {
    background: var(--bg-overlay);
    border-radius: 2px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── STATS GRID ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-top: 2px solid var(--accent, var(--gold));
    border-radius: var(--radius-md);
    padding: 16px 18px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    margin-bottom: 10px;
}

.stat-icon i {
    width: 22px;
    height: 22px;
}

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* ── GRID LAYOUTS ────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-base);
    backdrop-filter: blur(12px);
}

.menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 7px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.menu-btn i {
    width: 18px;
    height: 18px;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.breadcrumb-root {
    color: var(--text-muted);
    font-weight: 500;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

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

.status-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 5px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ── MAIN CONTENT LAYOUT ─────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.page-main {
    padding: 28px 32px 40px;
    flex: 1;
}

/* ── PAGE FOOTER ─────────────────────────────────────────── */
.page-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-divider {
    opacity: 0.3;
}

/* ── MONO TEXT ───────────────────────────────────────────── */
.mono {
    font-family: var(--font-mono);
}

/* ── FINAL MOBILE OVERRIDES ──────────────────────────────── */
@media (max-width: 900px) {
    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }

    .sidebar {
        width: min(84vw, 300px);
    }

    .menu-btn {
        display: inline-flex !important;
        width: 40px;
        height: 40px;
        padding: 0;
        z-index: 200;
    }

    .topbar {
        z-index: 150;
    }

    .sidebar-overlay {
        z-index: 140;
    }
}

@media (min-width: 901px) {
    .menu-btn {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}