:root {
    --navy: #101b2d;
    --navy-2: #0b1220;
    --navy-3: #17243a;
    --ink: #111827;
    --slate: #475569;
    --muted: #64748b;
    --line: #e7e2d8;
    --soft-line: #f0ebe2;
    --bg: #f7f4ee;
    --card: #fffdf8;
    --card-2: #fbf8f1;
    --gold: #c09a4a;
    --gold-2: #a87923;
    --gold-soft: #fbf1da;
    --teal: #0f766e;
    --emerald: #15803d;
    --amber: #b8872c;
    --orange: #c46a2b;
    --red: #b42318;
    --blue: #1d4e89;
    --violet: #5b4b8a;
    --shadow: 0 22px 55px rgba(16, 27, 45, .09);
    --shadow-soft: 0 12px 32px rgba(16, 27, 45, .06);
    --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 0% 0%, rgba(192, 154, 74, .15), transparent 30%),
        radial-gradient(circle at 100% 8%, rgba(15, 118, 110, .08), transparent 28%),
        linear-gradient(180deg, #fbf8f1 0%, var(--bg) 45%, #f3eee5 100%);
    color: var(--ink);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* Mobile-first shell */
.app-shell { min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 12px 14px;
    color: #efe7d8;
    background:
        linear-gradient(135deg, rgba(192, 154, 74, .18), transparent 26%),
        linear-gradient(180deg, rgba(16, 27, 45, .98), rgba(11, 18, 32, .98));
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 10px 30px rgba(16, 27, 45, .16);
    backdrop-filter: blur(18px);
}
.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
    margin-bottom: 12px;
}
.brand-logo {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #d5b66a, #a87923);
    color: #111827;
    font-weight: 950;
    letter-spacing: -.04em;
    box-shadow: 0 14px 34px rgba(192, 154, 74, .28), inset 0 1px 0 rgba(255,255,255,.45);
}
.brand-title { font-size: 15px; font-weight: 900; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-subtitle { font-size: 11px; color: #b9c2cf; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-title { display: none; }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-radius: 999px;
    color: #d8deea;
    margin: 0 6px 0 0;
    font-size: 13px;
    font-weight: 760;
    white-space: nowrap;
    background: rgba(255, 255, 255, .055);
    border: 1px solid rgba(255, 255, 255, .07);
}
.nav-link:hover, .nav-link.active {
    background: linear-gradient(135deg, rgba(213, 182, 106, .24), rgba(255,255,255,.08));
    color: #fff;
    border-color: rgba(213, 182, 106, .28);
}
.sidebar .nav-link { vertical-align: middle; }
.sidebar { overflow-x: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }

.main { padding: 16px; }
.topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 18px;
}
.page-title { margin: 0; font-size: 24px; letter-spacing: -.035em; line-height: 1.08; color: var(--navy); }
.page-subtitle, .topbar [style*="color:#64748b"] { line-height: 1.45; color: #6b7280 !important; }
.user-pill {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: rgba(255,253,248,.88);
    border-radius: 19px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f7edcf, #d7b66a);
    color: var(--navy);
    display: grid;
    place-items: center;
    font-weight: 950;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.card {
    background: linear-gradient(180deg, rgba(255,253,248,.98), rgba(251,248,241,.98));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}
.card h3 { color: var(--navy); }
.grid-4, .grid-3, .grid-2, .form-grid, .hero-card, .chart-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }
.kpi-value { font-size: clamp(20px, 6vw, 28px); font-weight: 950; letter-spacing: -.045em; line-height: 1.08; color: var(--navy); }
.kpi-hint { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
th { text-align: left; color: #5b6472; background: #f4efe5; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: rgba(246, 241, 231, .65); }

.btn {
    border: 0;
    border-radius: 14px;
    padding: 10px 14px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    letter-spacing: -.01em;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.01); }
.btn-primary { background: linear-gradient(135deg, var(--navy), #1e3558); color: #fff; box-shadow: 0 14px 28px rgba(16, 27, 45, .18); }
.btn-dark { background: linear-gradient(135deg, var(--navy-2), var(--navy-3)); color: #fff; box-shadow: 0 14px 28px rgba(16, 27, 45, .2); }
.btn-soft { background: #f2eadc; color: #18243a; border: 1px solid #e1d6c4; }
.btn-success { background: linear-gradient(135deg, #0f766e, #15803d); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #b42318, #84211b); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #d5b66a, #a87923); color: #111827; box-shadow: 0 14px 28px rgba(168, 121, 35, .2); }
.btn-sm { padding: 7px 10px; font-size: 12px; border-radius: 10px; min-height: 34px; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.action-row .btn, .action-row select, .action-row input { flex: 1 1 160px; }

.form-grid { gap: 14px; }
.form-full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 850; color: #263247; margin-bottom: 7px; }
input, select, textarea {
    width: 100%;
    border: 1px solid #d9d1c2;
    border-radius: 15px;
    padding: 11px 12px;
    background: #fffdf8;
    color: var(--navy);
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(192,154,74,.16); }
textarea { min-height: 110px; resize: vertical; }

.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.badge-blue { background: #e6eef8; color: #1d4e89; }
.badge-green { background: #e5f4ec; color: #0f766e; }
.badge-yellow { background: #fbf1da; color: #8b5e12; }
.badge-red { background: #fae7e5; color: #b42318; }
.badge-gray { background: #eee8de; color: #5b6472; }
.progress { width: 100%; height: 10px; background: #e9e1d6; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--teal)); }
.alert { padding: 13px 16px; border-radius: 16px; margin-bottom: 16px; font-weight: 750; border: 1px solid transparent; }
.alert-success { background: #e5f4ec; color: #14532d; border-color: #c6ead8; }
.alert-error { background: #fae7e5; color: #84211b; border-color: #f2c6c1; }

/* Chart components */
.chart-card { padding: 16px; border-radius: 22px; background: linear-gradient(180deg, #fffdf8, #f7f2e8); border: 1px solid var(--soft-line); box-shadow: var(--shadow-soft); }
.chart-title { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.chart-title h3 { margin:0; font-size:16px; }
.bar-row { margin-bottom: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-meta { display:flex; justify-content:space-between; gap:10px; align-items:center; font-size:12px; margin-bottom:6px; color:#4b5563; }
.bar-meta b { max-width: 58%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--navy); }
.bar-track { height: 11px; background:#e9e1d6; border-radius:999px; overflow:hidden; }
.bar-fill { height: 100%; border-radius:999px; background: linear-gradient(90deg, var(--gold), var(--teal)); min-width: 2%; box-shadow: inset 0 1px 0 rgba(255,255,255,.38); }
.donut-wrap { display:flex; justify-content:center; align-items:center; padding:12px 0; }
.donut {
    width: 174px;
    height: 174px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--teal) var(--donut, 62%), #e9e1d6 0);
    position: relative;
    box-shadow: 0 18px 40px rgba(15, 118, 110, .13);
}
.donut:after { content:""; position:absolute; inset:24px; border-radius:999px; background:#fffdf8; box-shadow: inset 0 0 0 1px var(--line); }
.donut strong { position: relative; z-index: 1; font-size: 28px; color: var(--navy); }
.donut span { position: relative; z-index: 1; display:block; color:var(--muted); font-size:12px; margin-top:4px; }

/* Landing mobile first */
.hero {
    min-height: 100vh;
    background:
        radial-gradient(circle at 11% 10%, rgba(213,182,106,.28), transparent 26%),
        radial-gradient(circle at 90% 36%, rgba(15,118,110,.18), transparent 30%),
        linear-gradient(135deg,#08111f,#101b2d 55%,#18243a);
    color: #fff;
    display: grid;
    place-items: center;
    padding: 22px;
}
.hero-card { width: min(1120px, 100%); align-items: center; }
.hero-panel { padding: 24px; border: 1px solid rgba(213,182,106,.16); background: rgba(255,255,255,.065); backdrop-filter: blur(12px); border-radius: 30px; box-shadow: 0 24px 70px rgba(0,0,0,.20); }
.hero h1 { font-size: clamp(34px, 12vw, 58px); line-height: 1.02; margin: 0 0 16px; letter-spacing: -.06em; }
.hero p { color: #d4d9e2; font-size: 15px; line-height: 1.65; }
.login-box { background: linear-gradient(180deg, #fffdf8, #f7f2e8); color: var(--navy); border-radius: 30px; padding: 22px; box-shadow: 0 34px 90px rgba(0,0,0,.28); border: 1px solid rgba(213, 182, 106, .20); }
.login-box h2 { margin-top: 0; color: var(--navy); }
.status-flow { display:flex; gap:8px; flex-wrap:wrap; }
.status-flow .step { padding:8px 10px; border-radius:999px; background:#eee8de; font-size:12px; font-weight:900; color:#5b6472; }
.status-flow .step.done { background:#e5f4ec; color:#0f766e; }
.keep-login-note { margin-top: 12px; padding: 10px 12px; border-radius: 16px; background: #f2eadc; color: #5b6472; font-size: 12px; line-height: 1.5; border: 1px solid #e1d6c4; }


.hero-minimal .hero-card-single { width: min(640px, 100%); display: block; }
.hero-center { text-align: center; padding: 34px 24px; }
.hero-center h1 { max-width: 10ch; margin-left: auto; margin-right: auto; }
@media (min-width: 720px) { .hero-minimal .hero-card-single { grid-template-columns: 1fr; } .hero-center { padding: 52px 40px; } }

/* Tablet and desktop */
@media (min-width: 720px) {
    .main { padding: 24px; }
    .topbar { grid-template-columns: 1fr auto; align-items: center; }
    .user-pill { width: auto; border-radius: 999px; }
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-grid { grid-template-columns: 1.2fr .8fr; }
    .hero-card { grid-template-columns: 1.12fr .88fr; gap: 24px; }
    .hero-panel { padding: 34px; }
}

@media (min-width: 1040px) {
    .app-shell { display: grid; grid-template-columns: 286px 1fr; }
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 24px;
        border-bottom: 0;
        border-right: 1px solid rgba(255,255,255,.08);
    }
    .brand { margin-bottom: 28px; }
    .nav-title { display: block; color: #8793a6; text-transform: uppercase; font-size: 11px; letter-spacing: .13em; margin: 22px 0 8px; }
    .nav-link {
        display: flex;
        border-radius: 15px;
        margin: 0 0 6px;
        padding: 11px 12px;
        font-size: 14px;
        background: transparent;
        white-space: normal;
    }
    .main { padding: 30px; }
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
    .main { padding: 14px; }
    .card { padding: 14px; border-radius: 21px; }
    .btn { width: 100%; }
    .action-row .btn { width: auto; }
    .hero { padding: 16px; }
    .login-box { padding: 18px; }
}

@media print {
    body { background:white; }
    .no-print { display:none !important; }
    .voucher-page { box-shadow:none !important; border:0 !important; }
}
