/* График замеров.
   Раскладка: доска-неделя из семи колонок под шапкой-«рулеткой»; на телефоне — лента дней недели. */

@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(fonts/golos-text-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(fonts/golos-text-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url(fonts/jetbrains-mono-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* цвет */
  --bg: #e9ecef;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --ink: #161b20;
  --ink-2: #48525d;
  --ink-3: #74808c;
  --line: #d5dae0;
  --line-2: #e4e8ec;
  --tape: #f6c500;          /* жёлтая лента рулетки: сегодня, марка */
  --tape-ink: #1b1a12;
  --tape-soft: #fdf3c4;
  --focus: #1c6dd0;
  --danger: #c2332f;
  --bar: #5d6d7e;           /* нейтральные столбики в итогах */
  --shadow: 0 1px 2px rgba(22, 27, 32, .08), 0 4px 14px rgba(22, 27, 32, .06);
  --overlay: rgba(22, 27, 32, .45);

  /* статусы: сплошной цвет — точка и столбики, фон и текст — плашка */
  --st-planned: #2a78d6;   --st-planned-bg: #e3eefb;   --st-planned-ink: #164f8c;
  --st-done: #008300;      --st-done-bg: #e0f2e0;      --st-done-ink: #0a5c0a;
  --st-tentative: #eda100; --st-tentative-bg: #fdf0d0; --st-tentative-ink: #775000;
  --st-moved: #4a3aa7;     --st-moved-bg: #eae7f8;     --st-moved-ink: #3d3090;
  --st-canceled: #e34948;  --st-canceled-bg: #fbe6e5;  --st-canceled-ink: #9c2423;

  /* шрифт */
  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --bar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161a; --surface: #1d2329; --surface-2: #171c21; --ink: #edf0f3; --ink-2: #b3bcc6; --ink-3: #87919c;
    --line: #333c46; --line-2: #262d35; --tape: #f6c500; --tape-ink: #1b1a12; --tape-soft: #3a3210;
    --focus: #5aa2f2; --danger: #ee6b66; --bar: #8494a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3); --overlay: rgba(0, 0, 0, .6);
    --st-planned: #3987e5;   --st-planned-bg: #1a2e48;   --st-planned-ink: #a3c9f7;
    --st-done: #199e30;      --st-done-bg: #15301a;      --st-done-ink: #86d993;
    --st-tentative: #c98500; --st-tentative-bg: #3a2c0b; --st-tentative-ink: #f1c463;
    --st-moved: #9085e9;     --st-moved-bg: #29264d;     --st-moved-ink: #c3bdf6;
    --st-canceled: #e66767;  --st-canceled-bg: #40201f;  --st-canceled-ink: #f5aaa9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161a; --surface: #1d2329; --surface-2: #171c21; --ink: #edf0f3; --ink-2: #b3bcc6; --ink-3: #87919c;
  --line: #333c46; --line-2: #262d35; --tape: #f6c500; --tape-ink: #1b1a12; --tape-soft: #3a3210;
  --focus: #5aa2f2; --danger: #ee6b66; --bar: #8494a5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3); --overlay: rgba(0, 0, 0, .6);
  --st-planned: #3987e5;   --st-planned-bg: #1a2e48;   --st-planned-ink: #a3c9f7;
  --st-done: #199e30;      --st-done-bg: #15301a;      --st-done-ink: #86d993;
  --st-tentative: #c98500; --st-tentative-bg: #3a2c0b; --st-tentative-ink: #f1c463;
  --st-moved: #9085e9;     --st-moved-bg: #29264d;     --st-moved-ink: #c3bdf6;
  --st-canceled: #e66767;  --st-canceled-bg: #40201f;  --st-canceled-ink: #f5aaa9;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-weight: 500; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-size: 16px; /* 16px: iOS не увеличивает страницу при вводе */
}
textarea.input { min-height: 72px; resize: vertical; line-height: 1.35; }
.input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.input::placeholder { color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--ink-3); }
.error-text { color: var(--danger); font-size: 13px; font-weight: 500; }

/* ---------- плашка статуса ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 8px 0 7px;
  border: 0; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--pb); color: var(--pi);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pc); flex: none; }
button.pill:hover { box-shadow: inset 0 0 0 1px var(--pc); }
.st-planned   { --pc: var(--st-planned);   --pb: var(--st-planned-bg);   --pi: var(--st-planned-ink); }
.st-done      { --pc: var(--st-done);      --pb: var(--st-done-bg);      --pi: var(--st-done-ink); }
.st-tentative { --pc: var(--st-tentative); --pb: var(--st-tentative-bg); --pi: var(--st-tentative-ink); }
.st-moved     { --pc: var(--st-moved);     --pb: var(--st-moved-bg);     --pi: var(--st-moved-ink); }
.st-canceled  { --pc: var(--st-canceled);  --pb: var(--st-canceled-bg);  --pi: var(--st-canceled-ink); }
.pill.st-tentative::before { border-radius: 1px; transform: rotate(45deg); }
.pill.st-canceled::before { border-radius: 1px; height: 3px; }

/* ---------- верхняя панель ---------- */
.appbar {
  position: sticky; top: var(--safe-top); z-index: 30;
  display: flex; align-items: center; gap: 14px; height: var(--bar-h); padding-inline: var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; text-decoration: none; flex: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px; background: var(--tape); flex: none;
  background-image: repeating-linear-gradient(90deg, var(--tape-ink) 0 1.5px, transparent 1.5px 5px);
  background-size: 100% 9px; background-repeat: no-repeat; background-position: 3px 100%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.nav { display: flex; gap: 2px; margin-left: 6px; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--radius);
  color: var(--ink-2); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff;
  font: 600 11px/18px var(--font-num); text-align: center;
}
.search { position: relative; flex: 1 1 200px; max-width: 320px; margin-left: auto; min-width: 0; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.search .input { min-height: 36px; padding: 6px 30px 6px 34px; background: var(--surface-2); font-size: 14px; }
.search .clear { position: absolute; right: 2px; top: 2px; width: 32px; min-height: 32px; }
.userbtn { flex: none; max-width: 180px; }
.userbtn span { overflow: hidden; text-overflow: ellipsis; }

/* нижние вкладки на телефоне */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none;
  padding-bottom: var(--safe-bottom); background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 54px; position: relative;
  color: var(--ink-3); font-size: 11px; font-weight: 600; text-decoration: none;
}
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 32px; height: 3px; background: var(--tape); border-radius: 0 0 3px 3px; }
.tabbar .badge { position: absolute; top: 5px; left: calc(50% + 6px); }

main { padding: 16px var(--gutter) 40px; }
.page { max-width: 980px; margin-inline: auto; display: flex; flex-direction: column; gap: 22px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
.demo-note {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 8px var(--gutter);
  background: var(--tape-soft); color: var(--ink); font-size: 13px; border-bottom: 1px solid var(--line);
}

/* ---------- панель недели ---------- */
.weekbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; }
.weeknav { display: flex; gap: 6px; }
.weektitle { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.weektitle h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.weeknum { font: 500 12px var(--font-num); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.weektools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.weektools .input { width: auto; min-height: 36px; padding: 5px 8px; font-size: 14px; }
.summary { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink-2); font-size: 13px; margin-bottom: 12px; }
.summary b { font-family: var(--font-num); font-weight: 600; color: var(--ink); }
.summary .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pc); margin-right: 5px; }

/* лента дней — только на телефоне */
.daystrip { display: none; }

/* ---------- доска ---------- */
.board-wrap { overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); padding-bottom: 8px; }
.board { display: grid; grid-template-columns: repeat(7, minmax(158px, 1fr)); gap: 8px; align-items: start; min-width: 0; }
.day { display: flex; flex-direction: column; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); }
.day.drop { outline: 2px dashed var(--focus); outline-offset: -2px; }
.day-head {
  display: flex; align-items: baseline; gap: 6px; padding: 9px 10px 13px; position: relative;
  border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); border-bottom: 1px solid var(--line);
}
/* деления рулетки по нижней кромке шапки дня */
.day-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px; pointer-events: none; opacity: .5;
  background:
    repeating-linear-gradient(90deg, var(--ink-3) 0 1px, transparent 1px 32px) 9px 100% / 100% 7px no-repeat,
    repeating-linear-gradient(90deg, var(--ink-3) 0 1px, transparent 1px 8px) 9px 100% / 100% 4px no-repeat;
}
.day-head .dow { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.day-head .dnum { font: 600 15px var(--font-num); letter-spacing: -.03em; }
.day-head .dmon { color: var(--ink-3); font-size: 12px; }
.day-head .dcount { margin-left: auto; font: 500 12px var(--font-num); color: var(--ink-3); }
.day.weekend .day-head .dow { color: var(--ink-3); }
.day.today .day-head { background: var(--tape); color: var(--tape-ink); border-bottom-color: transparent; }
.day.today .day-head .dmon, .day.today .day-head .dcount, .day.today .day-head .dow { color: var(--tape-ink); }
.day.today .day-head::after { opacity: .75; background:
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 32px) 9px 100% / 100% 7px no-repeat,
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 8px) 9px 100% / 100% 4px no-repeat; }
.day.past .card { opacity: .88; }

.day-note { margin: 8px 8px 0; }
.day-note button {
  width: 100%; text-align: left; padding: 5px 8px; border: 1px dashed transparent; border-radius: 6px; background: none;
  color: var(--ink-3); font-size: 12px; overflow-wrap: anywhere;
}
.day-note button:hover { border-color: var(--line); color: var(--ink-2); }
.day-note button.has { background: var(--tape-soft); color: var(--ink); font-weight: 500; }
.day-note .input { min-height: 32px; padding: 4px 8px; font-size: 14px; }

.cards { display: flex; flex-direction: column; gap: 6px; padding: 8px; min-height: 12px; }
.card {
  display: flex; flex-direction: column; gap: 3px; padding: 8px 9px 9px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
  overflow-wrap: anywhere;
}
.card:hover { border-color: var(--ink-3); box-shadow: var(--shadow); }
.card.dragging { opacity: .4; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 4px 6px; flex-wrap: wrap; margin-bottom: 2px; }
.card .time { font: 600 14px var(--font-num); letter-spacing: -.03em; }
.card .time.none { color: var(--ink-3); font-weight: 400; }
.card .client { font-weight: 600; line-height: 1.25; }
.card .addr { color: var(--ink-2); font-size: 13px; }
.card .phone { color: var(--ink-2); font: 500 12px var(--font-num); text-decoration: none; align-self: flex-start; }
.card .phone:hover { text-decoration: underline; color: var(--ink); }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12px; color: var(--ink-2); }
.chip.who { background: transparent; }
.chip.moved { border-style: dashed; }
.card .comment { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; padding-top: 5px; border-top: 1px dashed var(--line); }
.card.st-canceled .client, .card.st-canceled .time, .card.st-moved .client, .card.st-moved .time { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-3); }
.card.st-canceled, .card.st-moved { background: transparent; }
.card.st-tentative { border-style: dashed; border-color: var(--st-tentative); }
.add-btn {
  margin: 0 8px 8px; min-height: 32px; border: 1px dashed var(--line); border-radius: 7px; background: none;
  color: var(--ink-3); font-size: 13px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 4px;
}
.add-btn:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface); }
.empty-day { display: none; }

/* ---------- списки: контроль и поиск ---------- */
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head .count { font: 600 13px var(--font-num); color: var(--ink-3); }
.section-head p { flex-basis: 100%; color: var(--ink-2); font-size: 13px; }
.rows { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line-2); cursor: pointer; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row .when { display: flex; flex-direction: column; font: 600 13px var(--font-num); letter-spacing: -.03em; }
.row .when small { font: 400 12px var(--font-ui); color: var(--ink-3); letter-spacing: 0; }
.row .what { min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.row .what b { font-weight: 600; }
.row .what span { color: var(--ink-2); font-size: 13px; }
.row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.empty { padding: 18px 14px; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- итоги ---------- */
.presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.presets .btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.presets .input { width: auto; min-height: 36px; padding: 5px 8px; font-size: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h2 { font-size: 15px; font-weight: 700; }
.hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero .big { font: 600 40px/1 var(--font-num); letter-spacing: -.05em; }
.hero span { color: var(--ink-2); }
.stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.stack i { display: block; background: var(--pc); min-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--pc); }
.legend b { font: 600 13px var(--font-num); color: var(--ink); }
.bars { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr) max-content; gap: 8px 12px; align-items: center; font-size: 13px; }
.bars .name { color: var(--ink-2); overflow-wrap: anywhere; }
.bars .name small { display: block; color: var(--ink-3); font-size: 12px; }
.bars .track { height: 14px; display: flex; gap: 2px; }
.bars .track i { display: block; height: 100%; background: var(--pc, var(--st-planned)); border-radius: 0 4px 4px 0; min-width: 3px; }
.bars .track.plain i { background: var(--bar); }
.bars .track.stacked i { border-radius: 0; }
.bars .track.stacked i:last-child { border-radius: 0 4px 4px 0; }
.bars .val { font: 600 13px var(--font-num); text-align: right; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- настройки ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 120px; overflow-wrap: anywhere; }
.list-item small { display: block; color: var(--ink-3); font-size: 12px; }
.list-item.off .grow { color: var(--ink-3); text-decoration: line-through; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 150px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: var(--radius); }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th, table.t td { padding: 6px 10px; text-align: left; border-top: 1px solid var(--line-2); white-space: nowrap; }
table.t th { border-top: 0; color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
table.t td.wrap { white-space: normal; min-width: 160px; }
.warn { padding: 10px 12px; border-radius: var(--radius); background: var(--st-tentative-bg); color: var(--st-tentative-ink); font-size: 13px; }

/* ---------- окна ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: 0 0 0 auto; width: min(460px, 100%); height: 100%; max-height: none; max-width: none;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog.sheet.center { margin: auto; height: auto; max-height: 90%; border-radius: 12px; width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: var(--overlay); }
.sheet form, .sheet .sheet-body { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h2 { font-size: 17px; font-weight: 700; flex: 1; }
.sheet-main { padding: 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); flex: none; }
.sheet-foot .spacer { flex: 1; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg .pill { min-height: 32px; padding: 0 12px 0 10px; font-size: 13px; cursor: pointer; background: var(--surface-2); color: var(--ink-2); }
.seg input:checked + .pill { background: var(--pb); color: var(--pi); box-shadow: inset 0 0 0 1.5px var(--pc); }
.seg input:focus-visible + .pill { outline: 2px solid var(--focus); outline-offset: 2px; }
.history { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); }
.history li { list-style: none; }
.history ul { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history time { font: 500 12px var(--font-num); color: var(--ink-3); }
.history b { color: var(--ink); font-weight: 600; }

.menu {
  position: fixed; z-index: 60; min-width: 190px; padding: 5px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
}
.menu button { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 6px; background: none; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu hr { width: 100%; border: 0; border-top: 1px solid var(--line-2); margin: 3px 0; }

.toasts { position: fixed; left: 50%; translate: -50% 0; bottom: calc(20px + var(--safe-bottom)); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-weight: 500; max-width: 100%; }
.toast.error { background: var(--danger); color: #fff; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: 0; }

/* ---------- вход ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter); }
.login-box { width: min(360px, 100%); display: flex; flex-direction: column; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login-box h1 { font-size: 20px; font-weight: 700; }
.loading { padding: 40px 0; text-align: center; color: var(--ink-3); }

/* ---------- телефон ---------- */
@media (max-width: 900px) {
  :root { --bar-h: 50px; }
  .nav, .userbtn { display: none; }
  .tabbar { display: flex; }
  body { padding-bottom: calc(54px + var(--safe-bottom)); }
  .toasts { bottom: calc(66px + var(--safe-bottom)); }
  .search { max-width: none; }
  main { padding-top: 12px; }

  .weekbar { gap: 8px; margin-bottom: 8px; }
  .weektitle h1 { font-size: 18px; }
  .weektools { margin-left: 0; width: 100%; }
  .weektools .grow-m { flex: 1; }
  .summary { display: none; }

  .daystrip {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; position: sticky; z-index: 20;
    top: calc(var(--safe-top) + var(--bar-h)); margin-inline: calc(var(--gutter) * -1); padding: 6px var(--gutter) 8px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .daystrip button {
    display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0 6px; min-width: 0;
    border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); position: relative;
  }
  .daystrip .dow { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
  .daystrip .dnum { font: 600 16px var(--font-num); letter-spacing: -.04em; }
  .daystrip .dcount { font: 500 11px var(--font-num); color: var(--ink-3); min-height: 14px; }
  .daystrip button.today { background: var(--tape); border-color: transparent; color: var(--tape-ink); }
  .daystrip button.today .dow, .daystrip button.today .dcount { color: var(--tape-ink); }

  .board-wrap { overflow: visible; margin: 0; padding: 0; }
  .board { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin-top: 12px; }
  .day { scroll-margin-top: calc(var(--safe-top) + var(--bar-h) + 84px); }
  .day-head .dow { font-size: 14px; }
  .cards { gap: 8px; }
  .card { padding: 10px 12px 11px; }
  .card .time { font-size: 15px; }
  .card .client { font-size: 15px; }
  .card .addr { font-size: 14px; }
  .card .phone { font-size: 14px; padding: 4px 0; }
  .add-btn { min-height: 40px; }

  .row { grid-template-columns: minmax(0, 1fr); }
  .row .when { flex-direction: row; gap: 8px; align-items: baseline; }
  .row .acts { justify-content: flex-start; }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  dialog.sheet { width: 100%; }
  .page-title { font-size: 20px; }
  .hero .big { font-size: 34px; }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .btn, .add-btn { transition: border-color .12s, box-shadow .12s, background-color .12s; }
  html { scroll-behavior: smooth; }
}
