/* Классики 2026 · панель автопилота.
   Светлая тема — одна, без переключения по системной: панель смотрят с разных машин,
   и вид должен быть предсказуемым. Одна шкала отступов (4/8/12/16/24/32), один радиус.
   Анимации только на transform/opacity, 120–200 мс, глушатся при prefers-reduced-motion. */

:root {
  color-scheme: light;

  --bg:        #f7f9fc;
  --bg-tint:   #edf3fb;
  --surface:   #ffffff;
  --surface-2: #f4f6f9;
  --line:      #e3e8ef;
  --line-soft: #eef1f6;
  --ink:       #101828;
  --ink-2:     #556072;
  --ink-3:     #8994a5;

  --accent:      #12805a;
  --accent-soft: #eaf6f0;
  --accent-line: #b9e0cd;
  --warn:        #92600b;
  --warn-soft:   #fdf4e4;
  --warn-line:   #f0dcb4;
  --bad:         #b3261e;
  --bad-soft:    #fdeeee;
  --bad-line:    #f4cdcb;
  --info:        #0b5f89;

  --r:   24px;
  --r-s: 9px;
  --sp:  8px;
  --shadow:    0 1px 2px rgba(16,24,40,.05), 0 6px 18px rgba(16,24,40,.05);
  --shadow-lg: 0 2px 6px rgba(16,24,40,.08), 0 20px 48px rgba(16,24,40,.12);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg-tint);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1,h2,h3 { margin: 0; font-weight: 640; letter-spacing: -0.012em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--info); }
code, pre { font-family: var(--mono); }

#app {
  position: relative; isolation: isolate; min-height: 100vh;
  max-width: 1080px; margin: 0 auto; padding: 20px 24px 48px;
  display: flex; flex-direction: column; gap: 16px;
}
.profile-wash {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  transition: background .32s ease;
}
.profile-wash.is-papa {
  background:
    radial-gradient(circle at 18% -8%, rgba(89,174,255,.46), transparent 42%),
    radial-gradient(circle at 94% 26%, rgba(91,132,255,.14), transparent 34%),
    linear-gradient(145deg, #e8f5ff 0%, #f8fbff 48%, #edf2ff 100%);
}
.profile-wash.is-mama {
  background:
    radial-gradient(circle at 18% -8%, rgba(255,139,196,.42), transparent 42%),
    radial-gradient(circle at 94% 26%, rgba(226,115,184,.13), transparent 34%),
    linear-gradient(145deg, #fff0f7 0%, #fffafd 48%, #f9eff8 100%);
}

/* ---------- шапка ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 0 4px; }
.mark { display: flex; align-items: baseline; gap: var(--sp); font-weight: 670; font-size: 17px; letter-spacing: -0.02em; }
.mark span { font-size: 20px; }
.mark em { font-style: normal; font-weight: 450; color: var(--ink-3); font-size: 13px; }
.bar-right { display: flex; align-items: center; gap: calc(var(--sp)*1.5); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  padding: 6px 14px; border-radius: 7px; font-size: 13.5px; font-weight: 550;
  transition: color .14s ease, background-color .14s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.live { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- герой: часы + кнопки под ними ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(300px, .72fr); gap: 0;
  background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.78); border-radius: var(--r);
  box-shadow: 0 24px 64px rgba(51,73,108,.12), 0 2px 8px rgba(51,73,108,.06); overflow: hidden;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.hero-left, .hero-right { padding: 28px; }
.hero-left { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; background: var(--surface); }
.hero-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; border-left: 1px solid var(--line-soft); background: rgba(247,249,252,.78); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.c-open, .chip.c-submitted { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip.c-submitting { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.chip.c-failed { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.chip.c-open::before { animation: pulse 1.4s ease-in-out infinite; }

.clock {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(44px, 6vw, 64px); font-weight: 650; line-height: 1;
  letter-spacing: -0.045em; margin: 4px 0;
}
.when { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.tiny { color: var(--ink-3); font-size: 12.5px; }

/* быстрый сценарий и резерв — в белой зоне непосредственно под часами */
.action-console { width: 100%; display: grid; gap: 12px; margin-top: 12px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.btn.action { min-height: 48px; padding: 8px 12px; font-size: 13px; }
.btn.action span {
  width: 22px; height: 22px; display: grid; place-items: center; flex: none;
  border-radius: 50%; background: rgba(18,128,90,.10); font-size: 11px; font-weight: 750;
}
.btn.primary.action span { color: var(--accent); background: #fff; }
.reserve-kit {
  display: grid; gap: 8px; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe;
}
.reserve-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.reserve-head b { font-size: 13px; font-weight: 650; }
.reserve-head span { color: var(--ink-3); font-size: 11.5px; text-align: right; }
.reserve-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bookmark-pair { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
.bookmark-pair .drag { min-width: 0; border-style: dashed; border-color: #c5ceda; background: var(--surface); }
.utility { border-top: 1px solid var(--line-soft); padding-top: 4px; }
.utility > summary, .readiness > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 36px; color: var(--ink-2); font-size: 12.5px; font-weight: 600;
}
.utility > summary::-webkit-details-marker, .readiness > summary::-webkit-details-marker { display: none; }
.utility > summary::after { content: "+"; color: var(--ink-3); font-size: 18px; font-weight: 400; }
.utility[open] > summary::after { content: "−"; }
.utility-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding-top: 4px; }
.utility-menu .btn { justify-content: flex-start; white-space: normal; }
.utility-menu .dbl { grid-column: 1 / -1; padding: 8px; }

.auto {
  display: flex; gap: calc(var(--sp)*1.5); align-items: flex-start; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-s); padding: calc(var(--sp)*1.5) calc(var(--sp)*2);
  background: var(--surface-2); transition: background-color .16s ease, border-color .16s ease;
}
.auto:hover { border-color: var(--ink-3); }
.auto.on { background: var(--accent-soft); border-color: var(--accent-line); }
.auto input { margin: 2px 0 0; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.auto-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.auto-t b { font-size: 14px; font-weight: 620; }
.auto-t em { font-style: normal; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.auto.on .auto-t em { color: var(--accent); }

.readiness { border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); overflow: hidden; }
.readiness > summary { padding: 8px 12px; }
.readiness > summary::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.readiness > summary span { margin-right: auto; }
.readiness > summary b { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.readiness[open] > summary { border-bottom: 1px solid var(--line-soft); }

.check { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line-soft); }
.check li { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: var(--sp); background: var(--surface); padding: 7px 12px; font-size: 13px; }
.check .ic { font-weight: 700; text-align: center; }
.check li.y .ic { color: var(--accent); }
.check li.w .ic { color: var(--warn); }
.check li.n .ic { color: var(--bad); }
.check li.n { background: var(--bad-soft); }
.check li i { font-style: normal; color: var(--ink-3); font-size: 12.5px; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- плитки ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tiles > div { background: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.72); border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; gap: 3px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tiles span { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .055em; font-weight: 600; }
.tiles b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tiles b.good { color: var(--accent); }

.srow { display: flex; gap: var(--sp); align-items: center; }
.srow.wrap { flex-wrap: wrap; row-gap: var(--sp); }
.sect-t { font-size: 13px; font-weight: 620; color: var(--ink-2); display: flex; align-items: baseline; gap: var(--sp); flex-wrap: wrap; }
.sect-t em { font-style: normal; font-weight: 400; font-size: 12.5px; color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--r-s); padding: 8px 15px; font-size: 13.5px; font-weight: 570;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(16,24,40,.04);
  transition: background-color .13s ease, border-color .13s ease, transform .09s ease, opacity .13s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(18,128,90,.3); }
.btn.primary:hover:not([disabled]) { background: #0f6d4d; border-color: #0f6d4d; }
.btn.primary[disabled], .btn.step[disabled] { opacity: 1; color: var(--ink-3); background: #edf0f4; border-color: #e1e6ed; box-shadow: none; }
.btn.primary[disabled] span, .btn.step[disabled] span { color: var(--ink-3); background: #fff; }
.btn.step { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.btn.step:hover:not([disabled]) { background: #dff0e7; border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; border-color: transparent; }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); border-color: var(--line); }
.btn.mini { padding: 5px 10px; font-size: 12.5px; }
.dbl { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.dbl input { accent-color: var(--accent); }

.btn.drag { cursor: grab; border-style: dashed; border-color: var(--ink-3); }

/* ---------- предпросмотр формы ---------- */
.preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.preview-head { display: flex; align-items: center; gap: var(--sp); flex-wrap: wrap; padding: calc(var(--sp)*1.5) calc(var(--sp)*2); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.preview-head b { font-size: 14px; }
.preview-note { font-size: 12.5px; color: var(--ink-2); }
.preview-note.grow { flex: 1; min-width: 200px; }
.preview-frame { width: 100%; height: 62vh; min-height: 420px; border: 0; display: block; background: #fff; }
.preview-report { display: grid; gap: 2px; padding: calc(var(--sp)*1.5) calc(var(--sp)*2); border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; max-height: 190px; overflow: auto; }
.preview-report div.no { color: var(--bad); }
.preview-report div.yes { color: var(--accent); }

/* ---------- панели и таблица ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.panel summary {
  cursor: pointer; list-style: none; padding: calc(var(--sp)*1.5) calc(var(--sp)*2);
  font-size: 14px; font-weight: 620; display: flex; align-items: center; gap: var(--sp);
  transition: background-color .13s ease;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary::before { content: "▸"; color: var(--ink-3); font-size: 11px; transition: transform .16s ease; display: inline-block; }
.panel details[open] > summary::before { transform: rotate(90deg); }
.panel summary:hover { background: var(--surface-2); }
.panel summary small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.panel > details > *:not(summary) { padding: 0 calc(var(--sp)*2) calc(var(--sp)*2); }

.tbl-wrap { overflow-x: auto; }
table.rows { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
table.rows th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: .055em; padding: 0 12px 7px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.rows td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: baseline; }
table.rows tr:last-child td { border-bottom: 0; }
table.rows tbody tr:nth-child(even) { background: var(--surface-2); }
table.rows tbody tr:hover { background: var(--accent-soft); }
th.c-f, td.c-f { width: 34%; }
th.c-u, td.c-u { width: 84px; }
th.c-v, td.c-v { width: auto; }
td.c-f { font-weight: 550; }
td.c-u { font-family: var(--mono); color: var(--ink-3); font-size: 12.5px; }
td.c-v { font-family: var(--mono); word-break: break-word; }
td.c-v .arrow { color: var(--ink-3); }
td.c-v .wire { color: var(--accent); }
td.c-v.skip { color: var(--ink-3); font-style: italic; font-family: var(--sans); }
.muted { color: var(--ink-3); font-size: 13px; }
.probs { margin: calc(var(--sp)*1.5) 0 0; padding: var(--sp) var(--sp) var(--sp) 28px; color: var(--bad); font-size: 12.5px; display: grid; gap: 4px; background: var(--bad-soft); border: 1px solid var(--bad-line); border-radius: var(--r-s); }

.res { border: 1px solid var(--line); border-radius: var(--r-s); padding: calc(var(--sp)*1.5); margin-bottom: var(--sp); }
.res.ok { border-color: var(--accent-line); background: var(--accent-soft); }
.res.bad { border-color: var(--bad-line); background: var(--bad-soft); }
.rh { display: flex; align-items: center; gap: var(--sp); flex-wrap: wrap; font-size: 13.5px; }
.tag { font-size: 11.5px; font-weight: 620; padding: 2px 9px; border-radius: 999px; border: 1px solid; background: var(--surface); }
.tag.ok { color: var(--accent); border-color: var(--accent-line); }
.tag.bad { color: var(--bad); border-color: var(--bad-line); }
.kv { display: flex; gap: var(--sp); align-items: center; flex-wrap: wrap; margin-top: var(--sp); font-size: 13px; }
.kv code { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.res pre { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: var(--sp); overflow: auto; max-height: 220px; margin: 6px 0 0; }
.res details summary { padding: 6px 0; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.chk input { accent-color: var(--accent); }
.logbox { margin-top: var(--sp); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s); max-height: 340px; overflow: auto; padding: var(--sp); display: grid; gap: 1px; }
.ln { display: grid; grid-template-columns: 92px 76px 1fr; gap: var(--sp); font-family: var(--mono); font-size: 11.5px; line-height: 1.55; padding: 1px 0; align-items: baseline; }
.ln .t, .ln .sc { color: var(--ink-3); }
.ln .m { color: var(--ink); word-break: break-word; }
.ln .d { grid-column: 3; color: var(--ink-3); word-break: break-all; }
.ln.success .m { color: var(--accent); font-weight: 560; }
.ln.warn .m { color: var(--warn); }
.ln.error .m { color: var(--bad); font-weight: 600; }
.ln.debug .m { color: var(--ink-2); }

.foot { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; text-align: center; padding-top: var(--sp); border-top: 1px solid var(--line); }

/* ---------- тосты ---------- */
.toasts { position: fixed; right: calc(var(--sp)*2); bottom: calc(var(--sp)*2); display: grid; gap: var(--sp); z-index: 50; max-width: min(400px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  border-radius: var(--r-s); box-shadow: var(--shadow-lg); padding: 10px 13px; font-size: 13px;
  display: flex; gap: var(--sp); align-items: baseline; animation: rise .18s cubic-bezier(.2,.7,.3,1);
}
.toast b { font-size: 11px; text-transform: uppercase; letter-spacing: .055em; color: var(--ink-3); font-weight: 650; flex: none; }
.toast.success { border-left-color: var(--accent); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--bad); }
.toast.info { border-left-color: var(--info); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

@media (max-width: 860px) {
  #app { padding: 16px 16px 40px; }
  .hero { grid-template-columns: 1fr; }
  .hero-right { border-left: 0; border-top: 1px solid var(--line-soft); }
  th.c-f, td.c-f { width: 42%; }
  th.c-u, td.c-u { display: none; }
  .ln { grid-template-columns: 78px 1fr; }
  .ln .sc { display: none; }
  .ln .d { grid-column: 2; }
}
@media (max-width: 620px) {
  .bar { align-items: flex-start; }
  .mark { flex-wrap: wrap; row-gap: 0; }
  .mark em { flex-basis: 100%; margin-left: 28px; }
  .hero-left, .hero-right { padding: 20px; }
  .clock { font-size: clamp(40px, 14vw, 56px); }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid .action:last-child { grid-column: 1 / -1; }
  .reserve-head { align-items: flex-start; flex-direction: column; gap: 0; }
  .reserve-head span { text-align: left; }
  .reserve-actions { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  #app { padding-inline: 12px; }
  .bar-right { width: 100%; justify-content: space-between; }
  .action-grid { grid-template-columns: 1fr; }
  .action-grid .action:last-child { grid-column: auto; }
  .utility-menu { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
