:root {
  color-scheme: light dark;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #f3f4f1;
  --ink: #17211d;
  --muted: #5d6963;
  --line: rgba(23, 33, 29, .1);
  --field: rgba(23, 33, 29, .22);
  --accent: #14745c;
  --accent-hover: #0f604c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f2ec;
  --ok: #17704a;
  --ok-soft: #e3f3ea;
  --warn: #875800;
  --warn-soft: #faf0d8;
  --bad: #a93529;
  --bad-hover: #8e2b21;
  --bad-soft: #fbe8e5;
  --test: #5a3d9c;
  --test-soft: #efeaf9;
  --radius-lg: 16px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 0 0 1px rgba(23, 33, 29, .06), 0 1px 2px rgba(23, 33, 29, .05), 0 8px 24px -12px rgba(23, 33, 29, .12);
  --ease: cubic-bezier(.2, 0, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111614;
    --surface: #1a211e;
    --surface-2: #232b28;
    --ink: #e9eeeb;
    --muted: #9ba8a2;
    --line: rgba(233, 238, 235, .11);
    --field: rgba(233, 238, 235, .24);
    --accent: #2f9d80;
    --accent-hover: #38b091;
    --accent-ink: #06140f;
    --accent-soft: #17362d;
    --ok: #6ccb9f;
    --ok-soft: #16322a;
    --warn: #e5bd6a;
    --warn-soft: #362b13;
    --bad: #f0897c;
    --bad-hover: #f59f94;
    --bad-soft: #3b1c18;
    --test: #c4b2f0;
    --test-soft: #272038;
    --shadow: 0 0 0 1px rgba(233, 238, 235, .08), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.012em; font-weight: 650; margin: 0 0 .85rem; text-wrap: balance; }
h2 { font-size: 1.05rem; line-height: 1.3; font-weight: 650; margin: 1.75rem 0 .6rem; text-wrap: balance; }
p { margin: 0 0 .8rem; text-wrap: pretty; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Шапка */
.dry-banner {
  background: var(--test-soft);
  color: var(--test);
  text-align: center;
  padding: .35rem 1rem;
  font-weight: 600;
  font-size: .85rem;
}
.topbar { background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: .55rem 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; min-height: 40px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand-mark { display: block; width: 28px; height: 28px; flex: none; }
.brand-mark .mark-bg { fill: var(--accent); }
.brand-mark .mark-fg { fill: none; stroke: var(--accent-ink); stroke-width: 1.6; stroke-linecap: round; }
.brand-mark .mark-dot { fill: var(--accent-ink); }
.topbar nav { display: flex; flex-wrap: wrap; gap: .1rem .15rem; align-items: center; }
.topbar nav a, .linklike {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 .7rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .925rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.topbar nav a:hover, .linklike:hover { background: var(--surface-2); color: var(--ink); }
.topbar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
main { max-width: 1040px; margin: 0 auto; padding: 1.75rem 20px 4rem; }

/* Поверхности */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  margin-bottom: 1rem;
}
.card-table { padding: .35rem .6rem; }
.card-narrow { max-width: 24rem; margin: 3rem auto; }
.login-mark { display: block; width: 40px; height: 40px; margin-bottom: 1rem; }
.flush { margin-top: 0; }
.gap-top { margin-top: 1rem; }
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; min-height: 0; }
.notice { border-radius: var(--radius); padding: .75rem .95rem; margin: 0 0 1.1rem; overflow-wrap: anywhere; text-wrap: pretty; }
.notice-info { background: var(--accent-soft); }
.notice-ok { background: var(--ok-soft); }
.notice-warn { background: var(--warn-soft); }
.notice-error { background: var(--bad-soft); }

/* Формы */
label { display: block; font-weight: 600; font-size: .95rem; margin: 1rem 0 .35rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: .3rem; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: .55rem .75rem;
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
textarea { min-height: 8.5rem; resize: vertical; font-size: .95rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: 1.1rem 0; cursor: pointer; }
.check input { margin-top: .22rem; width: 1.1rem; height: 1.1rem; flex: none; accent-color: var(--accent); }

/* Кнопки */
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.25rem; }
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  border: 0;
  box-shadow: inset 0 0 0 1px var(--field);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s var(--ease), opacity .15s var(--ease), transform .1s var(--ease);
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { transform: scale(.96); }
.btn-primary { background: var(--accent); box-shadow: none; color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--bad); box-shadow: none; color: #fff; }
.btn-danger:hover { background: var(--bad-hover); }
@media (prefers-color-scheme: dark) { .btn-danger { color: #1c0b08; } }
.linklike { box-shadow: none; min-height: 40px; font-weight: 500; }
.linklike:active { transform: none; }
button.is-busy { opacity: .6; cursor: progress; }
.quiet-link { font-size: .9rem; color: var(--muted); padding: .5rem 0; }
.quiet-link:hover { color: var(--bad); }

/* Запуск: шаги слева, текущий шаг справа */
.run-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; align-items: center; margin-bottom: 1.1rem; }
.run-title { font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
.run-kicker { display: block; font-size: .825rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.run-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1.75rem; align-items: start; }
.eyebrow { display: block; font-size: .85rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; margin-bottom: .2rem; }

.rail ol { list-style: none; margin: 0; padding: 0; }
.rail li { position: relative; }
.rail li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 34px;
  bottom: -6px;
  width: 2px;
  border-radius: 1px;
  background: var(--line);
}
.rail li.s-done:not(:last-child)::after { background: var(--ok); opacity: .35; }
.rail a, .rail .chip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 40px;
  padding: 4px 8px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .925rem;
  text-decoration: none;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.rail a:hover { background: var(--surface); color: var(--ink); }
.rail-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--field);
  font-size: .78rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.rail-dot svg { display: block; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rail .s-done .rail-dot { background: var(--ok-soft); box-shadow: none; color: var(--ok); }
.rail .s-done a { color: var(--ink); }
.rail .s-error .rail-dot, .rail .s-interrupted .rail-dot { background: var(--bad); box-shadow: none; color: var(--surface); }
.rail .s-waiting .rail-dot { background: var(--warn-soft); box-shadow: inset 0 0 0 1.5px var(--warn); color: var(--warn); }
.rail .s-running .rail-dot { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.rail .is-now a, .rail .is-now .chip { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font-weight: 600; }
.rail .is-now.s-pending .rail-dot { background: var(--accent); box-shadow: none; color: var(--accent-ink); }

/* Таблицы */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .825rem; white-space: nowrap; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }

/* Содержимое шагов */
.checks { list-style: none; padding: 0; margin: .5rem 0 0; }
.checks li { display: flex; gap: .7rem; padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.checks li:last-child { border-bottom: 0; }
.checks .badge { flex: none; min-width: 5.2rem; text-align: center; }
.plan { padding-left: 1.2rem; margin: .4rem 0 .9rem; }
.plan li { margin: .3rem 0; overflow-wrap: anywhere; }
.big-value { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
details { margin-top: .9rem; }
summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: .35rem 0; }
summary:hover { color: var(--ink); }
pre { background: var(--surface-2); border-radius: var(--radius); padding: .8rem; overflow-x: auto; font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Главная */
.page-title { margin-bottom: 1.1rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.choice-grid form { display: flex; flex-direction: column; align-items: flex-start; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.5rem; }
.choice-grid p { flex: 1; }
.choice-grid button { width: 100%; }
.choice-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); margin-bottom: .9rem; }
.choice-icon svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inline-form { display: inline; margin: 0; }

.spinner-note::before {
  content: "";
  display: inline-block;
  width: .9em;
  height: .9em;
  margin-right: .5em;
  vertical-align: -.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner-note::before { animation: none; }
  button, .btn, input, select, textarea, .rail a, .topbar nav a, .linklike { transition: none; }
  button:active, .btn:active { transform: none; }
}

@media (max-width: 760px) {
  main { padding: 1.1rem 16px 3rem; }
  .topbar-inner { padding: .4rem 16px; }
  .brand { width: 100%; }
  .topbar nav { margin: 0 -.7rem; }
  .run-layout { display: block; }
  /* На телефоне шаги становятся строкой точек: название текущего есть в заголовке карточки. */
  .rail { margin-bottom: 1rem; }
  .rail ol { display: flex; justify-content: space-between; }
  .rail li { flex: 0 0 auto; }
  .rail li:not(:last-child)::after { display: none; }
  .rail-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .rail a, .rail .chip { padding: 0; min-height: 40px; min-width: 26px; justify-content: center; }
  .rail .is-now a, .rail .is-now .chip { background: none; box-shadow: none; }
  .rail .is-now .rail-dot { outline: 2px solid var(--accent); outline-offset: 2px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 1.15rem; }
  .actions button, .actions .btn { width: 100%; }
}
