:root {
    --navy: #10263b;
    --navy-deep: #0b1c2d;
    --navy-soft: #1b3954;
    --mint: #84d2bc;
    --mint-deep: #3ea88b;
    --sky: #76b6ec;
    --orange: #f3ad70;
    --violet: #a995e7;
    --ink: #173046;
    --muted: #728496;
    --muted-light: #a5b4c1;
    --line: #e2e9ee;
    --canvas: #f4f7f9;
    --white: #fff;
    --danger: #c65b61;
    --shadow: 0 14px 38px rgba(23, 48, 70, .06);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; letter-spacing: -.04em; line-height: 1.15; }
h2 { font-size: 22px; letter-spacing: -.035em; line-height: 1.2; }
h3 { font-size: 15px; letter-spacing: -.015em; }
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex: 0 0 238px; flex-direction: column; min-height: 100vh; padding: 27px 15px 18px; color: #eaf2f4; background: var(--navy); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 39px; }
.sidebar-brand strong { display: block; font-size: 14px; letter-spacing: .14em; }
.sidebar-brand small { display: block; margin-top: 2px; color: #8ca0af; font-size: 10px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--navy); background: var(--mint); font-size: 11px; font-weight: 900; letter-spacing: .03em; }
.sidebar-label { padding: 0 12px 9px; color: #71889b; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.main-nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; color: #a9bbc7; background: transparent; cursor: pointer; font-size: 13px; text-align: left; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: var(--navy); background: var(--mint); font-weight: 750; }
.nav-icon { display: grid; width: 19px; place-items: center; color: currentColor; font-size: 17px; font-weight: 500; }
.sidebar-note { display: flex; gap: 10px; margin: auto 7px 25px; padding: 12px; border: 1px solid rgba(132,210,188,.22); border-radius: 10px; background: rgba(132,210,188,.08); }
.sidebar-note-icon { display: grid; flex: 0 0 22px; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: var(--navy); background: var(--mint); font-size: 11px; font-weight: 900; }
.sidebar-note strong, .sidebar-note span { display: block; }
.sidebar-note strong { font-size: 11px; }
.sidebar-note span { margin-top: 3px; color: #8ea4b2; font-size: 10px; line-height: 1.35; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 15px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--navy); background: #d5e5ed; font-size: 12px; font-weight: 850; }
.sidebar-user-copy { min-width: 0; }
.sidebar-user-copy strong, .sidebar-user-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { color: #f3f7f8; font-size: 11px; }
.sidebar-user-copy span { margin-top: 2px; color: #8398a7; font-size: 10px; }
.logout-link { margin-left: auto; color: #96aab8; font-size: 17px; }
.logout-link:hover { color: #fff; }

.main-content { flex: 1; min-width: 0; max-width: 1600px; padding: 31px 42px 54px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 33px; }
.topbar h1 { margin-top: 5px; }
.topbar-actions, .heading-actions { display: flex; align-items: center; gap: 10px; }
.global-search { display: flex; align-items: center; width: 278px; height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; }
.global-search span { margin-right: 8px; font-size: 21px; line-height: 1; }
.global-search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.global-search input::placeholder { color: #9aaab5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 760; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: var(--navy); background: var(--mint); box-shadow: 0 5px 12px rgba(62,168,139,.13); }
.button-primary:hover { background: #9be1cc; }
.button-quiet { border-color: var(--line); color: var(--ink); background: #fff; }
.button-quiet:hover { border-color: #bfd1dc; background: #f9fbfc; }
.button-wide { width: 100%; }
.text-button { padding: 3px 0; border: 0; color: var(--mint-deep); background: transparent; cursor: pointer; font-size: 11px; font-weight: 750; }
.flash { position: fixed; z-index: 20; top: 21px; right: 24px; display: none; max-width: 360px; padding: 12px 15px; border-radius: 9px; color: #174f42; background: #d9f1e9; box-shadow: var(--shadow); font-size: 12px; font-weight: 650; }
.flash.visible { display: block; animation: flash-in .22s ease-out; }
.flash.error { color: #7d2d33; background: #f8dddd; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }

.view { display: none; }
.view.active { display: block; }
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.view-heading .muted { margin-top: 5px; font-size: 12px; }
.period-control { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.period-button { min-width: 47px; padding: 7px 10px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; }
.period-button.active { color: var(--navy); background: #e4f5ef; font-weight: 800; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.kpi-card { position: relative; overflow: hidden; min-height: 123px; padding: 18px 19px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.kpi-card::after { position: absolute; right: -29px; bottom: -38px; width: 110px; height: 110px; border-radius: 50%; content: ""; opacity: .11; }
.accent-mint::after { background: var(--mint); }.accent-blue::after { background: var(--sky); }.accent-orange::after { background: var(--orange); }.accent-violet::after { background: var(--violet); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 650; }
.kpi-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: var(--navy); background: #eef4f6; font-size: 12px; font-weight: 850; }
.accent-mint .kpi-icon { color: #297d6d; background: #e0f4ed; }.accent-blue .kpi-icon { color: #3675a9; background: #e3f0fc; }.accent-orange .kpi-icon { color: #a66932; background: #fff0df; }.accent-violet .kpi-icon { color: #6f5ab7; background: #eee9fb; }
.kpi-card strong { position: relative; z-index: 1; display: block; margin-top: 18px; color: var(--navy); font-size: 25px; letter-spacing: -.045em; line-height: 1; }
.kpi-card small { position: relative; z-index: 1; display: block; margin-top: 9px; color: var(--muted); font-size: 10px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.63fr) minmax(315px, .9fr); gap: 16px; margin-bottom: 16px; }
.lower-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 19px; }
.panel-heading .muted { margin-top: 4px; font-size: 11px; }
.chart-panel { min-height: 300px; }
.chart-legend { display: flex; gap: 13px; padding-top: 2px; color: var(--muted); font-size: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }.legend-dot.mint { background: var(--mint-deep); }.legend-dot.blue { background: var(--sky); }
.monthly-chart { display: grid; grid-template-columns: repeat(12, minmax(20px, 1fr)); align-items: end; gap: 10px; height: 213px; padding: 18px 7px 0; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 52px, rgba(226,233,238,.65) 53px); }
.chart-column { display: flex; flex-direction: column; align-items: center; justify-content: end; height: 100%; gap: 7px; }
.bar-pair { display: flex; align-items: end; gap: 3px; width: 100%; height: calc(100% - 19px); }
.bar { min-height: 2px; flex: 1; border-radius: 4px 4px 1px 1px; transition: height .35s ease; }.bar.revenue { background: var(--mint); }.bar.expense { background: var(--sky); }
.chart-column label { color: var(--muted); font-size: 9px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; min-height: 219px; }
.donut { display: grid; flex: 0 0 142px; width: 142px; height: 142px; place-items: center; border-radius: 50%; background: conic-gradient(var(--mint) 0deg, var(--mint) 120deg, var(--sky) 120deg, var(--sky) 230deg, var(--orange) 230deg, var(--orange) 310deg, var(--violet) 310deg, var(--violet) 360deg); }
.donut::before { width: 94px; height: 94px; border-radius: 50%; background: #fff; content: ""; grid-area: 1 / 1; }
.donut > div { z-index: 1; display: flex; grid-area: 1 / 1; flex-direction: column; align-items: center; }
.donut strong { color: var(--navy); font-size: 17px; letter-spacing: -.04em; }.donut span { color: var(--muted); font-size: 9px; }
.donut-legend { display: grid; gap: 9px; min-width: 0; }.donut-legend-item { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }.donut-legend-item i { width: 7px; height: 7px; border-radius: 50%; }.donut-legend-item strong { color: var(--ink); font-size: 10px; }
.count-badge { display: inline-grid; min-width: 24px; height: 22px; place-items: center; padding: 0 7px; border-radius: 12px; color: #397568; background: #e4f5ef; font-size: 10px; font-weight: 800; }
.issue-list, .mini-list { display: grid; gap: 9px; }
.issue-item, .mini-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid #edf1f3; }.issue-item:last-child, .mini-item:last-child { border-bottom: 0; }
.issue-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--orange); }.issue-dot.danger { background: var(--danger); }.issue-dot.mint { background: var(--mint-deep); }
.issue-copy, .mini-copy { min-width: 0; }.issue-copy strong, .mini-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }.issue-copy span, .mini-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.mini-item { align-items: center; }.mini-value { margin-left: auto; color: var(--ink); font-size: 11px; font-weight: 800; white-space: nowrap; }.mini-value.income { color: #378b75; }.mini-value.expense { color: #527da1; }
.empty-state { display: grid; min-height: 80px; place-items: center; color: var(--muted); font-size: 11px; }.empty-cell { padding: 40px 20px !important; color: var(--muted); text-align: center; }

.toolbar { display: flex; align-items: center; gap: 12px; margin: -2px 0 12px; }.segmented { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }.segment { padding: 7px 11px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; }.segment.active { color: var(--navy); background: #e4f5ef; font-weight: 800; }.toolbar-count { margin-left: auto; font-size: 11px; }
.table-panel { padding: 0; overflow: hidden; }.table-panel > .panel-heading { margin: 0; padding: 20px 20px 0; }.table-scroll { overflow-x: auto; }
.data-table { width: 100%; min-width: 880px; border-collapse: collapse; text-align: left; }.data-table th { padding: 12px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); background: #fbfcfd; font-size: 10px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }.data-table td { padding: 13px 18px; border-bottom: 1px solid #edf1f3; color: var(--ink); font-size: 11px; vertical-align: middle; }.data-table tbody tr:hover { background: #fbfdfd; }.data-table tr:last-child td { border-bottom: 0; }.align-right { text-align: right; }
.cell-primary { font-weight: 760; }.cell-secondary { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }.amount-income { color: #318a73; font-weight: 800; }.amount-expense { color: #3d6c92; font-weight: 800; }.status-pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 20px; font-size: 9px; font-weight: 780; white-space: nowrap; }.status-ok { color: #397568; background: #e4f5ef; }.status-open { color: #98662d; background: #fff0dd; }.status-danger { color: #a23e48; background: #fbe5e5; }.status-neutral { color: #607687; background: #edf2f5; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }.icon-button { display: inline-grid; width: 26px; height: 26px; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #fff; cursor: pointer; font-size: 12px; }.icon-button:hover { color: var(--navy); border-color: #bcd0dc; }.icon-button.delete:hover { color: var(--danger); border-color: #eab5b8; }

.callout { margin-bottom: 16px; padding: 14px 16px; border-radius: 9px; font-size: 11px; }.callout strong { margin-right: 4px; }.callout-mint { color: #27685a; background: #e4f5ef; }.relation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }.entity-list { display: grid; gap: 2px; }.entity-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf1f3; }.entity-item:last-child { border-bottom: 0; }.entity-main { min-width: 0; }.entity-main strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }.entity-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }.entity-meta { display: flex; align-items: center; gap: 8px; }.entity-actions { display: flex; align-items: center; gap: 4px; }

.document-upload { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }.upload-icon { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; border-radius: 10px; color: #347b6d; background: #e4f5ef; font-size: 21px; font-weight: 300; }.upload-copy { min-width: 180px; }.upload-copy h3 { margin-bottom: 3px; }.upload-copy p { font-size: 10px; }.upload-form { display: flex; flex: 1; align-items: center; justify-content: flex-end; gap: 8px; }.upload-form select { max-width: 245px; }.upload-form input[type=file] { max-width: 180px; color: var(--muted); font-size: 10px; }

.tax-banner { display: flex; gap: 12px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid #cce9df; border-radius: 10px; color: #306b5e; background: #ecf8f4; }.tax-banner-icon { display: grid; flex: 0 0 29px; width: 29px; height: 29px; place-items: center; border-radius: 50%; color: #fff; background: var(--mint-deep); font-weight: 800; }.tax-banner strong, .tax-banner span { display: block; }.tax-banner strong { font-size: 11px; }.tax-banner span { margin-top: 3px; font-size: 10px; }.tax-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }.summary-card span, .summary-card small { display: block; color: var(--muted); font-size: 11px; }.summary-card strong { display: block; margin: 13px 0 4px; color: var(--navy); font-size: 24px; letter-spacing: -.04em; }.summary-card small { font-size: 10px; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }.stack-form { display: grid; gap: 16px; }.stack-form label { color: var(--ink); font-size: 12px; }.modal-form { display: grid; gap: 14px; }.form-grid { display: grid; gap: 12px; }.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
input, select, textarea { width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid #d8e2e8; border-radius: 7px; outline: 0; color: var(--ink); background: #fff; font-size: 12px; font-weight: 500; }.amount-grid input { font-variant-numeric: tabular-nums; }.modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus, .upload-form select:focus { border-color: var(--mint-deep); box-shadow: 0 0 0 3px rgba(132,210,188,.18); }.modal-form textarea { resize: vertical; }
.modal { position: fixed; z-index: 30; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(11,28,45,.48); }.modal.open { display: flex; }.modal-card { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(11,28,45,.28); }.modal-large { width: min(760px, 100%); }.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 21px; }.modal-heading h2 { margin-top: 4px; }.modal-close { width: 30px; height: 30px; border: 0; border-radius: 7px; color: var(--muted); background: #f0f4f6; cursor: pointer; font-size: 22px; line-height: 1; }.modal-close:hover { color: var(--ink); background: #e5edf1; }.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.alert { margin: 17px 0; padding: 10px 12px; border-radius: 7px; font-size: 11px; }.alert-danger { color: #8a3d42; background: #fbe6e6; }

.login-page { min-height: 100vh; background: radial-gradient(circle at 80% 10%, #e0f4ee 0, transparent 33%), var(--canvas); }.login-shell { width: min(420px, calc(100% - 36px)); margin: 0 auto; padding-top: 13vh; }.login-brand { display: flex; align-items: center; gap: 10px; margin: 0 auto 21px; color: var(--navy); font-size: 13px; font-weight: 850; letter-spacing: .15em; }.login-brand .brand-mark { width: 41px; height: 41px; }.login-card { padding: 31px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 22px 60px rgba(23,48,70,.1); }.login-card h1 { margin-top: 7px; }.login-card > .muted { margin: 10px 0 25px; font-size: 12px; }.login-footnote { margin-top: 22px; color: var(--muted); font-size: 10px; text-align: center; }

@media (max-width: 1100px) {
    .main-content { padding-right: 25px; padding-left: 25px; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .chart-panel { min-height: 280px; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }.sidebar { position: static; min-height: auto; padding: 13px 12px 10px; }.sidebar-brand { padding: 0 7px 12px; }.sidebar-note, .sidebar-label, .sidebar-user { display: none; }.main-nav { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 2px; }.nav-item { flex: 0 0 auto; width: auto; padding: 8px 10px; font-size: 11px; }.nav-icon { display: none; }.main-content { padding: 21px 15px 35px; }.topbar { display: block; margin-bottom: 23px; }.topbar-actions { margin-top: 15px; }.global-search { flex: 1; width: auto; }.topbar-actions .button { white-space: nowrap; }.view-heading { align-items: flex-start; flex-direction: column; }.heading-actions { width: 100%; flex-wrap: wrap; }.period-control { align-self: stretch; justify-content: space-between; }.period-button { flex: 1; }.kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }.kpi-card { min-height: 113px; padding: 14px; }.kpi-card strong { font-size: 20px; }.kpi-card small { line-height: 1.25; }.dashboard-grid, .lower-grid, .relation-grid, .tax-summary-grid { grid-template-columns: 1fr; }.panel { padding: 15px; }.chart-legend { gap: 8px; }.monthly-chart { gap: 3px; }.donut-wrap { justify-content: center; }.document-upload { align-items: flex-start; flex-wrap: wrap; }.upload-form { flex: 1 1 100%; align-items: stretch; flex-direction: column; }.upload-form select, .upload-form input[type=file] { max-width: none; }.form-grid-3, .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }.modal { padding: 10px; }.modal-card { max-height: calc(100vh - 20px); padding: 18px; }.tax-banner { align-items: flex-start; }.login-shell { padding-top: 7vh; }
}
@media (max-width: 430px) {
    .kpi-grid { grid-template-columns: 1fr; }.topbar-actions { align-items: stretch; flex-direction: column; }.topbar-actions .button { width: 100%; }.form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }.donut-wrap { flex-direction: column; }.chart-legend { display: none; }
}
