/* Modulo Logico — TFT Unox 800×448 · niente scroll · densità widget Unox */

:root {
  --bg: #010101;
  --nav: #1a2025;
  --card: #282f35;
  --inset: #1a2025;
  --line: #3a4148;
  --text: #e8eaec;
  --muted: #9b9ea1;
  --accent: #44b4ff;
  --red: #c45a6a;
  --green: #6a9e86;
  --warn: #b89a5a;
  --primary-bg: #243844;
  --primary-line: #4a7a9a;
  --primary-text: #c8e0f0;
  --font: "Roboto", "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 8px;
  --radius-sm: 4px;
  --pad: 16px;
  --dock-h: 48px;
  --steps-gap: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: #111;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
}
button, input, select { font-family: inherit; }

/* —— Canvas ufficiale Unox —— */
#app {
  position: relative;
  width: 800px;
  height: 448px;
  max-width: 800px;
  max-height: 448px;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 0 1px #333;
}

/* Status 32 · Nav 44 (Dom_Impostaz) */
.status-bar {
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  font-size: 15px;
  color: var(--muted);
  flex-shrink: 0;
}
.status-bar__datetime {
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  text-align: center;
}
.status-bar__menu {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  letter-spacing: 0.08em;
}

.nav-bar {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px 0 4px;
  background: var(--nav);
  flex-shrink: 0;
}
.nav-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.04); }
.nav-btn:disabled {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}
.nav-btn:disabled:hover { background: transparent; }
.nav-title {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
  padding-left: 8px;
  color: #fff;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * LAYOUT TFT (contratto — non spezzare per schermata):
 * #app → status(32) + nav(44) + main(flex1)
 * main.builder → steps(shrink0) + fill-pane(flex1) + dock(shrink0)
 * fill-pane → mode(shrink0) + detail(flex1, overflow hidden)
 * Vietato: flex:0 su fill-pane, overflow:visible sul pane, margin negativi tra mode/detail.
 * Prova: usare .main.builder.is-test (niente :has() che altera il dock).
 */
.main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px 0;
  display: flex;
  flex-direction: column;
}
.main.builder {
  padding: 8px 28px 0;
}

.fill-pane,
.scroll-fill {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.main.builder .fill-pane {
  padding-bottom: 4px;
}
.main.builder .steps {
  margin-bottom: var(--steps-gap);
}

/* —— Liste —— */
.list-page {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.list.compact { gap: 6px; }
/* Altezza riga fissa Unox — non stretchare se 1 sola voce in pagina */
.list.fill > .row,
.list.fill > .row-wrap,
.list.fill > .bus-item {
  flex: 0 0 auto;
  min-height: 50px;
  height: 50px;
}
.list.fill > .bus-item {
  height: auto;
  min-height: 96px;
  justify-content: center;
}
.list.fill > .row-wrap {
  height: 50px;
}
.list.fill > .row-wrap > .row {
  height: 100%;
  min-height: 0;
}

/* Progress testo */
.steps {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin: 0 0 12px;
  flex-shrink: 0;
  min-height: 20px;
}
.step-dot {
  flex: 0 0 auto;
  padding: 0;
  border: none;
  background: transparent;
  color: #6a6e72;
  font-size: 14px;
  font-weight: 400;
  cursor: default;
  line-height: 1.2;
}
.step-dot + .step-dot::before {
  content: "·";
  display: inline-block;
  margin: 0 8px;
  color: #4a4e52;
}
.step-dot.on {
  color: #fff;
  font-weight: 500;
}
.step-dot.done {
  color: #b0b4b8;
  cursor: pointer;
}
.step-dot.done:hover { color: #fff; }
.step-dot:disabled { opacity: 1; cursor: default; }

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.hint.flash-warn {
  color: #e8b0b0;
  border: 1px solid #5a3030;
  background: #1a1010;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 8px;
}

/* —— Cards —— */
.cards {
  display: grid;
  gap: 8px;
  flex-shrink: 0;
}
.card {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  min-height: 50px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.card:hover { border-color: #4a5560; }
.card.on {
  border-color: #5a6a78;
  background: #323a42;
}
.card h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #fff;
}
.card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

/* —— Condizione (mode + detail, niente overlap) —— */
.cond-pane {
  gap: 8px;
}
.cond-mode {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.cond-mode .card {
  min-height: 52px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cond-mode .card h3 {
  margin-bottom: 2px;
  font-size: 14px;
}
.cond-mode .card p {
  font-size: 11px;
  line-height: 1.2;
}
.cond-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 0;
  margin: 0;
  padding: 0;
}
.cond-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  flex: 1 1 auto;
}
.cond-addr {
  flex: 0 0 auto;
  min-height: 52px;
}
.cond-need {
  margin: 0;
  flex-shrink: 0;
}
.cond-none {
  flex: 0 0 auto;
}
.cond-pane .list,
.cond-pane .list.fill {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  gap: 6px;
}
.cond-pane .list.fill > .row {
  flex: 0 0 auto;
  height: auto;
  min-height: 48px;
}
.cond-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  flex: 1 1 auto;
}
.cond-edit__spec {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}
.cond-edit__ops {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.cond-edit__ops .chip.op {
  flex: 1 1 0;
  min-width: 36px;
  height: 40px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
}
.cond-edit__soglia {
  flex: 0 0 auto;
  margin-top: 0;
  min-width: 0;
}
.cond-edit__soglia .cmd-pct-label {
  min-width: 3.2em;
}
.chip-row.cond-edit__presets,
.cond-edit__presets {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  gap: 6px;
  flex-shrink: 0;
  margin: 0;
}
.chip-row.cond-edit__presets .chip,
.cond-edit__presets .chip {
  flex: 1 1 0;
  min-width: 0;
  height: auto;
  min-height: 48px;
  padding: 6px 4px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.15;
  text-align: center;
}
.cond-edit__presets .chip-main {
  font-size: 14px;
  font-weight: 700;
}
.cond-edit__presets .chip-hint,
.chip-hint {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cond-device-hint {
  margin: 0 0 6px;
}
.cond-edit__ops.chip-row,
.cond-edit .chip-row.cond-edit__ops {
  margin: 0;
}

/* ============================================================================
 * QUANDO — layout originale:
 * Sempre | Giorni e orario → giorni → Tutto il giorno | Orari fissi → 4 slot 2×2
 * Spinner TFT: − | HH:MM | + · celle alte · bottoni ≥56px
 * ============================================================================ */

.when-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.when-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 0 0 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: transparent;
}
.when-seg__btn {
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
}
.when-seg__btn + .when-seg__btn {
  border-left: 1px solid var(--line);
}
.when-seg__btn.on {
  background: #2a4a38;
  color: #fff;
}

.when-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.when-detail.is-off {
  display: none;
}
.when-note {
  margin: 0;
  padding: 16px 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Giorni — testo + underline */
.when-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  flex: 0 0 36px;
  height: 36px;
  border-bottom: 1px solid var(--line);
}
.when-day {
  height: 36px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  line-height: 1.2;
  box-shadow: inset 0 -2px 0 transparent;
}
.when-day.on {
  color: #c5ebd6;
  background: transparent;
  border-color: transparent;
  box-shadow: inset 0 -2px 0 var(--green);
}

/* 4 orari · 2×2 — altezza fissa (niente stiramento), area touch ok */
.when-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 52px 52px;
  gap: 14px 16px;
  flex: 0 0 auto;
  width: 100%;
  margin-top: 4px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.when-time {
  display: flex;
  align-items: stretch;
  height: 52px;
  width: 100%;
  padding: 0;
  background: var(--nav);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.when-time__val {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #e8eaec;
  line-height: 1.2;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.when-time__val.empty {
  color: #9b9ea1;
  font-size: 16px;
  font-weight: 500;
}
.when-time__btn {
  flex: 0 0 52px;
  width: 52px;
  min-width: 52px;
  height: 52px;
  align-self: stretch;
  border: none;
  border-radius: 0;
  background: var(--inset);
  color: #c8ccd0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.when-time__btn:active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.row-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}
.row-wrap .row { flex: 1; min-width: 0; }
.row-wrap .btn.danger,
.row-wrap .btn[data-toggle-event],
.row-wrap .btn-slim {
  flex-shrink: 0;
  align-self: stretch;
  height: auto;
  min-height: 50px;
  padding: 0 10px;
  font-size: 12px;
}
.row-wrap .btn-slim {
  min-width: 44px;
  padding: 0 8px;
  letter-spacing: 0.02em;
}
.row-wrap.is-off .row { opacity: 0.55; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.row:hover { border-color: #4a5560; }
.row.selected {
  border-color: #5a6a78;
  background: #323a42;
}
.row--accent .grow { color: var(--accent); }
.row--disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.row--disabled:hover { border-color: transparent; }
.row .grow { flex: 1; min-width: 0; }
.row .meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.row .addr {
  color: var(--accent);
  font-weight: 500;
  margin-right: 6px;
}
.row .row-action {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-right: 4px;
}
.chevron {
  color: var(--muted);
  font-size: 18px;
  flex-shrink: 0;
}

/* —— Bus —— */
.bus-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.bus-id {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.bus-id .addr {
  color: var(--accent);
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.bus-set {
  display: flex;
  align-items: stretch;
}
.bus-set .pct-spin { width: 100%; flex: 1; }
.bus-chips {
  display: flex;
  width: 100%;
  margin: 0;
  gap: 8px;
}
.bus-chips .chip {
  flex: 1;
  min-height: 44px;
  height: 44px;
}

/* —— Chip —— */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.chip {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.chip:hover { border-color: #5a6570; }
.chip.on {
  border-color: #6a7582;
  background: #323a42;
  color: #fff;
}

.pct-spin {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.pct-btn {
  width: 48px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: #c8ccd0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.pct-btn:hover { border-color: #5a6570; color: #fff; background: #222830; }
.pct-readout {
  flex: 1;
  min-width: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
  font-variant-numeric: tabular-nums;
}
.pct-num {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
}
.pct-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.outputs-pane {
  gap: 8px;
}
.outputs-pane .hint {
  flex-shrink: 0;
  margin-bottom: 0;
}
.cmd-card {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 0 0;
  overflow: visible;
  border: 1px solid var(--line);
  padding: 12px 14px 14px;
}
.cmd-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}
.cmd-pct {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-shrink: 0;
}
.cmd-pct-label {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  min-width: 4.5em;
}
.cmd-pct .pct-spin { flex: 1; min-width: 0; }
.cmd-card .bus-chips { margin-top: 12px; flex-shrink: 0; }
.cmd-card > .row { margin: 10px 0 0; flex-shrink: 0; }
.cmd-rm {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
/* + Comando vive nel dock — mai clipato dalla card */
.btn.cmd-add {
  margin: 0;
  width: auto;
  min-width: 0;
  border-style: dashed;
  color: var(--accent);
  border-color: #3a5568;
  background: transparent;
  padding: 0 12px;
}
.btn.cmd-add:hover {
  border-color: var(--accent);
  background: rgba(68, 180, 255, 0.06);
}

/* —— Ctx / fields —— */
.ctx-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.ctx-box .label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ctx-box .value {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}
.field { margin-bottom: 10px; flex-shrink: 0; }
.field--search {
  margin: 0;
  flex-shrink: 0;
}
.field--search input {
  max-width: none;
}
.field label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field input, .field select {
  height: 40px;
  width: 100%;
  max-width: 320px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 15px;
  background: var(--inset);
  color: var(--text);
  outline: none;
  caret-color: var(--accent);
}
.field input::placeholder {
  color: #6a6e72;
}
.field input:focus, .field select:focus {
  border-color: #5a7a92;
  background: #1e262c;
}
.field input.sm { width: 88px; max-width: 88px; text-align: center; }
/* search cancel (WebKit) */
.field input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  width: 14px;
  background: linear-gradient(45deg, transparent 40%, #6a6e72 41%, #6a6e72 59%, transparent 60%),
    linear-gradient(-45deg, transparent 40%, #6a6e72 41%, #6a6e72 59%, transparent 60%);
  cursor: pointer;
}

/* —— Buttons / dock —— */
.btn-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: nowrap;
  align-items: center;
}
.btn-bar.dock {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin: 0 -16px 0;
  padding: 4px 16px;
  border-top: 1px solid var(--line);
  background: var(--nav);
  z-index: 2;
  min-height: var(--dock-h);
  height: var(--dock-h);
  gap: 10px;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}
.main.builder .btn-bar.dock {
  margin: 0 -28px 0;
  padding: 4px 28px;
}
.btn-bar.dock .btn {
  height: 36px;
}
.dock-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: nowrap;
}
.dock-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}
.pager .btn {
  width: 44px;
  min-width: 44px;
  height: 40px;
  padding: 0;
}
.pager-meta {
  font-size: 13px;
  color: var(--muted);
  min-width: 3.5em;
  text-align: center;
}
.btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn:hover { border-color: #5a6570; background: #222830; }
.btn.primary {
  border-color: var(--primary-line);
  background: var(--primary-bg);
  color: var(--primary-text);
}
.btn.primary:hover { border-color: #5a8aaa; background: #2a4452; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.danger {
  border-color: #5a3030;
  color: #e8b0b0;
  background: #1a1010;
}
.btn.danger:hover { border-color: #7a4040; background: #241414; }
.btn.active-on {
  border-color: #7ab896;
  background: #2a4a38;
  color: #ffffff;
}

/* Prova — tipografia equilibrata, niente titolo “billboard” */
.rule-sum {
  margin: 0;
  background: transparent;
  border: none;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.rule-sum > div {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  align-items: flex-start;
}
.rule-sum > div:last-child { border-bottom: none; }
.rule-sum .k {
  flex: 0 0 64px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}
.rule-sum .v {
  color: #fff;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  min-width: 0;
  flex: 1;
}

.main.builder.is-test {
  padding-top: 4px;
}
.main.builder.is-test .steps {
  margin-bottom: 6px;
  min-height: 16px;
}
.test-pane.fill-pane {
  flex: 1 1 auto;
  min-height: 0;
  gap: 10px;
  padding-bottom: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.test-verdict {
  flex: 0 0 auto;
  border-radius: var(--radius);
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--card);
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.test-verdict--ok {
  border-color: #3a6a52;
  background: #1a2a22;
}
.test-verdict--no {
  border-color: #6a3a42;
  background: #2a181c;
}
.test-verdict--warn {
  border-color: #6a5a3a;
  background: #2a2418;
}
.test-verdict--idle {
  border-color: var(--line);
}
.test-verdict__title {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  line-height: 1.25;
}
.test-verdict--ok .test-verdict__title { color: #9ed0b4; }
.test-verdict--no .test-verdict__title { color: #e8b0b0; }
.test-verdict--warn .test-verdict__title { color: #e0d0a0; }
.test-verdict__msg {
  font-size: 14px;
  color: var(--text);
  line-height: 1.35;
}
.test-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  overflow: hidden;
}
.test-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.test-block__h {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 8px;
  flex-shrink: 0;
  line-height: 1.2;
}
.test-checks {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.test-checks li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
}
.test-checks li > span:last-child {
  min-width: 0;
  flex: 1;
}
.test-checks .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: var(--muted);
}
.test-checks li.yes .dot { background: var(--green); }
.test-checks li.no .dot { background: var(--red); }
.test-hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.35;
}
.test-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.test-foot__ctx {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.test-foot .btn {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  flex-shrink: 0;
}
.row .addr,
.grow .addr {
  font-variant-numeric: tabular-nums;
}

/* Confirm overlay */
#confirmOverlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}
#confirmOverlay[hidden] { display: none !important; }
.confirm-card {
  width: 100%;
  max-width: 320px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.confirm-msg {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 14px;
  line-height: 1.35;
}
.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.confirm-actions .btn { min-width: 88px; }

@media (max-width: 800px), (max-height: 448px) {
  #app {
    width: min(100vw, calc(100vh * 800 / 448));
    height: min(100vh, calc(100vw * 448 / 800));
    max-width: 100vw;
    max-height: 100vh;
  }
}
