/* Slipway UI — layout follows the mockups; colours follow the Slipway logo (navy, blue, teal). */

:root {
  --primary: #0166ED;
  --primary-hover: #0152C4;
  --primary-soft: #E5EFFE;
  --primary-text: #0152C4;
  --logo-ink: #032651;
  --logo-blue: #0166ED;
  --logo-teal: #0DBBA2;
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-muted: #F8FAFC;
  --surface-hover: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #18181B;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --success-text: #15803D;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --warning-text: #B45309;
  --error: #DC2626;
  --error-soft: #FEE2E2;
  --error-text: #B91C1C;
  --neutral-soft: #F1F5F9;
  --neutral-text: #475569;
  --sidebar-bg: #FFFFFF;
  --nav-active-bg: #E5EFFE;
  --nav-active-text: #0152C4;
  --code-bg: #0F172A;
  --code-text: #E2E8F0;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);
  --radius-card: 14px;
  --radius-button: 10px;
  --mt-back: #CFE0FB;
  --mt-peak-a: #93BCF9;
  --mt-peak-b: #0166ED;
  --mt-mid: #5B9AF5;
  --mt-shade: rgba(1, 82, 196, .40);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary-soft: rgba(1, 102, 237, .18);
    --primary-text: #6AA8FF;
    --logo-ink: #F1F5F9;
    --logo-blue: #3D8BFF;
    --logo-teal: #14C9AE;
    --bg: #0E0E10;
    --surface: #18181B;
    --surface-muted: #1C1C20;
    --surface-hover: #232328;
    --border: #2A2A30;
    --border-strong: #3F3F46;
    --text: #F4F4F5;
    --text-muted: #A1A1AA;
    --text-subtle: #71717A;
    --success-soft: rgba(22, 163, 74, .16);
    --success-text: #4ADE80;
    --warning-soft: rgba(245, 158, 11, .16);
    --warning-text: #FBBF24;
    --error-soft: rgba(220, 38, 38, .18);
    --error-text: #F87171;
    --neutral-soft: #27272A;
    --neutral-text: #A1A1AA;
    --sidebar-bg: #121214;
    --nav-active-bg: linear-gradient(90deg, rgba(1, 102, 237, .55), rgba(3, 38, 81, .45));
    --nav-active-text: #FFFFFF;
    --code-bg: #0B0B0D;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
    --mt-back: #0A1A33;
    --mt-peak-a: #0B3570;
    --mt-peak-b: #0166ED;
    --mt-mid: #082B5C;
    --mt-shade: rgba(61, 139, 255, .32);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --primary-soft: rgba(1, 102, 237, .18);
  --primary-text: #6AA8FF;
  --logo-ink: #F1F5F9;
  --logo-blue: #3D8BFF;
  --logo-teal: #14C9AE;
  --bg: #0E0E10;
  --surface: #18181B;
  --surface-muted: #1C1C20;
  --surface-hover: #232328;
  --border: #2A2A30;
  --border-strong: #3F3F46;
  --text: #F4F4F5;
  --text-muted: #A1A1AA;
  --text-subtle: #71717A;
  --success-soft: rgba(22, 163, 74, .16);
  --success-text: #4ADE80;
  --warning-soft: rgba(245, 158, 11, .16);
  --warning-text: #FBBF24;
  --error-soft: rgba(220, 38, 38, .18);
  --error-text: #F87171;
  --neutral-soft: #27272A;
  --neutral-text: #A1A1AA;
  --sidebar-bg: #121214;
  --nav-active-bg: linear-gradient(90deg, rgba(1, 102, 237, .55), rgba(3, 38, 81, .45));
  --nav-active-text: #FFFFFF;
  --code-bg: #0B0B0D;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  --mt-back: #0A1A33;
  --mt-peak-a: #0B3570;
  --mt-peak-b: #0166ED;
  --mt-mid: #082B5C;
  --mt-shade: rgba(61, 139, 255, .32);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 750; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
code, pre, kbd, .mono { font-family: var(--mono); }
code { font-size: 12.5px; background: var(--neutral-soft); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

.i { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.i-sm { width: 15px; height: 15px; vertical-align: -3px; }
.i-lg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.brand { display: flex; align-items: center; padding: 22px 24px 18px; color: var(--logo-ink); }
.brand:hover { text-decoration: none; }
/* The logo sprite draws its ink in currentColor and its accents from --logo-blue / --logo-teal. */
.brand .logo { display: block; width: 145px; height: 36px; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; position: relative; z-index: 1; }
.nav a {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--text); font-size: 15px; font-weight: 500;
}
.nav a:hover { background: var(--surface-hover); text-decoration: none; }
.nav a.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 600; }
.nav a .i { width: 20px; height: 20px; }
.nav hr { margin: 10px 8px; }

.sidebar-art { margin-top: auto; position: relative; }
.mountains { display: block; width: 100%; height: 190px; }
.mountains .mt-back { fill: var(--mt-back); }
.mountains .mt-mid { fill: var(--mt-mid); }
.mountains .mt-shade { fill: var(--mt-shade); }
.mountains .mt-a { stop-color: var(--mt-peak-a); }
.mountains .mt-b { stop-color: var(--mt-peak-b); }
.mountains .mt-fade-a { stop-color: var(--sidebar-bg); stop-opacity: 0; }
.mountains .mt-fade-b { stop-color: var(--sidebar-bg); stop-opacity: 1; }
.tagline { padding: 0 24px 22px; margin-top: -40px; position: relative; }
.tagline strong { display: block; font-size: 19px; color: var(--primary-text); font-weight: 750; }
.tagline span { color: var(--text-muted); }
.tagline em { font-style: normal; color: var(--primary-text); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 68px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.search {
  flex: 1; max-width: 560px; position: relative; display: flex; align-items: center;
}
.search .i { position: absolute; left: 13px; color: var(--text-muted); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 56px 0 40px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
.search kbd {
  position: absolute; right: 10px; font-size: 11px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--surface-muted);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.pill:hover { text-decoration: none; background: var(--surface-hover); }
.pill .meta { font-weight: 450; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); display: inline-block; flex: none; }
.dot.success { background: var(--success); }
.dot.warning { background: var(--warning); }
.dot.error { background: var(--error); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); border-color: var(--border); }
.menu-toggle { display: none; }

.usermenu { position: relative; }
.usermenu > summary {
  list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 12px;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { background: var(--surface-hover); }
.usermenu .who { line-height: 1.2; }
.usermenu .who strong { display: block; font-size: 14px; }
.usermenu .who span { font-size: 12.5px; color: var(--text-muted); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px;
}
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-hover); text-decoration: none; }
.menu-panel .label { padding: 8px 10px 4px; font-size: 12px; color: var(--text-muted); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--primary-soft); color: var(--primary-text);
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.content { padding: 28px; display: flex; flex-direction: column; gap: 22px; max-width: 1600px; width: 100%; }

/* ------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .lede { color: var(--text-muted); font-size: 15px; margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.breadcrumb { display: flex; gap: 6px; align-items: center; color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }
.breadcrumb a { color: var(--text-muted); }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-button);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #0F6FEF, var(--primary-hover));
  border-color: var(--primary-hover); color: #fff;
  box-shadow: 0 1px 2px rgba(1, 82, 196, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--error-text); border-color: color-mix(in srgb, var(--error) 35%, var(--border)); }
.btn-danger:hover { background: var(--error-soft); }
.btn-danger.solid { background: var(--error); border-color: var(--error); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 50px; font-size: 16px; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.link-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px 14px; }
.card-head .head-icon { color: var(--text); margin-top: 2px; }
.card-head .head-icon.accent { color: var(--primary); }
.card-head h2 + p { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 0 20px 20px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.grid { display: grid; gap: 22px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-form { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat .label { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.stat .label .i { color: var(--primary); width: 22px; height: 22px; }
.stat .value { font-size: 34px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat .hint { font-size: 13px; color: var(--text-muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stat .hint .good { color: var(--success-text); font-weight: 600; }
.stat .hint .bad { color: var(--error-text); font-weight: 600; }

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--text-muted);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface-muted);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-hover); }
.table tr.selected td { background: var(--primary-soft); }
.table tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--primary-text); }
.table .primary-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.table .primary-cell strong { display: block; font-weight: 650; }
.table .primary-cell small { display: block; color: var(--text-muted); font-size: 12.5px; }
.table .num { text-align: right; }
.table td.actions-cell { text-align: right; white-space: nowrap; }
.row-icon {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  display: grid; place-items: center; flex: none; color: var(--text-muted); background: var(--surface);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 8px; background: var(--neutral-soft); color: var(--text);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 1px solid var(--border);
}
.chip.mono { font-family: var(--mono); font-weight: 500; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 9999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--neutral-text);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); color: var(--success-text); }
.badge.warning { background: var(--warning-soft); color: var(--warning-text); }
.badge.error { background: var(--error-soft); color: var(--error-text); }
.badge.primary { background: var(--primary-soft); color: var(--primary-text); }
.badge.spin::before {
  width: 9px; height: 9px; background: transparent;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
.badge.plain::before { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ meters */
.meter { display: flex; flex-direction: column; gap: 4px; min-width: 64px; }
.meter .meter-label { font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; }
.meter .meter-label span { color: var(--text-muted); }
.meter .bar { height: 6px; border-radius: 9px; background: var(--neutral-soft); overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 9px; background: var(--success); }
.meter.warn .bar i { background: var(--warning); }
.meter.crit .bar i { background: var(--error); }

/* ----------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label-text { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.field .help { font-size: 12.5px; color: var(--text-muted); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; resize: vertical; }
.input:focus, .search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.input::placeholder { color: var(--text-subtle); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--primary); }

.choice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface);
}
.choice:hover { border-color: var(--border-strong); }
.choice:has(input:checked) {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}
.choice:has(input:disabled) { cursor: not-allowed; }
.choice:has(input:disabled:not(:checked)) { opacity: .6; }
.choice input { margin-top: 3px; accent-color: var(--primary); }
.choice strong { display: block; }
.choice small { color: var(--text-muted); font-size: 12.5px; display: block; }
.choice .choice-meta { margin-left: auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.choice > span:not(.choice-meta) { min-width: 0; }

.repeater { display: flex; flex-direction: column; gap: 8px; }
.repeater-row { display: grid; gap: 8px; align-items: center; }
.repeater-row.env { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; }
.repeater-row.port { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 96px auto; }
.repeater-row.volume { grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto; }
.repeater .arrow { color: var(--text-muted); }

.stepper { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stepper .step { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-weight: 500; font-size: 15px; }
.stepper .step b {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); font-weight: 600; font-size: 14px; color: var(--text);
}
.stepper .step.active { color: var(--primary-text); font-weight: 650; }
.stepper .step.active b { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .line { flex: 1; min-width: 30px; height: 1px; background: var(--border-strong); }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.kv dd { margin: 0; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }

/* -------------------------------------------------------------- code/log */
.code, .log {
  background: var(--code-bg); color: var(--code-text); border-radius: 12px;
  font: 12.5px/1.6 var(--mono); padding: 14px 16px; margin: 0;
  overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.log { min-height: 240px; max-height: 620px; }
.log:empty::before { content: "Waiting for output…"; color: #64748B; }
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row .code { flex: 1; padding: 10px 12px; font-size: 12px; }

/* --------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0 20px 12px; }
.timeline li { display: grid; grid-template-columns: 28px 1fr auto; gap: 14px; padding: 12px 0; position: relative; }
.timeline li + li { border-top: 1px solid var(--border); }
.timeline li::before {
  content: ""; position: absolute; left: 13px; top: 38px; bottom: -14px; width: 2px; background: var(--border);
}
.timeline li:last-child::before { display: none; }
.timeline .tl-icon {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  background: var(--neutral-soft); color: var(--neutral-text);
}
.timeline .tl-icon.success { background: var(--success); color: #fff; }
.timeline .tl-icon.error { background: var(--error); color: #fff; }
.timeline .tl-icon.warning { background: var(--warning-soft); color: var(--warning-text); border: 2px solid var(--warning); }
.timeline .tl-icon .i { width: 15px; height: 15px; stroke-width: 2.6; }
.timeline .tl-title { font-weight: 600; }
.timeline .tl-title span { font-weight: 450; margin-left: 8px; }
.timeline .tl-meta { color: var(--text-muted); font-size: 12.5px; }
.timeline time { color: var(--text-muted); font-size: 13px; white-space: nowrap; }

/* -------------------------------------------------------------- empties */
.empty { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .empty-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-text);
}
.empty .empty-icon .i { width: 26px; height: 26px; }
.empty p { color: var(--text-muted); max-width: 440px; }

.checklist { list-style: none; margin: 0; padding: 0 20px 18px; display: flex; flex-direction: column; gap: 8px; }
.checklist a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-weight: 550;
}
.checklist a:hover { text-decoration: none; background: var(--surface-hover); }
.checklist .tick {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); color: transparent; flex: none;
}
.checklist .done .tick { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .done span { color: var(--text-muted); text-decoration: line-through; }
.checklist .i { width: 14px; height: 14px; stroke-width: 2.6; }
.checklist .go { margin-left: auto; color: var(--text-muted); }

.callout {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-muted); font-size: 13.5px;
}
.callout .i { margin-top: 1px; }
.callout.warning { background: var(--warning-soft); border-color: transparent; color: var(--warning-text); }
.callout.error { background: var(--error-soft); border-color: transparent; color: var(--error-text); }
.callout.success { background: var(--success-soft); border-color: transparent; color: var(--success-text); }
.callout.primary { background: var(--primary-soft); border-color: transparent; }

/* --------------------------------------------------------- tabs/sub-nav */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a {
  padding: 10px 14px; color: var(--text-muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.segmented a { padding: 6px 12px; border-radius: 8px; color: var(--text-muted); font-weight: 600; font-size: 13px; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.active { background: var(--primary); color: #fff; }

/* ---------------------------------------------------------------- dialog */
dialog.modal {
  border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(9, 9, 11, .55); backdrop-filter: blur(2px); }
dialog.modal .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
dialog.modal .modal-body { padding: 12px 20px 4px; display: flex; flex-direction: column; gap: 14px; }
dialog.modal .modal-foot { padding: 16px 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ----------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; animation: toast-in .18s ease-out;
  white-space: pre-line;
}
.toast.error { border-left: 4px solid var(--error); }
.toast.success { border-left: 4px solid var(--success); }
.toast.warning { border-left: 4px solid var(--warning); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------------ login */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth-page .mountains { position: fixed; left: 0; right: 0; bottom: 0; height: 42vh; z-index: 0; }
.auth-page .mountains .mt-fade-a, .auth-page .mountains .mt-fade-b { stop-color: var(--bg); }
.auth-card { width: min(420px, 100%); padding: 32px; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 18px; }
.auth-card .brand { padding: 0; justify-content: center; }
.auth-card .brand .logo { width: 177px; height: 44px; }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-card .lede { text-align: center; color: var(--text-muted); margin-top: -10px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-subtle); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-github { background: #18181B; color: #fff; border-color: #18181B; }
.btn-github:hover { background: #27272A; }
:root[data-theme="dark"] .btn-github { background: #F4F4F5; color: #18181B; border-color: #F4F4F5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-github { background: #F4F4F5; color: #18181B; border-color: #F4F4F5; } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .usermenu .who, .pill .meta, .search kbd { display: none; }
  .content { padding: 20px 16px; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .choice { flex-wrap: wrap; }
  .choice .choice-meta { margin-left: 26px; width: 100%; justify-content: flex-start; }
  h1 { font-size: 23px; }
  .repeater-row.port, .repeater-row.volume { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .repeater-row .arrow { display: none; }
}
