/* Стиль студии RAUJIN: палитра «Тушь и патина», шрифты Spectral, JetBrains Mono, Raujin Display.
   Источник: raujin/CLAUDE.md, раздел ДИЗАЙН-СИСТЕМА, и raujin/site/assets/css/site.css.
   Тема как у студии: по устройству, не по системе. ПК (точный указатель) тёмная, телефон и планшет светлая.
   theme.js ставит data-theme на <html>; выбор человека из настроек перекрывает устройство. */
@font-face { font-family: 'Spectral'; font-weight: 400; font-display: swap; src: url(assets/fonts/spectral-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Spectral'; font-weight: 400; font-display: swap; src: url(assets/fonts/spectral-latin-400-normal.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+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url(assets/fonts/jetbrains-mono-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url(assets/fonts/jetbrains-mono-latin-400-normal.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+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url(assets/fonts/jetbrains-mono-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url(assets/fonts/jetbrains-mono-latin-500-normal.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+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Raujin Display'; font-display: swap; src: url(assets/fonts/RaujinDisplay-Regular.woff2) format('woff2'); }

:root {
  /* тёмная (ПК): токены студии --bg --s1 --line --tx --mu --ac */
  --bg: #0C0E0D;
  --surface: #151816;
  --surface-2: #1d211f;
  --text: #E8E6DF;
  --muted: #848A85;
  --line: #232825;
  --accent: #7FA693;
  --accent-text: #0C0E0D;
  --expense: #E8E6DF;
  --income: #7FA693;
  --danger: #d0806c;
  --shadow: 0 10px 40px rgba(0, 0, 0, .55);
  --radius: 6px;
  --f-display: 'Raujin Display', 'Spectral', Georgia, serif;
  --f-body: 'Spectral', Georgia, serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;
  --tabs-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* графики: категориальные слоты и последовательная шкала (навык dataviz, проверено валидатором) */
  --series-1: #3987e5;
  --series-2: #d95926;
  --heat-0: #1d211f;
  --heat-1: #104281;
  --heat-2: #184f95;
  --heat-3: #256abf;
  --heat-4: #3987e5;
  --heat-5: #86b6ef;
  color-scheme: dark;
}

@media (pointer: coarse) {
  :root:not([data-theme="dark"]) {
    /* светлая (телефон, планшет) */
    --bg: #EEEDE6;
    --surface: #E2E1D8;
    --surface-2: #d6d5cb;
    --text: #111412;
    --muted: #646A65;
    --line: #cfcec4;
    --accent: #3F6E5C;
    --accent-text: #EEEDE6;
    --expense: #111412;
    --income: #3F6E5C;
    --danger: #a4462f;
    --shadow: 0 8px 28px rgba(17, 20, 18, .14);
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --heat-0: #d6d5cb;
    --heat-1: #cde2fb;
    --heat-2: #9ec5f4;
    --heat-3: #5598e7;
    --heat-4: #256abf;
    --heat-5: #0d366b;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  /* светлая (телефон, планшет) */
  --bg: #EEEDE6;
  --surface: #E2E1D8;
  --surface-2: #d6d5cb;
  --text: #111412;
  --muted: #646A65;
  --line: #cfcec4;
  --accent: #3F6E5C;
  --accent-text: #EEEDE6;
  --expense: #111412;
  --income: #3F6E5C;
  --danger: #a4462f;
  --shadow: 0 8px 28px rgba(17, 20, 18, .14);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --heat-0: #d6d5cb;
  --heat-1: #cde2fb;
  --heat-2: #9ec5f4;
  --heat-3: #5598e7;
  --heat-4: #256abf;
  --heat-5: #0d366b;
  color-scheme: light;
}

:where(*, *::before, *::after) { box-sizing: border-box; }
:where(body, h1, h2, p, ul) { margin: 0; padding: 0; }
:where(ul) { list-style: none; }
:where(button) { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.proto-banner {
  font-size: 12px;
  text-align: center;
  padding: calc(4px + var(--safe-t)) 16px 4px;
  background: var(--surface-2);
  color: var(--muted);
}

/* ---------- экран операций ---------- */
.screen { padding: 0 16px calc(var(--tabs-h) + var(--safe-b) + 96px); }
.top { padding: 16px 0 8px; }
.top h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.month-sum { color: var(--muted); font-size: 15px; margin-top: 2px; }
.month-sum strong { color: var(--text); font-weight: 600; }
.stub-text { color: var(--muted); margin-top: 8px; }

.day { margin-top: 18px; }
.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em;
  padding: 0 4px 6px;
}
.day-sum { text-transform: none; letter-spacing: 0; font-weight: 500; }
.ops { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.op { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 56px; }
.op + .op { border-top: 1px solid var(--line); }
.op-icon {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; background: var(--surface-2); font-size: 18px;
}
.op-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.op-title { font-weight: 500; }
.op-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-sum { flex: none; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--expense); }
.op-sum.is-income { color: var(--income); }
.op-sum.is-transfer { color: var(--muted); }

/* ---------- кнопка добавления и вкладки ---------- */
.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabs-h) + var(--safe-b) + 16px);
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  font-size: 34px; line-height: 1; font-weight: 300;
  box-shadow: var(--shadow);
  z-index: 5;
}
.fab:active { transform: scale(.96); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  z-index: 4;
}
.tabs button { font-size: 13px; color: var(--muted); }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* ---------- экран ввода ---------- */
.entry {
  position: fixed; inset: 0; z-index: 10;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(8px + var(--safe-t)) 12px calc(8px + var(--safe-b));
  max-width: 520px; margin: 0 auto;
}
.entry-head { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; font-size: 18px; color: var(--muted); flex: none; }
.seg {
  flex: 1; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface-2); border-radius: 10px; padding: 3px; margin-right: 48px;
}
.seg button { height: 34px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.amount-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 120px; gap: 12px; }
.amount {
  font-size: clamp(40px, 13vw, 56px); font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.amount.is-empty { color: var(--muted); }
.amount[data-kind="income"]:not(.is-empty) { color: var(--income); }
.amount.shake { animation: shake .35s; color: var(--danger); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 100%; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip-ghost { color: var(--muted); border-style: dashed; background: transparent; }

.grid-label { font-size: 13px; color: var(--muted); padding: 4px 4px 6px; }
.cat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cat {
  height: 64px; border-radius: 12px; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 0 2px;
}
.cat:active { background: var(--surface-2); }
.cat-icon { font-size: 20px; line-height: 1; }
.cat-name {
  font-size: 12px; line-height: 1.2; max-width: 100%; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.keypad button {
  height: 52px; border-radius: 12px; font-size: 24px; font-weight: 500;
  background: var(--surface-2);
}
.keypad button:active { background: var(--line); }

/* ---------- нижний лист ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 520px; margin: 0 auto;
  max-height: 80dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 16px 16px 0 0;
  padding: 0 16px calc(16px + var(--safe-b));
  box-shadow: var(--shadow);
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; height: 52px; flex: none; }
.sheet-head h2 { font-size: 17px; font-weight: 600; }
.text-btn { color: var(--accent); font-weight: 600; padding: 8px 4px; }
.sheet-body { overflow-y: auto; }
.opt-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.opt { width: 100%; text-align: left; padding: 14px 16px; min-height: 48px; }
.opt-list li + li .opt { border-top: 1px solid var(--line); }
.opt[aria-current="true"] { color: var(--accent); font-weight: 600; }
.opt[aria-current="true"]::after { content: " ✓"; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.field input {
  font: inherit; font-size: 16px; color: var(--text);
  height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
}
.cat-grid-all .cat { background: var(--surface); }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; z-index: 30;
  bottom: calc(var(--tabs-h) + var(--safe-b) + 92px);
  max-width: 488px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: var(--text); color: var(--bg);
  padding: 10px 10px 10px 16px; border-radius: 12px; box-shadow: var(--shadow);
  font-size: 14px;
}
.toast .text-btn { color: var(--bg); text-decoration: underline; flex: none; }

.proto-banner.is-real { background: var(--accent); color: var(--accent-text); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.import-btn {
  font-size: 14px; color: var(--accent); cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; background: var(--surface);
}
.import-btn:hover { background: var(--surface-2); }
.import-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.more-btn {
  display: block; width: 100%; margin-top: 16px; padding: 12px;
  border-radius: var(--radius); background: var(--surface); color: var(--accent); font-weight: 500;
}
.acc-note { color: var(--muted); font-size: 14px; margin-top: 4px; max-width: 640px; }
.acc { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 56px; }
.acc + .acc { border-top: 1px solid var(--line); }
.acc-sums { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-weight: 500; }
.is-negative { color: var(--danger); }
.cat-group { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 2px 6px; }
.cat-group:first-child { margin-top: 0; }
.sheet-body .cat-grid-all + .cat-grid-all { margin-top: 6px; }

/* ---------- формы правки ---------- */
.op[role="button"], .acc[role="button"] { cursor: pointer; }
.op:focus-visible, .acc:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.edit-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; padding-bottom: 4px; }
.edit-form .field-wide, .edit-form .form-actions, .edit-form .form-hint, .edit-form .form-error { grid-column: 1 / -1; }
.edit-form .field input, .edit-form .field select {
  width: 100%; min-width: 0; font: inherit; font-size: 16px; color: var(--text);
  height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
}
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check span { display: flex; flex-direction: column; gap: 2px; }
.check b { font-weight: 500; }
.check small { color: var(--muted); font-size: 13px; }
.form-hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.form-error { color: var(--danger); font-size: 14px; margin: 12px 0 0; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.form-actions .btn-primary { margin-left: auto; }
.btn { height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-danger { color: var(--danger); background: var(--surface); border: 1px solid var(--line); }

/* ---------- аналитика ---------- */
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav-label { min-width: 150px; text-align: center; font-weight: 600; }
.month-nav .icon-btn { font-size: 22px; color: var(--text); background: var(--surface); }
.month-nav .icon-btn:disabled { opacity: .35; cursor: default; }
.an-body { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.an-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.an-card { background: var(--surface); border-radius: var(--radius); padding: 16px; min-width: 0; }
.an-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.an-card-title { font-size: 16px; font-weight: 600; }
.an-card-sub { font-size: 13px; color: var(--muted); }
.kpi-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.kpi-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw-1 { background: var(--series-1); }
.sw-2 { background: var(--series-2); }
.legend-scale { gap: 3px; margin-top: 8px; }
.legend-scale span { margin: 0 4px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .bar.s1, .hbar-track .bar.s1 { fill: var(--series-1); }
.chart .bar.s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .month:hover .hit { fill: var(--surface-2); }
.chart .month.is-selected .hit { fill: var(--surface-2); }
.calendar { width: auto; min-width: 720px; }
.calendar-scroll { overflow-x: auto; }
.day-cell.l0, .day-cell-sw.l0 { fill: var(--heat-0); background: var(--heat-0); }
.day-cell.l1, .day-cell-sw.l1 { fill: var(--heat-1); background: var(--heat-1); }
.day-cell.l2, .day-cell-sw.l2 { fill: var(--heat-2); background: var(--heat-2); }
.day-cell.l3, .day-cell-sw.l3 { fill: var(--heat-3); background: var(--heat-3); }
.day-cell.l4, .day-cell-sw.l4 { fill: var(--heat-4); background: var(--heat-4); }
.day-cell.l5, .day-cell-sw.l5 { fill: var(--heat-5); background: var(--heat-5); }
.day-cell:hover { stroke: var(--text); stroke-width: 1.5; }
.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar { cursor: default; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.hbar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-val { flex: none; font-variant-numeric: tabular-nums; font-weight: 500; }
.hbar-track { display: block; width: 100%; height: 8px; margin-top: 4px; }
.hbar-note { font-size: 12px; color: var(--muted); }
.an-table { margin-top: 8px; font-size: 14px; }
.an-table summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.an-card table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.an-card th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.an-card td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.an-card td.num, .an-card th:not(:first-child), .an-table td:not(:first-child) { text-align: right; }
.viz-tip {
  position: fixed; z-index: 40; pointer-events: none; max-width: 280px;
  background: var(--text); color: var(--bg); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; line-height: 1.4; box-shadow: var(--shadow);
}

/* ---------- хранилище и экран входа ---------- */
.store-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px;
  font-size: 12px; padding: 4px 16px; background: var(--surface-2); color: var(--muted);
}
.store-bar .text-btn { font-size: 12px; padding: 2px 0; }
.lock {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px 16px; overflow-y: auto;
}
.lock-box { width: 100%; max-width: 440px; }
.lock-box h1 { font-size: 26px; font-weight: 700; }
.lock-text { color: var(--muted); margin-top: 8px; }
.lock-box .field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
}
.recovery, .generated {
  display: block; margin: 16px 0 8px; padding: 14px; border-radius: 10px; background: var(--surface);
  font-family: ui-monospace, Consolas, monospace; font-size: 17px; line-height: 1.6; letter-spacing: .04em;
  word-break: break-all; user-select: all;
}
.lock-box > .btn { background: var(--surface); border: 1px solid var(--line); }
body.is-locked > :not(.lock):not(script) { visibility: hidden; }

.desktop-only { display: none; }
.entry-fields { display: none; }

@media (min-width: 700px) {
  .screen { max-width: 640px; margin: 0 auto; }
}

/* ---------- ПК: меню слева, история в центре, панель ввода справа ---------- */
@media (min-width: 1024px) {
  body {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr) 400px;
    grid-template-rows: auto auto 1fr;
    min-height: 100vh;
  }
  .desktop-only { display: block; }
  .proto-banner { grid-column: 1 / -1; }

  .tabs {
    position: sticky; top: 0; align-self: start;
    grid-column: 1; grid-row: 3;
    height: 100vh; padding: 20px 12px;
    display: flex; flex-direction: column; gap: 2px;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .brand { font-weight: 700; font-size: 18px; padding: 4px 12px 16px; }
  .tabs button { text-align: left; font-size: 15px; padding: 9px 12px; border-radius: 8px; color: var(--text); }
  .tabs button:hover { background: var(--surface-2); }
  .tabs button[aria-current="page"] { background: var(--surface-2); color: var(--accent); }

  .screen {
    grid-column: 2; grid-row: 3;
    width: 100%; max-width: 760px; margin: 0 auto;
    padding: 8px 32px 48px;
  }
  .top { padding-top: 28px; }
  .op:hover { background: var(--surface-2); }

  .fab { display: none; }

  .entry {
    position: sticky; top: 0; inset: auto; z-index: auto;
    grid-column: 3; grid-row: 3; align-self: start;
    height: 100vh; max-width: none; margin: 0;
    padding: 24px 24px 24px;
    background: var(--surface); border-left: 1px solid var(--line);
    overflow-y: auto; overflow-x: hidden;
  }
  #entry-close, .keypad, .chips { display: none; }
  .seg { margin-right: 0; }
  .amount-wrap { flex: none; min-height: 0; padding: 28px 0 8px; gap: 6px; }
  .amount { font-size: 44px; }
  .amount-hint { font-size: 13px; color: var(--muted); text-align: center; }

  .entry-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; margin: 8px 0 18px; }
  .entry-fields .field input, .entry-fields .field select { width: 100%; min-width: 0; }
  .entry-fields .field-wide { grid-column: 1 / -1; }
  .field select {
    font: inherit; font-size: 15px; color: var(--text);
    height: 40px; padding: 0 10px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--bg);
  }
  .entry-fields .field input { height: 40px; font-size: 15px; background: var(--bg); }

  .cat { background: var(--bg); height: 72px; }
  .cat:hover { background: var(--surface-2); }

  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 16px; width: 480px; }

  .proto-banner { grid-column: 2 / -1; grid-row: 1; }
  .store-bar { grid-column: 2 / -1; grid-row: 2; }
  .tabs { grid-row: 1 / span 3 !important; }
  .toast { left: 232px; right: auto; bottom: 24px; width: 440px; margin: 0; }

  body:not([data-tab="ops"]) .screen { grid-column: 2 / 4; }
  .screen-wide { max-width: 1120px; }
  .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .an-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
}

/* ---------- RAUJIN: шрифты, служебные подписи моноширинным, перьевой штрих ---------- */
h1, .lock-box h1, .brand { font-family: var(--f-display); font-weight: 400; letter-spacing: .01em; }
.top h1 { font-size: 40px; line-height: 1.05; }
.top { position: relative; padding-bottom: 18px; }
.top::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 4px; height: 6px; background: var(--line);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 8' preserveAspectRatio='none'%3E%3Cpath d='M0,2.9 L100,1.8 L200,1.1 L300,.3 L400,-.2 L500,-.1 L600,.7 L700,1.8 L800,2.9 L900,3.8 L1000,4.2 L1000,4.5 L900,4.5 L800,5.1 L700,5.7 L600,6.5 L500,7 L400,7 L300,6.4 L200,5.7 L100,5.2 L0,4.4Z'/%3E%3C/svg%3E") center/100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 8' preserveAspectRatio='none'%3E%3Cpath d='M0,2.9 L100,1.8 L200,1.1 L300,.3 L400,-.2 L500,-.1 L600,.7 L700,1.8 L800,2.9 L900,3.8 L1000,4.2 L1000,4.5 L900,4.5 L800,5.1 L700,5.7 L600,6.5 L500,7 L400,7 L300,6.4 L200,5.7 L100,5.2 L0,4.4Z'/%3E%3C/svg%3E") center/100% 100% no-repeat;
}
.kpi-label, .an-card th, .field > span, .proto-banner, .store-bar {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
}
.field > span { font-size: 10.5px; }
.op-sum, .acc-sums, .day-sum, .kpi-value, .amount, .hbar-val, #month-spent, .an-card td.num, .recovery, .generated, .chart .tick,
.entry-fields input, .edit-form input[inputmode] {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
}
.day-sum { text-transform: none; letter-spacing: 0; }
.amount { font-weight: 500; letter-spacing: -.02em; }
.kpi-value { font-weight: 500; font-size: 22px; }
.op-title, .an-card-title, .hbar-name { font-weight: 400; }
.an-card-title { font-family: var(--f-display); font-size: 22px; letter-spacing: .01em; }
.cat-name { font-size: 13px; }
.btn { border-radius: 4px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; }
.import-btn, .more-btn { font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; }
.brand::before {
  content: ''; width: 28px; height: 28px; flex: none; background: var(--accent);
  -webkit-mask: url(assets/brand/mark.svg) center/contain no-repeat; mask: url(assets/brand/mark.svg) center/contain no-repeat;
}
/* зерно бумаги, как на сайте студии */
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 100; background: url(assets/grain.png); opacity: .18; }
@media (pointer: coarse) { body::after { opacity: .1; } }
/* телефон: знак только в меню ПК, служебные плашки сверху компактнее */
@media (max-width: 1023px) { .brand { display: none; } }
@media (max-width: 699px) {
  .proto-banner, .store-bar { font-size: 10px; letter-spacing: .06em; line-height: 1.35; }
  .store-bar { padding: 3px 12px; }
  .store-bar .text-btn { font-size: 11px; }
}

/* поиск и фильтры операций */
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 4px 0 14px; }
.filters input { grid-column: 1 / -1; }
.filters input, .filters select {
  width: 100%; min-width: 0; font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px;
}
.filters select { font-size: 14px; padding-right: 4px; }
@media (pointer: coarse) { .filters input, .filters select { font-size: 16px; } } /* меньше 16px Safari увеличивает страницу при фокусе */
.filters .text-btn { justify-self: start; font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
@media (min-width: 700px) {
  .filters { grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr)) auto; align-items: center; }
  .filters input { grid-column: auto; }
}

/* сверка остатка в форме счёта */
.reconcile { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 14px; margin: 4px 0; min-width: 0; }
.reconcile legend { font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.reconcile .form-hint, .reconcile .btn { grid-column: 1 / -1; margin: 0; }
.reconcile .btn { justify-self: start; }

/* напоминание о копии и ссылки на экране входа */
.store-bar.is-warn { color: var(--danger); }
.lock-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* управление категориями */
.cat-manager { display: grid; gap: 12px; }
.cat-manager > .btn { justify-self: start; }
.cat-list .op.is-child { margin-left: 28px; }
.cat-list .op.is-archived .op-title { color: var(--muted); }
.cat-manage-btn { margin-top: 16px; }
.cat-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface); border-radius: var(--radius); padding: 4px; }
.cat-seg button { padding: 8px; border-radius: 4px; color: var(--muted); font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.cat-seg button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

/* капитал, годы, люди */
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--series-1); }
.chart .dot.s1 { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.capital-now { margin: -4px 0 8px; }
.an-card table tr.is-selected td { color: var(--text); font-weight: 500; background: var(--surface-2); }
.an-card td.is-negative { color: var(--danger); }
.years td:first-child, .people td:first-child { white-space: nowrap; }
.an-card table { width: 100%; }
@media (max-width: 699px) { .years, .people { font-size: 13px; } .years th:nth-child(5), .years td:nth-child(5) { display: none; } }
.table-scroll { overflow-x: auto; }

/* вкладка «Планы» */
.plans-body { display: grid; gap: 16px; }
.plans-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-list .op { align-items: center; }
.plan-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-left: auto; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 11px; }
.plan.is-overdue .op-sub { color: var(--danger); }
.plan.is-paid .op-sum, .plan.is-closed .op-title { color: var(--muted); }
.progress { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); margin: 8px 0 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.plan-note { font-size: 13px; }
.plan-accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.plan-accounts .check { margin: 0; }
.plan .op-sub { white-space: normal; overflow: visible; text-overflow: clip; }
.btn-small { min-height: 44px; border: 1px solid var(--line); background: transparent; color: var(--accent); }

.plan.is-over .op-sub.plan-note { color: var(--danger); }
.plan.is-over .progress i { background: var(--danger); }
.subs tr.is-stopped td { color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.generated[hidden] { display: none; }
/* тема: выбор и предупреждение */
.theme-pick .form-hint { margin: 0 0 12px; }
.theme-pick .opt { background: var(--surface); border-radius: var(--radius); }
.theme-pick .opt + .opt { margin-top: 8px; }
.theme-warn p { line-height: 1.5; margin: 0 0 12px; }
.theme-warn .form-actions { margin-top: 20px; flex-wrap: wrap; }

/* ---------- тише интерфейс (решение 2026-11-21): плоские строки, иконки в круге, подписи строчными ---------- */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--text); font-family: var(--f-body); font-size: 16px; line-height: 1; }
.ops { background: none; border-radius: 0; overflow: visible; }
.op, .acc { padding: 9px 8px; margin: 0 -8px; gap: 14px; border-radius: var(--radius); min-height: 60px; }
.op + .op, .acc + .acc { border-top: 0; }
.op { align-items: flex-start; }
.op > .badge { margin-top: 1px; }
.op-main { gap: 1px; }
.op-title { font-size: 17px; }
.op-sub { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.ic-sub { width: 14px; height: 14px; stroke-width: 1.6; }
.op-sum { font-size: 16px; align-self: flex-start; padding-top: 2px; }
.op-sum.is-expense { color: var(--danger); }
.op-sum.is-income { color: var(--income); }
.op-sum.is-transfer { color: var(--muted); }
.op:hover, .acc:hover { background: var(--surface); }
.day { margin-top: 22px; }
.day-head, .grid-label, .cat-group, #month-label, .an-card-sub, .legend { font-family: var(--f-body); font-size: 15px; letter-spacing: 0; text-transform: none; font-weight: 400; }
.day-head { padding: 0 0 4px; color: var(--muted); }
.day-sum { font-size: 13px; }
.cat { gap: 6px; }
.cat .badge { width: 34px; height: 34px; }
.cat .badge .ic { width: 18px; height: 18px; }
.more-btn { background: none; font-family: var(--f-body); font-size: 15px; letter-spacing: 0; text-transform: none; }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 4px; }
.icon-pick button { display: grid; place-items: center; height: 48px; border-radius: var(--radius); }
.icon-pick button[aria-checked="true"] { background: var(--surface-2); }
.icon-pick button[aria-checked="true"] .badge { border-color: var(--accent); color: var(--accent); }

/* вкладки с иконками: пять на телефоне, меню слева на ПК */
.tabs { grid-template-columns: repeat(5, 1fr); }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-family: var(--f-body); font-size: 12px; letter-spacing: 0; text-transform: none; }
.ic-tab { width: 22px; height: 22px; }
@media (min-width: 1024px) {
  .tabs button { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 16px; }
  .ic-tab { width: 20px; height: 20px; }
}

/* фильтры за кнопкой */
.filters { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.filters input { grid-column: auto; }
.flt-toggle { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
.flt-toggle[aria-expanded="true"] { background: var(--surface); color: var(--accent); }
.flt-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-family: var(--f-mono); font-size: 11px; line-height: 18px; text-align: center; }
.flt-more { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.flt-more[hidden] { display: none; }
@media (min-width: 700px) {
  .filters { grid-template-columns: minmax(0, 1fr) auto; }
  .flt-more { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: center; }
}

/* экран «Ещё» */
.more-list { display: grid; gap: 2px; margin-top: 8px; }
.more-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 10px 8px; margin: 0 -8px; border-radius: var(--radius); cursor: pointer; }
.more-item:hover { background: var(--surface); }
.more-item:focus-within, .more-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.more-text { display: flex; flex-direction: column; min-width: 0; }
.more-text .op-sub { white-space: normal; }
.ic-more { width: 40px; height: 40px; padding: 9px; border: 1px solid var(--line); border-radius: 50%; }

/* «Счета»: сворачиваемые группы с итогом справа */
.acc-capital { color: var(--muted); margin-top: 2px; }
.acc-capital strong { color: var(--text); font-family: var(--f-mono); font-weight: 500; font-size: 22px; margin-left: 6px; }
.acc-group > summary { list-style: none; cursor: pointer; padding: 6px 0; align-items: center; }
.acc-group > summary::-webkit-details-marker { display: none; }
.acc-group > summary > span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.ic-fold { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.acc-group[open] .ic-fold { transform: rotate(90deg); }
.acc-group > summary .day-sum { font-size: 15px; color: var(--text); }
.acc-group > summary .day-sum.is-negative { color: var(--danger); }
.acc-group .more-btn { margin-top: 2px; text-align: left; padding: 8px 0; }
#screen-accounts .acc-note { margin-top: 28px; font-size: 13px; }

/* регулярные операции */
.rec-pending { flex-wrap: wrap; }
.rec-btns { display: flex; gap: 8px; flex-basis: 100%; padding-left: 54px; margin-top: 2px; }
.btn-ghost { color: var(--muted); }
.rec-pending .op-sub { color: var(--accent); }
.plan-list .op > .badge { margin-top: 1px; }
.sub-make { font-size: 13px; padding: 2px 0; }

/* можно потратить сегодня, прогноз */
.can-spend { margin-top: 0; }
.can-spend strong { font-family: var(--f-mono); font-weight: 500; color: var(--accent); }
.can-spend strong.is-negative { color: var(--danger); }
.forecast-base { margin: 0 0 12px; }
.an-card .plan-list { margin-top: 4px; }

/* левая рука и свайп */
body[data-hand="left"] .fab { right: auto; left: 16px; }
@media (pointer: coarse) { .ops .op { touch-action: pan-y; } }
.op.is-swiping { transition: none; background: var(--surface); }
.op { transition: transform .2s; }
.op.will-delete { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }
