/* Семеен бюджет — "clean report" direction.
   White ground, graphite ink, one blue, red only for over-plan, green only for reconciled/invested.
   Golos Text, tabular figures everywhere money appears. */

@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/golos-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/golos-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/golos-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/golos-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #15171c;
  --ink-2: #2b2f37;
  --muted: #5f6570;
  --faint: #858c96;
  --line: #e3e5e8;
  --line-strong: #cfd3d8;
  --wash: #f5f6f7;
  --surface: #ffffff;
  --blue: #1f3fa8;
  --blue-ink: #17307f;
  --blue-wash: #eef1fb;
  --unplanned: #9aa2b1;
  --red: #b42318;
  --red-wash: #fdf1ef;
  --green: #1e7b45;
  --green-wash: #edf7f1;
  --amber: #8a5a00;
  --amber-wash: #fdf5e4;

  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 6px;
  --gutter: clamp(16px, 3vw, 32px);
  --page: 1180px;
  --ease: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--blue-wash); color: var(--blue-ink); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--blue-ink); }

h1, h2, h3 { font-weight: 500; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 16px; line-height: 1.35; }
h3 { font-size: 14px; }
p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------- shell ---------- */

.shell-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.shell-bar {
  max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 28px; height: 56px;
}
.brand { font-weight: 500; font-size: 15px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px; height: 56px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); font-weight: 500; }
.nav a.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); }
.count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 500;
}
.user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.user form { margin: 0; }

main.page { max-width: var(--page); margin: 0 auto; padding: 28px var(--gutter) 80px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { background: var(--wash); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); color: #fff; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-wash); color: var(--red); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); padding: 0 8px; }
.btn-quiet:hover { color: var(--ink); background: var(--wash); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.input, .select {
  height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); min-width: 0;
}
.select { padding-right: 28px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235f6570' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.input:hover, .select:hover { border-color: var(--faint); }
.input::placeholder { color: var(--faint); }
.input-money { width: 110px; text-align: right; }
.input-sm, .select-sm { height: 28px; font-size: 13px; }

.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 16px; }

.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }

.month-picker { display: inline-flex; align-items: center; gap: 2px; }
.month-picker .select { font-weight: 500; }

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

/* ---------- numbers ---------- */

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--green); }
.neg, .over { color: var(--red); }
.dim { color: var(--muted); }
.faint { color: var(--faint); }
.cents { color: var(--faint); }

/* ---------- dashboard ---------- */

.hero { display: grid; grid-template-columns: minmax(300px, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 28px; align-items: end;
  padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-big { font-size: clamp(40px, 6vw, 56px); line-height: 1.02; letter-spacing: -0.03em; font-weight: 400; margin: 6px 0 6px; }
.kpi-mid { font-size: 20px; letter-spacing: -0.01em; margin: 4px 0 2px; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi-note .over { font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.section { margin-bottom: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head .dim { font-size: 12px; }

.bullets { display: grid; gap: 2px; }
.bullet { display: grid; grid-template-columns: 150px minmax(0, 1fr) 84px; align-items: center; gap: 12px; min-height: 28px;
  color: inherit; text-decoration: none; border-radius: 4px; }
a.bullet:hover { background: var(--wash); color: inherit; }
.bullet-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bullet-track { position: relative; height: 8px; background: var(--wash); border-radius: 1px; }
.bullet-bar { position: absolute; inset: 0 auto 0 0; background: var(--blue); border-radius: 1px; }
.bullet-bar.over { background: var(--red); }
.bullet-bar.unplanned { background: var(--unplanned); }
.bullet-plan { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.bullet-value { text-align: right; }

.chart { width: 100%; height: 300px; }
.chart-sm { height: 240px; }

.status-line { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.status-line a { color: var(--ink); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.status-line a:hover { color: var(--blue); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.blue { background: var(--blue); } .dot.green { background: var(--green); } .dot.red { background: var(--red); } .dot.amber { background: #c98a00; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
.data th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tbody tr:hover td { background: #fafbfb; }
.data .r { text-align: right; }
.data .c { text-align: center; }
.data tr.selected td { background: var(--blue-wash); }
.data tr.is-dup td { background: var(--amber-wash); }
.data tfoot td { font-weight: 500; border-bottom: none; }
.data a { text-decoration: none; }
.data a:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
.data .select-sm { max-width: 200px; }
.cell-main { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }

.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11px; font-weight: 500; white-space: nowrap;
  background: var(--wash); color: var(--muted); }
.tag.blue { background: var(--blue-wash); color: var(--blue-ink); }
.tag.green { background: var(--green-wash); color: var(--green); }
.tag.red { background: var(--red-wash); color: var(--red); }
.tag.amber { background: var(--amber-wash); color: var(--amber); }

.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px;
  background: var(--blue-wash); color: var(--blue-ink); border-radius: var(--radius); font-size: 13px; }

/* ---------- panels & notices ---------- */

.panel { border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.notice { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; background: var(--wash); color: var(--ink-2); }
.notice.red { background: var(--red-wash); color: var(--red); }
.notice.green { background: var(--green-wash); color: var(--green); }
.notice.amber { background: var(--amber-wash); color: var(--amber); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

.recon { display: grid; grid-template-columns: repeat(6, auto); gap: 4px 24px; align-items: baseline; justify-content: start; }
.recon dt { font-size: 12px; color: var(--muted); }
.recon dd { margin: 0; font-size: 16px; }

.dropzone { display: grid; place-items: center; gap: 6px; padding: 22px; border: 1px dashed var(--line-strong); border-radius: 8px;
  color: var(--muted); text-align: center; position: relative; transition: border-color .15s var(--ease), background .15s var(--ease); }
.dropzone:hover { border-color: var(--blue); background: var(--blue-wash); color: var(--blue-ink); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.empty { padding: 40px 0; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }

.steps { margin: 8px 0 0; padding-left: 20px; }
.steps li { margin: 4px 0; }
code, .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; background: var(--wash); padding: 2px 6px; border-radius: 4px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }

.pre { white-space: pre-wrap; color: var(--ink-2); font-size: 13px; }
details.note { border-top: 1px solid var(--line); padding: 10px 0; }
details.note summary { cursor: pointer; font-weight: 500; }

/* ---------- login & consent ---------- */

.login, body.consent { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--wash); }
.login-card, .consent-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 32px; }
.login-card h1, .consent-card h1 { margin-bottom: 8px; }
.login-card p, .consent-card p { color: var(--muted); margin-bottom: 20px; }
.consent-card .eyebrow { display: none; }
.consent-card .muted { font-size: 13px; }
.consent-card .actions { display: flex; gap: 8px; }
.login-card .btn { width: 100%; height: 40px; }

/* ---------- blazor chrome ---------- */

#blazor-error-ui { display: none; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
#blazor-error-ui a { color: #fff; margin-left: 12px; }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 12px; }

.toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: toast-in .35s var(--ease); }
.toast.error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.loading { color: var(--muted); padding: 40px 0; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .hero > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .grid-2, .split { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .recon { grid-template-columns: repeat(3, auto); }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .shell-bar { gap: 12px; height: auto; flex-wrap: wrap; padding-top: 10px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; margin: 0 calc(var(--gutter) * -1); padding: 0 calc(var(--gutter) - 10px); }
  .nav a { height: 44px; }
  .user .email { display: none; }
  main.page { padding-top: 20px; }
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bullet { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name value" "track track"; gap: 4px 8px; padding: 4px 0; }
  .bullet-name { grid-area: name; }
  .bullet-value { grid-area: value; }
  .bullet-track { grid-area: track; }
  .recon { grid-template-columns: repeat(2, auto); }
  .hide-sm { display: none; }
  .cell-main, .cell-sub { max-width: 130px; }
  .data .select-sm { max-width: 140px; }
  table.data { font-size: 12.5px; }
  .data td, .data th { padding: 7px 6px; }
}

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