/* Kassa Kunlik — 1366×768 без скролла страницы. Vitour: #234b96 / #1c8cf2, Space Grotesk. */
:root {
  color-scheme: light;
  --blue: #234b96; --blue2: #1c8cf2; --on-primary: #ffffff; --ink: #101418; --muted: #6b7280; --line: #dfe4ec;
  --bg: #f4f6fa; --card: #ffffff; --card2: #f8fafc; --hover: #f6f8fc; --chipbg: #eef2f8; --sel: #e8f1fd; --input: #ffffff;
  --red: #c62828; --red-bg: #fdecec; --yellow-bg: #fff6d6; --yellow: #b7791f;
  --green: #1f8a4c; --green-bg: #e6f6ec; --grey-row: #8a94a6; --expense-ink: #7a3b3b; --radius: 8px;
  --warn-ink: #6b4e00; --warn-line: #f0dca0; --info-bg: #e8f1fd; --info-ink: #1e3a8a; --info-line: #c7dcf8;
  --accept-bg: #f0f5ff; --submit-bg: #fff8e6; --badge-ed-bg: #fff0d6; --badge-ed-ink: #8a5a00; --chip-arch-bg: #e5e7eb; --chip-arch-ink: #374151;
  --shadow: 0 8px 24px rgba(16,20,24,.12);
}
/* Тёмная тема (владелец 2026-09-11): переключатель ☾/☀ в шапке, выбор в localStorage, по умолчанию — как в системе. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --blue: #8ab4ff; --blue2: #5aa9ff; --on-primary: #0f131a; --ink: #e6e9ef; --muted: #98a2b3; --line: #2a3140;
  --bg: #0f131a; --card: #171c25; --card2: #1c222d; --hover: #1f2631; --chipbg: #232b38; --sel: #1e2e45; --input: #10151d;
  --red: #ff7b7b; --red-bg: #3a1c1c; --yellow-bg: #3a2f14; --yellow: #e2b04a;
  --green: #4cc38a; --green-bg: #17301f; --grey-row: #7b8596; --expense-ink: #f0a3a3;
  --warn-ink: #f2d38b; --warn-line: #5a4a1c; --info-bg: #1b2a44; --info-ink: #cfe0ff; --info-line: #2c4a7a;
  --accept-bg: #16223a; --submit-bg: #2e2712; --badge-ed-bg: #3a2f14; --badge-ed-ink: #f2d38b; --chip-arch-bg: #2a3140; --chip-arch-ink: #c5ccd8;
  --shadow: 0 8px 24px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif; font-size: 15px; letter-spacing: -0.02em;
  display: grid; grid-template-rows: auto auto auto 1fr auto auto; height: 100vh; overflow: hidden;
}
button, input { font: inherit; letter-spacing: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* header */
.top { display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); height: 48px; }
.brand { font-weight: 700; color: var(--blue); font-size: 17px; }
.brand span { color: var(--blue2); }
.daybox { display: flex; align-items: center; gap: 10px; }
.daylabel { font-weight: 600; font-size: 17px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--chipbg); color: var(--muted); text-transform: lowercase; }
.chip.open { background: var(--green-bg); color: var(--green); }
.chip.submitted { background: var(--yellow-bg); color: var(--yellow); }
.chip.archived { background: var(--chip-arch-bg); color: var(--chip-arch-ink); }
.ratebox { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.ratebox input { width: 92px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; text-align: right; font-weight: 600; color: var(--ink); background: var(--input); }
.ratebox input.bad { border-color: var(--red); }
.navbox { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.theme-btn { font-size: 16px; line-height: 1; }
.navbox .who { font-weight: 600; }
.net { color: var(--yellow); font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; }
.link:hover { text-decoration: underline; }

/* banners / tabs */
.banner { padding: 0 16px; grid-row: 2; }
.bn { margin-top: 8px; padding: 7px 12px; border-radius: var(--radius); font-size: 14px; display: flex; align-items: center; gap: 12px; }
.bn.warn { background: var(--yellow-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.bn.info { background: var(--info-bg); color: var(--info-ink); border: 1px solid var(--info-line); }
.tabs { display: flex; gap: 6px; padding: 8px 16px 0; grid-row: 3; }
.tab { border: 1px solid var(--line); background: var(--input); padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.tab i { font-style: normal; color: var(--muted); margin-left: 4px; }
.tab.active { background: var(--blue); color: var(--on-primary); border-color: var(--blue); }
.tab.active i { color: var(--on-primary); opacity: .75; }

/* no day */
.noday { display: flex; align-items: center; justify-content: center; grid-row: 4; }
.noday-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; width: 420px; text-align: center; }
.noday-card h2 { margin: 0 0 6px; }
.noday-row { display: flex; justify-content: center; gap: 22px; margin: 16px 0; }
.noday-row label { cursor: pointer; }

/* main columns */
.main { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px 16px 0; min-height: 0; grid-row: 4; }
.col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.col h2 { margin: 0; padding: 8px 12px 4px; font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.col[data-kind="expense"] h2 { color: var(--expense-ink); }
.entry-form { display: grid; grid-template-columns: 1fr 130px 54px 30px; gap: 6px; padding: 4px 10px 6px; position: relative; }
.entry-form input, .entry-form button { height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--input); padding: 0 9px; }
.entry-form input:focus { outline: none; border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(28,140,242,.15); }
.f-amount { text-align: right; font-weight: 600; }
.f-cur { cursor: pointer; font-weight: 600; }
.f-cur:focus { outline: none; border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(28,140,242,.15); }
.f-flag { cursor: pointer; color: var(--line); padding: 0 !important; }
.f-flag.on { color: var(--red); }
.f-err { grid-column: 1 / -1; color: var(--red); font-size: 12px; }
.readonly .entry-form { opacity: .45; }
.namewrap { position: relative; }
.namewrap input { width: 100%; }
.sugg { position: absolute; left: 0; right: 0; top: 36px; z-index: 5; margin: 0; padding: 4px 0; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.sugg li { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; }
.sugg li i { color: var(--muted); font-style: normal; font-size: 12px; }
.sugg li.hl, .sugg li:hover { background: var(--sel); }
.freq { padding: 0 10px 6px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.chipbtn { border: 1px solid var(--line); background: var(--card2); border-radius: 999px; padding: 2px 9px; font-size: 12px; cursor: pointer; }
.chipbtn:hover { border-color: var(--blue2); color: var(--blue); }
.rows-wrap { flex: 1; overflow-y: auto; min-height: 0; border-top: 1px solid var(--line); }
.col-total { display: flex; align-items: baseline; gap: 12px; padding: 7px 12px; border-top: 2px solid var(--line); background: var(--card2); border-radius: 0 0 var(--radius) var(--radius); font-variant-numeric: tabular-nums; }
.col-total > span:first-child { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.col-total .ct-native { color: var(--muted); font-size: 13px; }
.col-total .ct-usd { margin-left: auto; font-size: 17px; }
.col[data-kind="expense"] .col-total .ct-usd { color: var(--expense-ink); }
.rows { list-style: none; margin: 0; padding: 4px 6px; }
.row { display: grid; grid-template-columns: 18px 1fr auto 22px 26px; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; min-height: 27px; border-left: 3px solid transparent; }
.row:hover { background: var(--hover); }
.row .mark { background: none; border: 0; padding: 0; color: var(--line); cursor: pointer; font-size: 12px; width: 18px; }
.row.flag { border-left-color: var(--red); background: var(--red-bg); }
.row.flag .mark, .row.flag .nm, .row.flag .am { color: var(--red); }
.row .nm { cursor: text; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row .am { font-weight: 600; white-space: nowrap; cursor: text; font-variant-numeric: tabular-nums; }
.row .am i { font-style: normal; color: var(--muted); font-weight: 500; font-size: 13px; }
.row .st { font-size: 12px; text-align: center; }
.row .st.ok { color: var(--green); }
.row .st.wait { color: var(--yellow); }
.row .st.fail { color: var(--red); }
.row .del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.row .del:hover { color: var(--red); }
.row.pending { background: var(--yellow-bg); }
.row.failed { background: var(--red-bg); grid-template-columns: 18px 1fr auto 22px auto; }
.row.failed .mini { margin-left: 4px; }
.row.carry { color: var(--grey-row); }
.row.carry .nm, .row.carry .am { color: var(--grey-row); font-style: italic; }
.row.deleted .nm, .row.deleted .am { text-decoration: line-through; color: var(--muted); }
.badge { font-style: normal; font-size: 11px; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--chipbg); color: var(--muted); vertical-align: 1px; }
.badge.ed { background: var(--badge-ed-bg); color: var(--badge-ed-ink); cursor: help; }
.badge.del { background: var(--chipbg); }
.rowmsg { grid-column: 1 / -1; font-size: 12px; color: var(--red); padding-left: 26px; }
.mini { border: 1px solid var(--line); background: var(--input); border-radius: 5px; padding: 1px 7px; font-size: 12px; cursor: pointer; }
.row.editing { background: var(--sel); }
.edit-form { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 120px 54px auto auto; gap: 6px; }
.edit-form input, .edit-form button { height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; background: var(--input); }
.edit-form.bad input { border-color: var(--red); }
.e-amount { text-align: right; font-weight: 600; }

/* totals */
.totals { grid-row: 5; display: flex; align-items: center; gap: 24px; margin: 10px 16px 0; padding: 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.tot { border-collapse: collapse; font-variant-numeric: tabular-nums; }
/* «как на бумаге»: остаток на начало, + приход, − расход, = в кассе */
.paper { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.paper th { text-align: left; font-weight: 500; color: var(--muted); padding: 2px 18px 2px 0; white-space: nowrap; }
.paper .p-head th { font-size: 12px; text-align: right; padding-bottom: 0; }
.paper .p-head th:first-child { text-align: left; }
.paper td { text-align: right; padding: 2px 0 2px 18px; min-width: 120px; color: var(--ink); }
.paper .p-out td { color: var(--expense-ink); }
.paper .p-cash th, .paper .p-cash td { border-top: 1px solid var(--ink); padding-top: 4px; font-weight: 700; }
.paper .p-cash b { font-size: 17px; }
.paper .p-cash b.neg { color: var(--red); }
.paper input { width: 118px; padding: 3px 7px; border: 1px dashed var(--line); border-radius: 6px; text-align: right; font-weight: 600; color: var(--ink); background: var(--input); font-size: 14px; }
.paper input:focus { outline: none; border-style: solid; border-color: var(--blue2); }
.paper input.bad { border-color: var(--red); }
.paper input:disabled { opacity: .75; border-style: solid; }
.hide-sums .paper td, .hide-sums .paper input { filter: blur(7px); user-select: none; pointer-events: none; }
.tot th { text-align: left; padding: 3px 14px 3px 0; color: var(--muted); font-weight: 600; width: 44px; }
.tot td { padding: 3px 26px 3px 0; color: var(--muted); }
.tot td b { color: var(--ink); font-size: 17px; margin-left: 6px; }
.tot td b.neg { color: var(--red); }
.t-conv { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 6px; }
.tot-side { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.rate-total { color: var(--muted); font-size: 13px; }
.rate-total b { color: var(--ink); font-size: 15px; }
.queue-note { color: var(--yellow); font-size: 13px; }
.readonly-note { color: var(--muted); font-size: 13px; }
.btn { border: 1px solid var(--line); background: var(--input); border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(.92); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.armed { background: var(--yellow); border-color: var(--yellow); color: var(--on-primary); }

/* submit (Akmal) */
.submit-panel { grid-row: 6; margin: 8px 16px 10px; padding: 8px 14px; background: var(--submit-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); }
.sub-grid { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 14px; align-items: end; }
.sub-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.sub-grid input { height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 9px; text-align: right; font-weight: 600; color: var(--ink); background: var(--input); }
.sub-keep { font-size: 14px; font-weight: 600; padding-bottom: 8px; }
.handover-note { color: var(--muted); font-size: 13px; }
.acc-exp { color: var(--muted); font-size: 11px; }

/* accept (Yakub) */
.accept { grid-row: 6; margin: 8px 16px 10px; padding: 8px 14px; background: var(--accept-bg); border: 1px solid var(--info-line); border-radius: var(--radius); }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 14px; align-items: end; }
.acc-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.acc-grid input { height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 9px; text-align: right; font-weight: 600; color: var(--ink); background: var(--input); }
.acc-ind { min-height: 16px; font-size: 12px; font-weight: 600; }
.acc-ind.ok { color: var(--green); }
.acc-ind.bad { color: var(--red); }
.accept-btn { background: var(--green); border-color: var(--green); color: var(--on-primary); height: 40px; }
.accept-btn.armed { background: var(--yellow); border-color: var(--yellow); }
.acc-btns { display: flex; align-items: center; gap: 10px; }
.err { color: var(--red); font-size: 13px; }

/* скрытый режим: итоги размыты, строки видны */
.hide-sums .tot td b, .hide-sums .col-total .ct-native, .hide-sums .col-total .ct-usd, .hide-sums #rateTotal b,
.hide-sums #handoverNote, .hide-sums .acc-exp, .hide-sums .arx-day .meta, .hide-sums .arx-day .tot b {
  filter: blur(7px); user-select: none; pointer-events: none; transition: filter .15s;
}
.tot td b, .col-total .ct-native, .col-total .ct-usd { transition: filter .15s; }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; grid-template-rows: none; }
.login-card { width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px; text-align: center; }
.login-brand { color: var(--blue2); font-weight: 700; letter-spacing: .06em; font-size: 12px; text-transform: uppercase; }
.login-card h1 { margin: 6px 0 4px; font-size: 24px; color: var(--blue); }
.login-card .pin { display: block; width: 100%; margin: 18px 0 12px; height: 52px; font-size: 30px; letter-spacing: .5em; text-align: center; border: 1px solid var(--line); border-radius: 10px; }
.login-card .pin:focus { outline: none; border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(28,140,242,.15); }
.login-card .btn { width: 100%; height: 44px; }
.login-card .err { margin-top: 6px; background: var(--red-bg); padding: 8px; border-radius: 8px; }
.lang-row { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* archive */
.arx-body { grid-template-rows: auto 1fr; overflow: auto; }
.arx { padding: 16px; max-width: 1200px; width: 100%; margin: 0 auto; }
.arx-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.arx-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.arx-form input[type="date"], .arx-form input[type="text"] { height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 9px; background: var(--input); color: var(--ink); }
.arx-form input[type="text"] { width: 260px; }
.arx-form .chk { flex-direction: row; align-items: center; gap: 6px; height: 34px; }
.arx-hint { color: var(--muted); font-size: 13px; margin: 14px 2px; }
.arx-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; font-variant-numeric: tabular-nums; }
.arx-table th, .arx-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.arx-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.arx-table td.am { text-align: right; font-weight: 600; white-space: nowrap; }
.arx-table tr.flag td { color: var(--red); background: var(--red-bg); }
.arx-table tr.deleted td { text-decoration: line-through; color: var(--muted); }
.arx-table td.date a { font-weight: 600; }
.arx-table td.kind { color: var(--muted); font-size: 12px; }
.arx-day { margin-top: 12px; }
.arx-day h2 { margin: 0 0 10px; font-size: 18px; }
.arx-day .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.arx-day .col { padding-bottom: 6px; }
.arx-day .rows-wrap { border-top: 0; }
.arx-day .meta { margin-top: 10px; color: var(--muted); font-size: 13px; }
.arx-day .tot { margin-top: 10px; }
