/* Родвэй — интерфейс в духе дорожных указателей: синяя табличка, янтарная кнопка, асфальт. */
@font-face { font-family: "PT Sans"; src: url("/static/fonts/pt-sans-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PT Sans"; src: url("/static/fonts/pt-sans-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "PT Sans Narrow"; src: url("/static/fonts/pt-sans-narrow-700.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --sign: #164A96;        /* синий дорожного указателя */
  --sign-deep: #0F3A78;
  --amber: #F2A900;       /* световозвращатель */
  --amber-ink: #2B2000;
  --ink: #1D2329;         /* асфальт */
  --muted: #5A6570;
  --road: #E9ECEF;        /* фон */
  --paper: #FFFFFF;
  --line: #D3D9DF;
  --ok: #1E7A46;
  --bad: #B3261E;
  --warn-bg: #FFF4D1;
  --focus: #F2A900;
  --narrow: "PT Sans Narrow", "PT Sans", "Arial Narrow", sans-serif;
  --sans: "PT Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --tap: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8ECEF; --muted: #A3ADB6; --road: #14181C; --paper: #1D2227; --line: #333B43;
    --warn-bg: #3A2F0E; --sign: #1A56AD; --sign-deep: #123E80; --ok: #4CC07F; --bad: #FF8A80;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--road); color: var(--ink); font: 17px/1.45 var(--sans); }
a { color: var(--sign); }
@media (prefers-color-scheme: dark) { a { color: #8DB4F0; } }
h1, h2, h3 { font-family: var(--narrow); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 23px; margin: 28px 0 10px; }
h3 { font-size: 19px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- загрузка ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-plate { background: var(--sign); color: #fff; padding: 22px 34px; border-radius: 12px;
  box-shadow: inset 0 0 0 5px var(--sign), inset 0 0 0 8px #fff; font: 700 30px var(--narrow); }

/* ---------- каркас ---------- */
.shell { min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; max-width: 640px; margin: 0 auto; }
.top .who { flex: 1; min-width: 0; }
.top .who b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .who span { font-size: 14px; color: var(--muted); }
.main { max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--paper);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px;
  color: var(--muted); text-decoration: none; font-size: 13px; position: relative; }
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.on { color: var(--sign); font-weight: 700; }
@media (prefers-color-scheme: dark) { .tabbar a.on { color: #8DB4F0; } }
.tabbar .dot { position: absolute; top: 5px; left: 50%; margin-left: 9px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 12px; line-height: 18px; text-align: center; padding: 0 5px; }

/* ---------- табличка (главный экран смены) ---------- */
.plate { background: var(--sign); color: #fff; border-radius: 16px; padding: 22px 22px 18px; margin: 8px 0 18px;
  box-shadow: inset 0 0 0 6px var(--sign), inset 0 0 0 9px #fff; }
.plate .route { font-size: 16px; opacity: .92; }
.plate .route b { font-family: var(--narrow); font-size: 21px; letter-spacing: .02em; opacity: 1; }
.plate .sum { font: 700 54px/1 var(--narrow); margin: 18px 0 4px; letter-spacing: .01em; }
.plate .sum-label { font-size: 15px; opacity: .85; }
.plate .facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: 15px; }
.plate .state { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.35); font-size: 16px; }
.plate.idle { background: var(--sign-deep); box-shadow: inset 0 0 0 6px var(--sign-deep), inset 0 0 0 9px var(--amber); }
.plate.blank .sum { font-size: 38px; }
.plate details { margin-top: 12px; }
.plate summary { cursor: pointer; font-size: 15px; opacity: .9; list-style: none; }
.plate summary::-webkit-details-marker { display: none; }
.plate summary::after { content: " ▾"; }
.plate details[open] summary::after { content: " ▴"; }
.plate dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 10px 0 0; font-size: 15px; }
.plate dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.plate dt.total, .plate dd.total { font-weight: 700; border-top: 1px solid rgba(255,255,255,.35); padding-top: 6px; }

/* ---------- кнопки ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: var(--tap);
  padding: 12px 18px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  font: 700 18px var(--sans); cursor: pointer; text-decoration: none; text-align: center; }
.btn svg { width: 24px; height: 24px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn.danger { color: var(--bad); border-color: currentColor; background: transparent; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--sign); min-height: 44px; }
@media (prefers-color-scheme: dark) { .btn.quiet { color: #8DB4F0; } }
.btn.small { width: auto; min-height: 40px; padding: 6px 14px; font-size: 16px; border-radius: 10px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { display: grid; gap: 10px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- блоки ---------- */
.note { background: var(--warn-bg); border-left: 5px solid var(--amber); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; }
.note .btn { margin-top: 10px; }
.err-note { border-left-color: var(--bad); }
.list { background: var(--paper); border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.list > .item { padding: 13px 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.list > .item:first-child { border-top: 0; }
.list > .item .grow { flex: 1 1 240px; min-width: 0; }
.list > a.item { color: inherit; text-decoration: none; }
.chip { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: currentColor; }
.chip.bad { color: var(--bad); border-color: currentColor; }
.chip.wait { color: #8A6100; border-color: var(--amber); background: var(--warn-bg); }
@media (prefers-color-scheme: dark) { .chip.wait { color: var(--amber); } }
.empty { color: var(--muted); padding: 14px 0; }

/* ---------- формы ---------- */
label.f { display: block; margin: 14px 0 6px; font-weight: 700; }
input, select, textarea { width: 100%; font: 18px var(--sans); color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: var(--tap); }
textarea { min-height: 110px; resize: vertical; }
input.big { font: 700 34px var(--narrow); letter-spacing: .04em; text-align: center; }
input:focus, select:focus, textarea:focus { border-color: var(--sign); outline: none; }
.choice { display: grid; gap: 8px; }
.choice button { text-align: left; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.choice button.on { border-color: var(--sign); box-shadow: inset 0 0 0 1px var(--sign); }
.choice button small { display: block; font-weight: 400; color: var(--muted); font-size: 15px; }
.photo-box { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; margin-top: 12px; }
.photo-box img { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin: 0 auto 10px; }
.step { font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.formrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.formrow label.f { margin-top: 0; font-size: 15px; }

/* ---------- нижняя панель (выбор) ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(10,14,18,.5); z-index: 40; display: flex; align-items: flex-end;
  justify-content: center; }
.sheet { position: relative; background: var(--road); width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
.sheet h2 { margin-top: 0; padding-right: 96px; }
.sheet .close { position: absolute; top: 10px; right: 8px; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@media (min-width: 960px) { .sheet-back { align-items: center; } .sheet { border-radius: 16px; } }

#toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; max-width: min(92vw, 560px); background: var(--ink); color: var(--road); padding: 12px 18px;
  border-radius: 12px; font-size: 16px; display: none; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
#toast.show { display: block; }
#toast.bad { background: var(--bad); color: #fff; }

.queue { background: var(--ink); color: var(--road); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 15px; }

/* ---------- вход ---------- */
.login { max-width: 420px; margin: 0 auto; padding: 48px 20px; }
.login .plate { text-align: left; }
.login .plate h1 { font-size: 40px; }

/* ---------- офис (компьютер) ---------- */
@media (min-width: 960px) {
  .shell.office { display: grid; grid-template-columns: 236px 1fr; padding-bottom: 0;
    background: linear-gradient(to right, var(--ink) 236px, transparent 236px); }
  .office .tabbar { position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start;
    background: var(--ink); border: 0; padding: 18px 10px; gap: 2px; }
  .office .tabbar .brand { display: block; color: #fff; font: 700 24px var(--narrow); padding: 6px 12px 18px; }
  .office .tabbar a { flex: none; flex-direction: row; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #C9D1D8;
    font-size: 16px; }
  .office .tabbar a.on { background: rgba(255,255,255,.09); color: #fff; }
  .office .tabbar a svg { width: 22px; height: 22px; }
  .office .tabbar .dot { position: static; margin-left: auto; }
  .office .top, .office .main { max-width: 1160px; margin: 0; padding-left: 32px; padding-right: 32px; }
  .office .top { padding-top: 22px; }
  #toast { bottom: 24px; }
}
.tabbar .brand { display: none; }

table.t { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; font-size: 16px; }
table.t th, table.t td { padding: 10px 12px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { border-top: 0; font-size: 14px; color: var(--muted); font-weight: 700; background: var(--road); }
table.t td.r, table.t th.r { text-align: right; }
table.t tr.link { cursor: pointer; }
table.t tr.link:hover td { background: rgba(22,74,150,.06); }
.scroll { overflow-x: auto; }
.grid2 { display: grid; gap: 18px; }
@media (min-width: 960px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos a { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  color: inherit; text-decoration: none; font-size: 13px; }
.photos img { width: 100%; height: 110px; object-fit: cover; display: block; }
.photos span { display: block; padding: 6px 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pay { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; }
.pay .total { font-weight: 700; border-top: 1px solid var(--line); padding-top: 8px; }
.pay > span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.secret { font: 700 22px var(--narrow); letter-spacing: .06em; background: var(--paper); border: 2px dashed var(--amber);
  border-radius: 10px; padding: 10px 14px; display: inline-block; user-select: all; }

@media (max-width: 700px) {
  .hm { display: none; }
  table.t { font-size: 15px; }
  table.t th, table.t td { padding: 9px 8px; }
}
