/* Планировщик · Mini App. Образ: диспетчерский щит производства —
   холодная сталь, графит, кобальт для действий, сигнальный жёлтый только для «сейчас». */
:root {
  --bg: #eceef1; --surface: #ffffff; --ink: #17202b; --ink2: #55616f; --ink3: #8a95a3; --rule: #dde1e6;
  --accent: #1d4ed8; --accent-ink: #ffffff; --accent-soft: #e4ebfd;
  --board: #17202b; --board-ink: #f2f4f6; --board-ink2: #a3afbc; --board-rule: #364454;
  --now: #f5b800; --now-ink: #17202b;
  --good: #0ca30c; --good-text: #0a7a2f; --warn: #fab219; --crit: #d03b3b; --crit-soft: #fbe9e9;
  --d1: #2a78d6; --d2: #eb6834; --d3: #1baf7a; --d4: #eda100; --d5: #e87ba4; --d6: #008300;
  --h0: #edf0f3; --h1: #cde2fb; --h2: #9ec5f4; --h3: #5598e7; --h4: #256abf; --h5: #104281;
  --display: "Sofia Sans Condensed", "Arial Narrow", sans-serif;
  --body: "Golos Text", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #19212a; --ink: #eef1f4; --ink2: #a9b4c0; --ink3: #76828f; --rule: #2a3440;
  --accent: #7ca0ff; --accent-ink: #0b1220; --accent-soft: #1f2c4a;
  --board: #222c38; --board-ink: #f2f4f6; --board-ink2: #9eabb9; --board-rule: #3b4a5b;
  --good: #0ca30c; --good-text: #3ecf5c; --crit: #e66767; --crit-soft: #3a2024;
  --d1: #3987e5; --d2: #d95926; --d3: #199e70; --d4: #c98500; --d5: #d55181; --d6: #008300;
  --h0: #222c38; --h1: #104281; --h2: #1c5cab; --h3: #2a78d6; --h4: #6da7ec; --h5: #b7d3f6;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body { font: 400 15px/1.4 var(--body); color: var(--ink); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
#screen { padding: 14px 16px calc(150px + env(safe-area-inset-bottom)); outline: none; }

/* ---------- заголовки ---------- */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h1 { font: 600 34px/1 var(--display); letter-spacing: .005em; margin: 0; }
.lede { margin: 6px 0 0; color: var(--ink2); }
.lede b { color: var(--ink); font-weight: 600; }
.lede .bad { color: var(--crit); font-weight: 600; }
h2 { font: 600 15px/1.3 var(--body); margin: 26px 2px 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
h2 small { font: 400 13px var(--body); color: var(--ink3); }
h2.bad { color: var(--crit); }
.hint { color: var(--ink2); font-size: 13.5px; margin: 0 2px 10px; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink2); background: var(--surface); flex: none; }

/* ---------- щит дня ---------- */
.board { background: var(--board); color: var(--board-ink); border-radius: 20px; padding: 16px 16px 12px; }
.next-label { color: var(--board-ink2); font-size: 13.5px; }
.next { display: flex; gap: 12px; align-items: baseline; margin-top: 2px; width: 100%; }
.next time { font: 700 40px/1 var(--display); flex: none; }
.next span { font-weight: 500; font-size: 16px; line-height: 1.25; }
.rail { position: relative; height: 62px; margin: 18px 6px 0; }
.rail-track { position: absolute; left: 0; right: 0; top: 30px; height: 2px; background: var(--board-rule); border-radius: 2px; }
.rail-past { position: absolute; left: 0; top: 29px; height: 4px; background: var(--board-ink); border-radius: 2px; }
.rail-hour { position: absolute; top: 40px; transform: translateX(-50%); font: 500 13px/1 var(--display); color: var(--board-ink2); }
.rail-hour::before { content: ""; position: absolute; left: 50%; top: -8px; width: 1px; height: 5px; background: var(--board-rule); }
.mark { position: absolute; top: 31px; width: 26px; height: 26px; margin: -13px 0 0 -13px; display: grid; place-items: center; }
.mark i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--board-ink); background: var(--board); }
.mark.done i { background: var(--good); border-color: var(--good); }
.mark.late i { background: var(--crit); border-color: var(--crit); }
.mark.key i { width: 14px; height: 14px; border-width: 3px; }
.now { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.now b { background: var(--now); color: var(--now-ink); font: 700 14px/1 var(--display); padding: 3px 6px 2px; border-radius: 5px; }
.now::after { content: ""; width: 2px; height: 22px; background: var(--now); }
@media (prefers-reduced-motion: no-preference) {
  .rail-past { animation: grow .7s cubic-bezier(.2,.7,.2,1) both; transform-origin: left; }
  @keyframes grow { from { transform: scaleX(0); } }
}

/* ---------- списки ---------- */
.list { background: var(--surface); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px 11px 6px; position: relative; }
.row + .row::before, .prow + .prow::before, .crow + .crow::before { content: ""; position: absolute; left: 50px; right: 0; top: 0; height: 1px; background: var(--rule); }
.check { width: 40px; height: 40px; flex: none; display: grid; place-items: center; margin-top: -4px; }
.check i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink3); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check svg { opacity: 0; }
.row.done .check i { background: var(--good); border-color: var(--good); }
.row.done .check svg { opacity: 1; }
.row.done .title { color: var(--ink3); text-decoration: line-through; }
.body { flex: 1; min-width: 0; padding-top: 4px; }
.title { font-weight: 500; line-height: 1.3; display: block; }
.title .flag { color: var(--crit); font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 3px; font-size: 13px; color: var(--ink2); }
.dir { display: inline-flex; align-items: center; gap: 5px; }
.dir::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.c1 { --c: var(--d1); } .c2 { --c: var(--d2); } .c3 { --c: var(--d3); } .c4 { --c: var(--d4); } .c5 { --c: var(--d5); } .c6 { --c: var(--d6); } .c0 { --c: var(--ink3); }
.late-text { color: var(--crit); font-weight: 500; }
.when { flex: none; text-align: right; padding-top: 2px; font: 600 20px/1.1 var(--display); min-width: 44px; }
.when small { display: block; font: 400 12px/1.2 var(--body); color: var(--ink3); margin-top: 2px; }
.row.late .when { color: var(--crit); }
.row.done .when { color: var(--ink3); }
.more { width: 100%; padding: 12px 16px; color: var(--accent); font-weight: 500; display: flex; justify-content: space-between; }
.empty { padding: 22px 16px; color: var(--ink2); text-align: center; }

/* ---------- переключатели ---------- */
.seg { display: flex; background: var(--surface); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 9px; text-align: center; color: var(--ink2); font-size: 14px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 500; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--surface); color: var(--ink2); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.chip.dir::before { margin: 0; }
.search { width: 100%; border: 0; background: var(--surface); border-radius: 12px; padding: 11px 14px; outline-offset: 0; }
.search::placeholder { color: var(--ink3); }

/* ---------- поручения и контакты ---------- */
.prow, .crow { display: flex; align-items: center; gap: 12px; padding: 12px; position: relative; width: 100%; }
.prow + .prow::before, .crow + .crow::before { left: 64px; }
.ava { width: 40px; height: 40px; border-radius: 11px; background: var(--bg); color: var(--ink2); display: grid; place-items: center; font: 600 17px/1 var(--display); flex: none; }
.pmain { flex: 1; min-width: 0; }
.pname { font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
.pname span:last-child { font: 600 18px/1.1 var(--display); flex: none; }
.psub { font-size: 13px; color: var(--ink2); margin-top: 1px; }
.meter { height: 6px; border-radius: 3px; background: var(--h0); margin: 7px 0 5px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.days { font: 600 18px/1.1 var(--display); flex: none; text-align: right; color: var(--ink2); }
.days small { display: block; font: 400 12px var(--body); color: var(--ink3); }
.days.cold { color: var(--crit); }
.nudge { margin-left: auto; flex: none; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 500; font-size: 14px; }

/* ---------- статистика ---------- */
.card { background: var(--surface); border-radius: 14px; padding: 14px; }
.kpi { display: flex; align-items: flex-end; gap: 14px; }
.kpi-n { font: 700 64px/.85 var(--display); }
.kpi-n small { font-size: 30px; font-weight: 600; }
.kpi-t { padding-bottom: 2px; color: var(--ink2); font-size: 14px; }
.kpi-t b { display: block; color: var(--good-text); font-weight: 600; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; border-top: 1px solid var(--rule); padding-top: 12px; }
.trio div { font-size: 13px; color: var(--ink2); display: flex; flex-direction: column; gap: 3px; }
.trio b { font: 600 26px/1 var(--display); color: var(--ink); }
.trio span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.chart { width: 100%; display: block; margin-top: 4px; overflow: visible; }
.chart text { font: 500 12px var(--display); fill: var(--ink2); }
.chart .val { fill: var(--ink); font-size: 14px; font-weight: 600; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.hb { display: grid; grid-template-columns: 104px 1fr 34px; align-items: center; gap: 8px; padding: 5px 0; width: 100%; font-size: 14px; }
.hb .bar { height: 14px; background: var(--h0); border-radius: 4px; overflow: hidden; }
.hb .bar i { display: block; height: 100%; background: var(--c); border-radius: 0 4px 4px 0; }
.hb b { font: 600 17px/1 var(--display); text-align: right; }
.say { margin: 0 0 10px; font-weight: 500; line-height: 1.35; }
.heat { display: grid; grid-template-columns: 50px repeat(7, 1fr); gap: 3px; font-size: 12.5px; color: var(--ink2); align-items: center; }
.heat .hc { aspect-ratio: 1.25; border-radius: 5px; display: grid; place-items: center; font: 600 15px var(--display); }
.heat .hh { text-align: center; padding-bottom: 2px; }
.q0 { background: var(--h0); color: var(--ink3); } .q1 { background: var(--h1); color: #0d366b; } .q2 { background: var(--h2); color: #0d366b; }
.q3 { background: var(--h3); color: #fff; } .q4 { background: var(--h4); color: #fff; } .q5 { background: var(--h5); color: #fff; }
:root[data-theme="dark"] .q1, :root[data-theme="dark"] .q2 { color: #e6effc; }
:root[data-theme="dark"] .q4, :root[data-theme="dark"] .q5 { color: #0b1a30; }
.streak { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.streak + .streak { border-top: 1px solid var(--rule); }
.streak-n { font: 700 30px/1 var(--display); min-width: 40px; }
.streak-t { flex: 1; min-width: 0; font-weight: 500; line-height: 1.25; }
.streak-t small { display: block; font-weight: 400; color: var(--ink2); font-size: 13px; }
.dots { display: flex; gap: 3px; }
.dots i { width: 9px; height: 18px; border-radius: 3px; background: var(--good); }
.dots i.miss { background: var(--crit); } .dots i.off { background: var(--h0); }

/* ---------- панель снизу, тосты ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--rule); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; max-width: 96px; padding: 8px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--ink3); }
#tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }
#fab { position: fixed; right: max(16px, calc(50% - 224px)); bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 6; width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
#scrim { position: fixed; inset: 0; background: rgba(8, 12, 18, .5); z-index: 10; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 480px; margin: 0 auto; max-height: 88dvh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: no-preference) { #sheet:not([hidden]) { animation: up .22s ease-out; } @keyframes up { from { transform: translateY(24px); opacity: 0; } } }
.grab { width: 100%; height: 22px; display: grid; place-items: center; }
.grab::before { content: ""; width: 38px; height: 4px; border-radius: 2px; background: var(--ink3); opacity: .5; }
.sheet-title { font: 600 26px/1.1 var(--display); margin: 4px 0 4px; }
.sheet-sub { color: var(--ink2); margin: 0 0 14px; }
.facts { background: var(--surface); border-radius: 14px; padding: 2px 14px; margin-bottom: 12px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; }
.facts div + div { border-top: 1px solid var(--rule); }
.facts dt { color: var(--ink2); } .facts dd { margin: 0; text-align: right; font-weight: 500; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn { padding: 13px 12px; border-radius: 13px; background: var(--surface); text-align: center; font-weight: 500; }
.btn.primary { background: var(--accent); color: var(--accent-ink); grid-column: 1 / -1; }
.tl { list-style: none; margin: 0; padding: 4px 14px; background: var(--surface); border-radius: 14px; }
.tl li { padding: 10px 0 10px 16px; position: relative; }
.tl li + li { border-top: 1px solid var(--rule); }
.tl li::before { content: ""; position: absolute; left: 0; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink3); }
.tl time { display: block; font-size: 13px; color: var(--ink2); }
textarea.say-in { width: 100%; min-height: 96px; border: 0; border-radius: 14px; background: var(--surface); padding: 12px 14px; resize: none; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(140px + env(safe-area-inset-bottom)); z-index: 20; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); font-size: 14px; }
#toast button { color: var(--now); font-weight: 600; }
#tip { position: fixed; z-index: 30; background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 9px; font-size: 13px; line-height: 1.35; max-width: 240px; pointer-events: none; white-space: pre-line; }
[hidden] { display: none !important; }

.still *, .still *::before, .still *::after { animation: none !important; transition: none !important; }

/* рабочая версия */
.check.ro i { opacity: .35; border-style: dashed; }
.gate { min-height: 70vh; display: grid; align-content: center; gap: 8px; padding: 0 8px; text-align: center; }
.gate p { color: var(--ink2); }
