:root {
    color-scheme: light;
    --ink: #172641;
    --body: #263650;
    --muted: #596982;
    --surface: #ffffff;
    --paper: #f2f5f9;
    --line: #dce4ef;
    --blue: #2659d0;
    --blue-dark: #143b9d;
    --blue-light: #e8efff;
    --nav: #14213d;
    --nav-text: #bfcee6;
    --radius: 16px;
    --shadow: 0 3px 14px #1e3c6609;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    background: var(--paper);
    color: var(--body);
    font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; font-size: 15px; line-height: 1.55; }
button, select, input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #6592ff; outline-offset: 3px; }
h1, h2, p, figure, ul { margin: 0; }
h1, h2 { color: var(--ink); line-height: 1.15; }
h1 { font-size: clamp(29px, 3vw, 44px); font-weight: 720; letter-spacing: -.05em; }
h2 { font-size: 17px; font-weight: 710; letter-spacing: -.025em; }
.muted, .hint { color: var(--muted); font-size: 13px; }
.hint { margin-top: 11px; }
.skip { position: fixed; z-index: 20; top: 10px; left: 10px; padding: 10px 15px; color: white; background: var(--blue-dark); transform: translateY(-200%); }
.skip:focus { transform: none; }

.shell { display: grid; min-height: 100vh; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--nav); color: var(--nav-text); padding: 27px 15px 20px; overflow: auto; }
.wordmark { display: flex; gap: 12px; align-items: center; padding: 0 10px; color: #fff; font-size: 20px; font-weight: 550; letter-spacing: -.045em; white-space: nowrap; }
.wordmark strong { font-weight: inherit; color: #a9c5ff; margin-left: .25em; }
.mark { width: 35px; height: 35px; flex: none; display: grid; place-content: center; justify-items: start; gap: 3px; background: #527dff; border-radius: 9px; }
.mark i { display: block; width: 15px; height: 2px; background: white; border-radius: 2px; }
.mark i:nth-child(2) { width: 11px; }
.mark i:nth-child(3) { width: 7px; }
.navigation { display: grid; gap: 5px; margin-top: 37px; }
.navigation a { display: flex; align-items: center; gap: 9px; min-height: 43px; padding: 8px 11px; border-radius: 8px; font-size: 13px; font-weight: 620; }
.navigation a::before { content: ""; width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 2px; flex: none; }
.navigation a:hover { color: #fff; background: #1d2e50; }
.navigation a[aria-current="page"] { color: white; background: #263d70; }
.navigation a[aria-current="page"]::before { color: #98b8ff; background: currentColor; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding: 18px 10px 0; border-top: 1px solid #324361; font-size: 11px; }
.sidebar-foot a { font-size: 12px; color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 4; min-height: 74px; padding: 10px clamp(18px, 3vw, 42px); background: var(--surface); display: flex; align-items: center; gap: 18px; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar-label { font-weight: 650; color: var(--ink); white-space: nowrap; }
.menu-toggle { display: none; }
.selectors { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.picker { display: grid; gap: 3px; min-width: 0; font-size: 10px; font-weight: 700; color: var(--muted); }
.picker select { min-height: 33px; width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-weight: 640; color: var(--ink); background: var(--surface); }
.screen { width: 100%; max-width: 1600px; min-width: 0; margin: 0 auto; padding: 29px clamp(18px, 3vw, 42px) 25px; flex: 1; }
.screen:focus { outline: none; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 10px clamp(18px, 3vw, 42px) 22px; color: var(--muted); font-size: 11px; }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 3px 0 23px; }
.page-head p { color: var(--muted); max-width: 680px; margin-top: 7px; }
.hero { position: relative; display: flex; align-items: end; gap: 25px; justify-content: space-between; overflow: hidden; border-radius: var(--radius); padding: 28px clamp(23px, 3.5vw, 44px); background: radial-gradient(ellipse at 108% -62%, #607ff2 0%, transparent 58%), #213c82; color: white; }
.hero h1 { color: #fff; margin: 10px 0 8px; }
.hero p { color: #e1eaff; max-width: 570px; }
.hero-period { color: #dfe9ff; font-weight: 680; font-size: 12px; letter-spacing: .015em; }
.hero-actions, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-actions { flex: 0 0 auto; }
.nowrap { flex-wrap: nowrap; }
.button { display: inline-flex; gap: 5px; align-items: center; justify-content: center; min-height: 41px; padding: 8px 13px; border-radius: 8px; border: 1px solid transparent; font-size: 13px; font-weight: 680; line-height: 1.25; white-space: nowrap; }
.button.primary { background: var(--blue); color: white; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { background: white; color: var(--ink); border-color: #bfcde0; }
.button.secondary:hover, .button.quiet:hover { background: var(--blue-light); color: var(--blue-dark); }
.button.light { background: #fff; color: var(--nav); }
.button.light:hover { background: #e7efff; }
.button.ghost { border-color: #a8bdf3; color: #fff; background: #ffffff0f; }
.button.ghost:hover { background: #ffffff24; }
.button.quiet { background: transparent; color: var(--blue-dark); }
.button.remove { background: #fff4f3; color: #9c2926; }
.button.small { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.button:disabled { opacity: .6; cursor: wait; }
.inline-link { color: var(--blue-dark); font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 15px 0; }
.metrics.compact { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.metric { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; box-shadow: var(--shadow); }
.metric > span, .metric small { display: block; font-size: 12px; color: var(--muted); }
.metric > span { font-weight: 650; }
.metric strong { display: block; margin: 6px 0 4px; color: var(--ink); font-size: clamp(19px, 2.4vw, 29px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric small { font-size: 11px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.summary-split { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.card { min-width: 0; margin: 0 0 14px; padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.card > p { margin-bottom: 10px; }
.checkline { display: flex; gap: 16px; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.checkline:last-child { padding-bottom: 0; border: 0; }
.empty { display: grid; min-height: 76px; place-content: center; text-align: center; padding: 16px; background: #f3f6fb; border-radius: 9px; color: var(--muted); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; font-weight: 650; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; background: #3768d9; }
.legend span + span i { background: #a7bbeb; }
.chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; margin: 8px 0; }
.chart-month { min-width: 0; text-align: center; color: var(--muted); font-size: 10px; }
.bar-pair { display: inline-block; height: 101px; width: 20px; position: relative; margin-bottom: 4px; }
.bar { display: block; appearance: none; border: 0; position: absolute; width: 100px; height: 7px; left: 4px; bottom: -3px; transform-origin: 0 center; transform: rotate(-90deg); background: #edf2fb; border-radius: 4px; }
.bar.expense { left: 14px; }
.bar::-webkit-meter-bar { background: #edf2fb; border: 0; border-radius: 4px; }
.bar::-webkit-meter-optimum-value { background: #3768d9; border-radius: 4px; }
.bar.expense::-webkit-meter-optimum-value { background: #a7bbeb; }
.bar::-moz-meter-bar { background: #3768d9; border: 0; border-radius: 4px; }
.bar.expense::-moz-meter-bar { background: #a7bbeb; }
.chart-month > span { display: block; }
.chart-details { color: var(--muted); font-size: 12px; }
.chart-details[open] > summary { margin-bottom: 8px; }

.task-list { padding: 0; list-style: none; }
.task-list > li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #edf1f7; font-size: 13px; }
.task-list > li:last-child { border-bottom: 0; }
.task-list a:not(.button) { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; border-radius: 5px; }
.task-list a:hover strong { color: var(--blue-dark); text-decoration: underline; }
.task-list strong { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.task-list small, td small, .tax-window small { display: block; color: var(--muted); font-size: 11px; }
.task-list i { color: var(--blue); font-style: normal; }
.model-number { min-width: 41px; display: inline-grid; place-content: center; padding: 5px 6px; border-radius: 8px; background: var(--blue-light); color: var(--blue-dark); font-weight: 720; font-size: 14px; line-height: 1.2; }

.table-wrap { min-width: 0; overflow-x: auto; scrollbar-color: #adbdda transparent; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th { padding: 9px 10px; background: #eaf0f9; color: #4a5b74; font-size: 11px; font-weight: 680; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #ecf1f7; }
td strong { font-weight: 650; color: var(--ink); }
td small { margin-top: 2px; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 4px 8px; border-radius: 20px; font-weight: 680; font-size: 10px; line-height: 1.25; white-space: nowrap; }
.pill.muted { background: #e8edf5; color: #43536b; }
.pill.green { background: #e6f4ea; color: #206141; }
.pill.amber { background: #fff2d6; color: #74500c; }
.pill.danger { background: #fde7e5; color: #9d2928; }
.pill.blue { background: var(--blue-light); color: var(--blue-dark); }

.form { display: grid; gap: 12px; }
.form-grid, .filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px 13px; align-items: end; }
.filter-grid { padding: 12px 14px; background: #edf2fa; border-radius: 11px; margin-bottom: 14px; }
.filter-grid .form-actions { justify-self: start; }
.field { display: grid; gap: 5px; min-width: 0; font-weight: 680; font-size: 12px; color: var(--ink); }
.field :is(input, select, textarea) { width: 100%; min-width: 0; min-height: 41px; padding: 7px 9px; border: 1px solid #afbfd6; border-radius: 7px; background: white; color: var(--body); font-size: 13px; font-weight: 450; }
.field input[readonly] { background: #edf2f8; }
.field textarea { resize: vertical; }
.checkset { display: grid; gap: 7px; border: 1px solid var(--line); padding: 9px 12px 12px; min-width: 0; margin: 0; border-radius: 9px; }
.checkset legend { font-weight: 650; color: var(--ink); font-size: 12px; padding: 0 4px; }
.check { display: flex; align-items: start; gap: 7px; font-size: 13px; }
.check input { accent-color: var(--blue); margin-top: 4px; }
.form > :is(.remove, .quiet) { justify-self: start; }
.form-error { color: #842327; background: #fff0ef; border-radius: 8px; padding: 8px 11px; font-size: 13px; }
.notice { margin: 0 0 14px; padding: 10px 13px; background: var(--blue-light); border-left: 3px solid #6386df; border-radius: 7px; font-size: 13px; color: #2b467f; }
.section-tools { display: flex; gap: 9px 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; flex-wrap: wrap; padding: 3px; gap: 4px; background: #e7edf7; border-radius: 9px; }
.tab { min-height: 32px; border: 0; background: transparent; color: #475b78; border-radius: 6px; font-size: 12px; padding: 6px 10px; font-weight: 660; }
.tab[aria-pressed="true"] { background: white; color: var(--blue-dark); box-shadow: var(--shadow); }
.model-grid, .service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 13px; align-items: stretch; margin-bottom: 14px; }
.model-card, .service-card { display: flex; flex-direction: column; margin: 0; gap: 8px; }
.model-card p, .service-card p { color: var(--muted); font-size: 13px; }
.model-card-head, .tax-window, .model-status { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.model-card-head { justify-content: space-between; }
.tax-window { justify-content: space-between; padding: 7px 0 0; border-top: 1px solid var(--line); font-size: 12px; }
.model-scope { max-width: 850px; margin: 9px 0 14px; color: var(--muted); }
.model-scope + .hint, .screen > .hint { margin-bottom: 13px; }
.service-card > .actions { margin-top: auto; }
.file-strip, .source-grid { display: flex; flex-wrap: wrap; gap: 7px 12px; padding-top: 9px; }

.dialog { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-width: min(660px, calc(100vw - 24px)); width: 100%; max-height: 90dvh; color: var(--body); box-shadow: 0 18px 80px #10244755; }
.dialog::backdrop { background: #17264199; }
.dialog-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dialog-head h2 { font-size: 21px; }
.toast { z-index: 15; position: fixed; bottom: 20px; right: 20px; max-width: min(400px, calc(100% - 40px)); padding: 11px 15px; background: var(--nav); color: white; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); }
.toast.error { background: #8d2a2a; }

@media (max-width: 1120px) {
    .hero { align-items: start; flex-direction: column; gap: 17px; }
    .summary-split { grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); }
}
@media (max-width: 920px) {
    .shell { grid-template-columns: 188px minmax(0, 1fr); }
    .sidebar { padding-inline: 9px; }
    .desktop-label { display: none; }
    .topbar { justify-content: end; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-split { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .page-head { align-items: start; flex-direction: column; gap: 11px; }
}
@media (max-width: 680px) {
    .shell { display: block; }
    .sidebar { display: none; position: fixed; width: min(275px, calc(100vw - 34px)); height: auto; top: 48px; left: 8px; z-index: 8; max-height: calc(100dvh - 60px); border-radius: 12px; padding: 14px; box-shadow: 0 9px 45px #17264177; }
    .menu-open .sidebar { display: flex; }
    .navigation { margin-top: 15px; margin-bottom: 16px; }
    .menu-toggle { min-height: 36px; display: inline-block; padding: 6px 9px; border: 1px solid #b2c2d7; border-radius: 7px; color: var(--ink); background: white; font-size: 12px; font-weight: 700; }
    .topbar { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 9px 11px 12px; }
    .selectors { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, .6fr) minmax(0, .9fr); gap: 6px; }
    .picker select { font-size: 11px; padding-inline: 5px; }
    .screen { padding: 16px 10px 22px; }
    .hero { padding: 21px 14px; }
    .hero p, .page-head p { font-size: 13px; }
    .hero-actions .button { font-size: 12px; padding-inline: 8px; }
    .metrics { gap: 7px; margin: 10px 0; }
    .metric { padding: 11px 9px; }
    .split { display: block; }
    .card { padding: 13px 10px; }
    .card-head { align-items: start; }
    .footer { padding: 5px 11px 14px; flex-direction: column; }
}
@media (max-width: 360px) {
    .selectors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .picker:first-child { grid-column: 1 / -1; }
    .bar-pair { width: 16px; }
    .bar { left: 0; height: 6px; }
    .bar.expense { left: 9px; }
}
