/* ==========================================================================
   Balance — design system
   Mobile-first: үндсэн загвар гар утсанд, 900px-ээс дээш desktop (sidebar).
   Өнгө, зай, фонтыг зөвхөн token-оор (--*) ашиглана.
   ========================================================================== */

:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f1f4f7;
    --surface-3: #e8edf2;
    --text: #0f1b2a;
    --text-2: #3d4b5c;
    --muted: #66768a;
    --border: #dfe5ec;
    --border-strong: #c5cfda;

    --brand: #0f766e;
    --brand-strong: #0b5c56;
    --brand-soft: #e3f4f2;
    --brand-contrast: #ffffff;

    --success: #15803d;
    --success-soft: #e5f6ea;
    --warning: #b45309;
    --warning-soft: #fdf1df;
    --danger: #b91c1c;
    --danger-soft: #fdeaea;
    --info: #1d4ed8;
    --info-soft: #e6edfd;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-full: 999px;

    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;

    --shadow-1: 0 1px 2px rgba(15, 27, 42, .06), 0 1px 1px rgba(15, 27, 42, .04);
    --shadow-2: 0 6px 20px rgba(15, 27, 42, .10);
    --shadow-3: 0 18px 48px rgba(15, 27, 42, .18);

    --topbar-h: 56px;
    --bottom-h: 64px;
    --sidebar-w: 256px;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c131b;
    --surface: #131c26;
    --surface-2: #19242f;
    --surface-3: #22303d;
    --text: #e8eef5;
    --text-2: #c2ccd8;
    --muted: #8b9aab;
    --border: #253341;
    --border-strong: #34475a;
    --brand: #2dd4bf;
    --brand-strong: #5eead4;
    --brand-soft: #0f2f2d;
    --brand-contrast: #06201d;
    --success: #4ade80;
    --success-soft: #10301d;
    --warning: #fbbf24;
    --warning-soft: #33270b;
    --danger: #f87171;
    --danger-soft: #3a1515;
    --info: #93b4ff;
    --info-soft: #172443;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 6px 20px rgba(0, 0, 0, .45);
    --shadow-3: 0 18px 48px rgba(0, 0, 0, .6);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0c131b; --surface: #131c26; --surface-2: #19242f; --surface-3: #22303d;
        --text: #e8eef5; --text-2: #c2ccd8; --muted: #8b9aab; --border: #253341; --border-strong: #34475a;
        --brand: #2dd4bf; --brand-strong: #5eead4; --brand-soft: #0f2f2d; --brand-contrast: #06201d;
        --success: #4ade80; --success-soft: #10301d; --warning: #fbbf24; --warning-soft: #33270b;
        --danger: #f87171; --danger-soft: #3a1515; --info: #93b4ff; --info-soft: #172443;
        --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 6px 20px rgba(0, 0, 0, .45); --shadow-3: 0 18px 48px rgba(0, 0, 0, .6);
    }
}

/* ── Үндэс ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    font: 400 16px/1.5 var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s4) 0; }

/* FocusOnNavigate гарчгийг (tabindex=-1) программаар focus хийдэг — хүрээ харуулахгүй. */
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s3); }
.row-wrap { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-2 { margin-top: var(--s2); } .mt-4 { margin-top: var(--s4); } .mt-6 { margin-top: var(--s6); }

/* ── Shell ─────────────────────────────────────────────────────────────── */

.shell { min-height: 100dvh; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: var(--s3);
    padding: 0 var(--s4);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: var(--brand-contrast); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }

.icon-btn {
    width: 44px; height: 44px; border-radius: var(--r-full);
    display: inline-grid; place-items: center;
    background: transparent; border: 0; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.avatar {
    width: 36px; height: 36px; border-radius: var(--r-full);
    display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand-strong);
    font-weight: 700; font-size: .9rem;
}

.content {
    width: 100%; max-width: 1080px; margin: 0 auto;
    padding: var(--s4) var(--s4) calc(var(--bottom-h) + var(--safe-b) + var(--s8));
}

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottom-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15, 27, 42, .05);
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font-size: .72rem; font-weight: 600; text-decoration: none;
}
.bottom-nav a .icon { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a.active .nav-pill { background: var(--brand-soft); }
.nav-pill { padding: 3px 16px; border-radius: var(--r-full); display: grid; place-items: center; transition: background .15s; }

.sidebar { display: none; }

@media (min-width: 900px) {
    .shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
    .topbar.mobile-only, .bottom-nav { display: none; }
    .sidebar {
        display: flex; flex-direction: column; gap: var(--s2);
        position: sticky; top: 0; height: 100dvh;
        padding: var(--s5) var(--s4);
        background: var(--surface); border-right: 1px solid var(--border);
    }
    .sidebar .brand { padding: 0 var(--s2) var(--s4); }
    .side-nav { display: flex; flex-direction: column; gap: 2px; }
    .side-nav a {
        display: flex; align-items: center; gap: var(--s3);
        min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-md);
        color: var(--text-2); font-weight: 600; text-decoration: none;
    }
    .side-nav a:hover { background: var(--surface-2); color: var(--text); }
    .side-nav a.active { background: var(--brand-soft); color: var(--brand-strong); }
    .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); }
    .content { padding: var(--s8) var(--s8) var(--s10); }
}

/* ── Хуудасны толгой ───────────────────────────────────────────────────── */

.page-head { display: flex; align-items: flex-start; gap: var(--s3); margin-bottom: var(--s5); }
.page-head .grow p { margin-top: 4px; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: var(--s2); }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s6) 0 var(--s3); }
.section-title h2 { font-size: 1.05rem; }

/* ── Card, list ───────────────────────────────────────────────────────── */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-body { padding: var(--s4); }
.card-pad { padding: var(--s5); }
@media (min-width: 900px) { .card-body { padding: var(--s5); } }

.card-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card-link.row { display: flex; }
.card-link:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.card-link:active { transform: scale(.995); }

.grid { display: grid; gap: var(--s3); }
.grid > * { min-width: 0; } /* урт текст grid баганыг тэлж хэвтээ гүйлгээ үүсгэхгүй */
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--border); }
.list-item { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); min-height: 60px; color: inherit; text-decoration: none; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }

.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 10px var(--s4); }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* ── Товч ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
    min-height: 44px; padding: 0 var(--s4);
    border-radius: var(--r-md); border: 1px solid transparent;
    font-weight: 650; font-size: .95rem; line-height: 1; cursor: pointer;
    text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); }
.btn-lg { min-height: 52px; font-size: 1.02rem; border-radius: var(--r-lg); }
.btn-sm { min-height: 36px; padding: 0 var(--s3); font-size: .875rem; }
.btn-block { width: 100%; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fab {
    position: fixed; right: var(--s4); bottom: calc(var(--bottom-h) + var(--safe-b) + var(--s4)); z-index: 25;
    height: 56px; padding: 0 var(--s5); border-radius: var(--r-full);
    display: inline-flex; align-items: center; gap: var(--s2);
    background: var(--brand); color: var(--brand-contrast); font-weight: 700;
    box-shadow: var(--shadow-3); text-decoration: none;
}
.fab:hover { text-decoration: none; background: var(--brand-strong); }
@media (min-width: 900px) { .fab { display: none; } }
.desktop-only { display: none !important; }
@media (min-width: 900px) { .desktop-only { display: inline-flex !important; } .mobile-hide-desktop { display: none !important; } }

/* ── Маягт ────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.label-row { display: flex; align-items: center; gap: 4px; min-height: 28px; }
.label { font-weight: 650; font-size: .92rem; color: var(--text); }
.hint { font-size: .84rem; color: var(--muted); }
.error-text { font-size: .86rem; color: var(--danger); font-weight: 600; }

.input, .select, .textarea {
    width: 100%; min-height: 48px; padding: 10px 14px;
    border-radius: var(--r-md); border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text);
    font-size: 16px; /* iOS focus үед томруулахгүй */
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.invalid { border-color: var(--danger); }
.input-xl { min-height: 58px; font-size: 1.35rem; font-weight: 650; letter-spacing: .04em; text-align: center; border-radius: var(--r-lg); }
.otp-input { letter-spacing: .5em; font-family: var(--mono); font-size: 1.6rem; text-align: center; padding-left: .5em; }

.input-group { position: relative; }
.input-group .input { padding-right: 52px; }
.input-group .icon-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }

.check { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }

.choices { display: grid; gap: var(--s3); }
@media (min-width: 640px) { .choices-3 { grid-template-columns: repeat(3, 1fr); } .choices-2 { grid-template-columns: repeat(2, 1fr); } }
.choice {
    position: relative; display: flex; gap: var(--s3); align-items: flex-start;
    padding: var(--s4); border-radius: var(--r-lg);
    border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer;
    transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--brand); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.choice-icon { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.choice .choice-icon { background: var(--surface-2); }
.choice.selected .choice-icon { background: var(--surface); }
.choice strong { display: block; }
.choice span.small { color: var(--muted); }

/* ── (i) тусламж ──────────────────────────────────────────────────────── */

.help-tip {
    position: relative;
    width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
    display: inline-grid; place-items: center;
    background: var(--info-soft); color: var(--info); cursor: pointer; flex: none;
}
.help-tip::before { content: ""; position: absolute; inset: -11px; } /* хурууны 44px талбай */
.help-tip .icon { width: 14px; height: 14px; }
.help-tip:hover { background: var(--info); color: #fff; }

.help-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--info); font-weight: 600; font-size: .88rem; background: none; border: 0; padding: 0; cursor: pointer; }

/* ── Sheet / modal: утсанд доороос, desktop-д голд ────────────────────── */

.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(8, 15, 24, .5); animation: fade .18s ease-out; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
    max-height: 88dvh; display: flex; flex-direction: column;
    background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--shadow-3);
    padding-bottom: var(--safe-b);
    animation: rise .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4) var(--s5) var(--s2); }
.sheet-head h2 { flex: 1; font-size: 1.12rem; padding-top: 8px; }
.sheet-body { padding: var(--s2) var(--s5) var(--s5); overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: var(--s3); padding: var(--s3) var(--s5) var(--s5); border-top: 1px solid var(--border); }
.sheet-foot .btn { flex: 1; }
@media (min-width: 900px) {
    .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, calc(100vw - 48px)); transform: translate(-50%, -50%); border-radius: var(--r-xl); animation: pop .18s ease-out; }
    .sheet-handle { display: none; }
    .sheet-foot { justify-content: flex-end; }
    .sheet-foot .btn { flex: 0 0 auto; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%); } }

.help-body { display: flex; flex-direction: column; gap: var(--s3); color: var(--text-2); }
.help-body ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.help-example { padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); font-size: .92rem; }
.help-law { display: flex; gap: var(--s2); align-items: flex-start; font-size: .85rem; color: var(--muted); }

/* ── Badge, chip, banner ─────────────────────────────────────────────── */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-full); font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge .icon { width: 13px; height: 13px; }
.badge-brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }

.chips { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 0 var(--s4); border-radius: var(--r-full); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: .9rem; cursor: pointer; }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }

.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); font-size: .92rem; }
.banner .icon { margin-top: 2px; }
.banner-info { background: var(--info-soft); color: color-mix(in srgb, var(--info) 80%, var(--text)); }
.banner-warning { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 80%, var(--text)); }
.banner-success { background: var(--success-soft); color: color-mix(in srgb, var(--success) 80%, var(--text)); }
.banner-danger { background: var(--danger-soft); color: var(--danger); }

/* ── Tabs (гүйлгэдэг segmented) ───────────────────────────────────────── */

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-lg); background: var(--surface-3); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s4); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-height: 40px; padding: 0 var(--s4); border: 0; border-radius: var(--r-md); background: transparent; color: var(--text-2); font-weight: 650; font-size: .92rem; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }

/* ── Progress, steps ─────────────────────────────────────────────────── */

.progress { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .3s; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { display: flex; gap: var(--s3); padding: var(--s3) 0; }
.step + .step { border-top: 1px dashed var(--border); }
.step-mark { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--surface-3); color: var(--muted); }
.step.done .step-mark { background: var(--success); color: #fff; }
.step.next .step-mark { background: var(--brand); color: var(--brand-contrast); }
.step .grow strong { display: block; }

.wizard { display: flex; gap: 6px; margin-bottom: var(--s5); }
.wizard span { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.wizard span.on { background: var(--brand); }

/* ── Stats, deadlines ────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.stat { padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.stat .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 600; }

.date-block { width: 52px; flex: none; border-radius: var(--r-md); background: var(--surface-2); text-align: center; padding: 6px 0; line-height: 1.1; }
.date-block .d { font-size: 1.3rem; font-weight: 800; }
.date-block .m { font-size: .72rem; color: var(--muted); font-weight: 700; }
.date-block.soon { background: var(--warning-soft); color: var(--warning); }
.date-block.urgent { background: var(--danger-soft); color: var(--danger); }
.date-block.soon .m, .date-block.urgent .m { color: inherit; }

.cat-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.cat-1 { background: #0ea5e9; } .cat-2 { background: #f59e0b; } .cat-3 { background: #8b5cf6; } .cat-4 { background: #10b981; }

.hero {
    padding: var(--s5); border-radius: var(--r-xl);
    background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 60%, #0b3b6a) 100%);
    color: #fff;
}
.hero p { opacity: .92; }
.hero .btn-primary { background: #fff; color: #0b4f4a; }
.hero .btn-primary:hover { background: #ecfdf9; }

/* ── Хоосон, ачааллах ────────────────────────────────────────────────── */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s8) var(--s4); }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty-icon .icon { width: 30px; height: 30px; }
.empty p { color: var(--muted); max-width: 420px; }

.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Toast ───────────────────────────────────────────────────────────── */

.toasts { position: fixed; z-index: 80; left: var(--s4); right: var(--s4); top: calc(var(--topbar-h) + var(--s2)); display: flex; flex-direction: column; gap: var(--s2); pointer-events: none; }
@media (min-width: 900px) { .toasts { left: auto; top: auto; bottom: var(--s6); right: var(--s6); width: 380px; } }
.toast { pointer-events: auto; display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--text); color: var(--surface); box-shadow: var(--shadow-3); animation: pop-in .2s ease-out; font-size: .94rem; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px); } }

/* ── Auth (нэвтрэх) ──────────────────────────────────────────────────── */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--s5) var(--s4) calc(var(--s8) + var(--safe-b)); background:
    radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
    radial-gradient(900px 400px at 110% 110%, color-mix(in srgb, #3b82f6 12%, transparent), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .card-pad { padding: var(--s6) var(--s5); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: var(--s3); text-align: center; margin-bottom: var(--s5); }
.auth-brand .brand-mark { width: 56px; height: 56px; border-radius: 18px; }
.auth-brand .brand-mark svg { width: 32px; height: 32px; }
.auth-foot { margin-top: var(--s4); text-align: center; font-size: .84rem; color: var(--muted); }
.dev-code { font-family: var(--mono); background: var(--warning-soft); color: var(--warning); padding: 2px 8px; border-radius: 6px; font-weight: 700; }

/* ── Splash (WASM ачааллах) ──────────────────────────────────────────── */

.splash { min-height: 100dvh; display: grid; place-items: center; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: var(--s4); }
.splash .brand-mark { width: 64px; height: 64px; border-radius: 20px; }
.splash .brand-mark svg { width: 36px; height: 36px; }
.splash-bar { width: 160px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: var(--blazor-load-percentage, 10%); background: var(--brand); transition: width .2s; }

/* ── Хүснэгт (хуулга) ───────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.amount-in { color: var(--success); font-weight: 650; }
.amount-out { color: var(--danger); font-weight: 650; }

/* ── Тусламжийн нийтлэл ─────────────────────────────────────────────── */

.article h2 { margin: var(--s6) 0 var(--s2); font-size: 1.1rem; }
.article p, .article li { color: var(--text-2); }
.article ul, .article ol { padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Blazor-ийн алдааны мөр */
#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; padding: 12px 16px; background: var(--danger); color: #fff; }
#blazor-error-ui .reload { color: #fff; font-weight: 700; text-decoration: underline; margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
