:root {
    --bg: #f3f6fb;
    --bg-2: #eef2ff;
    --surface: rgba(255,255,255,.88);
    --surface-strong: #ffffff;
    --line: #dbe4f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #1d4ed8;
    --primary-2: #2563eb;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 20px 45px rgba(15, 23, 42, .10);
    --radius: 22px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(59,130,246,.14), transparent 28%),
        radial-gradient(circle at top right, rgba(16,185,129,.12), transparent 22%),
        linear-gradient(180deg, #f7f9fc, #eef4fb 55%, #edf2f8);
}
a { color: var(--primary); }
.app-shell { display: block; min-height: 100vh; }
.sidebar {
    width: 300px;
    color: #fff;
    background: linear-gradient(180deg, #0f172a 0%, #102342 45%, #0f172a 100%);
    padding: 26px 18px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 10px 0 30px rgba(15, 23, 42, .18);
}
.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.06);
    border-radius: 18px;
    margin-bottom: 24px;
}
.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-title { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.brand-subtitle { font-size: 12px; color: #bfd2f5; margin-top: 2px; }
.menu-section { margin-bottom: 18px; }
.menu-caption {
    padding: 6px 12px 10px;
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 11px;
    font-weight: 700;
}
.menu-link {
    display: block;
    text-decoration: none;
    color: #dbeafe;
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 7px;
    transition: .2s ease;
    border: 1px solid transparent;
}
.menu-link:hover,
.menu-link.active {
    background: rgba(255,255,255,.09);
    color: #fff;
    border-color: rgba(255,255,255,.08);
    transform: translateX(2px);
}
.danger-link:hover { background: rgba(220,38,38,.14); border-color: rgba(220,38,38,.2); }
.sidebar-footer { margin-top: 10px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.content { margin-left: 300px; min-height: 100vh; padding: 24px; overflow-x: hidden; }
.topbar {
    padding: 18px 22px;
    border-radius: 22px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.55);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 22px; font-weight: 800; }
.topbar-subtitle { color: var(--muted); font-size: 13px; }
.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.user-panel {
    min-width: 180px;
    border-radius: 18px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(56,189,248,.08));
    border: 1px solid rgba(37,99,235,.10);
}
.user-panel strong { display: block; font-size: 15px; }
.user-panel span { color: var(--muted); font-size: 13px; }
.mobile-only { display: none; }
h1 { font-size: 30px; margin-bottom: 10px; }
h2 { font-size: 20px; margin-bottom: 14px; }
p { line-height: 1.6; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin: 18px 0 22px; }
.card,
.table-wrap,
.form-wrap,
.hero-box {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: var(--shadow);
}
.card { padding: 22px; position: relative; overflow: hidden; }
.card::after {
    content: "";
    position: absolute;
    right: -20px;
    top: -20px;
    width: 90px;
    height: 90px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(37,99,235,.12), transparent 70%);
}
.card h3 { font-size: 13px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.card strong { font-size: 31px; }
.card .money { font-size: 28px; font-weight: 800; }
.table-wrap, .form-wrap, .hero-box { padding: 24px; margin-bottom: 22px; }
.hero-box {
    background: linear-gradient(135deg, rgba(15,23,42,.96), rgba(30,64,175,.92));
    color: #fff;
}
.hero-box p, .hero-box .muted-hero { color: #dbeafe; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mini-grid { display: grid; grid-template-columns: 1.25fr .95fr; gap: 18px; margin-bottom: 20px; }
label { display: block; margin-bottom: 4px; font-weight: 700; color: #334155; }
input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    margin-top: 8px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.92);
    color: var(--text);
    outline: none;
    transition: .2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(37,99,235,.45);
    box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}
textarea { resize: vertical; min-height: 110px; }
button, .btn {
    appearance: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-height: 44px;
    padding: 11px 18px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 10px 20px rgba(37,99,235,.18);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 16px 28px rgba(37,99,235,.22); }
.btn-secondary { background: linear-gradient(135deg, #334155, #475569); }
.btn-success { background: linear-gradient(135deg, #059669, #10b981); }
.btn-warning { background: linear-gradient(135deg, #b45309, #f59e0b); }
.btn-danger { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.badge, .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge { background: #e2e8f0; color: #1e293b; }
.badge-primary, .status-pill { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.alert-success, .alert-danger, .alert-warning {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
table { width: 100%; border-collapse: collapse; overflow: hidden; }
table th, table td {
    padding: 13px 12px;
    text-align: left;
    border-bottom: 1px solid #e7eef7;
    vertical-align: top;
}
table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    background: rgba(241,245,249,.72);
}
table tr:hover td { background: rgba(248,250,252,.72); }
.actions a { margin-right: 10px; color: var(--primary); font-weight: 700; text-decoration: none; }
.chart-list { display: grid; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 180px 1fr 110px; gap: 12px; align-items: center; }
.chart-label { color: #334155; font-size: 14px; }
.chart-bar { width: 100%; height: 14px; border-radius: 999px; background: #dbe4f0; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2563eb, #38bdf8); }
.chart-value { text-align: right; font-weight: 800; }
.kpi-note { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.list-clean { list-style: none; display: grid; gap: 12px; }
.list-clean li {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid #e5edf7;
    background: rgba(255,255,255,.6);
}
.money-positive { color: #166534; }
.money-negative { color: #991b1b; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.no-wrap { white-space: nowrap; }
@media (max-width: 1100px) {
    .mini-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar {
        position: fixed;
        z-index: 999;
        transform: translateX(-110%);
        transition: transform .22s ease;
        width: min(310px, calc(100vw - 28px));
        height: calc(100vh - 18px);
        top: 9px;
        left: 9px;
        bottom: auto;
        border-radius: 24px;
    }
    .content { margin-left: 0; width: 100%; padding: 16px; }
    .menu-toggle { display: inline-grid; place-items: center; }
    .desktop-only { display: none; }
    .mobile-only { display: block; }
    .topbar { padding: 16px; }
    .grid-2, .grid-3, .cards, .chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    h1 { font-size: 24px; }
    .table-wrap, .form-wrap, .hero-box, .card { padding: 18px; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
    .toolbar .btn, .toolbar button { width: 100%; }
}
@media print {
    .sidebar, .topbar, .toolbar, .menu-toggle, .no-print { display: none !important; }
    body { background: #fff; }
    .content { padding: 0; }
    .card, .table-wrap, .form-wrap, .hero-box { box-shadow: none; border: 1px solid #e5e7eb; backdrop-filter: none; background: #fff; }
}
