:root {
  --bg-primary: #07090e;
  --bg-secondary: #0d111a;
  --bg-tertiary: #131926;
  --bg-glass: rgba(13, 17, 26, 0.68);
  --accent-cyan: #00f0ff;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-glow: rgba(0, 240, 255, 0.35);
  --glow-cyan: 0 0 25px rgba(0, 240, 255, 0.25);
  --grad: linear-gradient(135deg, #00f0ff 0%, #8b5cf6 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-primary);
  color: var(--text-main);
  font: 15px/1.55 var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 700; line-height: 1.15; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(700px 450px at 10% 110%, rgba(0, 240, 255, 0.10), transparent 60%),
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px) 0 0 / 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 40%, transparent 100%);
}

.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; position: relative;
  background: var(--bg-secondary); border: 1px solid var(--border-glow); box-shadow: var(--glow-cyan);
}
.brand-mark::before {
  content: ''; position: absolute; inset: 8px 9px 8px 10px;
  border: 2.5px solid var(--accent-cyan); border-left-color: var(--accent-purple); border-radius: 0 12px 12px 0;
}
.brand-mark::after {
  content: ''; position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent-cyan); left: 50%; top: 50%; transform: translate(-30%, -50%);
}
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.1; }
.brand-sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent-cyan); }
.brand-lg .brand-mark { width: 44px; height: 44px; }
.brand-lg .brand-name { font-size: 22px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--font-body); color: var(--text-main);
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #04121a; box-shadow: var(--glow-cyan); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 34px rgba(0, 240, 255, 0.45); }
.btn-outline { background: transparent; border-color: var(--border-glow); color: var(--accent-cyan); }
.btn-outline:hover:not(:disabled) { background: rgba(0, 240, 255, 0.08); }
.btn-ghost { background: transparent; border-color: var(--border-subtle); color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-main); border-color: var(--border-strong); }
.btn-danger { background: transparent; border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-lg { padding: 15px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer; padding: 6px; border-radius: 8px;
}
.icon-btn:hover { color: var(--accent-cyan); background: rgba(255,255,255,.04); }

/* ---------- forms ---------- */
fieldset { margin: 0; min-width: 0; }
fieldset.card > legend { float: left; width: 100%; }
fieldset.card > legend + * { clear: both; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field em { font-style: normal; color: var(--text-dim); font-weight: 400; margin-left: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input:not([type]) {
  width: 100%; background: rgba(7, 9, 14, 0.7); color: var(--text-main);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  padding: 11px 12px; font: inherit; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
select {
  width: 100%; background: rgba(7, 9, 14, 0.7); color: var(--text-main); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 11px 12px; font: inherit; font-size: 14px; outline: none;
}
select:focus { border-color: var(--border-glow); box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12); }
input.mono { font-family: var(--font-mono); font-size: 13.5px; }
input::placeholder { color: var(--text-dim); }
input:focus { border-color: var(--border-glow); box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12); }
input[aria-invalid=true] { border-color: rgba(239, 68, 68, .7); box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 42px; }
.hint { color: var(--text-dim); font-size: 12px; line-height: 1.4; }
.field-error { color: #fca5a5; font-size: 12px; }
.form-error { color: #fca5a5; font-size: 13px; margin: 10px 0 0; min-height: 0; }
.form-error:empty { display: none; }

.row { display: grid; gap: 14px; margin-bottom: 14px; }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui {
  width: 38px; height: 22px; border-radius: 999px; background: var(--bg-tertiary); border: 1px solid var(--border-strong);
  position: relative; flex: none; margin-top: 1px; transition: background .2s, border-color .2s;
}
.toggle-ui::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; top: 2px; left: 2px;
  background: var(--text-muted); transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-ui { background: rgba(0, 240, 255, 0.18); border-color: var(--border-glow); }
.toggle input:checked + .toggle-ui::after { transform: translateX(16px); background: var(--accent-cyan); box-shadow: var(--glow-cyan); }
.toggle input:focus-visible + .toggle-ui { box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2); }
.toggle strong { display: block; font-weight: 600; font-size: 14px; }

.advanced { margin-top: 4px; border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.advanced summary { cursor: pointer; color: var(--text-muted); font-size: 13px; font-weight: 500; margin-bottom: 12px; }
.advanced summary:hover { color: var(--text-main); }

/* ---------- login ---------- */
.login { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; display: flex; flex-direction: column; gap: 16px; }
.login-card .muted { margin: 0; }

/* ---------- layout ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px;
  padding: 24px 18px; border-right: 1px solid var(--border-subtle); background: rgba(7, 9, 14, 0.75); backdrop-filter: blur(12px);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--text-dim); margin: 0 10px 8px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 14px; border: 1px solid transparent;
}
.nav a:hover { color: var(--text-main); background: rgba(255,255,255,.03); text-decoration: none; }
.nav a.active { color: var(--text-main); background: rgba(0, 240, 255, 0.07); border-color: rgba(0, 240, 255, 0.18); }
.nav a.active svg { color: var(--accent-cyan); }
.nav-badge { margin-left: auto; font: 600 11px var(--font-mono); background: rgba(16,185,129,.15); color: var(--accent-green); padding: 2px 7px; border-radius: 999px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.nav-ext { display: flex; align-items: center; gap: 6px; font: 12px var(--font-mono); color: var(--text-muted); padding: 0 4px; }
.nav-ext svg { width: 14px; height: 14px; }

.main { padding: 36px clamp(16px, 3.5vw, 48px) 64px; min-width: 0; }
.view { max-width: 1240px; margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head p { margin: 8px 0 0; max-width: 640px; }
.eyebrow { font: 500 12px var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--accent-cyan); margin-bottom: 10px; }
.back { display: inline-block; font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }

.card { padding: 22px; }
.card-title { font: 600 15px var(--font-head); display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 0; }
.card-title .num { font: 500 11px var(--font-mono); color: var(--accent-cyan); background: rgba(0,240,255,.08); border: 1px solid rgba(0,240,255,.2); padding: 3px 7px; border-radius: 6px; }

/* ---------- deploy ---------- */
.deploy-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.deploy-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sticky { position: sticky; top: 24px; }
.test-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.checklist { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; color: var(--text-muted); }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li::before {
  content: ''; width: 14px; height: 14px; border-radius: 4px; flex: none; margin-top: 3px;
  background: rgba(0,240,255,.12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300f0ff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat;
  border: 1px solid rgba(0,240,255,.25);
}
.summary { font-size: 12px; color: var(--text-muted); background: rgba(7,9,14,.6); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 16px; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.summary dt { color: var(--text-dim); }
.summary dd { margin: 0; color: var(--text-main); overflow-wrap: anywhere; }
.deploy-side .btn-lg { margin-top: 4px; }
.deploy-side .small { margin: 12px 0 0; }

.probe { margin-top: 16px; border-top: 1px solid var(--border-subtle); padding-top: 16px; }
.probe-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.probe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.probe-item { background: rgba(7,9,14,.55); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px 12px; }
.probe-item .k { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; gap: 6px; }
.probe-item .v { font-family: var(--font-mono); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.probe-item .fix { font-size: 12px; color: #fca5a5; margin-top: 3px; }
.probe-item.bad { border-color: rgba(239,68,68,.35); }
.probe-error { color: #fca5a5; font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--accent-green); box-shadow: 0 0 8px rgba(16,185,129,.7); }
.dot.bad { background: var(--accent-red); box-shadow: 0 0 8px rgba(239,68,68,.6); }
.dot.live { background: var(--accent-cyan); box-shadow: 0 0 0 0 rgba(0,240,255,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0,240,255,.55); } 70% { box-shadow: 0 0 0 8px rgba(0,240,255,0); } 100% { box-shadow: 0 0 0 0 rgba(0,240,255,0); } }

/* ---------- job ---------- */
.job-meta { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 7px; font: 600 12px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-muted); }
.pill.running { color: var(--accent-cyan); border-color: rgba(0,240,255,.35); background: rgba(0,240,255,.07); }
.pill.success { color: var(--accent-green); border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.08); }
.pill.failed, .pill.interrupted { color: #fca5a5; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); }

.job-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 0 0 18px; position: relative; }
.steps li:not(:last-child)::before { content: ''; position: absolute; left: 12px; top: 26px; bottom: 2px; width: 2px; background: var(--border-subtle); }
.steps li.done:not(:last-child)::before { background: linear-gradient(var(--accent-green), rgba(16,185,129,.25)); }
.step-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); background: var(--bg-secondary); color: var(--text-dim); font: 600 11px var(--font-mono); }
.step-icon svg { width: 14px; height: 14px; stroke-width: 3; }
.steps li.running .step-icon { border-color: var(--accent-cyan); color: var(--accent-cyan); box-shadow: var(--glow-cyan); }
.steps li.running .step-icon::after { content: ''; width: 12px; height: 12px; border: 2px solid var(--accent-cyan); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.steps li.done .step-icon { border-color: var(--accent-green); background: rgba(16,185,129,.15); color: var(--accent-green); }
.steps li.failed .step-icon { border-color: var(--accent-red); background: rgba(239,68,68,.15); color: #fca5a5; }
.steps li.skipped .step-icon { opacity: .6; }
.steps li.warn .step-icon { border-color: var(--accent-gold); background: rgba(245,158,11,.15); color: var(--accent-gold); font-size: 13px; }
.step-label { font-weight: 600; font-size: 14px; line-height: 26px; }
.steps li.pending .step-label { color: var(--text-muted); font-weight: 500; }
.step-hint { font-size: 12px; color: var(--text-dim); margin-top: -2px; }
.step-time { font: 11px var(--font-mono); color: var(--text-dim); margin-left: 6px; font-weight: 400; }

.terminal-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.terminal-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); background: rgba(7,9,14,.5); }
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #2a3040; }
.dots i:nth-child(1) { background: rgba(239,68,68,.6); }
.dots i:nth-child(2) { background: rgba(245,158,11,.6); }
.dots i:nth-child(3) { background: rgba(16,185,129,.6); }
.autoscroll { margin-left: auto; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.terminal { height: min(62vh, 640px); overflow: auto; padding: 14px 16px; font-size: 12.5px; line-height: 1.6; background: rgba(4,6,10,.75); white-space: pre-wrap; word-break: break-word; }
.terminal .ln { color: #c8d3e3; }
.terminal .ln.info { color: var(--accent-cyan); }
.terminal .ln.warn { color: var(--accent-gold); }
.terminal .ln.error { color: #fca5a5; font-weight: 500; }
.terminal .ln.arrow { color: #e2e8f0; }
.terminal .ln.step { color: var(--accent-purple); margin-top: 8px; font-weight: 500; }
.terminal .ts { color: #3d4759; margin-right: 10px; user-select: none; }

.result { margin-bottom: 20px; padding: 24px; position: relative; overflow: hidden; }
.result.success { border-color: rgba(16,185,129,.35); }
.result.success::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; background: var(--grad); }
.result.success .warn-list li { background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.25); border-radius: var(--radius-sm); padding: 10px 12px; }
.result.failed { border-color: rgba(239,68,68,.35); }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.result-head h2 { font-size: 20px; }
.result-head p { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }
.creds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cred { background: rgba(7,9,14,.6); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 11px 12px; min-width: 0; }
.cred .k { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }
.cred .v { display: flex; align-items: center; gap: 8px; margin-top: 4px; font: 13.5px var(--font-mono); }
.cred .v span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cred button { background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 2px; border-radius: 6px; flex: none; }
.cred button:hover { color: var(--accent-cyan); }
.cred button svg { width: 15px; height: 15px; }
.err-msg { font: 13px/1.6 var(--font-mono); color: #fecaca; background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.25); border-radius: var(--radius-sm); padding: 12px 14px; overflow-wrap: anywhere; }
.warn-list { margin: 14px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--accent-gold); display: flex; flex-direction: column; gap: 6px; }

/* ---------- history ---------- */
.history { display: flex; flex-direction: column; gap: 10px; }
.h-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) 150px 120px; gap: 16px; align-items: center; padding: 16px 20px; color: var(--text-main); transition: border-color .15s, background .15s; }
.h-row:hover { border-color: var(--border-glow); text-decoration: none; background: rgba(13,17,26,.85); }
.h-host { font: 500 14px var(--font-mono); }
.h-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.h-url { font: 13px var(--font-mono); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-date { font-size: 13px; color: var(--text-muted); }
.empty { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty h3 { color: var(--text-main); margin-bottom: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg-tertiary); border: 1px solid var(--border-glow); color: var(--text-main); padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; z-index: 50; box-shadow: var(--glow-cyan); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .deploy-grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .job-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .nav { flex-direction: row; flex: 1 1 100%; order: 3; overflow-x: auto; min-width: 0; max-width: 100%; }
  .sidebar { min-width: 0; }
  .nav-label, .nav-ext { display: none; }
  .nav a { white-space: nowrap; padding: 8px 10px; font-size: 13px; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; }
  .main { padding-top: 24px; }
  .row-3, .row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-row { grid-template-columns: 1fr auto; }
  .h-url, .h-date { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .card { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- tunnels ---------- */
.hub { margin-bottom: 20px; }
.hub-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.hub-head h2 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
.hub-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.hub-meta b { color: var(--text-main); font-family: var(--font-mono); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font: 12px var(--font-mono); padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-muted); }
.chip.main { border-color: rgba(0,240,255,.35); color: var(--accent-cyan); }
.chip.used { border-color: rgba(139,92,246,.4); color: #c4b5fd; }
.hub-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.nodes { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 13.5px; }
.nodes th { text-align: left; font: 500 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); padding: 0 10px 8px; border-bottom: 1px solid var(--border-subtle); }
.nodes td { padding: 12px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.nodes tr:last-child td { border-bottom: 0; }
.nodes .mono { font-size: 12.5px; }
.nodes .fw { display: flex; flex-direction: column; gap: 3px; font: 12.5px var(--font-mono); }
.nodes .actions { white-space: nowrap; text-align: right; }
.nodes .actions .btn { margin-left: 6px; }
.status-cell { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.inline-form { margin-top: 16px; border-top: 1px solid var(--border-subtle); padding-top: 18px; }
.inline-form h3 { font-size: 15px; margin-bottom: 14px; }
.fw-row { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1.3fr) 110px 110px 36px; gap: 10px; align-items: end; margin-bottom: 10px; }
.fw-row .icon-btn { position: static; transform: none; height: 42px; width: 36px; display: grid; place-items: center; border: 1px solid var(--border-subtle); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.note { font-size: 12.5px; color: var(--text-muted); background: rgba(0,240,255,.05); border: 1px solid rgba(0,240,255,.15); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0 14px; line-height: 1.5; }
.activity { padding: 0; overflow: hidden; margin-top: 20px; }
@media (max-width: 820px) {
  .nodes thead { display: none; }
  .nodes tr { display: block; border-bottom: 1px solid var(--border-subtle); padding: 8px 0; }
  .nodes td { display: block; border: 0; padding: 4px 0; }
  .nodes .actions { text-align: left; }
  .nodes .actions .btn { margin: 6px 6px 0 0; }
  .fw-row { grid-template-columns: 1fr 1fr; }
}

/* ---------- scan + console ---------- */
.scan { margin-top: 16px; border-top: 1px solid var(--border-subtle); padding-top: 16px; }
.scan-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.scan-head h3 { font-size: 16px; }
.scan h4 { font: 600 13px var(--font-head); margin: 18px 0 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.scan pre { white-space: pre-wrap; background: rgba(4,6,10,.7); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px; color: var(--text-muted); }
.issues { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.issues li { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }
.issues li b { margin-right: 6px; }
.issues li.bad { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); color: #fecaca; }
.issues li.warn { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.07); color: #fde68a; }
.issues li.info { border-color: rgba(0,240,255,.2); background: rgba(0,240,255,.04); color: var(--text-muted); }
.issues li.good { border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.08); color: #a7f3d0; }
.scan-tunnel { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: rgba(7,9,14,.45); }
.scan-tunnel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.scan-tunnel-head b { margin-right: 6px; font-size: 14px; }
.nodes.compact { margin-top: 10px; font-size: 12.5px; }
.nodes.compact td { padding: 8px 10px; }
.console { margin-top: 18px; border: 1px solid var(--border-glow); border-radius: var(--radius-sm); overflow: hidden; }
.console .terminal-head { gap: 10px; }
.console-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); background: rgba(7,9,14,.6); min-height: 44px; }
.console-log { height: 320px; }
.terminal .ln.out { color: #c8d3e3; }
