:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --ink: #0f172a;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e2e8f0;
    --primary: #0b5fff;
    --primary-dark: #0747c7;
    --primary-soft: #eaf1ff;
    --accent: #00b894;
    --accent-soft: #e6fff8;
    --warning: #b54708;
    --warning-soft: #fff7df;
    --danger: #c62828;
    --danger-soft: #fff0f0;
    --success: #047857;
    --success-soft: #e9fbf3;
    --info: #026aa2;
    --info-soft: #e9f6ff;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --shadow-soft: 0 8px 22px rgba(15, 23, 42, .06);
    --radius: 22px;
    --radius-sm: 14px;
    --sidebar: 286px;
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(11, 95, 255, .10), transparent 32rem),
        radial-gradient(circle at 80% 0%, rgba(0, 184, 148, .10), transparent 28rem),
        var(--bg);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
p { line-height: 1.55; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    width: var(--sidebar);
    min-width: var(--sidebar);
    height: 100vh;
    padding: 22px 18px;
    background: rgba(255,255,255,.92);
    border-right: 1px solid rgba(226,232,240,.85);
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 50;
}
.brand, .mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
}
.brand small, .mobile-brand small, .sidebar-user small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}
.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-grid;
    place-items: center;
    color: white;
    background: linear-gradient(135deg, var(--primary), #003383 72%);
    box-shadow: 0 12px 24px rgba(11,95,255,.24);
    font-weight: 950;
    letter-spacing: -.05em;
    flex: 0 0 auto;
}
.nav { display: grid; gap: 8px; }
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 11px 13px;
    border-radius: 14px;
    color: #334155;
    font-weight: 800;
}
.nav a:hover { background: var(--panel-soft); color: var(--primary); }
.nav a.active {
    background: linear-gradient(135deg, var(--primary-soft), #ffffff);
    color: var(--primary-dark);
    border: 1px solid #dbe7ff;
    box-shadow: var(--shadow-soft);
}
.sidebar-card {
    margin-top: auto;
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(145deg, #eef5ff, #ffffff);
    border: 1px solid #dbe7ff;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--line);
}
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 950;
}
.sidebar-links { margin-top: 3px; font-size: 12px; font-weight: 800; color: var(--muted); }
.content-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 28px 0;
}
.top-actions, .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mobile-topbar { display: none; }
.container { width: min(1260px, calc(100% - 56px)); margin: 0 auto; padding: 24px 0 34px; }
.container-auth { width: min(460px, calc(100% - 32px)); padding-top: 7vh; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}
.page-head h1, .page-head h2 { margin: 0; letter-spacing: -.04em; }
.page-head h1 { font-size: clamp(30px, 4vw, 46px); }
.page-head h2 { font-size: 22px; }
.page-head p { margin: 7px 0 0; color: var(--muted); }
.hero {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    margin-bottom: 18px;
    border: 1px solid rgba(219,231,255,.95);
    border-radius: 30px;
    background:
        linear-gradient(135deg, rgba(11,95,255,.10), rgba(0,184,148,.08)),
        #fff;
    box-shadow: var(--shadow);
}
.hero::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -80px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(11,95,255,.12);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { margin: 0; font-size: clamp(31px, 4vw, 48px); letter-spacing: -.05em; }
.hero p { color: var(--muted); margin: 10px 0 0; max-width: 720px; }
.hero-actions { align-self: center; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mini-label { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.card, .stat, .statement {
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}
.card { margin-bottom: 18px; }
.card.compact { padding: 18px; }
.card h2 { margin-top: 0; letter-spacing: -.03em; }
.card h3 { margin: 0 0 8px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
    position: relative;
    overflow: hidden;
    min-height: 128px;
}
.stat::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.stat span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.stat strong { display: block; font-size: clamp(25px, 3vw, 36px); margin-top: 9px; letter-spacing: -.05em; }
.stat small { display: block; color: var(--muted); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 850; margin-bottom: 7px; color: #1e293b; }
input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 12px 13px;
    min-height: 46px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea { min-height: 104px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: #7aa7ff;
    box-shadow: 0 0 0 4px rgba(11,95,255,.13);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.help { color: var(--muted); font-size: 13px; margin: 7px 0 0; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(11,95,255,.18);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { color: white; transform: translateY(-1px); box-shadow: 0 14px 26px rgba(11,95,255,.24); }
.btn.secondary { background: #fff; color: #334155; border-color: var(--line); box-shadow: none; }
.btn.secondary:hover { color: var(--primary); background: var(--panel-soft); box-shadow: var(--shadow-soft); }
.btn.danger { background: linear-gradient(135deg, #e5484d, var(--danger)); }
.btn.small { min-height: 36px; padding: 8px 11px; border-radius: 11px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 13px;
    font-size: 20px;
}
.searchbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.82);
    box-shadow: var(--shadow-soft);
}
.searchbar input, .searchbar select { width: auto; min-width: 220px; flex: 1; }
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 780px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdff; }
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 900;
    font-size: 12px;
    white-space: nowrap;
}
.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); }
.badge.muted { background: #f1f5f9; color: #475569; }
.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-weight: 700;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.alert-info { background: var(--info-soft); color: var(--info); border-color: #bae6fd; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 9px 14px; }
.kv div:nth-child(odd) { color: var(--muted); font-weight: 850; }
.statement {
    padding: 32px;
    background: #fff;
}
.statement-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 2px solid var(--line);
    padding-bottom: 18px;
    margin-bottom: 20px;
}
.statement-title h1 { margin: 0; }
.statement-title p { margin: 4px 0; color: var(--muted); }
.copy-box { width: 100%; min-height: 190px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.auth-body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(11,95,255,.10), rgba(0,184,148,.10)),
        var(--bg);
}
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo .brand-mark { margin: 0 auto 12px; width: 58px; height: 58px; border-radius: 20px; }
.auth-logo h1 { margin: 0; letter-spacing: -.05em; }
.login-card { padding: 26px; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.balance-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-weight: 900; }
.balance-pill.danger { background: var(--danger-soft); color: var(--danger); }
.balance-pill.success { background: var(--success-soft); color: var(--success); }
.balance-pill.muted { background: #f1f5f9; color: #475569; }
.empty-state {
    text-align: center;
    padding: 34px 18px;
    color: var(--muted);
}
.empty-state strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.footer {
    width: min(1260px, calc(100% - 56px));
    margin: auto auto 0;
    padding: 12px 0 24px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}
@media (max-width: 1080px) {
    .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero { flex-direction: column; }
    .hero-actions { align-self: flex-start; justify-content: flex-start; }
}
@media (max-width: 860px) {
    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 80;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 14px;
        background: rgba(255,255,255,.92);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(14px);
    }
    .mobile-brand .brand-mark { width: 38px; height: 38px; border-radius: 13px; }
    .app-shell { display: block; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-102%);
        transition: transform .22s ease;
        width: min(86vw, 310px);
        min-width: 0;
        box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,.35);
        z-index: 40;
    }
    .sidebar-backdrop.open { display: block; }
    .content-top { display: none; }
    .container { width: min(100% - 28px, 1260px); padding-top: 18px; }
    .footer { width: min(100% - 28px, 1260px); flex-direction: column; }
    .page-head { flex-direction: column; }
    .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid { grid-template-columns: 1fr; }
    .searchbar input, .searchbar select { min-width: 100%; }
    .statement-head { flex-direction: column; }
    .text-right { text-align: left; }
    .kv { grid-template-columns: 1fr; }
    .hero { padding: 22px; border-radius: 24px; }
}
@media (max-width: 520px) {
    .actions, .hero-actions, .top-actions { width: 100%; }
    .actions .btn, .hero-actions .btn { width: 100%; }
    .stat { min-height: auto; }
    .card, .stat, .statement { border-radius: 18px; padding: 16px; }
    .statement { padding: 16px; }
}
@media print {
    body { background: #fff !important; }
    .no-print, .sidebar, .mobile-topbar, .content-top, .footer, .actions, .alert, .btn { display: none !important; }
    .app-shell, .content-shell { display: block; min-height: auto; }
    .container { width: 100%; margin: 0; padding: 0; }
    .statement, .card { box-shadow: none; border: 0; padding: 0; }
    table { min-width: 0; font-size: 11px; }
    th { position: static; }
}
