/* НИ-КАЙ — the modern pages (web/ux/). Calm surfaces, one accent, tabular numbers, a clear focus ring: keyboard
   first, the mouse works everywhere. Sizes in rem; the root follows the window and the user's Ctrl −/=/0
   (--ux-scale). */
/* the parts of the UX redesign, one file per package (they come before the rules below; @import must be first) */
@import "core.css";
@import "inputs.css";
@import "pages.css";
@import "shell.css";
html[data-ui="modern"] {
  /* the colours: the roles of the active theme (web/theme.css) */
  --ux-bg: var(--c-bg);
  --ux-surface: var(--c-surface);
  --ux-surface-2: var(--c-surface-2);
  --ux-surface-3: var(--c-surface-3);
  --ux-text: var(--c-text);
  --ux-muted: var(--c-text-muted);
  --ux-faint: var(--c-text-faint);
  --ux-line: var(--c-line);
  --ux-line-strong: var(--c-line-strong);
  --ux-accent: var(--c-accent);
  --ux-accent-2: var(--c-accent-2);
  --ux-accent-soft: var(--c-accent-soft);
  --ux-accent-text: var(--c-on-accent);
  --ux-sel: var(--c-sel);
  --ux-sel-soft: var(--c-sel-soft);
  --ux-sel-text: var(--c-on-sel);
  --ux-ok: var(--c-ok);
  --ux-ok-soft: var(--c-ok-soft);
  --ux-warn: var(--c-warn);
  --ux-warn-soft: var(--c-warn-soft);
  --ux-danger: var(--c-danger);
  --ux-danger-soft: var(--c-danger-soft);
  --ux-focus: 0 0 0 3px var(--c-focus);
  --ux-shadow: var(--c-shadow);
  --ux-shadow-l: var(--c-shadow-l);
  --ux-radius: 0.5rem;
  --ux-radius-s: 0.35rem;
  --ux-font: "Inter", "Segoe UI", "Noto Sans", "DejaVu Sans", Roboto, Arial, sans-serif;
  --ux-mono: "JetBrains Mono", "DejaVu Sans Mono", Consolas, "Liberation Mono", monospace;
  --ux-row: 2.05rem;
  font-size: calc(clamp(13px, 0.62vw + 6.5px, 18px) * var(--ux-scale, 1));
}

html[data-ui="modern"] body { background: var(--ux-bg); color: var(--ux-text); font: 1rem/1.4 var(--ux-font); font-variant-numeric: tabular-nums; }
html[data-ui="modern"] #app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
html[data-ui="modern"] #app > .ux-host { flex: 1; }
html[data-ui="modern"] kbd { font: 600 0.72rem/1 var(--ux-font); padding: 0.18rem 0.32rem; border-radius: 0.28rem; background: var(--ux-surface-3); color: var(--ux-muted);
  border: 1px solid var(--ux-line); min-width: 1.25rem; text-align: center; display: inline-block; }
.muted { color: var(--ux-muted); }

/* ---------------------------------------------------------------- scroll bars (the theme's --c-scroll*)
   A rounded thumb without a rail; a small triangle at each end, pale when there is nothing more to scroll that way.
   The triangles are two right-angled halves drawn with gradients (they take the theme's colour). */
html[data-ui="modern"] ::-webkit-scrollbar, html[data-ui="modern"]::-webkit-scrollbar { width: 12px; height: 12px; background: transparent; }
html[data-ui="modern"] ::-webkit-scrollbar-track, html[data-ui="modern"] ::-webkit-scrollbar-track-piece,
html[data-ui="modern"] ::-webkit-scrollbar-corner { background: transparent; border: 0; }
html[data-ui="modern"] ::-webkit-scrollbar-thumb { background-color: var(--c-scroll); border: 3px solid transparent; background-clip: padding-box; border-radius: 6px;
  min-height: 2rem; min-width: 2rem; }
html[data-ui="modern"] ::-webkit-scrollbar-thumb:hover, html[data-ui="modern"] ::-webkit-scrollbar-thumb:active { background-color: var(--c-scroll-on); }
html[data-ui="modern"] ::-webkit-scrollbar-button { width: 12px; height: 12px; background-color: transparent; --a: var(--c-scroll); }
html[data-ui="modern"] ::-webkit-scrollbar-button:hover { --a: var(--c-scroll-on); }
html[data-ui="modern"] ::-webkit-scrollbar-button:disabled { --a: var(--c-scroll-end); }
html[data-ui="modern"] ::-webkit-scrollbar-button:vertical:start:increment, html[data-ui="modern"] ::-webkit-scrollbar-button:vertical:end:decrement,
html[data-ui="modern"] ::-webkit-scrollbar-button:horizontal:start:increment, html[data-ui="modern"] ::-webkit-scrollbar-button:horizontal:end:decrement { display: none; }
html[data-ui="modern"] ::-webkit-scrollbar-button:vertical:decrement {
  background: linear-gradient(to bottom right, transparent 50%, var(--a) 50%) 2px 4px / 4px 5px no-repeat,
              linear-gradient(to bottom left, transparent 50%, var(--a) 50%) 6px 4px / 4px 5px no-repeat; }
html[data-ui="modern"] ::-webkit-scrollbar-button:vertical:increment {
  background: linear-gradient(to top right, transparent 50%, var(--a) 50%) 2px 3px / 4px 5px no-repeat,
              linear-gradient(to top left, transparent 50%, var(--a) 50%) 6px 3px / 4px 5px no-repeat; }
html[data-ui="modern"] ::-webkit-scrollbar-button:horizontal:decrement {
  background: linear-gradient(to bottom right, transparent 50%, var(--a) 50%) 4px 2px / 5px 4px no-repeat,
              linear-gradient(to top right, transparent 50%, var(--a) 50%) 4px 6px / 5px 4px no-repeat; }
html[data-ui="modern"] ::-webkit-scrollbar-button:horizontal:increment {
  background: linear-gradient(to bottom left, transparent 50%, var(--a) 50%) 3px 2px / 5px 4px no-repeat,
              linear-gradient(to top left, transparent 50%, var(--a) 50%) 3px 6px / 5px 4px no-repeat; }

/* ---------------------------------------------------------------- top bar */
.ux-top { display: flex; align-items: center; gap: 0.9rem; padding: 0.35rem 0.9rem; background: var(--c-bar); color: var(--c-on-bar); }
.ux-brand { font-weight: 800; letter-spacing: 0.22em; font-size: 0.95rem; }
.ux-grow { flex: 1; }
.ux-firm, .ux-user, .ux-date-now { font-size: 0.82rem; white-space: nowrap; opacity: .95; }
.ux-firm { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ux-topbtn { border: 1px solid color-mix(in srgb, currentColor 35%, transparent); background: transparent; color: inherit; font: 600 0.76rem var(--ux-font); padding: 0.2rem 0.55rem;
  border-radius: 0.35rem; cursor: pointer; white-space: nowrap; }
.ux-topbtn:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.ux-topbtn.exit { background: var(--c-on-bar); color: var(--c-bar); border-color: var(--c-on-bar); }

/* ---------------------------------------------------------------- path, host, key bar */
.ux-crumbs { display: flex; align-items: center; gap: 0.35rem; padding: 0.35rem 1rem; font-size: 0.85rem; color: var(--ux-muted); background: var(--ux-surface-2);
  border-bottom: 1px solid var(--ux-line); min-height: 2rem; }
.ux-crumbs[hidden] { display: none; }
.ux-crumb { border: 0; background: transparent; color: var(--ux-muted); font: inherit; cursor: pointer; padding: 0.1rem 0.35rem; border-radius: 0.3rem; }
.ux-crumb:hover { background: var(--ux-surface-3); color: var(--ux-text); }
.ux-crumb.on { color: var(--ux-text); font-weight: 600; }
.ux-crumbs .sep { color: var(--ux-faint); }
.ux-host { position: relative; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.ux-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0.75rem 1rem; gap: 0.7rem; overflow: auto; }
.ux-page[hidden] { display: none; }
.ux-keybar { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.4rem 0.8rem; background: var(--ux-surface); border-top: 1px solid var(--ux-line); min-height: 2.6rem; align-items: center; }
.ux-key { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--ux-line); background: var(--ux-surface-2); color: var(--ux-text);
  font: 0.83rem var(--ux-font); padding: 0.22rem 0.6rem 0.22rem 0.3rem; border-radius: 0.4rem; cursor: pointer; white-space: nowrap; }
.ux-key:hover { border-color: var(--ux-line-strong); background: var(--ux-surface-3); }
.ux-key.off { opacity: .45; cursor: default; }
.ux-key.primary { border-color: var(--ux-accent); }
.ux-key kbd { min-width: 1.6rem; }

/* ---------------------------------------------------------------- home */
.ux-home { flex: 1; overflow: auto; padding: 1.4rem 1.6rem; }
.ux-home[hidden] { display: none; }
.ux-home-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; align-items: start; }
.ux-home-col { background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: 0.75rem; overflow: hidden; transition: border-color .15s; }
.ux-home-col.on { border-color: var(--ux-accent); }
.ux-home-col header { display: flex; gap: 0.6rem; align-items: center; padding: 0.7rem 0.9rem; font-weight: 700; border-bottom: 1px solid var(--ux-line); background: var(--ux-surface-2); }
.ux-home-col.on header { background: var(--ux-accent-soft); color: var(--ux-accent); }
.ux-home-col.on header kbd { background: var(--ux-accent); color: var(--ux-accent-text); border-color: var(--ux-accent); }
.ux-home-items { display: flex; flex-direction: column; padding: 0.35rem; }
.ux-home-item { display: grid; grid-template-columns: auto 1fr; column-gap: 0.65rem; align-items: center; border: 0; background: transparent; text-align: left; color: var(--ux-text);
  font: 0.95rem var(--ux-font); padding: 0.5rem 0.6rem; border-radius: 0.45rem; cursor: pointer; }
.ux-home-item:hover { background: var(--ux-surface-2); }
.ux-home-item.on { background: var(--ux-sel); color: var(--ux-sel-text); }
.ux-home-item.on kbd { background: transparent; color: var(--ux-sel-text); border-color: color-mix(in srgb, currentColor 50%, transparent); }
.ux-home-item .s { grid-column: 2; font-size: 0.78rem; color: var(--ux-muted); }
.ux-home-item.on .s { color: inherit; opacity: .85; }

/* ---------------------------------------------------------------- page parts */
.ux-head { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.ux-head h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
.ux-head .ux-sub { color: var(--ux-muted); font-size: 0.9rem; }
.ux-card { background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: 0.7rem; }
.ux-card.pad { padding: 0.8rem 1rem; }
.ux-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(22rem, 38%); gap: 0.8rem; }
.ux-split > * { min-height: 0; }
.ux-filters { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: flex-end; padding: 0.6rem 0.8rem; }
.ux-filters .ux-chips { margin-left: auto; }
.ux-section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ux-muted); margin: 0 0 0.35rem; }
.ux-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 600; padding: 0.12rem 0.5rem; border-radius: 1rem; background: var(--ux-surface-3); color: var(--ux-muted); }
.ux-badge.ok { background: var(--ux-ok-soft); color: var(--ux-ok); }
.ux-badge.warn { background: var(--ux-warn-soft); color: var(--ux-warn); }
.ux-badge.danger { background: var(--ux-danger-soft); color: var(--ux-danger); }
.ux-badge.accent { background: var(--ux-accent-soft); color: var(--ux-accent); }
.ux-btn { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid var(--ux-line-strong); background: var(--ux-surface); color: var(--ux-text);
  font: 600 0.9rem var(--ux-font); padding: 0.42rem 0.9rem; border-radius: 0.45rem; cursor: pointer; white-space: nowrap; }
.ux-btn:hover { background: var(--ux-surface-2); }
.ux-btn:focus-visible { outline: none; box-shadow: var(--ux-focus); }
.ux-btn.primary { background: var(--ux-sel); border-color: var(--ux-sel); color: var(--ux-sel-text); }
.ux-btn.primary:hover { filter: brightness(1.06); }
.ux-btn.danger { background: var(--ux-danger); border-color: var(--ux-danger); color: var(--c-on-status); }
.ux-btn.small { font-size: 0.8rem; padding: 0.25rem 0.6rem; }
/* the key on a button: flat, its letters only (no chip that sticks out of the button) */
.ux-btn kbd { background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 30%, transparent); opacity: .85; }
.ux-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

/* ---------------------------------------------------------------- inputs */
.ux-field { display: inline-flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.ux-field.no-label { gap: 0; }
.ux-label { font-size: 0.76rem; font-weight: 600; color: var(--ux-muted); white-space: nowrap; }
.ux-control { position: relative; display: flex; align-items: stretch; min-width: 0; }
.ux-input { font: 0.98rem var(--ux-font); color: var(--ux-text); background: var(--c-input); border: 1px solid var(--c-input-line); border-radius: var(--ux-radius-s);
  padding: 0.38rem 0.55rem; min-width: 0; width: 100%; outline: none; transition: border-color .12s, box-shadow .12s; font-variant-numeric: tabular-nums; }
.ux-input:hover { border-color: var(--ux-faint); }
.ux-input:focus { border-color: var(--ux-sel); box-shadow: var(--ux-focus); background: var(--ux-surface); }
.ux-input.num { text-align: right; }
.ux-input::placeholder { color: var(--ux-faint); }
.ux-input::selection { background: var(--ux-sel); color: var(--ux-sel-text); }
.ux-field.ro .ux-input { background: var(--ux-surface-2); color: var(--ux-muted); }
.ux-field.bad .ux-input { border-color: var(--ux-danger); box-shadow: 0 0 0 3px var(--ux-danger-soft); }
.ux-field.bad[data-error]:not([data-error=""])::after { content: attr(data-error); color: var(--ux-danger); font-size: 0.74rem; }
.ux-area { resize: vertical; min-height: 4.5rem; line-height: 1.35; }
/* one height for every one-line field (a drop-down list too), so the labels of a row line up */
input.ux-input, select.ux-input { line-height: 1.35; height: calc(0.98rem * 1.35 + 0.76rem + 2px); }
.ux-lrow input.ux-input, .ux-lrow select.ux-input { height: calc(0.98rem * 1.35 + 0.56rem + 2px); }
/* a drop-down list: the same ▾ as the search fields (in the theme's colour), no system arrow */
.ux-select { appearance: none; -webkit-appearance: none; padding-top: 0; padding-bottom: 0; padding-right: 1.9rem; cursor: pointer; }
.ux-selectfield .ux-control::after { content: "▾"; position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); pointer-events: none;
  color: var(--ux-muted); font-size: 0.8rem; }
.ux-select option { background: var(--c-surface); color: var(--c-text); }
.ux-checkfield { flex-direction: row; align-items: center; gap: 0.45rem; cursor: pointer; }
.ux-check { width: 1.05rem; height: 1.05rem; accent-color: var(--ux-sel); }
.ux-date .ux-input { padding-right: 2.2rem; }
.ux-date .ux-control { width: 9.6em; }
.ux-lrow .ux-date .ux-control { width: 100%; }
.ux-cal-btn, .ux-combo-btn { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 2rem; border: 0; border-radius: 0.3rem; background: transparent; color: var(--ux-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ux-cal-btn:hover, .ux-combo-btn:hover { background: var(--ux-surface-3); color: var(--ux-text); }
.ux-cal-btn svg { width: 1.1rem; height: 1.1rem; }
.ux-combo .ux-input { padding-right: 1.9rem; }
.ux-combo-btn { width: 1.7rem; font-size: 0.8rem; }

.ux-cal { position: fixed; z-index: 200; background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: 0.7rem; box-shadow: var(--ux-shadow-l); padding: 0.6rem; width: 17.5rem; user-select: none; }
.ux-cal-head { display: flex; align-items: center; gap: 0.2rem; margin-bottom: 0.4rem; }
.ux-cal-head .title { flex: 1; text-align: center; font-weight: 700; font-size: 0.92rem; }
.ux-cal-head .nav { border: 0; background: transparent; color: var(--ux-muted); font-size: 1rem; width: 1.8rem; height: 1.8rem; border-radius: 0.35rem; cursor: pointer; }
.ux-cal-head .nav:hover { background: var(--ux-surface-3); color: var(--ux-text); }
.ux-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ux-cal-grid .wd { font-size: 0.7rem; font-weight: 700; color: var(--ux-muted); text-align: center; padding: 0.2rem 0; }
.ux-cal-grid .we { color: var(--ux-accent); }
.ux-cal-grid .d { border: 0; background: transparent; color: var(--ux-text); font: 0.86rem var(--ux-font); height: 2rem; border-radius: 0.35rem; cursor: pointer; }
.ux-cal-grid .d.we { color: var(--ux-accent); }
.ux-cal-grid .d:hover { background: var(--ux-surface-3); }
.ux-cal-grid .d.today { box-shadow: inset 0 0 0 1px var(--ux-sel); }
.ux-cal-grid .d.sel { background: var(--ux-sel); color: var(--ux-sel-text); }
.ux-cal-foot { display: flex; justify-content: center; margin-top: 0.4rem; }
.ux-cal-foot .link { border: 0; background: transparent; color: var(--ux-sel); font: 600 0.82rem var(--ux-font); cursor: pointer; }

.ux-list { position: fixed; z-index: 210; background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: 0.55rem; box-shadow: var(--ux-shadow-l); max-height: 21rem;
  overflow: auto; padding: 0.25rem; }
.ux-opt { display: grid; grid-template-columns: minmax(3.5rem, auto) 1fr auto; gap: 0.8rem; padding: 0.32rem 0.55rem; border-radius: 0.35rem; cursor: pointer; font-size: 0.92rem; }
.ux-opt .c { font-family: var(--ux-mono); color: var(--ux-muted); font-size: 0.85rem; }
.ux-opt .x { color: var(--ux-muted); font-size: 0.82rem; text-align: right; }
.ux-opt:hover { background: var(--ux-surface-2); }
.ux-opt.on { background: var(--ux-sel); color: var(--ux-sel-text); }
.ux-opt.on .c, .ux-opt.on .x { color: inherit; opacity: .85; }
.ux-opt.none { color: var(--ux-muted); cursor: default; }

/* ---------------------------------------------------------------- tables */
.ux-table { display: flex; flex-direction: column; min-height: 0; background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: 0.7rem; overflow: hidden;
  outline: none; }
.ux-table:not(.static) { flex: 1; }
.ux-table:focus { border-color: var(--ux-sel); }
.ux-thead { display: grid; background: var(--ux-surface-2); border-bottom: 1px solid var(--ux-line); }
.ux-th { padding: 0.45rem 0.6rem; font-size: 0.76rem; font-weight: 700; color: var(--ux-muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-th.r, .ux-td.r { text-align: right; } .ux-th.c, .ux-td.c { text-align: center; }
.ux-body { position: relative; flex: 1; min-height: 6rem; }
.ux-viewport { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; }
.ux-spacer { width: 1px; }
.ux-rows { position: absolute; left: 0; right: 0; top: 0; }
.ux-rows .ux-tr { position: absolute; left: 0; right: 0; height: var(--ux-row); }
.ux-tr { display: grid; align-items: center; border-bottom: 1px solid var(--ux-line); cursor: default; }
.ux-td { padding: 0 0.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.93rem; line-height: var(--ux-row); }
.ux-td.mono { font-family: var(--ux-mono); font-size: 0.86rem; }
.ux-td.strong { font-weight: 650; }
.ux-td.dim, .ux-tr .dim { color: var(--ux-muted); }
.ux-td .ux-badge { line-height: 1.25; vertical-align: middle; padding-top: 0.08rem; padding-bottom: 0.08rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ux-rows .ux-tr:hover { background: var(--ux-surface-2); }
.ux-rows .ux-tr.on { background: var(--ux-sel-soft); box-shadow: inset 3px 0 0 var(--ux-sel); }
.ux-table:focus .ux-rows .ux-tr.on { background: var(--ux-sel); color: var(--ux-sel-text); box-shadow: none; }
.ux-table:focus .ux-rows .ux-tr.on .dim { color: var(--ux-sel-text); opacity: .85; }
.ux-table:focus .ux-rows .ux-tr.on .ux-badge { color: var(--ux-sel-text); background: color-mix(in srgb, var(--ux-sel-text) 18%, transparent); }
.ux-ph { display: inline-block; height: 0.7rem; width: 70%; border-radius: 0.3rem; background: linear-gradient(90deg, var(--ux-surface-3), var(--ux-surface-2), var(--ux-surface-3));
  background-size: 200% 100%; animation: ux-shimmer 1.1s linear infinite; vertical-align: middle; }
@keyframes ux-shimmer { to { background-position: -200% 0; } }
.ux-loading { position: absolute; left: 50%; transform: translateX(-50%); display: none; align-items: center; gap: 0.5rem; background: var(--ux-text); color: var(--ux-surface);
  font-size: 0.8rem; padding: 0.3rem 0.8rem; border-radius: 1rem; z-index: 3; box-shadow: var(--ux-shadow-l); }
.ux-loading.top { top: 0.5rem; } .ux-loading.bottom { bottom: 0.5rem; }
.ux-loading.on { display: flex; }
.ux-empty { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; color: var(--ux-muted); font-size: 0.95rem; }
.ux-empty.on { display: flex; }
.ux-table.static .ux-empty.on { position: static; padding: 1rem; }
.ux-tfoot { padding: 0.3rem 0.7rem; font-size: 0.78rem; color: var(--ux-muted); border-top: 1px solid var(--ux-line); background: var(--ux-surface-2); text-align: right; min-height: 1.6rem; }
.ux-sbody { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.ux-sbody > .ux-thead { position: sticky; top: 0; z-index: 1; flex-shrink: 0; }
.ux-sbody > .ux-tr { flex-shrink: 0; }
.ux-table.static .ux-td { line-height: 1.9rem; }
.ux-table.static .ux-sbody > .ux-tr:last-child { border-bottom: 0; }
.ux-table.static .ux-tr.total { background: var(--ux-surface-2); font-weight: 700; border-top: 1px solid var(--ux-line-strong); }
.ux-table.loading .ux-viewport { opacity: .5; }
.ux-spin { width: 0.9rem; height: 0.9rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ux-rot .75s linear infinite; display: inline-block; }
@keyframes ux-rot { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- dialogs, toasts, busy */
.ux-overlay { position: fixed; inset: 0; background: var(--c-scrim); display: flex; align-items: center; justify-content: center; z-index: 300; backdrop-filter: blur(1.5px); }
/* flat: no shadow and no coloured band on top (owner 2026-11-01), only a thin line around it */
.ux-dialog { background: var(--ux-surface); color: var(--ux-text); border-radius: 0.85rem; border: 1px solid var(--ux-line-strong); padding: 1.1rem 1.3rem 1rem; min-width: 24rem; max-width: min(46rem, 92vw);
  max-height: 88vh; overflow: auto; }
.ux-dialog-title { font-weight: 700; font-size: 1.08rem; margin-bottom: 0.5rem; }
.ux-dialog-text { display: flex; flex-direction: column; gap: 0.25rem; font-size: 1rem; }
.ux-dialog-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.ux-toasts { position: fixed; right: 1rem; bottom: 3.6rem; display: flex; flex-direction: column; gap: 0.4rem; z-index: 400; }
.ux-toast { background: var(--ux-text); color: var(--ux-surface); padding: 0.55rem 0.95rem; border-radius: 0.55rem; box-shadow: var(--ux-shadow-l); font-size: 0.9rem; transition: opacity .35s, transform .35s; }
.ux-toast.k-ok { border-left: 4px solid var(--c-ok); } .ux-toast.k-warn { border-left: 4px solid var(--c-warn); } .ux-toast.k-error { border-left: 4px solid var(--c-danger); }
.ux-toast.out { opacity: 0; transform: translateY(0.4rem); }
.ux-busy { position: fixed; left: 50%; bottom: 3.6rem; transform: translateX(-50%); background: var(--ux-text); color: var(--ux-surface); padding: 0.5rem 1.05rem; border-radius: 1.4rem;
  z-index: 350; display: flex; gap: 0.6rem; align-items: center; box-shadow: var(--ux-shadow-l); font-size: 0.9rem; }

/* ---------------------------------------------------------------- printing */
.ux-print-dialog { min-width: 30rem; }
.ux-print-what { margin-bottom: 0.8rem; }
.ux-print-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem 1rem; }
.ux-print-range { display: flex; gap: 0.6rem; align-items: flex-end; }
.ux-print-range .ux-field { width: 7rem; }
.ux-report { flex: 1; overflow: auto; background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: 0.7rem; outline: none; }
.ux-report:focus { border-color: var(--ux-sel); }
.ux-report-text { margin: 0; padding: 1rem 1.2rem; font: 0.9rem/1.3 var(--ux-mono); white-space: pre; }

/* ---------------------------------------------------------------- the login (НИ-КАЙ and the server admin program) */
.ux-login { margin: 11vh auto 2rem; width: min(27rem, 100%); display: flex; flex-direction: column; gap: 0.95rem; background: var(--ux-surface); color: var(--ux-text);
  border: 1px solid var(--ux-line); border-radius: 0.85rem; box-shadow: var(--ux-shadow-l); padding: 2rem 2.2rem 1.8rem; font-family: var(--ux-font); }
.ux-login .ux-field { width: 100%; }
.ux-login input.ux-input { font-size: 1rem; padding: 0.5rem 0.65rem; height: auto; }
.ux-login-brand { text-align: center; font-size: 2rem; font-weight: 800; letter-spacing: 0.5em; padding-left: 0.5em; color: var(--ux-accent); }
.ux-login-sub { text-align: center; color: var(--ux-muted); margin: -0.7rem 0 0.5rem; }
.ux-login-msg { min-height: 1.3rem; color: var(--ux-danger); font-weight: 600; text-align: center; font-size: 0.92rem; }
.ux-login-msg:empty { min-height: 0; margin-top: -0.95rem; }
.ux-login-go { justify-content: center; padding: 0.6rem; font-size: 1rem; }
.ux-login-wait { pointer-events: none; }   /* while connecting: the same look (the spinner pill says it), no clicks */
.ux-eye { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 2.3rem; border: 0; border-radius: 0.3rem; background: transparent; color: var(--ux-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ux-eye:hover { background: var(--ux-surface-3); color: var(--ux-text); }
.ux-eye.on { color: var(--ux-sel); }
.ux-eye svg { width: 1.15rem; height: 1.15rem; }
.ux-control:has(.ux-eye) .ux-input { padding-right: 2.6rem; }

/* ---------------------------------------------------------------- the theme page (web/ux/theme.js) */
.ux-theme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; outline: none; align-items: start; }
.ux-theme-card { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.6rem; border: 2px solid var(--ux-line); border-radius: 0.8rem; background: var(--ux-surface);
  color: var(--ux-text); font: inherit; text-align: left; cursor: pointer; }
.ux-theme-card:hover { border-color: var(--ux-line-strong); }
.ux-theme-card.on { border-color: var(--ux-sel); box-shadow: var(--ux-focus); }
.ux-theme-name { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; font-weight: 700; }
.ux-theme-name .s { font-weight: 400; font-size: 0.8rem; color: var(--ux-muted); flex-basis: 100%; }
/* a theme page sample shows its own theme: the roles again on the sample (they were taken from the page's theme) */
[data-theme-preview] {
  --ux-bg: var(--c-bg);
  --ux-surface: var(--c-surface);
  --ux-surface-2: var(--c-surface-2);
  --ux-surface-3: var(--c-surface-3);
  --ux-text: var(--c-text);
  --ux-muted: var(--c-text-muted);
  --ux-faint: var(--c-text-faint);
  --ux-line: var(--c-line);
  --ux-line-strong: var(--c-line-strong);
  --ux-accent: var(--c-accent);
  --ux-accent-2: var(--c-accent-2);
  --ux-accent-soft: var(--c-accent-soft);
  --ux-accent-text: var(--c-on-accent);
  --ux-sel: var(--c-sel);
  --ux-sel-soft: var(--c-sel-soft);
  --ux-sel-text: var(--c-on-sel);
  --ux-ok: var(--c-ok);
  --ux-ok-soft: var(--c-ok-soft);
  --ux-warn: var(--c-warn);
  --ux-warn-soft: var(--c-warn-soft);
  --ux-danger: var(--c-danger);
  --ux-danger-soft: var(--c-danger-soft);
  --ux-focus: 0 0 0 3px var(--c-focus);
  --ux-shadow: var(--c-shadow);
  --ux-shadow-l: var(--c-shadow-l);
}
.ux-theme-sample { border-radius: 0.55rem; overflow: hidden; border: 1px solid var(--c-line); background: var(--c-bg); color: var(--c-text); font-size: 0.8rem; }
.ux-theme-sample .bar { display: flex; justify-content: space-between; padding: 0.3rem 0.6rem; background: var(--c-bar); color: var(--c-on-bar); }
.ux-theme-sample .bar b { letter-spacing: 0.18em; }
.ux-theme-sample .body { margin: 0.5rem; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 0.45rem; overflow: hidden; }
.ux-theme-sample .row { display: grid; grid-template-columns: 4rem 1fr 4.5rem; padding: 0.22rem 0.5rem; border-bottom: 1px solid var(--c-line); font-family: var(--ux-mono); }
.ux-theme-sample .row.head { background: var(--c-surface-2); color: var(--c-text-muted); font: 700 0.7rem var(--ux-font); text-transform: uppercase; }
.ux-theme-sample .row.sel { background: var(--c-sel); color: var(--c-on-sel); }
.ux-theme-sample .r { text-align: right; } .ux-theme-sample .muted { color: var(--c-text-muted); } .ux-theme-sample .neg { color: var(--c-danger); }
.ux-theme-sample .keys { display: flex; gap: 0.35rem; align-items: center; padding: 0.35rem 0.5rem; background: var(--c-surface-2); }
.ux-theme-sample .k { display: inline-flex; gap: 0.3rem; align-items: center; border: 1px solid var(--c-line); background: var(--c-surface); border-radius: 0.35rem; padding: 0.1rem 0.4rem 0.1rem 0.15rem; }
.ux-theme-sample kbd { background: var(--c-surface-3); color: var(--c-text-muted); border-color: var(--c-line); }
.ux-theme-sample .ok { margin-left: auto; color: var(--c-ok); font-weight: 600; }

/* ---------------------------------------------------------------- documents (preview, view, edit) */
.ux-doc { display: flex; flex-direction: column; gap: 0.7rem; min-height: 0; }
.ux-doc-head { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; align-items: baseline; }
.ux-doc-head .no { font-size: 1.1rem; font-weight: 750; }
.ux-doc-head .who { font-weight: 650; }
.ux-kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.9rem; font-size: 0.92rem; }
.ux-kv dt { color: var(--ux-muted); }
.ux-kv dd { margin: 0; font-weight: 600; }
.ux-totals { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1.2rem; font-size: 0.95rem; min-width: 16rem; margin-left: auto; }
.ux-totals .l { color: var(--ux-muted); }
.ux-totals .v { text-align: right; font-weight: 650; }
.ux-totals .grand { font-size: 1.1rem; font-weight: 800; color: var(--ux-text); border-top: 2px solid var(--ux-line-strong); padding-top: 0.25rem; }
.ux-preview { display: flex; flex-direction: column; gap: 0.7rem; padding: 0.9rem 1rem; overflow: auto; min-height: 0; }
/* the side panel: its parts keep their size and the lines of the document scroll under their head (down to four
   rows); a smaller window scrolls the whole panel */
.ux-preview > .ux-doc { display: contents; }
.ux-preview > *, .ux-preview > .ux-doc > * { flex-shrink: 0; }
.ux-preview .ux-table.static { box-shadow: none; flex: 0 1 auto; min-height: calc(2rem + var(--rows, 4) * (1.9rem + 1px) + var(--tot, 0) * 2rem); }
.ux-preview-empty { color: var(--ux-muted); text-align: center; padding: 3rem 1rem; }
/* the buttons float at the panel's bottom left (owner 2026-11-01); being last in the panel they take their own room,
   so the panel scrolls far enough for the last lines to come out above them */
.ux-preview-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; position: sticky; bottom: 0; z-index: 1; margin: auto -1rem -0.9rem;
  padding: 0.55rem 1rem 0.7rem; background: var(--ux-surface); border-top: 1px solid var(--ux-line); }

/* ---------------------------------------------------------------- document lines being edited */
.ux-lines { display: flex; flex-direction: column; min-height: 0; }
.ux-lrow { display: grid; grid-template-columns: 2.6rem 7.5rem minmax(12rem, 1fr) 8rem 8rem 8.5rem 2rem; gap: 0.35rem; align-items: center; padding: 0.18rem 0.6rem; }
.ux-lrow.head { background: var(--ux-surface-2); border-bottom: 1px solid var(--ux-line); padding-top: 0.45rem; padding-bottom: 0.45rem; position: sticky; top: 0; z-index: 2; }
.ux-lh { font-size: 0.76rem; font-weight: 700; color: var(--ux-muted); text-transform: uppercase; letter-spacing: .03em; }
.ux-lh.r { text-align: right; }
.ux-lbody { overflow: auto; flex: 1; min-height: 0; }
.ux-lbody .ux-lrow { border-bottom: 1px solid var(--ux-line); }
.ux-lbody .ux-lrow:focus-within { background: var(--ux-sel-soft); }
.ux-lc.no { color: var(--ux-muted); text-align: right; font-size: 0.85rem; }
.ux-lc.val { text-align: right; font-weight: 600; }
.ux-lrow .ux-field { width: 100%; }
.ux-lrow .ux-input { padding: 0.28rem 0.45rem; }
.ux-lrow .lc-code .ux-input { font-family: var(--ux-mono); }
.ux-ldel { border: 0; background: transparent; color: var(--ux-faint); cursor: pointer; border-radius: 0.3rem; height: 1.8rem; }
.ux-ldel:hover { background: var(--ux-danger-soft); color: var(--ux-danger); }
.nk-lines-card { flex: 1; min-height: 12rem; display: flex; flex-direction: column; overflow: hidden; }
.nk-edit-head { align-items: flex-end; }
.nk-client-name { align-self: center; min-width: 14rem; max-width: 30rem; padding-bottom: 0.1rem; }
.nk-edit-foot { display: flex; align-items: flex-start; gap: 1.5rem; }

/* ---------------------------------------------------------------- history of a document */
.ux-history { display: flex; flex-direction: column; gap: 0.6rem; outline: none; }
.ux-hist { padding: 0.6rem 0.9rem; }
.ux-hist-head { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.ux-hist-body { margin-top: 0.4rem; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.92rem; }
.ux-hist-changes { color: var(--ux-warn); font-weight: 600; }
.ux-hist-diff { font-family: var(--ux-mono); font-size: 0.85rem; display: flex; flex-direction: column; gap: 1px; }
.ux-hist-diff .d-add { color: var(--ux-ok); }
.ux-hist-diff .d-del { color: var(--ux-danger); text-decoration: line-through; }
.ux-hist-diff .d-chg { color: var(--ux-warn); }
.ux-doc.big .ux-doc-head .no { font-size: 1.3rem; }
.ux-form-card { max-width: 52rem; }
.ux-form-grid { display: flex; flex-wrap: wrap; gap: 0.75rem 1.2rem; align-items: flex-end; }
.ux-form-grid > .ux-field:has(textarea), .ux-form-grid > .ux-checkfield { flex-basis: 100%; }
.client-edit .ux-form-grid { flex-direction: column; align-items: flex-start; }
.ux-lc.r { text-align: right; }

.ux-lrow .ux-combo-btn { opacity: 0; }
.ux-lrow:hover .ux-combo-btn, .ux-lrow:focus-within .ux-combo-btn { opacity: 1; }
.ux-preview .ux-td { font-size: 0.86rem; padding: 0 0.4rem; }
.ux-preview .ux-th { padding: 0.4rem 0.4rem; }
.ux-lrow.recipe { grid-template-columns: 6rem minmax(12rem, 1fr) 5rem 9rem 7rem 8rem 2rem; }
.nkz-recipe { display: flex; flex-direction: column; gap: 0.6rem; }
.nkz-recipe .ux-lbody { max-height: 40vh; }
.nkz-recipe-foot { display: flex; gap: 2rem; align-items: flex-start; }
.ux-classifier-edit { gap: 0.8rem; }
.ux-lrow.doc { grid-template-columns: 6rem minmax(10rem, 1fr) 7rem 7rem 7.5rem 2rem; }
.ux-lrow.till { grid-template-columns: minmax(14rem, 1fr) 12rem 2rem; }   /* Каса на управителя: label, + / − amount */
.ux-lrow.doc.details { grid-template-columns: 6rem minmax(9rem, 1fr) 6.5rem 6.5rem 7rem 9rem 9.6rem 8rem 8rem 2rem; }
/* money lines only (a general expense / income): no Код */
.ux-lrow.doc.nocode { grid-template-columns: minmax(10rem, 1fr) 7rem 7rem 7.5rem 2rem; }
.ux-lrow.doc.nocode.details { grid-template-columns: minmax(9rem, 1fr) 6.5rem 6.5rem 7rem 9rem 9.6rem 8rem 8rem 2rem; }
.ux-lrow .ux-date .ux-input { width: 100%; }
.ux-lrow.work { grid-template-columns: 6rem minmax(12rem, 1fr) 7rem 7rem 4.5rem 7.5rem 2rem; }
.ux-lrow.rate { grid-template-columns: 7.5rem 7rem minmax(10rem, 1fr) 7rem 7.5rem 2rem; }
.ux-lrow.bonus { grid-template-columns: minmax(10rem, 1fr) 11rem 7rem 7.5rem 2rem; }
.ux-lrow.prate { grid-template-columns: 7rem minmax(10rem, 1fr) 7rem 7.5rem 2rem; }
.ux-lrow.plabel { grid-template-columns: 7rem minmax(10rem, 1fr) 7rem 2rem; }
.nkz-rates, .nkz-label-groups { display: flex; flex-direction: column; gap: 0.7rem; }
.nkz-label-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.nkz-day-head { align-items: flex-end; }
.ux-doc .muted { white-space: pre-line; }

/* ---------------------------------------------------------------- cell grid (web/ux/grid.js) */
.ux-grid { flex: 1; min-height: 10rem; }
.ux-gbody { flex: 1; overflow: auto; min-height: 0; }
.ux-grid .ux-tr { min-height: 2rem; align-items: stretch; }
.ux-grid .ux-td { line-height: 2rem; border-left: 1px solid transparent; }
.ux-grid .ux-td.ed { background: color-mix(in srgb, var(--ux-surface-3) 55%, transparent); }
.ux-grid .ux-tr.on .ux-td { background: var(--ux-sel-soft); }
/* the cursor cell wins over its row's colour (else its text, in the selection's text colour, is lost on it) */
.ux-grid .ux-tr .ux-td.cur { background: var(--ux-sel); color: var(--ux-sel-text); }
.ux-grid .ux-td.ovr { box-shadow: inset 0 -2px 0 var(--ux-warn); font-weight: 700; color: var(--ux-warn); }
.ux-grid .ux-td.cur.ovr { color: var(--ux-sel-text); }
.ux-grid .ux-td.neg { color: var(--ux-danger); }
.ux-grid .ux-td.cur.neg { color: var(--ux-sel-text); }
.ux-grid .ux-tr.adj .ux-td { font-style: italic; }
.ux-grid .ux-td.editing { padding: 0; background: var(--ux-surface); }
input.ux-input.ux-cell-input { height: 2rem; border-radius: 0; border: 2px solid var(--ux-sel); padding: 0 0.4rem; }
.ux-cell-input.bad { border-color: var(--ux-danger); }
.nkz-shop-grid { flex: 1; min-height: 0; display: flex; }
.ux-wait { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; align-items: center; justify-content: center; color: var(--ux-text); font-size: 1rem; }
.nk-edit-foot[hidden] { display: none; }
.nkz-shop-detail { flex: 1; font-size: 0.85rem; align-self: center; }
.ux-static-wrap { max-width: 100%; overflow-x: auto; }
.ux-static-wrap .ux-table.static { min-width: 40rem; }
.ux-tr.sub .ux-td { font-size: 0.85rem; }
.ux-tr.neg .ux-td { color: var(--ux-danger); }

.ux-grid .ux-th { white-space: normal; line-height: 1.15; text-overflow: clip; display: flex; align-items: flex-end; }
.ux-grid .ux-th.r { justify-content: flex-end; text-align: right; }
.ux-field .ux-control { max-width: 100%; }

/* ---------------------------------------------------------------- what can be selected (copied)
   The program's own words (menus, labels, heads, buttons, keys, the path, the top bar, the rows of the lists) are not
   selectable: a click or a drag never paints them blue. The values are: the fields, a document in the side panel or
   its page, its history, a report on the screen, the text of a dialog (a code to copy). */
html[data-ui="modern"] body { -webkit-user-select: none; user-select: none; }
html[data-ui="modern"] :is(input, textarea, [contenteditable], .ux-preview, .ux-doc, .ux-history, .ux-report, .ux-dialog-text, .ux-toast,
  .ux-table.static .ux-td, pre, [data-selectable]) { -webkit-user-select: text; user-select: text; }
html[data-ui="modern"] :is(.ux-preview, .ux-doc, .ux-history) :is(.ux-th, .ux-label, .ux-section-title, .ux-badge, button, kbd) { -webkit-user-select: none; user-select: none; }

/* A16: a tick of a list (the payments of the notes: Space / click) */
.nk-tick { display: inline-flex; width: 1.25em; height: 1.25em; border: 1.5px solid var(--ux-line-strong); border-radius: var(--ux-radius-s);
  align-items: center; justify-content: center; cursor: pointer; font-weight: 700; line-height: 1; background: var(--ux-surface); }
.nk-tick.on { background: var(--ux-ok); border-color: var(--ux-ok); color: var(--ux-surface); }
.ux-tr.on .nk-tick { border-color: var(--ux-sel-text); }
/* the manager's balance: a day row over its lines */
.ux-tr.cash-day { font-weight: 600; background: var(--ux-surface-2); }
.ux-tr.cash-day.on { background: var(--ux-sel); }
.ux-tr.cash-line .ux-td:first-child { padding-left: 1.4rem; }
