/* QR-Цех — shared tokens and components. Layout: utilitarian workshop tool, blueprint-blue accent on cool grey. */
:root {
  --bg: #e9ecee;
  --stage-hi: #f8f9fa;
  --stage-lo: #d9dee2;
  --panel: #ffffff;
  --sunk: #f3f5f6;
  --line: #d3d9dd;
  --ink: #1b2228;
  --ink-2: #5b6670;
  --accent: #2456c9;
  --accent-ink: #ffffff;
  --accent-soft: #e3eafb;
  --edge: #2a3036;
  --ok: #1f8a4c;
  --ok-soft: #dff3e7;
  --warn: #b3541e;
  --warn-soft: #fbe9de;
  --font-ui: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161a1e; --stage-hi: #262d34; --stage-lo: #101316; --panel: #1f252b; --sunk: #191e23; --line: #323a42; --ink: #e8ecef; --ink-2: #9aa6b1;
    --accent: #6d9bff; --accent-ink: #0d1530; --accent-soft: #24324f; --edge: #0b0d0f;
    --ok: #4cc785; --ok-soft: #173326; --warn: #f0935c; --warn-soft: #3a2418; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 14px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--warn); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:disabled { opacity: .55; cursor: default; }

.field { display: grid; gap: 5px; }
.field label { font-size: 13px; color: var(--ink-2); }
.input { height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk); padding: 0 11px; width: 100%; }
textarea.input { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hintline { font-size: 12.5px; color: var(--ink-2); }
.err { color: var(--warn); font-size: 13px; min-height: 1em; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top, 0px)); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 9px; z-index: 200; max-width: calc(100% - 32px); font-size: 13.5px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--warn); color: #fff; }

.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 18, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: calc(100% - 8px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; min-width: 0; text-wrap: balance; }
.modal-body { padding: 16px; overflow: auto; min-height: 0; }
.x { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 18px; }
.x:hover { background: var(--accent-soft); }

table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid th { font-weight: 600; color: var(--ink-2); font-size: 12px; position: sticky; top: 0; background: var(--panel); }
table.grid td.r, table.grid th.r { text-align: right; }
.tablewrap { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }

@media print {
  body { background: #fff; color: #000; }
  .noprint { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
