/* CraftHearth — общие стили панели, страницы входа и лендинга.
   Без внешних зависимостей: только CSS-переменные, системный шрифт. */

:root {
  color-scheme: dark;
  --bg: #0e1217;
  --bg-soft: #121822;
  --glow: rgba(69, 201, 138, 0.10);
  --card: #161d26;
  --card-2: #1b2430;
  --line: #263141;
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #e9eef5;
  --muted: #94a2b3;
  --dim: #6c7a8b;
  --accent: #45c98a;
  --accent-strong: #6ee7a8;
  --accent-ink: #06251a;
  --accent-soft: rgba(69, 201, 138, 0.14);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.12);
  --warn: #f4b860;
  --warn-soft: rgba(244, 184, 96, 0.12);
  --info: #6aa9ff;
  --info-soft: rgba(106, 169, 255, 0.12);
  --track: #232d3a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --bg-soft: #eef1f5;
  --glow: rgba(20, 138, 92, 0.08);
  --card: #ffffff;
  --card-2: #f7f9fc;
  --line: #dfe5ee;
  --line-soft: rgba(16, 32, 51, 0.05);
  --text: #16202b;
  --muted: #5b6a7d;
  --dim: #7c8a9c;
  --accent: #128a5a;
  --accent-strong: #0f7049;
  --accent-ink: #ffffff;
  --accent-soft: rgba(18, 138, 90, 0.10);
  --danger: #c93b3b;
  --danger-soft: rgba(201, 59, 59, 0.08);
  --warn: #a96d13;
  --warn-soft: rgba(169, 109, 19, 0.10);
  --info: #2a63b8;
  --info-soft: rgba(42, 99, 184, 0.08);
  --track: #e4e9f0;
  --shadow: 0 18px 40px rgba(22, 36, 51, 0.10);
  --shadow-soft: 0 4px 14px rgba(22, 36, 51, 0.07);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 8% -12%, var(--glow), transparent 62%),
    radial-gradient(900px 520px at 100% 0%, rgba(106, 169, 255, 0.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.block { width: 100%; }
.right { text-align: right; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px clamp(14px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand:hover { text-decoration: none; }

.logo {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--accent), #1d7f56);
  color: #05170f;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(69, 201, 138, 0.25);
  flex: 0 0 auto;
}
html[data-theme="light"] .logo { color: #fff; }

.brand-name {
  display: block;
  font-weight: 650;
  font-size: 16px;
  max-width: 38ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  color: var(--muted);
  min-height: 34px;
}
.topbar-status strong { color: var(--text); font-weight: 600; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px transparent;
}
.dot.on {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 10px rgba(69, 201, 138, 0.55);
}
.dot.off { background: var(--dim); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chip.accent { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-weight: 550;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--card-2); border-color: var(--muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--card-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { min-height: 31px; padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.link { border: 0; background: none; padding: 4px 6px; color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- вкладки ---------- */
.tabs {
  position: sticky;
  top: 65px;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 0 clamp(10px, 3vw, 28px);
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  padding: 13px 12px 12px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- контейнер и карточки ---------- */
.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 30px) clamp(14px, 3vw, 28px) 56px;
}

.panel-section { display: none; animation: fade 0.18s ease; }
.panel-section.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.stack { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.card.pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--card-2) 55%, transparent);
}
.card-head.plain { border-bottom: 0; background: none; padding-bottom: 6px; }
.card-title { font-size: 15px; font-weight: 650; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px 20px 20px; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
}
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 650; margin-top: 6px; letter-spacing: -0.02em; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat-note { font-size: 12px; color: var(--dim); margin-top: 4px; }

.metric { display: flex; flex-direction: column; gap: 8px; }
.metric-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.metric-top .name { color: var(--muted); }
.metric-top .val { font-variant-numeric: tabular-nums; font-weight: 600; }

.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  width: 0;
  transition: width 0.4s ease, background 0.3s ease;
}
.bar-fill.warn { background: var(--warn); }
.bar-fill.bad { background: var(--danger); }

.spark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--accent);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}
.spark .empty-cell { color: var(--track); }

/* ---------- списки / строки ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
  min-width: 0;
}
.list-item:first-child { border-top: 0; }
.item-main { min-width: 0; flex: 1; }
.item-name {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  flex: 0 0 auto;
}

.kv { display: flex; flex-direction: column; }
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.kv-row:first-child { border-top: 0; }
.kv-key { color: var(--muted); }
.kv-val { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.price, .bytes { font-variant-numeric: tabular-nums; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 20px;
  margin-bottom: 4px;
}
.empty-title { font-weight: 600; color: var(--text); font-size: 14px; }
.empty-text { font-size: 13px; max-width: 48ch; }

/* ---------- события ---------- */
.events { display: flex; flex-direction: column; }
.event {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  align-items: baseline;
}
.event:first-child { border-top: 0; }
.event-time { color: var(--dim); font-family: var(--mono); font-size: 12px; flex: 0 0 auto; }
.event-kind {
  flex: 0 0 auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.event-kind.backup { color: var(--info); border-color: var(--info-soft); background: var(--info-soft); }
.event-kind.error { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.event-kind.install, .event-kind.update { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.event-kind.restart { color: var(--warn); border-color: var(--warn-soft); background: var(--warn-soft); }
.event-msg { min-width: 0; overflow-wrap: anywhere; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-head label { font-size: 13px; font-weight: 550; color: var(--text); }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }

.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select { appearance: none; padding-right: 34px; background-image: none; }
.textarea { min-height: 80px; resize: vertical; font-family: var(--mono); font-size: 13px; }

.select-wrap { position: relative; }
.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 12px;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.fieldset { border: 0; margin: 0; padding: 0; }
.form-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
}

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 28px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--track);
  border: 1px solid var(--line);
  transition: background 0.18s ease, border-color 0.18s ease;
  flex: 0 0 auto;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--accent-ink); }
html[data-theme="light"] .switch input:checked + .track::after { background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .switch-text { font-size: 13px; color: var(--muted); }

/* ---------- консоль ---------- */
.console-card { display: flex; flex-direction: column; height: min(66vh, 620px); }
.console-card .card-head { flex: 0 0 auto; }
.console-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  background: #0a0e13;
  color: #c9d5e3;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  border-top: 1px solid var(--line);
  scroll-behavior: smooth;
}
.log-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line.sys { color: #7f8ea1; }
.console-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.console-form .input { font-family: var(--mono); font-size: 13px; background: var(--bg-soft); }
.console-form .btn { flex: 0 0 auto; }

/* ---------- таблицы (бэкапы, задачи) ---------- */
.rows { width: 100%; }
.row-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
}
.row-line.head {
  border-top: 0;
  background: color-mix(in srgb, var(--card-2) 60%, transparent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  padding-top: 9px;
  padding-bottom: 9px;
}
.row-line .cell { min-width: 0; }
.row-line .cell.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.row-line .cell.meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- тосты, диалог, вход ---------- */
.toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toast-in 0.18s ease;
}
.toast.ok { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.toast.err { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.toast .t-icon { flex: 0 0 auto; }
.toast.ok .t-icon { color: var(--accent); }
.toast.err .t-icon { color: var(--danger); }
.toast .t-text { min-width: 0; overflow-wrap: anywhere; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

dialog.confirm {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  padding: 22px;
  width: min(430px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog.confirm::backdrop { background: rgba(4, 8, 12, 0.6); backdrop-filter: blur(2px); }
dialog.confirm h3 { font-size: 16px; margin-bottom: 8px; }
dialog.confirm p { color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(800px 500px at 50% 0%, var(--glow), transparent 65%),
    var(--bg);
}
.login-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.login-card .logo { width: 44px; height: 44px; font-size: 22px; }
.login-card h1 { font-size: 20px; }
.login-card .hint { margin-top: -4px; }

.banner {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 auto;
  width: min(1180px, 100%);
  padding: 9px clamp(14px, 3vw, 28px);
  font-size: 13px;
  color: var(--warn);
  background: var(--warn-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}

.loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- лендинг ---------- */
.landing {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 40px) clamp(16px, 4vw, 28px) 48px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.hero {
  position: relative;
  padding: clamp(24px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(520px 280px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.hero h1 {
  font-size: clamp(28px, 6vw, 44px);
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.hero-sub { color: var(--muted); font-size: 15px; max-width: 56ch; }

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 13px;
  font-weight: 550;
}
.online-pill.is-on { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent); }
.online-pill.is-off { color: var(--muted); }

.addr-box {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
}
.addr-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); width: 100%; }
.addr-value {
  font-family: var(--mono);
  font-size: clamp(16px, 3.6vw, 22px);
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  min-width: 0;
  flex: 1;
}
.addr-actions { display: flex; gap: 8px; margin-left: auto; }

.player-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
}

.howto { counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.howto-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
}
.howto-num {
  counter-increment: step;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}
.howto-num::before { content: counter(step); }

.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--dim);
  font-size: 12px;
  padding-top: 6px;
}

/* ---------- мастер настройки ---------- */
.wizard {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px) clamp(16px, 4vw, 28px) 56px;
}
.wizard-head { margin-bottom: 20px; }
.wizard-head h1 { font-size: clamp(22px, 4vw, 30px); letter-spacing: -0.02em; }
.wizard-head p { color: var(--muted); margin-top: 6px; }

.wizard-steps {
  display: flex;
  gap: 6px;
  margin: 22px 0 18px;
  flex-wrap: wrap;
}
.wstep {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  flex: 1 1 160px;
  min-width: 0;
  cursor: default;
}
.wstep .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--track);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}
.wstep.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.wstep.active .num { background: var(--accent); color: var(--accent-ink); }
.wstep.done { color: var(--text); cursor: pointer; }
.wstep.done .num { background: var(--accent-soft); color: var(--accent); }
.wstep .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wizard-card { padding: clamp(18px, 3.6vw, 28px); }
.step { display: none; flex-direction: column; gap: 18px; }
.step.active { display: flex; animation: fade 0.2s ease; }
.step h2 { font-size: 18px; }
.step-intro { color: var(--muted); font-size: 14px; margin-top: -8px; }

.engine-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.engine-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.engine-card:hover { border-color: var(--muted); }
.engine-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.engine-card input { position: absolute; opacity: 0; pointer-events: none; }
.engine-title { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.engine-title .emoji { font-size: 18px; }
.engine-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }
.engine-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--card);
}
.engine-card.selected .tag { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.wizard-nav .spacer { flex: 1; }

.summary { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); padding: 4px 14px; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.summary-row:first-child { border-top: 0; }
.summary-row .k { color: var(--muted); }
.summary-row .v { text-align: right; font-weight: 550; overflow-wrap: anywhere; }

.notice {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.notice.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); color: var(--text); }
.notice .n-icon { flex: 0 0 auto; }

/* ---------- адаптив ---------- */
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .topbar { gap: 10px; padding: 10px 14px; }
  .brand-sub { display: none; }
  .brand-name { max-width: 44vw; font-size: 15px; }
  .topbar-actions { margin-left: 0; width: 100%; }
  .topbar-actions .btn { flex: 1 1 auto; }
  .topbar-status { order: 3; }
  .tabs { top: 58px; padding: 0 10px; }
  .page { padding: 16px 12px 48px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .card-head, .card-body { padding-left: 15px; padding-right: 15px; }
  .list-item { padding-left: 15px; padding-right: 15px; }
  .row-line { padding-left: 15px; padding-right: 15px; grid-template-columns: minmax(0, 1fr) auto; }
  .row-line .cell.meta.optional { display: none; }
  .engine-grid { grid-template-columns: 1fr; }
  .console-card { height: 72vh; }
  .addr-actions { width: 100%; }
  .addr-actions .btn { flex: 1; }
  .wstep { flex: 1 1 auto; }
  .wstep .label { display: none; }
  .wstep.active .label { display: inline; }
  .footer-note { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
