:root {
  --paper: #F3F5F4;
  --surface: #FFFFFF;
  --ink: #17211E;
  --muted: #5A6A65;
  --thread: #1D6B62;
  --thread-dark: #134A44;
  --seam: #CBD5D1;
  --alert: #B0481E;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 1.0625rem; line-height: 1.5; }
a { color: var(--thread-dark); }

.topbar { background: var(--thread); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.topbar strong { font-size: 1.125rem; }
.topbar form { margin: 0; }
.link-btn { background: none; border: 0; color: #fff; font: inherit; text-decoration: underline; padding: .5rem 0; cursor: pointer; }

main { max-width: 36rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: .5rem 0 1rem; }
h2 { font-size: 1.125rem; margin: 2rem 0 .5rem; }
p { margin: .5rem 0; max-width: 62ch; }
.muted { color: var(--muted); }

.auth { max-width: 24rem; margin: 0 auto; padding: 3rem 1rem; }
.auth .mark { width: 3.5rem; height: 3.5rem; margin-bottom: 1rem; }

label { display: block; font-weight: 600; margin: 1rem 0 .25rem; }
input[type=text], input[type=tel], input[type=password] {
  width: 100%; min-height: 3rem; padding: .5rem .75rem; font: inherit;
  border: 2px solid var(--seam); border-radius: .375rem; background: var(--surface); color: var(--ink);
}
input.pin { font-size: 1.75rem; letter-spacing: .5rem; text-align: center; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--thread); outline-offset: 2px; }

.btn { display: block; width: 100%; min-height: 3.25rem; margin-top: 1.5rem; padding: .75rem 1rem; font: inherit; font-weight: 600;
  color: #fff; background: var(--thread); border: 0; border-radius: .375rem; cursor: pointer; text-align: center; text-decoration: none; }
.btn:hover { background: var(--thread-dark); }
.alt { display: inline-block; margin-top: 1.25rem; }

.error { margin: 1rem 0 0; padding: .75rem 1rem; border-left: 4px solid var(--alert); background: #FBEFE9; color: #6E2A0F; }

.scope { border-left: 4px solid var(--thread); padding: .25rem 0 .25rem 1rem; margin: 1rem 0; }
.facts { display: flex; gap: 2rem; margin: 1rem 0; }
.facts div { min-width: 6rem; }
.facts b { display: block; font-size: 1.75rem; line-height: 1.1; }

.menu { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--seam); }
.menu li { border-bottom: 1px solid var(--seam); }
.menu a, .menu span { display: flex; justify-content: space-between; min-height: 3.25rem; align-items: center; padding: .5rem 0; text-decoration: none; }
.menu span { color: var(--muted); }
.menu small { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) { .btn { transition: background-color .15s; } }

/* ---- рабочие экраны ---- */
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; background: var(--thread-dark); padding: 0 1rem; }
.nav a { color: #fff; text-decoration: none; padding: .75rem 0; min-height: 3rem; display: inline-flex; align-items: center; border-bottom: 3px solid transparent; }
.nav a[aria-current=page] { border-bottom-color: #fff; font-weight: 600; }
.badge { display: inline-block; min-width: 1.5rem; padding: 0 .4rem; margin-left: .4rem; background: #fff; color: var(--thread-dark); border-radius: 1rem; font-size: .875rem; text-align: center; font-weight: 700; }
.wide { max-width: 64rem; }

.msgs { list-style: none; margin: 0 0 1rem; padding: 0; }
.msgs li { padding: .75rem 1rem; border-left: 4px solid var(--thread); background: #E8F1EF; margin-bottom: .5rem; }
.msgs li.error { border-left-color: var(--alert); background: #FBEFE9; color: #6E2A0F; }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--seam); }
.rows li { border-bottom: 1px solid var(--seam); }
.rows a.row { display: block; padding: .875rem 0; text-decoration: none; color: inherit; min-height: 3.5rem; }
.rows a.row:hover strong { text-decoration: underline; }
.rows .meta { display: block; color: var(--muted); font-size: .9375rem; }
.rows .line { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.rows .row-static { padding: .75rem 0; }

.status { font-size: .875rem; font-weight: 600; white-space: nowrap; }
.status.pending { color: var(--alert); }
.status.confirmed { color: var(--thread-dark); }
.status.cancelled { color: var(--muted); text-decoration: line-through; }

.bar { height: .5rem; background: var(--seam); border-radius: .25rem; overflow: hidden; margin-top: .375rem; }
.bar i { display: block; height: 100%; background: var(--thread); }

table.t { width: 100%; border-collapse: collapse; font-size: .9375rem; }
table.t th, table.t td { text-align: left; padding: .5rem .5rem .5rem 0; border-bottom: 1px solid var(--seam); vertical-align: top; }
table.t th { font-weight: 600; color: var(--muted); font-size: .875rem; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

select, input[type=date], input[type=number], textarea {
  width: 100%; min-height: 3rem; padding: .5rem .75rem; font: inherit;
  border: 2px solid var(--seam); border-radius: .375rem; background: var(--surface); color: var(--ink);
}
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--thread); outline-offset: 2px; }
input.qty { font-size: 2rem; text-align: center; min-height: 4rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .25rem 1rem; align-items: end; }
.filters .btn { margin-top: 0; }
.btn.small { width: auto; min-height: 2.75rem; margin-top: 0; padding: .5rem 1.25rem; }
.btn.quiet { background: transparent; color: var(--thread-dark); border: 2px solid var(--thread); }
.btn.quiet:hover { background: #E8F1EF; }
.btn.danger { background: var(--alert); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.warn { margin: 1rem 0; padding: .75rem 1rem; border-left: 4px solid var(--alert); background: #FBEFE9; }
.days { display: flex; gap: 1.5rem; margin: 1rem 0 0; }
.days label { display: inline-flex; gap: .5rem; align-items: center; margin: 0; font-weight: 400; min-height: 2.75rem; }
.days input { width: 1.25rem; height: 1.25rem; }
.checkcell { width: 2.5rem; }
.checkcell input { width: 1.5rem; height: 1.5rem; }
.history li { margin-bottom: .25rem; }
.sum { display: flex; gap: 2rem; flex-wrap: wrap; margin: 1rem 0; }
.sum b { display: block; font-size: 1.5rem; line-height: 1.1; }
