:root {
  --bg: #0d1117;
  --bg-2: #131a23;
  --panel: #161d27;
  --panel-2: #1c2531;
  --border: #263241;
  --text: #e6e9ef;
  --muted: #8d99a8;
  --accent: #3fb6a8;
  --accent-text: #06201d;
  --ok: #3fb950;
  --warn: #e0a43a;
  --err: #f0605a;
  --busy: #5b8def;
  --off: #6e7781;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f8;
    --bg-2: #e9edf2;
    --panel: #ffffff;
    --panel-2: #f5f7fa;
    --border: #dde3ea;
    --text: #18202b;
    --muted: #5f6b7a;
    --accent: #1f8f83;
    --accent-text: #ffffff;
    --shadow: 0 8px 30px rgba(20, 30, 50, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body.no-scroll { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 17px; display: flex; align-items: center; gap: 6px; }
h3 { font-size: 15px; display: flex; align-items: center; gap: 6px; }
p { margin: 0; }

.icon { width: 18px; height: 18px; flex: none; }
.icon.big { width: 40px; height: 40px; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .92em; }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-s { gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.error { color: var(--err); font-size: 14px; }
.error:empty { display: none; }
.warn-text { color: var(--warn); }
.center-msg { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Pulsanti e campi ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.icon-only { width: 40px; padding: 0; }
.btn.block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }

input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, .btn:focus-visible, .slot-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.otp { font-family: var(--mono); font-size: 22px; letter-spacing: 6px; text-align: center; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.chip {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--muted); padding: 8px 14px; font: inherit; cursor: pointer; }
.seg button.active { background: var(--accent); color: var(--accent-text); }

/* ---------- Login / setup ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand img { width: 30px; height: 30px; }
.brand.big { font-size: 22px; }
.brand.big img { width: 38px; height: 38px; }

.twofa-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--bg-2); }
.steps { margin: 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.qr { width: 200px; height: 200px; align-self: center; border-radius: 10px; background: #fff; padding: 6px; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { font-family: var(--mono); padding: 8px; text-align: center; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; }

/* ---------- Struttura ---------- */

.shell { max-width: 1280px; margin: 0 auto; padding: 0 16px 90px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: var(--bg);
}
.top-meta { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, .6); } 70% { box-shadow: 0 0 0 8px rgba(63, 185, 80, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); } }

.tabs-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 10px;
}
.nav-btn.active { color: var(--accent); background: var(--panel-2); }

@media (min-width: 900px) {
  .shell { padding-bottom: 40px; }
  .tabs-nav {
    position: static;
    display: flex;
    gap: 6px;
    background: transparent;
    border: 0;
    padding: 0 0 16px;
  }
  .nav-btn { flex-direction: row; font-size: 14px; padding: 8px 14px; gap: 8px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 2px -4px; }

.dashboard { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Server ---------- */

.gauges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 760px) { .gauges { grid-template-columns: repeat(4, 1fr); } }
.gauge { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gauge-svg { width: 68px; height: 68px; flex: none; }
.gauge-track { fill: none; stroke: var(--panel-2); stroke-width: 8; }
.gauge-value { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray .6s; }
.gauge.warn .gauge-value { stroke: var(--warn); }
.gauge.crit .gauge-value { stroke: var(--err); }
.gauge-text { fill: var(--text); font-size: 16px; font-weight: 700; }
.gauge-info { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.gauge-info strong { font-size: 14px; }
.gauge-info small { color: var(--muted); }

.host-sparks { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
@media (min-width: 760px) { .host-sparks { grid-template-columns: 1fr 1fr; } }
.host-sparks .spark { height: 36px; color: var(--accent); }

.spark { display: block; width: 100%; height: 26px; }

/* ---------- Mappa RAM ---------- */

.stack-bar {
  display: flex;
  height: 26px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.stack-seg { height: 100%; min-width: 2px; border-right: 1px solid var(--panel); transition: width .6s; }
.stack-seg.free {
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(127, 127, 127, .08) 6px 12px);
  border-right: 0;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend-item b { color: var(--text); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.free { border: 1px dashed var(--muted); }

/* ---------- Slot ---------- */

.slot-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 680px) { .slot-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .slot-grid { grid-template-columns: repeat(3, 1fr); } }

.slot-card {
  --slot-color: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 12px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.slot-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--slot-color); }
.slot-card:hover { border-color: var(--slot-color); }
.slot-card.st-empty { border-style: dashed; background: transparent; }
.slot-card.st-empty::before { opacity: .35; }
.slot-card.st-stopped { opacity: .78; }
.slot-card.st-error { border-color: rgba(240, 96, 90, .55); }

.slot-head { display: flex; align-items: center; gap: 10px; }
.slot-num {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 800;
  background: color-mix(in srgb, var(--slot-color) 20%, transparent);
  color: var(--slot-color);
}
.slot-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.slot-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-domain { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-domain .icon { width: 13px; height: 13px; }
.slot-repo { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); }
.slot-repo .icon { width: 14px; height: 14px; }
.slot-repo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-error { color: var(--err); background: rgba(240, 96, 90, .1); padding: 6px 10px; border-radius: 8px; }
.slot-warn { color: var(--warn); background: rgba(224, 164, 58, .1); padding: 6px 10px; border-radius: 8px; }
.slot-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 22px 0; color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--muted);
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: rgba(63, 185, 80, .12); }
.pill.err { color: var(--err); background: rgba(240, 96, 90, .12); }
.pill.busy { color: var(--busy); background: rgba(91, 141, 239, .14); }
.pill.busy .pill-dot { animation: blink 1s infinite; }
.pill.idle { color: var(--warn); background: rgba(224, 164, 58, .12); }
@keyframes blink { 50% { opacity: .2; } }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metric { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.metric-top { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.metric-top b { color: var(--text); font-weight: 600; white-space: nowrap; }
.bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .6s; }

.slot-actions { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; cursor: default; }

.switch {
  position: relative;
  width: 58px;
  height: 32px;
  flex: none;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  padding: 0;
  transition: background .2s;
}
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--off);
  color: #fff;
  transition: left .2s, background .2s;
}
.switch-knob .icon { width: 14px; height: 14px; }
.switch.on { background: rgba(63, 185, 80, .25); border-color: var(--ok); }
.switch.on .switch-knob { left: 29px; background: var(--ok); }
.switch:disabled { opacity: .4; cursor: not-allowed; }

.phases { display: flex; list-style: none; margin: 0; padding: 0; gap: 4px; }
.phases li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); position: relative; }
.phases li i { width: 100%; height: 6px; border-radius: 99px; background: var(--panel-2); }
.phases li.done i { background: var(--ok); }
.phases li.current i { background: var(--busy); animation: blink 1s infinite; }
.phases li.current { color: var(--text); font-weight: 600; }

/* ---------- Finestra di dettaglio ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.modal {
  width: 100%;
  max-width: 980px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 900px) {
  .modal-overlay { align-items: center; padding: 24px; }
  .modal { height: min(92vh, 980px); border-radius: 18px; border: 1px solid var(--border); box-shadow: var(--shadow); }
}
.modal-head {
  --slot-color: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.modal-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.modal-title h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.modal-title a { display: inline-flex; align-items: center; gap: 4px; }
.modal-title a .icon { width: 13px; height: 13px; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  scrollbar-width: none;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.tab.active { background: var(--panel-2); color: var(--text); }
.tab .icon { width: 16px; height: 16px; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
@media (max-width: 520px) { .hide-s { display: none; } }

/* Schema dello slot */
.flow { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
@media (min-width: 900px) {
  .flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr) 28px) minmax(0, 1fr); align-items: stretch; }
  .flow .node { flex-direction: column; flex-wrap: nowrap; }
  .flow .node-attach { flex: none; margin-top: auto; }
}
.node {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--off);
  background: var(--panel);
  min-width: 0;
}
.node.ok { border-left-color: var(--ok); }
.node.warn { border-left-color: var(--warn); }
.node.err { border-left-color: var(--err); }
.node.busy { border-left-color: var(--busy); }
.node-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--panel-2); color: var(--muted); }
.node.ok .node-icon { color: var(--ok); }
.node.warn .node-icon { color: var(--warn); }
.node.err .node-icon { color: var(--err); }
.node.busy .node-icon { color: var(--busy); }
.node-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.node-text strong { color: var(--text); font-size: 14px; }
.node-text span { overflow-wrap: anywhere; }
.node-attach {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
}
.node-attach .icon { width: 15px; height: 15px; }
.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  position: relative;
  font-size: 11px;
  color: var(--muted);
}
.flow-arrow::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 2px dashed var(--border); }
.flow-arrow span { position: relative; background: var(--bg); padding: 0 8px; }
@media (min-width: 900px) {
  .flow-arrow { min-height: 0; }
  .flow-arrow::before { top: 50%; bottom: auto; left: 2px; right: 6px; border-left: 0; border-top: 2px dashed var(--border); }
  .flow-arrow::after { content: ""; position: absolute; right: 2px; top: calc(50% - 4px); border: 5px solid transparent; border-left-color: var(--muted); border-right: 0; }
  .flow-arrow span { display: none; }
}

.services { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; }
.service { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); min-width: 0; }
.service b { font-weight: 600; }
.service .muted { margin-left: auto; white-space: nowrap; }
.svc-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--off); }
.service.ok .svc-dot { background: var(--ok); }
.service.err .svc-dot { background: var(--err); }
.flow .services { margin-top: auto; }

.repo-picker { gap: 8px; }
.repo-picker input[type=search] {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit;
}
.repo-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; padding-right: 2px; }
.repo-item {
  display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2);
  color: var(--text); font: inherit; cursor: pointer;
}
.repo-item:hover { border-color: var(--accent); }
.repo-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.repo-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.repo-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

.advanced summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary h3::before { content: "▸"; color: var(--muted); margin-right: 4px; }
.advanced[open] summary h3::before { content: "▾"; }
.advanced[open] > .stack { margin-top: 14px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.kpi b { color: var(--text); font-size: 15px; }

.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.alert.err { background: rgba(240, 96, 90, .1); color: var(--err); border: 1px solid rgba(240, 96, 90, .35); }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 40px 10px; max-width: 460px; margin: 0 auto; }

.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.grid-line { stroke: var(--border); stroke-width: 1; }
.limit-line { stroke: var(--err); stroke-width: 1.5; stroke-dasharray: 6 5; }
.axis { fill: var(--muted); font-size: 12px; }
.limit-text { fill: var(--err); }

.log {
  margin: 0;
  padding: 12px;
  height: 60vh;
  overflow: auto;
  background: #05080c;
  color: #c9d4e0;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
}

.version-row, .deploy-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.version-row:last-child, .deploy-row:last-child { border-bottom: 0; }
.deploy-row { align-items: flex-start; }
.deploy-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; flex: none; background: var(--off); }
.deploy-row.ok .deploy-dot { background: var(--ok); }
.deploy-row.err .deploy-dot { background: var(--err); }
.deploy-row.busy .deploy-dot { background: var(--busy); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.sticky-actions { position: sticky; bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px 16px; background: var(--bg); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.env-row { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 6px; }
@media (max-width: 520px) {
  .env-row { grid-template-columns: 1fr auto auto; }
  .env-row input:first-child { grid-column: 1 / -1; }
}

.danger-zone { border-color: rgba(240, 96, 90, .45); }

/* ---------- Pagine secondarie ---------- */

.audit { display: flex; flex-direction: column; }
.audit-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.audit-row.err b { color: var(--err); }
.audit-time { color: var(--muted); min-width: 92px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* ---------- Notifiche ---------- */

#toasts { position: fixed; z-index: 100; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ok);
  box-shadow: var(--shadow);
  font-size: 14px;
  transition: opacity .4s, transform .4s;
}
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast.hide { opacity: 0; transform: translateY(10px); }
