/* EN: One stylesheet for both modes. No external fonts, no inline styles (CSP).
   UA: Один CSS для обох режимів. Без зовнішніх шрифтів і inline-стилів. */
/* EN: Theme tokens (ADR 0029, CASHIER_SCREEN.md §4): light by default, dark by the
   system setting unless the server set data-theme, or forced by data-theme="dark".
   The dark set is written twice on purpose: CSS cannot join a media query and an
   attribute selector. .theme-cashier / .theme-admin set only density, never colours.
   UA: Токени тем: світла за замовчуванням, темна — за системою (якщо сервер не
   поставив data-theme) або примусово data-theme="dark". Темний набір записано двічі
   свідомо: CSS не поєднує медіазапит і атрибут. .theme-* задають лише щільність. */
:root {
  --bg: #eef1f4; --surface: #ffffff; --surface-2: #f5f7f9; --line: #d5dce2;
  --fg: #15191d; --muted: #56616c; --zero: #9aa4ad; --accent: #1f5fd1;
  --buy: #1e8a55; --on-buy: #ffffff; --sell: #e09a1b; --on-sell: #231500;
  --danger: #b3261e; --warn: #8a5a00; --ok: #17692f;
  --buy-tint: #e8f6ee; --sell-tint: #fdf3df; --bal-head: #e3eaf3; --bal-cell: #f2f6fb;
  --input-bg: #ffffff; --on-accent: #ffffff;
  /* EN: text colour of buy/sale on light backgrounds (contrast >= 4.5:1). UA: текст купівлі/продажу. */
  --buy-fg: #17724a; --sell-fg: #8f5a00;
  --card: var(--surface);
  color-scheme: light;
  font-family: "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1317; --surface: #161b20; --surface-2: #1d242b; --line: #2b343d;
    --fg: #eef1f4; --muted: #9aa6b2; --zero: #5f6b77; --accent: #7fb0ff;
    --buy: #3fbf7f; --on-buy: #06210f; --sell: #f2b441; --on-sell: #2b1a00;
    --danger: #ff8a80; --warn: #f2c066; --ok: #6fd391;
    --buy-tint: rgba(63, 191, 127, .10); --sell-tint: rgba(242, 180, 65, .10);
    --bal-head: #25303a; --bal-cell: rgba(127, 176, 255, .07);
    --input-bg: #0f1317; --on-accent: #0f1317;
    --buy-fg: #3fbf7f; --sell-fg: #f2b441;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1317; --surface: #161b20; --surface-2: #1d242b; --line: #2b343d;
  --fg: #eef1f4; --muted: #9aa6b2; --zero: #5f6b77; --accent: #7fb0ff;
  --buy: #3fbf7f; --on-buy: #06210f; --sell: #f2b441; --on-sell: #2b1a00;
  --danger: #ff8a80; --warn: #f2c066; --ok: #6fd391;
  --buy-tint: rgba(63, 191, 127, .10); --sell-tint: rgba(242, 180, 65, .10);
  --bal-head: #25303a; --bal-cell: rgba(127, 176, 255, .07);
  --input-bg: #0f1317; --on-accent: #0f1317;
  --buy-fg: #3fbf7f; --sell-fg: #f2b441;
  color-scheme: dark;
}
/* Cashier: larger type (TZ §9: >= 16 px, key sums >= 20 px). / Каса: більший шрифт. */
.theme-cashier { font-size: 17px; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); }
[hidden] { display: none !important; }
a { color: var(--accent); }
/* EN: <a class="btn"> and <button> look the same: one height, one baseline, no underline (task 162a). */
/* UA: <a class="btn"> і <button> однакові: одна висота й лінія, без підкреслення. */
button, .btn { min-height: 44px; padding: 0 16px; font: inherit; line-height: 1.2; color: var(--fg);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  vertical-align: middle; text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* htmx indicators (its own inline <style> is off for CSP). / Індикатори htmx. */
.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Banners / Банери */
.banner { padding: 8px 16px; font-weight: 600; text-align: center; }
.banner--test, .banner--warn { background: var(--warn); color: var(--on-accent); }
.banner--danger { background: var(--danger); color: var(--on-accent); }
.banner--info { background: var(--accent); color: var(--on-accent); }

/* Cashier layout (ADR 0029, CASHIER_SCREEN.md §2): status bar, main, bottom bar.
   Макет каси: статус-бар, робоча зона, нижня панель. */
.cashier { min-height: 100vh; display: flex; flex-direction: column; }
.statusbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 20px; min-height: 44px;
  padding: 4px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 15px; }
.statusbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.statusbar__closed { color: var(--danger); font-weight: 700; }
.statusbar .btn, .statusbar button { min-height: 34px; padding: 0 10px; font-size: 14px; }
.statusbar form { margin: 0; }
/* EN: Shell-style header of the cash desk (task 161f): brand, grouped drop-down menu, user menu.
   UA: Шапка каси в стилі оболонки: бренд, випадне меню групами, меню користувача. */
.statusbar .shell-brand { min-height: 34px; font-size: 1.05rem; }
.statusbar .usermenu summary { min-height: 34px; }
.cashmenu { position: relative; }
.cashmenu summary { min-height: 34px; display: flex; align-items: center; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; list-style: none; font-weight: 600; }
.cashmenu__sheet { position: absolute; left: 0; top: 40px; z-index: 30; display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr)); gap: 0 8px; width: max-content;
  max-width: calc(100vw - 32px); max-height: 75vh; overflow-y: auto; padding-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.cashmenu__group { display: grid; align-content: start; }
.cashmenu__sheet a { min-height: 40px; display: flex; align-items: center; padding: 0 16px;
  color: var(--fg); text-decoration: none; }
.cashmenu__sheet a:hover, .cashmenu__sheet a:focus-visible { background: var(--surface-2); }
.cashmenu__sheet a[aria-current="page"] { font-weight: 700; color: var(--accent); }
.dot { display: inline-flex; align-items: center; gap: 6px; }
.dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--buy); }
.dot--bad::before { background: var(--danger); }
.dot--unknown::before { background: var(--zero); }
.themes { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.themes button { border: 0; border-radius: 0; background: transparent; }
.themes button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cashier__main { padding: 16px; flex: 1; }
.fkeys { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px;
  background: var(--surface); border-top: 1px solid var(--line); }
.fkeys > .btn, .fkeys > button { flex: 1; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; }
.fkeys__form { margin: 0 0 0 auto; display: flex; }

/* Panel shell of every portal (task 161b, ADR 0015/0047): header across, grouped side
   menu on PC. / Оболонка панелі кожного порталу: шапка на всю ширину, бічне меню групами. */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); grid-template-rows: auto 1fr;
  min-height: 100vh; }
.shell-top { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  padding: 8px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.shell-brand { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700;
  font-size: 1.2rem; color: var(--fg); text-decoration: none; }
.shell-brand__portal { font-weight: 400; font-size: .9rem; color: var(--muted); }
.shell-top__company { color: var(--muted); }
.shell-top__tools { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.usermenu { position: relative; }
.usermenu summary { min-height: 44px; display: flex; align-items: center; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; list-style: none; }
.usermenu__sheet { position: absolute; right: 0; top: 48px; z-index: 20; min-width: 220px; display: grid;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.usermenu__sheet a, .usermenu__sheet button { padding: 12px 16px; color: var(--fg); text-decoration: none;
  text-align: left; border: 0; border-radius: 0; background: none; width: 100%; font: inherit; cursor: pointer; }
.usermenu__sheet a[aria-current="page"] { font-weight: 700; color: var(--accent); }
.usermenu__sheet form { margin: 0; border-top: 1px solid var(--line); }
.usermenu .my-portals { display: grid; padding: 8px 16px; }
.sidenav { background: var(--card); border-right: 1px solid var(--line); padding: 8px 0 16px; }
.nav-group { display: block; padding: 14px 16px 4px; font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* EN: «Мої входи» (ADR 0046). UA: «Мої входи». */
.my-portals { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.my-portals a { min-height: 44px; display: inline-flex; align-items: center; }
.sidenav__list a { display: block; padding: 8px 16px; color: var(--fg); text-decoration: none; }
.sidenav__list a[aria-current="page"] { background: var(--bg); font-weight: 700;
  box-shadow: inset 4px 0 0 var(--accent); }
.admin__col { min-width: 0; }
.page-title { margin: 0 0 16px; font-size: 1.3rem; }
.page-title:empty { display: none; }
.admin__main { padding: 24px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.bottomnav { display: none; }

/* Forms, cards, sign-in (task 007). / Форми, картки, вхід. */
.form { display: grid; gap: 12px; max-width: 420px; margin: 0 0 16px; }
.form label { display: block; font-weight: 600; margin-bottom: 4px; }
/* EN: Text-like fields only. Checkbox, radio and file have their own rules below — the full-width
       44 px box made them big centred squares (task 162a). */
/* UA: Лише текстові поля. Чекбокс, радіо й файл — окремо нижче: рамка 44 px на всю ширину
       робила з них великі відцентровані квадрати. */
/* :where() keeps the old specificity (.form input), so local overrides still win. */
.form input:where(:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])), .form select {
  width: 100%; min-height: 44px; padding: 0 12px; font: inherit; color: var(--fg);
  background: var(--input-bg); border: 1px solid var(--line); border-radius: 6px; }
/* EN: Checkbox/radio row: small square on the left, text on the right, whole row clickable.
       Works for <label class="check"> and for any <label> that wraps its own box. */
/* UA: Рядок чекбокса/радіо: малий квадрат ліворуч, текст праворуч, клікабельний увесь рядок.
       Для <label class="check"> і будь-якого <label>, що обгортає свій квадрат. */
/*     Block + absolute box (not flex): label text may hold <code>/<span>, and flex would split it.
       12 px top/bottom + 20 px line = 44 px row; the box is aligned with the first text line. */
/*     Блок + квадрат absolute (не flex): у підписі бувають <code>/<span>, flex їх розриває.
       12 + 20 + 12 = рядок 44 px; квадрат — на рівні першого рядка тексту. */
.check, .form label:has(> input[type="checkbox"], > input[type="radio"]) {
  display: block; position: relative; margin: 0; padding: 12px 0 12px 28px; line-height: 20px;
  font-weight: 600; cursor: pointer; }
.check > input, .form label > input[type="checkbox"], .form label > input[type="radio"] {
  position: absolute; left: 0; top: 13px; width: 18px; height: 18px; margin: 0;
  accent-color: var(--accent); cursor: pointer; }
/* EN: Help text sits under the label text, not under the square (18 px box + 10 px gap). */
/* UA: Пояснення — під текстом підпису, а не під квадратом (квадрат 18 + проміжок 10). */
.check-field .helptext, .check-field .errorlist, .check + .muted, .check + .helptext,
.form label:has(> input[type="checkbox"], > input[type="radio"]) + .muted {
  margin: -8px 0 0 28px; font-size: .9rem; }
.form .check-field + .check-field, .form .check + .check { margin-top: -8px; }
/* EN: File input: the system button gets the outline-button look; file name stays muted. */
/* UA: Поле файла: системна кнопка — як контурна кнопка; назва файла — приглушена. */
.form input[type="file"] { max-width: 100%; font: inherit; color: var(--muted); }
/* <label>Файл <input type=file></label>: the button goes under the caption, like other fields. */
.form label > input[type="file"] { display: block; margin-top: 4px; font-weight: 400; }
input[type="file"]::file-selector-button { min-height: 44px; margin-right: 12px; padding: 0 16px;
  font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--accent); }
.form .errorlist { margin: 4px 0 0; padding: 0; list-style: none; color: var(--danger); }
.form .helptext { color: var(--muted); font-size: .9rem; }
.form__error { margin: 0; color: var(--danger); font-weight: 600; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; margin: 0 0 16px; max-width: 560px; }
.card__title { margin: 0 0 12px; font-size: 1.1rem; }
.muted { color: var(--muted); }
.notice { padding: 10px 14px; border-left: 4px solid var(--ok); background: var(--card); }
.notice--warn { border-left-color: var(--warn); }
.backup-ind { font-size: .85rem; color: var(--ok); }
.backup-ind--stale { color: var(--danger); font-weight: 700; }
.auth { max-width: 400px; margin: 10vh auto 0; padding: 0 16px; }
.auth__title { margin: 0 0 16px; }
.auth .form { max-width: none; }
.auth__alt { margin-top: 24px; }
.inline-form { display: inline-block; margin: 4px 0 0 8px; }

/* Company switcher, permission matrix (task 008). / Перемикач компанії, матриця прав. */
.switcher { display: flex; gap: 8px; align-items: center; }
.switcher select { min-height: 44px; max-width: 220px; padding: 0 8px; font: inherit;
  color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; }
.perm-table { max-width: 760px; margin: 0 0 16px; }
.perm-table__role, .perm-table__cell { text-align: center; width: 120px; }
.perm-table__cell input { width: 24px; height: 24px; }
.perm-table__cell--changed { background: color-mix(in srgb, var(--warn) 18%, transparent); }

/* TOTP setup: long key/URI wraps, no page scroll at 360 px (task 010a).
   Налаштування TOTP: довгий ключ/URI переноситься, без скролу на 360 px. */
.secret-key code { word-break: break-all; font-size: 1.05rem; }
.codes { list-style: none; padding: 0; display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); font-size: 1.1rem; }

/* Phone (derived layout): bottom bar, big targets, no horizontal page scroll.
   Телефон (похідна верстка): нижня панель, великі кнопки, без горизонтального скролу. */
@media (max-width: 767px) {
  .shell { display: block; padding-bottom: 64px; }
  .sidenav { display: none; }
  .admin__main { padding: 12px; }
  .shell-top { padding: 4px 12px; gap: 4px 8px; }
  .shell-top__tools { margin-left: 0; width: 100%; flex-wrap: nowrap; }
  .shell-top .themes button { min-height: 36px; padding: 0 8px; font-size: 14px; white-space: nowrap; }
  .usermenu { margin-left: auto; min-width: 0; }
  .usermenu summary { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
    line-height: 42px; }
  .bottomnav { position: fixed; inset: auto 0 0 0; display: flex; background: var(--card);
    border-top: 1px solid var(--line); z-index: 10; }
  /* D-112: long labels («Відділення», «Користувачі») used to run together at 360 px:
     equal shrinkable cells, small padding, wrap inside a cell, a thin divider. */
  .bottomnav > a, .bottomnav summary { flex: 1 1 0; min-width: 0; min-height: 56px; display: flex;
    align-items: center; justify-content: center; color: var(--fg); text-decoration: none;
    list-style: none; cursor: pointer; padding: 4px 3px; font-size: 13px; line-height: 1.15;
    text-align: center; overflow-wrap: break-word; }
  .bottomnav > a + a, .bottomnav__more { border-left: 1px solid var(--line); }
  .bottomnav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
  .bottomnav__more { flex: 1 1 0; min-width: 0; }
  .bottomnav__sheet { position: absolute; right: 0; bottom: 56px; min-width: 60%;
    background: var(--card); border: 1px solid var(--line); display: grid; }
  .bottomnav__sheet { max-height: 70vh; overflow-y: auto; }
  .bottomnav__sheet a { padding: 14px 16px; color: var(--fg); text-decoration: none; }
  .table-wrap { overflow-x: auto; }
  .perm-table__role, .perm-table__cell { width: 72px; }
  .switcher select { max-width: 140px; }
  /* EN: Cash menu on a phone: one column, big targets. UA: Меню каси на телефоні: одна колонка. */
  .cashmenu__sheet { grid-template-columns: 1fr; width: calc(100vw - 32px); position: fixed; left: 16px; top: auto;
    max-height: 70vh; }
  .cashmenu__sheet a { min-height: 44px; }
}

/* Cash count by denominations (task 101b). / Перерахунок за номіналами. */
.count { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 8px 12px; }
.count legend { font-weight: 700; padding: 0 6px; }
.count__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.count__grid label { display: grid; gap: 2px; }
.count__grid input, .count-price input { width: 100%; min-height: 40px; padding: 0 8px; font: inherit;
  color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.count-adjust { display: flex; gap: 6px; flex-wrap: wrap; }
.count-adjust input { min-height: 40px; padding: 0 8px; font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }

/* Main cash screen (task 123a, CASHIER_SCREEN.md): 1366x768 without page scroll,
   only the journal scrolls. Currencies left (640 px), journal / exchange panel right.
   Головний екран каси: 1366×768 без прокрутки сторінки, прокручується лише журнал. */
.cashier--fit { height: 100vh; min-height: 0; overflow: hidden; }
.cashier--fit .cashier__main { min-height: 0; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.cashier--fit .cashier__main > .notice { margin: 0; padding: 6px 12px; }
.screen { flex: 1; min-height: 0; display: grid; grid-template-columns: 640px minmax(0, 1fr); gap: 16px; }
.screen__left { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.screen__right { min-height: 0; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }

/* Currency table / Таблиця валют */
.ctable { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.ctable table { font-size: 15px; }
.ctable th, .ctable td { padding: 6px 5px; white-space: nowrap; }
.ctable thead th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.ctable .bal { background: var(--bal-cell); font-weight: 700; font-size: 17px; }
.ctable thead .bal { background: var(--bal-head); color: var(--fg); font-size: 13px; }
.ctable .res { color: var(--accent); }
.ctable .row--empty, .ctable .row--empty .bal, .ctable .row--empty .res { color: var(--zero); }
.ctable label { display: block; cursor: pointer; }
.ctable small { font-weight: 400; font-size: 12px; }

/* Summary tiles / Картки підсумків */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.tile__label { display: block; font-size: 13px; color: var(--muted); }
.tile__value { display: block; white-space: nowrap; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile__note { font-size: 13px; color: var(--muted); font-weight: 400; }
.tile--result .tile__value { color: var(--accent); }

/* Quick actions 2 x 4 / Швидкі дії */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick__btn { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px;
  font-size: 14px; color: var(--fg); text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; }
.quick__btn--accent { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.quick__icon { width: 1.4em; text-align: center; color: var(--muted); }
.quick__btn--accent .quick__icon { color: var(--accent); }

/* Shift journal / Журнал операцій зміни */
.journal__head { display: flex; align-items: baseline; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.journal__title { margin: 0; font-size: 17px; }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 12px; }
.legend__buy::before, .legend__sell::before { content: ""; display: inline-block; width: 10px; height: 10px;
  margin-right: 4px; border-radius: 2px; background: var(--buy); }
.legend__sell::before { background: var(--sell); }
.journal__scroll { flex: 1; min-height: 0; overflow: auto; }
.jtable { font-size: 15px; }
.jtable th, .jtable td { padding: 6px 8px; }
.jtable thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.op--buy td { background: var(--buy-tint); }
.op--sell td { background: var(--sell-tint); }
.type--buy { color: var(--buy-fg); font-weight: 700; }
.type--sell { color: var(--sell-fg); font-weight: 700; }
.receipt--missing { color: var(--danger); font-weight: 700; }
.receipt--ok { color: var(--buy-fg); }
.opmenu { position: relative; }
.opmenu summary { list-style: none; cursor: pointer; padding: 0 8px; min-height: 32px; display: flex; align-items: center; }
.opmenu summary::-webkit-details-marker { display: none; }
.opmenu__list { position: absolute; right: 0; top: 100%; z-index: 5; min-width: 180px; display: grid;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 12px #0004; }
.opmenu__list a, .opmenu__list button { display: block; width: 100%; text-align: left; padding: 10px 14px;
  border: 0; border-radius: 0; background: transparent; color: var(--fg); text-decoration: none; }
.opmenu__list form { margin: 0; }
.opmenu__list .opmenu__danger { color: var(--danger); }

/* Exchange panel in place of the journal / Панель обміну на місці журналу */
.xpanel { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.xpanel__head { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline;
  justify-content: space-between; gap: 12px; }
.xpanel--buy .xpanel__head { background: var(--buy-tint); box-shadow: inset 6px 0 0 var(--buy); }
.xpanel--sell .xpanel__head { background: var(--sell-tint); box-shadow: inset 6px 0 0 var(--sell); }
.xpanel--wholesale .xpanel__head { box-shadow: inset 6px 0 0 var(--accent); }
.xpanel__title { margin: 0; font-size: 20px; }
.xpanel__hint { font-size: 13px; color: var(--muted); }
.xpanel__body { padding: 12px 16px; display: grid; gap: 12px; }
.xpanel .form { max-width: none; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.chips legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.form .chips label { min-width: 72px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px; margin: 0; font-weight: 700; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface-2); cursor: pointer; }
.chips input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chips input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.xrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.form .xbig input { min-height: 56px; font-size: 26px; font-weight: 700; text-align: right;
  font-variant-numeric: tabular-nums; border: 2px solid var(--accent); }
.xread { display: grid; gap: 2px; }
.xread__label { font-size: 13px; color: var(--muted); }
.xread__value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.xread--big .xread__value { font-size: 26px; }
.xread--short .xread__value { color: var(--danger); }
.xpanel__note { font-size: 14px; color: var(--muted); margin: 0; }
.xmore summary { cursor: pointer; color: var(--muted); }
.xmore[open] summary { margin-bottom: 8px; }
.xactions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 4px; }
.xactions .btn { min-height: 52px; padding: 0 24px; font-size: 18px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn--buy { background: var(--buy); border-color: var(--buy); color: var(--on-buy); font-weight: 700; }
.btn--sell { background: var(--sell); border-color: var(--sell); color: var(--on-sell); font-weight: 700; }
.btn--danger-outline { border-color: var(--danger); color: var(--danger); }
kbd { font: inherit; font-size: .8em; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; opacity: .8; }
.exchange__preview { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 4px 0; font-size: 14px; }
.exchange__preview dt { color: var(--muted); }
.exchange__preview dd { margin: 0; }
.exchange__damaged { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin: 0; }
.exchange__damaged label { display: block; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: .8em; font-weight: 700; }
.tag--wholesale { border: 2px solid var(--accent); color: var(--accent); }
.tag--damaged { background: var(--sell-tint); color: var(--warn); }
.tag--reversed { background: var(--sell-tint); color: var(--warn); }
.op--reversed td:not(:last-child) { text-decoration: line-through; opacity: .7; }
.op--reversed .tag { text-decoration: none; display: inline-block; }
.row--empty { color: var(--zero); }

/* Bottom action bar of the screen / Нижня панель дій */
.actions { position: static; flex-wrap: nowrap; align-items: center; }
.actions > .btn, .actions > button, .actions > details { flex: 0 0 auto; }
.actions { gap: 6px; }
.actions .btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; white-space: nowrap; text-decoration: none; }
.actions .act--main { min-height: 56px; min-width: 132px; justify-content: center; font-size: 20px; font-weight: 700; }
.actions .act--opt { border: 2px solid var(--accent); color: var(--accent); }
.act--off { opacity: .4; pointer-events: none; }
.actions__sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.actions__end { margin-left: auto; display: flex; gap: 8px; }
.btn--open { background: var(--buy); border-color: var(--buy); color: var(--on-buy); font-weight: 700; }
.more { position: relative; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more__list { position: absolute; left: 0; bottom: 100%; z-index: 5; min-width: 220px; display: grid; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 -4px 12px #0004; }
.more__list a { padding: 10px 14px; color: var(--fg); text-decoration: none; }

/* Receipt of the operation just booked / Квитанція щойно проведеної операції */
.receipt-pop { position: fixed; right: 16px; bottom: 84px; z-index: 15; max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  box-shadow: 0 4px 16px #0006; }
.receipt-pop summary { cursor: pointer; font-weight: 700; }
.receipt-pop .tapes { margin: 8px 0 0; }

/* Competitors' rates window (stub until 117) / Вікно «Курси конкурентів» */
.overlay { position: fixed; inset: 0; z-index: 20; background: #000a; display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay__box { width: min(900px, 100%); max-height: 90vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; }
.overlay__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.overlay__head h2 { margin: 0; }
.overlay__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }

/* Narrow screens: one column, the page scrolls again. / Вузький екран: одна колонка. */
@media (max-width: 1100px) {
  .cashier--fit { height: auto; overflow: visible; }
  .screen { grid-template-columns: 1fr; }
  .screen__right { min-height: 420px; }
  .actions { flex-wrap: wrap; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Virtual printer tape (task 107): the receipt as a thermal printer prints it.
   Віртуальний принтер: чек, як його друкує термопринтер. */
.tapes { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0; }
.tape-card { margin: 0; display: grid; gap: 8px; justify-items: start; }
.tape { background: #fff; color: #000; font-family: ui-monospace, Consolas, monospace;
  font-size: 15px; line-height: 1.35; padding: 12px; border-radius: 4px; box-shadow: 0 1px 4px #0006; }
.tape--32 { width: calc(32ch + 24px); }
.tape--48 { width: calc(48ch + 24px); }
.tape-card { max-width: 100%; overflow-x: auto; }
.tape__line { white-space: pre; overflow: hidden; }
.tape__line--center { text-align: center; }
.tape__line--right { text-align: right; }
.tape__line--bold { font-weight: 700; }
.tape__line--tall { transform: scaleY(2); transform-origin: top; margin-bottom: 1.35em; }
.tape__cut { color: #777; text-align: center; margin-top: 8px; }

/* Silent print through QZ Tray (task 108). / Тихий друк через QZ Tray. */
.qzjob { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.qzjob[data-mode="failed"] .qzjob__state { color: var(--warn); font-weight: 700; }
.print-banner { background: color-mix(in srgb, var(--warn) 25%, transparent);
  border-bottom: 2px solid var(--warn); padding: 8px 16px; }
.print-banner__item { margin-top: 4px; }

/* Board: large digits. / Табло: великі цифри. */
.board { font-size: 3rem; border-collapse: collapse; margin: 0 auto; }
.board th, .board td { padding: 0.2em 0.6em; text-align: right; }
.board small { font-size: 1rem; }

/* Bars of /stats (task 112): pure CSS, no libraries. / Стовпчики /stats без бібліотек. */
.bars { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; }
.bars__bar { width: 100%; height: 14px; }
.bars__bar::-webkit-meter-bar { background: var(--line); border-radius: 7px; border: 0; }
.bars__bar::-webkit-meter-optimum-value { background: var(--accent); border-radius: 7px; }
.bars__bar::-moz-meter-bar { background: var(--accent); }

/* Task 117: «Курси конкурентів» board — cards like playing cards, reorderable.
   Дошка карток курсів: картки можна переставляти, відкріплювати й повертати. */
.overlay__box--wide { width: min(1320px, 100%); }
.mboard__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.mboard__hint, .mboard__legend { margin: 4px 0; font-size: .9em; }
.mboard__tray { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.mcards--single { grid-template-columns: minmax(230px, 360px); }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 3px #0002; }
.mcard--ours { border-color: var(--accent); border-width: 2px; }
.mcard--nbu { background: var(--surface-2); }
.mcard.is-stale { border-style: dashed; }
.mboard.is-editing .mcard { cursor: grab; outline: 2px dashed var(--line); }
.mcard__head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mcard__title { margin: 0; font-size: 1.05em; }
.mcard__tools { display: flex; gap: 4px; }
.mcard__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mcard__table th, .mcard__table td { padding: 2px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.mcard__table .num { text-align: right; }
.mcard__foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85em; margin-top: auto; }
.delta { display: block; font-size: .78em; }
.delta--worse { color: var(--danger); }
.delta--better { color: var(--ok); }
.delta--same { color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .85em; }
.badge--warn { background: var(--sell-tint); color: var(--warn); border: 1px solid var(--warn); }
.btn--icon { min-width: 32px; padding: 2px 6px; }
.btn--chip { border-radius: 999px; padding: 2px 10px; }

/* Task 123 (ADR 0036): «Панель перерахунку» — open / count / close in the right column.
   Панель перерахунку: відкриття / перерахунок / закриття в правій колонці. */
.cpanel--open .xpanel__head { background: var(--buy-tint); box-shadow: inset 6px 0 0 var(--buy); }
.cpanel--open .xpanel__title { color: var(--buy); }
.cpanel--count .xpanel__head { background: var(--surface-2); box-shadow: inset 6px 0 0 var(--accent); }
.cpanel--count .xpanel__title { color: var(--accent); }
.cpanel--close .xpanel__head { background: color-mix(in srgb, var(--danger) 10%, transparent); box-shadow: inset 6px 0 0 var(--danger); }
.cpanel__sub { font-size: 16px; margin: 0; }
.cpanel__pick { display: grid; gap: 6px; }
.chips__search { max-width: 320px; }
.chips label[hidden] { display: none; }
.chips .chip--zero { color: var(--zero); }
.mark { margin-left: 4px; font-size: 13px; }
.mark--diff { color: var(--danger); font-weight: 700; }
.chips input:checked + label .mark { color: inherit; }
.cnotes { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 10px; margin: 0 0 8px; min-width: 0; }
.cnotes[hidden] { display: none; }
.cnotes legend { font-weight: 700; font-size: 18px; padding: 0 4px; }
.cnotes__booked { margin-left: 12px; font-weight: 400; font-size: 15px; color: var(--muted); }
.cnotes__table { width: auto; }
.cnotes__table th, .cnotes__table td { padding: 2px 10px; font-variant-numeric: tabular-nums; }
.cnotes__table input { width: 7em; font-size: 17px; text-align: right; font-variant-numeric: tabular-nums; }
.cfoot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; margin: 8px 0 0; font-size: 16px; }
.cfoot b { font-size: 26px; font-variant-numeric: tabular-nums; }
.cfoot--diff .cfoot__diff b { color: var(--danger); }
.creview .row--diff th, .creview .row--diff td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.ctable .row--counting th, .ctable .row--counting td { background: var(--bal-cell); }
.ctable .row--counting th { box-shadow: inset 4px 0 0 var(--accent); }
.tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ztape { max-width: 46em; }
.screen--bare { grid-template-columns: minmax(0, 1fr); }
/* Board pages (40 currencies): page counter under the table. / Сторінки табло. */
.board__page { text-align: center; font-size: 1.2rem; color: var(--muted); }
/* Count panel at 1366x768: compact chips (40 currencies in <= 3 rows), only the notes
   scroll. / Компактні кнопки (40 валют у <= 3 рядки), прокручуються лише номінали. */
.cpanel .xpanel__body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.form .cpanel__chips label { min-width: 0; min-height: 34px; padding: 2px 8px; font-size: 15px; }
.cpanel__chips { max-height: 150px; overflow-y: auto; }
.cpanel__notes .cfoot { position: sticky; bottom: 0; background: var(--surface); padding: 4px 0; }
.cpanel__form--tabs { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.cpanel__form--tabs .cpanel__notes { flex: 1; min-height: 160px; overflow: auto; }

/* Platform overview (task 161c): status tiles, attention list, quick actions.
   Огляд платформи: плитки стану, список «Що зараз важливо», швидкі дії. */
.overview-kpis { margin: 16px 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
a.kpi { display: block; color: inherit; text-decoration: none; }
a.kpi:hover, a.kpi:focus-visible { border-color: var(--accent); }
.kpi--bad { border-color: var(--danger); }
.kpi--bad b { color: var(--danger); }
.attention { margin: 6px 0 0; padding-left: 20px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 24px; }
.quick-actions .inline-form { margin: 0; }
.quick-actions .btn { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.empty-state .btn { margin-top: 4px; }

/* EN: ⓘ hint on complex admin screens (task 161d): closed by default, no JS. */
/* UA: Підказка ⓘ на складних екранах адмінки: закрита за замовчуванням, без JS. */
.hint { margin: 0 0 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 0 12px; max-width: 72ch; }
.hint summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); }
.hint[open] { padding-bottom: 8px; }
.hint ul, .hint ol { margin: 0 0 8px; padding-left: 20px; }
.hint li { margin: 4px 0; }
