
/* Layout: one-column field tool — sticky header with tabs, card list, bottom action bar; form opens as a full-height sheet */
:root {
  --bg: #f3f2ef;          /* светлый гранит */
  --surface: #ffffff;
  --sunk: #e9e7e2;
  --fg: #1d1e21;
  --muted: #6c6a66;
  --line: #d9d6cf;
  --gold: #a87a22;        /* золото гравировки */
  --gold-soft: #f3e7cc;
  --hr: #8a5a2b;          /* HelpRetouch — тёплый коричневый */
  --hr-soft: #f4e6d6;
  --zpu: #1f3a7a;         /* АРТ ЗПУ — синий */
  --zpu-soft: #dfe6f6;
  --hot: #c2412d; --warm: #c98a12; --cold: #5d7a99;
  --ok: #2f7d4f; --warn: #b26b00;
  --shadow: 0 1px 2px rgba(30,28,24,.06), 0 4px 14px rgba(30,28,24,.06);
  --f-display: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", "Roboto Mono", Menlo, Consolas, monospace;
  --r: 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #151618; --surface: #1f2023; --sunk: #2a2b2f; --fg: #ecebe7; --muted: #a3a09a; --line: #34353a;
  --gold: #d9ab52; --gold-soft: #3a311f; --hr: #d49a62; --hr-soft: #3a2b1e; --zpu: #8fa9ea; --zpu-soft: #1f2a45;
  --hot: #ef7a62; --warm: #e5b04a; --cold: #8aa6c4; --ok: #6cc391; --warn: #e5a443;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #151618; --surface: #1f2023; --sunk: #2a2b2f; --fg: #ecebe7; --muted: #a3a09a; --line: #34353a;
  --gold: #d9ab52; --gold-soft: #3a311f; --hr: #d49a62; --hr-soft: #3a2b1e; --zpu: #8fa9ea; --zpu-soft: #1f2a45;
  --hot: #ef7a62; --warm: #e5b04a; --cold: #8aa6c4; --ok: #6cc391; --warn: #e5a443;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .wrap { padding-block: 12px 0; display: grid; gap: 10px; }
.titlerow { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.brand { display: grid; gap: 2px; min-width: 0; }
.brand .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.brand h1 { font-family: var(--f-display); font-weight: 600; font-size: 19px; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.who { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok .dot { background: var(--ok); } .pill.wait .dot { background: var(--warn); } .pill.local .dot { background: var(--hot); }
.tabs { display: flex; gap: 4px; }
.tab { flex: 1; border: 0; background: none; padding: 10px 6px 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--gold); }

main { padding-block: 14px 120px; }
.toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 14px; line-height: 1.2; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip.hr[aria-pressed="true"] { background: var(--hr); border-color: var(--hr); color: #fff; }
.chip.zpu[aria-pressed="true"] { background: var(--zpu); border-color: var(--zpu); color: #fff; }
:root[data-theme="dark"] .chip.zpu[aria-pressed="true"], :root[data-theme="dark"] .chip.hr[aria-pressed="true"] { color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.zpu[aria-pressed="true"], :root:not([data-theme="light"]) .chip.hr[aria-pressed="true"] { color: #111; } }
.count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.list { display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 12px 16px; display: grid; gap: 6px; position: relative; overflow: hidden; text-align: left; width: 100%; box-shadow: var(--shadow); }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--line); }
.card.t-hot::before { background: var(--hot); } .card.t-warm::before { background: var(--warm); } .card.t-cold::before { background: var(--cold); }
.card .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .name { font-weight: 650; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.card .time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.card .org { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.b { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--sunk); color: var(--fg); }
.b.hr { background: var(--hr-soft); color: var(--hr); } .b.zpu { background: var(--zpu-soft); color: var(--zpu); }
.b.next { background: var(--gold-soft); color: var(--fg); font-weight: 500; }
.b.orion { background: var(--sunk); }
.b.pending { background: none; border: 1px dashed var(--warn); color: var(--warn); }
.phone { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.phone .num { font-family: var(--f-mono); font-size: 14px; user-select: all; }
.mini { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 3px 9px; font-size: 13px; color: var(--fg); text-decoration: none; }
.card .note { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .open { position: absolute; inset: 0; background: none; border: 0; z-index: 0; }
.card > *:not(.open) { position: relative; z-index: 1; pointer-events: none; }
.card .phone, .card .phone * { pointer-events: auto; }

.empty { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 28px 18px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty strong { color: var(--fg); font-size: 17px; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: linear-gradient(to top, var(--bg) 70%, transparent); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding-top: 18px; }
.bar .wrap { display: flex; gap: 10px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 13px 18px; font-weight: 600; font-size: 16px; }
.btn.primary { flex: 1; background: var(--fg); color: var(--bg); border-color: var(--fg); font-size: 17px; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: var(--hot); border-color: var(--hot); background: none; }
.btn:disabled { opacity: .5; }

/* Итоги */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 2px; }
.stat .n { font-family: var(--f-display); font-size: 26px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); }
.stat.hr .n { color: var(--hr); } .stat.zpu .n { color: var(--zpu); } .stat.hot .n { color: var(--hot); }
section.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; display: grid; gap: 10px; }
section.block h2 { font-family: var(--f-display); font-size: 15px; font-weight: 600; margin: 0; }
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; }
.agenda { display: grid; gap: 8px; }
.agenda .it { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 10px; align-items: start; border: 0; background: none; text-align: left; padding: 0; }
.agenda .when { font-family: var(--f-mono); font-size: 13px; color: var(--gold); }
.agenda .what { min-width: 0; overflow-wrap: anywhere; }
.agenda .what small { display: block; color: var(--muted); }
.hint { font-size: 14px; color: var(--muted); }
.exports { display: flex; gap: 8px; flex-wrap: wrap; }

/* Форма */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: env(safe-area-inset-top, 0px); }
.sheet header { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); }
.sheet header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 10px; }
.sheet header h2 { font-family: var(--f-display); font-size: 17px; margin: 0; font-weight: 600; }
.x { border: 0; background: none; font-size: 15px; color: var(--muted); padding: 8px 4px; }
form.f { display: grid; gap: 18px; padding-block: 16px calc(110px + env(safe-area-inset-bottom, 0px)); }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
legend, label.lab { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; padding: 0; margin-bottom: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; }
input.t, select.t, textarea.t { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 17px; }
textarea.t { min-height: 92px; resize: vertical; }
input.t.mono { font-family: var(--f-mono); font-size: 16px; }
.proj { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.proj button { border: 2px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 14px 10px; font-weight: 700; font-size: 16px; }
.proj button.hr[aria-pressed="true"] { border-color: var(--hr); background: var(--hr-soft); color: var(--hr); }
.proj button.zpu[aria-pressed="true"] { border-color: var(--zpu); background: var(--zpu-soft); color: var(--zpu); }
.proj small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px; }
.temp .chip[data-v="hot"][aria-pressed="true"] { background: var(--hot); border-color: var(--hot); color: #fff; }
.temp .chip[data-v="warm"][aria-pressed="true"] { background: var(--warm); border-color: var(--warm); color: #fff; }
.temp .chip[data-v="cold"][aria-pressed="true"] { background: var(--cold); border-color: var(--cold); color: #fff; }
.checks { display: grid; gap: 6px; }
.check { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
.check.consent { border-color: var(--gold); }
.sub { border-left: 3px solid var(--line); padding-left: 12px; display: grid; gap: 14px; }
.sub.hr { border-left-color: var(--hr); } .sub.zpu { border-left-color: var(--zpu); }
.sub .tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sub.hr .tag { color: var(--hr); } .sub.zpu .tag { color: var(--zpu); }
.dup { background: var(--gold-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.err { color: var(--hot); font-size: 14px; }
.danger-zone { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meta { font-size: 13px; color: var(--muted); }

.picker { position: fixed; inset: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.picker .box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px; width: min(420px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); }
.picker h2 { font-family: var(--f-display); font-size: 18px; margin: 0; font-weight: 600; text-wrap: balance; }
.picker .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.picker .opts button { padding: 18px 10px; border-radius: var(--r); border: 2px solid var(--line); background: var(--bg); font-weight: 700; font-size: 18px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 40; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 15px; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: up .18s ease-out; } @keyframes up { from { transform: translate(-50%, 8px); opacity: 0; } } }

/* ── standalone-дополнения ───────────────────────────── */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100%; }
:root { padding-top: 0; }
.brand h1 { font-weight: 750; }
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.login .box { width: min(420px, 100%); display: grid; gap: 16px; }
.login .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 650; }
.login h1 { font-family: var(--f-display); font-size: 26px; line-height: 1.15; margin: 0; font-weight: 750; text-wrap: balance; }
.login p { margin: 0; color: var(--muted); }
.login .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.login .opts button { padding: 16px 10px; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 18px; }
.login .opts button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.install { background: var(--gold-soft); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; margin-bottom: 12px; font-size: 15px; }
.install .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.callbtn { text-decoration: none; }
.offscreen { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }
.menu { display: grid; gap: 8px; }
.menu .btn { text-align: left; }
.small { font-size: 13px; color: var(--muted); }
.spacer58 { width: 58px; }
body.noscroll { overflow: hidden; }
