/* Folk Cloud — clean, modern control panel.
   Light surfaces, one blue accent for primary actions, colour only for status.
   System fonts on purpose: no third-party font requests (the CSP forbids them) and it works offline. */

:root {
  /* Crisp, light surfaces; one blue for primary actions; colour only for status. */
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e6e9ed;
  --border-strong: #d5dae0;
  --text: #1b2430;
  --text-2: #4a5565;
  --text-3: #7a8494;
  --primary: #147aff;
  --primary-hover: #0866e0;
  --primary-soft: #ebf3ff;
  --primary-ring: rgba(20, 122, 255, 0.25);
  --ok: #12a150;
  --ok-soft: #e8f7ee;
  --warn: #c27b05;
  --warn-soft: #fdf4e3;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --code-bg: #141a23;
  --code-text: #e3e8ef;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --radius-sm: 3px;
  --radius: 4px;
  --radius-lg: 7px;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lift: 0 8px 24px -8px rgba(16, 24, 40, 0.18), 0 2px 6px rgba(16, 24, 40, 0.06);
  --sidebar-w: 232px;
  --subnav-w: 232px;
  --topbar-h: 56px;
  --fast: 140ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/inter.woff2") format("woff2");
}

/* 1rem = 14px on laptops, larger on big screens so text stays readable on 2K/4K monitors. */
html { font-size: 1rem; }
@media (min-width: 1700px) { html { font-size: 1.071rem; } }
@media (min-width: 2200px) { html { font-size: 1.143rem; } }
@media (min-width: 3000px) { html { font-size: 1.286rem; } }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); }
body { margin: 0; font: 1rem/1.55 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; color: var(--text); letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 1.714rem; font-weight: 650; }
h2 { font-size: 1.143rem; font-weight: 620; margin-bottom: 4px; }
h3 { font-size: 1rem; font-weight: 620; }
p { margin: 0 0 10px; }
code, .mono, pre { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 0.05em 0.35em; border-radius: 4px; }
small, .small { font-size: 0.893rem; }
.muted { color: var(--text-3); }
.strong { font-weight: 600; color: var(--text); }
a.strong:hover { color: var(--primary); }
.muted-link { color: var(--text-2); }
.grow { flex: 1; min-width: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-weight: 700; font-size: 1.143rem; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), oklch(62% 0.19 290)); color: #fff; font-size: 1.071rem; font-weight: 750;
  box-shadow: 0 4px 10px -4px var(--primary);
}
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-2); font-weight: 520; font-size: 1rem; background: none; border: 0; width: 100%; cursor: pointer; font-family: inherit;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.side-nav a:hover, .side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-nav a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-nav svg, .side-link svg { flex: none; opacity: 0.9; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.content { padding: 24px clamp(16px, 2.2vw, 40px) 64px; width: 100%; min-width: 0; }

/* ---------- page header & tabs ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--text-3); margin: 4px 0 0; }
.head-main { display: flex; align-items: center; gap: 14px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 0.893rem; color: var(--text-3); margin-bottom: 2px; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--primary); }
.eyebrow { margin: 0 0 2px; font-size: 0.893rem; color: var(--text-3); }
.eyebrow a { color: var(--text-3); }
.meta, .pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 0; }
ul.pills { list-style: none; padding: 0; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -6px 0 22px; overflow-x: auto; overflow-y: hidden; }
.tab {
  padding: 10px 12px; color: var(--text-2); font-weight: 540; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.tab:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.tab.is-active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 0.821rem; text-align: center; color: var(--text-2); }

/* ---------- surfaces ---------- */
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card h2 { margin-bottom: 12px; }
.form-card { margin-bottom: 16px; }
.form-card h2 { margin-bottom: 4px; }
.danger-card { border-color: oklch(88% 0.05 25); }
.danger-card h2 { color: var(--bad); }
.callout { border-color: oklch(85% 0.06 262); background: linear-gradient(180deg, var(--primary-soft), var(--surface) 70%); margin-bottom: 20px; }
.connect-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; margin-top: 8px; }
.connect-grid h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.section { margin-top: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-title { font-size: 1.143rem; font-weight: 620; margin: 0 0 12px; }
.link { font-weight: 560; font-size: 0.929rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.two-col > .card { margin-top: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; color: var(--text-2); }
.note h2 { font-size: 1rem; margin: 14px 0 6px; }
.note h2:first-child { margin-top: 0; }
.note ul, .note ol { padding-left: 18px; margin: 0 0 8px; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 36px; text-align: center; color: var(--text-2); }
.empty h2 { margin-bottom: 6px; }
.empty p { max-width: 520px; margin: 0 auto 16px; }

/* ---------- stats & metrics ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat, .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; display: grid; gap: 4px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 0.893rem; color: var(--text-3); font-weight: 520; }
.stat-value { font-size: 2rem; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 1.071rem; color: var(--text-3); font-weight: 520; }
.kpi-value { font-size: 1.071rem; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.metric { margin: 0; display: grid; gap: 10px; }
.metric figcaption { display: grid; gap: 2px; }
.metric .kpi-value { font-size: 1.429rem; }
.spark { width: 100%; height: 56px; }
.spark polyline { fill: none; stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.bar { width: 100%; height: 6px; display: block; }
.bar-lg { height: 8px; margin-top: 18px; }
.bar .track { fill: oklch(94% 0.006 265); }
.bar .fill { fill: var(--ok); }
.bar.is-busy .fill { fill: var(--warn); }
.bar.is-bad .fill { fill: var(--bad); }
.services { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 16px; padding: 14px 18px; }
.service { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- server cards ---------- */
.server-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.server-card { display: grid; gap: 16px; color: inherit; transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast); }
.server-card:hover { text-decoration: none; color: inherit; box-shadow: var(--shadow-lift); transform: translateY(-1px); border-color: var(--border-strong); }
.server-card-head { display: flex; align-items: center; gap: 12px; }
.server-card-head p { margin: 0; }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0; }
.mini-metrics dt { font-size: 0.857rem; color: var(--text-3); }
.mini-metrics dd { margin: 2px 0 6px; font-weight: 650; font-size: 1.071rem; font-variant-numeric: tabular-nums; }
.mini-metrics small { color: var(--text-3); font-weight: 500; }
.metrics-empty { margin: 0; }
.server-card-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; font-size: 0.929rem; font-weight: 520; }
.avatar {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 0.964rem; letter-spacing: 0.02em;
}
.avatar-sm { width: 30px; height: 30px; border-radius: var(--radius); font-size: 0.893rem; }
.avatar-lg, .site-icon { width: 46px; height: 46px; border-radius: var(--radius-lg); font-size: 1.214rem; }
.site-icon { display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }

/* ---------- tables & lists ---------- */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.857rem; font-weight: 560; color: var(--text-3); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.site-cell { display: flex; align-items: center; gap: 10px; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity li:last-child { border-bottom: 0; }
.activity-meta { display: grid; justify-items: end; gap: 2px; }
.kv { display: grid; gap: 10px; margin: 0; }
.kv div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: baseline; }
.kv dt { color: var(--text-3); font-size: 0.929rem; }
.kv dd { margin: 0; word-break: break-all; }
.kv.compact div { grid-template-columns: 70px 1fr; }
details summary { cursor: pointer; color: var(--primary); font-size: 0.929rem; font-weight: 540; }
.secret { display: inline-block; margin-top: 6px; user-select: all; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card-actions { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.card-actions form { margin: 0; }

/* ---------- status ---------- */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: 0.857rem; font-weight: 600; line-height: 18px; text-transform: capitalize; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.is-ok.badge, .is-ok.pill { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.is-busy.badge, .is-busy.pill, .is-warn.badge { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.is-bad.badge, .is-bad.pill { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge-accent, .tag { background: var(--primary-soft); color: var(--primary); border-color: transparent; text-transform: none; }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--radius-sm); font-size: 0.821rem; font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.is-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.is-busy { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.is-bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.alert { padding: 12px 14px; border-radius: var(--radius); border: 1px solid transparent; margin: 0 0 18px; font-weight: 500; }
.alert ul { margin: 0; padding-left: 18px; }
pre.alert { white-space: pre-wrap; font-size: 0.929rem; font-weight: 400; }
.alert-ok { background: var(--ok-soft); color: oklch(42% 0.11 155); }
.alert-bad { background: var(--bad-soft); color: oklch(45% 0.17 25); }
.alert-info { background: var(--primary-soft); color: oklch(40% 0.15 262); }
.alert-busy { background: var(--warn-soft); color: oklch(45% 0.11 70); }
.retry { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.retry p { margin: 0; }
.retry form { margin: 0; }

/* ---------- forms & buttons ---------- */
label { display: grid; gap: 6px; font-weight: 560; font-size: 0.929rem; color: var(--text-2); }
input, select, textarea {
  font: 1rem var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 11px; width: 100%;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input.mono, textarea.mono { font-family: var(--mono); font-size: 0.929rem; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.stack { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.narrow { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin-top: 14px; align-items: start; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-top: 12px; }
.inline-form label { min-width: 260px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 2.43rem; padding: 0 1rem;
  font: 550 0.93rem var(--font); border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); color: var(--text); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(20, 122, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { color: var(--bad); border-color: #f3c2c4; }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.danger-link { color: var(--bad); font-weight: 560; font-size: 0.929rem; }

/* ---------- code, logs, editor ---------- */
.code, .log { background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; font-size: 0.893rem; line-height: 1.65; margin: 8px 0 0; }
.log { min-height: 55vh; }
.editor-card { padding: 0; overflow: hidden; }
.editor-bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.editor { border: 0; border-radius: 0; min-height: 62vh; background: var(--code-bg); color: var(--code-text); font: 0.929rem/1.6 var(--mono); padding: 16px; tab-size: 4; }
.editor:focus { box-shadow: none; }
.editor-card .form-actions { padding: 12px 16px; margin: 0; border-top: 1px solid var(--border); }

/* ---------- auth ---------- */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(900px 500px at 50% -10%, var(--primary-soft), var(--bg) 60%); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lift); }
.auth-card h1 { font-size: 1.429rem; margin: 18px 0 18px; }
.brand-large { padding: 0; margin: 0; }

@media (max-width: 1080px) {
  .two-col, .split, .connect-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 4px 8px; }
  .side-nav { display: flex; gap: 2px; order: 3; width: 100%; overflow-x: auto; }
  .side-nav a { padding: 7px 10px; }
  .side-nav a svg { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .side-link { padding: 6px 8px; }
  .grid-3, .row, .form-grid { grid-template-columns: 1fr; }
  .kv div { grid-template-columns: 1fr; gap: 2px; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .content { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- overview tiles (site & server) ---------- */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { display: grid; gap: 8px; align-content: start; }
.tile h2 { margin: 0; }
.tile p { margin: 0; }
.tile-wide { grid-column: span 2; }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile-big { font-size: 1.143rem; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.compact-kv div { grid-template-columns: 80px 1fr; }
.attention { background: var(--warn-soft); border: 1px solid oklch(88% 0.07 80); color: oklch(40% 0.1 70); border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 18px; }
.attention ul { margin: 6px 0 0; padding-left: 18px; }
.info-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 16px; margin: -8px 0 18px; font-size: 0.929rem; }
.health-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.health-nums div { display: grid; }
.text-bad { color: var(--bad); }
.checks, .quick { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 10px; }
.quick a { display: block; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 540; }
.quick a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; background: var(--primary-soft); }

/* ---------- task progress ---------- */
.task-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.steps { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 2px; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-weight: 520; }
.step-mark { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--ok); }
.steps li.is-ok .step-mark::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.steps li.is-busy .step-mark { background: var(--warn-soft); border: 2px solid var(--warn); }
.steps li.is-bad .step-mark { background: var(--bad); }
.steps li.is-bad { color: var(--bad); }
.log-card summary { font-weight: 600; color: var(--text); margin-bottom: 8px; }

@media (max-width: 1080px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .bento { grid-template-columns: 1fr; }
  .tile-wide { grid-column: auto; }
}

/* ---------- site menu: second column next to the main sidebar ---------- */
.app.has-subnav { grid-template-columns: var(--sidebar-w) var(--subnav-w) minmax(0, 1fr); }
.subnav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  padding: 18px 10px; background: var(--surface-2); border-right: 1px solid var(--border);
}
.subnav-head { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.subnav-head:hover { text-decoration: none; color: var(--text); }
.subnav-site-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary); }
.subnav-site { display: grid; min-width: 0; line-height: 1.3; }
.subnav-site strong { font-size: 0.964rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subnav-site small { font-size: 0.857rem; color: var(--text-3); }
.subnav-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--text-2);
  font-size: 1rem; font-weight: 540; cursor: pointer; list-style: none; user-select: none;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.subnav-row::-webkit-details-marker { display: none; }
.subnav-row:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.subnav-row:focus-visible, .subnav-items a:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 1px; }
a.subnav-row.is-active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }
.subnav-group.is-active > .subnav-row { color: var(--text); font-weight: 600; }
.subnav-icon { display: grid; flex: none; }
.subnav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.subnav-chev { width: 14px; height: 14px; margin-left: auto; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--fast) var(--ease); }
.subnav-group[open] > .subnav-row .subnav-chev { transform: rotate(90deg); }
.subnav-items { position: relative; list-style: none; margin: 2px 0 8px; padding: 0 0 0 28px; display: grid; gap: 1px; }
.subnav-items::before { content: ""; position: absolute; left: 18px; top: 2px; bottom: 2px; width: 1px; background: var(--border-strong); }
.subnav-items a {
  position: relative; display: block; padding: 6px 10px; border-radius: var(--radius); color: var(--text-2); font-size: 0.964rem; font-weight: 500;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.subnav-items a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.subnav-items a.is-active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }
.subnav-items a.is-active::before { content: ""; position: absolute; left: -11px; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--primary); }

/* Narrow screens: no side column; sections as chips and the current section's pages as tabs. */
.compact-nav { display: none; }
.compact-groups { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 10px; }
.chip-link { flex: none; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 0.929rem; font-weight: 560; white-space: nowrap; }
.chip-link:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.chip-link.is-active { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.compact-tabs { margin: 0 0 18px; overflow-y: hidden; }
.compact-groups, .compact-tabs { scrollbar-width: none; }
.compact-groups::-webkit-scrollbar, .compact-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 1080px) {
  .app.has-subnav { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .subnav { display: none; }
  .compact-nav { display: block; }
}
@media (max-width: 760px) {
  .app.has-subnav { grid-template-columns: minmax(0, 1fr); }
  /* Backup rows become small cards so Restore/Delete stay on screen. */
  .backup-table thead { display: none; }
  .backup-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .backup-table tbody tr:last-child { border-bottom: 0; }
  .backup-table td, .backup-table td:nth-child(n+4) { display: block; padding: 0; border: 0; }
  .backup-table td.row-actions { grid-column: 1 / -1; text-align: left; }
}
.site-main { min-width: 0; }
.site-main .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.toggle:hover { border-color: var(--border-strong); background: var(--surface-2); }
.toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.toggle span { display: grid; gap: 2px; }
.toggle strong { color: var(--text); font-weight: 600; }
.span-2 { grid-column: 1 / -1; }
.form-card .table { margin: 12px 0; border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 900px) {
  .site-main .bento { grid-template-columns: 1fr; }
}

/* ---------- Backups ---------- */
.page-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-bar-actions { display: flex; gap: 8px; align-items: center; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented a { padding: 6px 16px; border-radius: calc(var(--radius) - 3px); color: var(--text-2); font-weight: 500; text-decoration: none; transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.segmented a:hover { color: var(--text); }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.segmented a:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 1px; }
.table-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.table-head h2 { margin: 0 0 2px; }
.table-head p { margin: 0; }
.empty-inline { padding: 32px 16px; text-align: center; color: var(--text-2); }
.empty-inline p { max-width: 480px; margin: 0 auto 14px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 6px; }
.btn-sm { height: 2rem; padding: 0 0.7rem; font-size: 0.893rem; }
.btn-quiet-danger { color: var(--text-2); }
.btn-quiet-danger:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.nowrap { white-space: nowrap; }
.confirm-card { border-left: 3px solid var(--warn); background: var(--warn-soft); margin-bottom: 16px; }
.confirm-card.is-danger { border-left-color: var(--bad); background: var(--bad-soft); }
.confirm-card h2 { margin-bottom: 4px; }
.stack-sm { display: grid; gap: 10px; margin-top: 10px; }
.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split-2 > .form-card, .stack > .form-card { margin-bottom: 0; }

@media (max-width: 760px) { .split-2 { grid-template-columns: 1fr; } }
.link-danger { color: var(--bad); }
.pill.plain { text-transform: none; }
.tags { display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.table-card { overflow-x: auto; margin-bottom: 16px; }
.split-2 { align-items: start; }

/* ---------- operations pages ---------- */
.text-ok { color: var(--ok); }
.break { word-break: break-word; }
.arrow { color: var(--text-3); margin: 0 2px; }
.check-col { width: 40px; }
.check-col input { width: 16px; height: 16px; accent-color: var(--primary); }
.side-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--bad); color: #fff; font-size: 0.821rem; font-weight: 650; text-align: center; line-height: 18px; }
.locked-rules { display: grid; gap: 8px; margin-top: 10px; }
.locked-rules div { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-2); font-size: 0.964rem; }
@media (max-width: 760px) {
  .update-table th:nth-child(3), .update-table td:nth-child(3) { display: none; }
  .update-table td:nth-child(4), .update-table th:nth-child(4) { display: table-cell; }
}
/* ---------- logs ---------- */
.segmented-wrap { flex-wrap: wrap; }
.log-body { padding: 0 16px 16px; }
.log-body > p { margin: 12px 0 0; }
.log-view { max-height: 520px; overflow: auto; white-space: pre; word-break: normal; }
.table-head h2 .tag { vertical-align: middle; margin-left: 6px; }
@media (max-width: 760px) {
  .table-head { flex-wrap: wrap; }
  .table-head > div:first-child { flex: 1 1 100%; }
}

/* ---------- top bar ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px;
  height: var(--topbar-h); padding: 0 clamp(16px, 2.2vw, 40px); background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.4) blur(8px);
}
.topbar-sep { color: var(--border-strong); font-size: 1.15rem; padding: 0 2px; }
.picker { position: relative; }
.picker > summary {
  display: flex; align-items: center; gap: 8px; height: 2.43rem; padding: 0 10px; max-width: 280px;
  border: 1px solid transparent; border-radius: var(--radius); color: var(--text-2); font-weight: 550; cursor: pointer; list-style: none;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.picker > summary::-webkit-details-marker { display: none; }
.picker > summary:hover, .picker[open] > summary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.picker > summary:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 1px; }
.picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-chev { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.picker-menu {
  position: absolute; top: calc(100% + 6px); left: 0; width: 320px; max-width: 90vw; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lift); overflow: hidden;
}
.picker-search { padding: 8px; border-bottom: 1px solid var(--border); }
.picker-search input { height: 2.29rem; }
.picker-menu ul { list-style: none; margin: 0; padding: 4px; max-height: 360px; overflow-y: auto; }
.picker-menu li a { display: grid; gap: 1px; padding: 7px 10px; border-radius: var(--radius); color: var(--text); }
.picker-menu li a:hover { background: var(--primary-soft); text-decoration: none; }
.picker-menu li a strong { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-menu li a small { color: var(--text-3); }
.picker-empty { padding: 10px; }
.picker-foot { display: block; padding: 9px 14px; border-top: 1px solid var(--border); font-weight: 550; font-size: 0.93rem; }
.topbar-search { position: relative; margin-left: auto; width: min(360px, 40vw); }
.topbar-search svg, .toolbar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.topbar-search input { height: 2.29rem; padding-left: 34px; background: var(--surface-2); }
.topbar-icon { position: relative; display: grid; place-items: center; width: 2.43rem; height: 2.43rem; border-radius: var(--radius); color: var(--text-2); }
.topbar-icon:hover { background: var(--surface-2); color: var(--text); }
.topbar-count { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 0.75rem; font-weight: 650; line-height: 17px; text-align: center; }
.progress-picker > summary { gap: 7px; font-size: 0.93rem; }
.progress-pill.is-busy { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.progress-picker[open] > .progress-pill.is-busy, .progress-pill.is-busy:hover { background: var(--primary-soft); border-color: var(--primary-ring); color: var(--primary); }
.progress-spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--primary-ring); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
.progress-pill-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.progress-menu { left: auto; right: 0; }
.progress-menu li a { gap: 4px; }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.progress-menu .setup-progress { height: 4px; margin-top: 2px; }
.setup-callout { display: grid; gap: 14px; }
.callout .setup-actions { justify-content: flex-start; }
.known-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: 4px; }
.setup-hint { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--warn-soft, #fdf2dd); color: var(--text); font-size: 0.93rem; }
@media (prefers-reduced-motion: reduce) { .progress-spin { animation-duration: 2.4s; } }

/* ---------- avatars ---------- */
.site-avatar { display: grid; place-items: center; flex: none; width: 2.6rem; height: 2.6rem; border-radius: var(--radius); font-weight: 650; font-size: 1rem; }
.t-blue { background: #e8f1ff; color: #1463d8; }
.t-violet { background: #f0ebff; color: #6a3fd6; }
.t-teal { background: #e3f6f5; color: #0f7f78; }
.t-amber { background: #fdf2dd; color: #a36400; }
.t-rose { background: #fdebee; color: #c42f45; }
.t-green { background: #e6f6ec; color: #148044; }

/* ---------- site and server lists ---------- */
.site-list, .server-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-row, .server-row {
  display: grid; align-items: center; gap: 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.site-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.server-row { grid-template-columns: auto minmax(200px, 1.2fr) minmax(260px, 1fr) auto auto; }
.site-row:hover, .server-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.site-row-main, .server-row-main { min-width: 0; display: grid; gap: 4px; }
.site-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.site-row-name { font-weight: 650; font-size: 1.07rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-row-name:hover { color: var(--primary); }
.site-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; color: var(--text-3); font-size: 0.93rem; }
.meta-link { color: var(--text-2); }
.meta-item { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); }
a.meta-item:hover { color: var(--primary); text-decoration: none; }
.meta-item svg, .chip svg, .btn svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.env { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-sm); font-size: 0.79rem; font-weight: 600; }
.env-prod { background: var(--ok-soft); color: var(--ok); }
.env-staging { background: var(--warn-soft); color: var(--warn); }
.site-row-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 1.93rem; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 0.86rem; font-weight: 500; white-space: nowrap; }
.chip-ok svg { color: var(--ok); }
.chip-warn { color: var(--warn); }
.chip-bad { color: var(--bad); border-color: #f6caca; background: var(--bad-soft); }
.site-row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.site-row-actions form { margin: 0; }
.usage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; }
.usage dt { font-size: 0.79rem; color: var(--text-3); font-weight: 550; text-transform: uppercase; letter-spacing: 0.03em; }
.usage dd { margin: 2px 0 4px; font-weight: 650; }
.usage dd small { color: var(--text-3); font-weight: 500; }
.usage .bar { display: block; width: 100%; height: 4px; }
.usage-empty { margin: 0; }
.server-row-sites { display: grid; justify-items: center; line-height: 1.2; }
.server-row-sites strong { font-size: 1.15rem; }

/* ---------- list toolbar, stats, pager ---------- */
.list-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-search { position: relative; flex: 1 1 320px; max-width: 480px; }
.toolbar-search input { padding-left: 34px; }
.toolbar-select select { min-width: 180px; }
.toolbar-count { margin-left: auto; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--surface-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.stat-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: none; border-radius: var(--radius); }
.stat-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-text { display: grid; }
.stat-card .stat-label { color: var(--text-3); font-size: 0.86rem; font-weight: 550; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stat-card .stat-value small { font-size: 0.93rem; color: var(--text-3); font-weight: 500; }
.activity-card { padding: 4px 16px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.pager-numbers { display: flex; gap: 4px; }
.pager-num { display: grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 6px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2); font-weight: 550; }
.pager-num:hover { border-color: var(--border-strong); text-decoration: none; }
.pager-num.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-gap { display: grid; place-items: center; min-width: 1.5rem; color: var(--text-3); }
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

@media (max-width: 1200px) {
  .server-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .server-row .usage { grid-column: 1 / -1; order: 3; }
  .server-row .server-row-sites { display: none; }
}
@media (max-width: 1000px) {
  .site-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .site-row-chips { grid-column: 2 / -1; justify-content: flex-start; order: 3; }
}
@media (max-width: 760px) {
  .topbar { position: static; height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 4px; }
  .topbar-sep { display: none; }
  .topbar-search { order: 5; width: 100%; margin: 4px 0 0; }
  .picker > summary { max-width: 42vw; }
  .site-row, .server-row { grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; align-items: start; }
  .site-row-title { flex-wrap: nowrap; align-items: flex-start; }
  .site-row-title .dot { margin-top: 0.55em; }
  .site-row-name { white-space: normal; overflow-wrap: anywhere; }
  .site-row-title .env { flex: none; }
  .site-row-chips, .site-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .server-row .usage { grid-column: 1 / -1; }
  .pager-numbers { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 12px; gap: 10px; }
}

/* ---------- connect a server ---------- */
.auth-switch { position: relative; display: inline-flex; padding: 3px; gap: 2px; margin: 6px 0 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.auth-switch input { position: absolute; inset: 0 auto auto 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.auth-switch label { padding: 6px 16px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 550; cursor: pointer; }
.auth-switch input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08); }
.auth-switch input:focus-visible + label { outline: 2px solid var(--primary-ring); outline-offset: 1px; }
.auth-panel { display: none; }
.ssh-auth:has(#auth-password:checked) .auth-panel-password, .ssh-auth:has(#auth-key:checked) .auth-panel-key { display: grid; gap: 10px; }
.security-notes { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); font-size: 0.93rem; display: grid; gap: 4px; }

/* ---------- server setup popup ---------- */
.setup-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 35, 0.45); backdrop-filter: blur(2px); overflow-y: auto; }
.setup-modal { width: min(480px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lift); padding: 24px; display: grid; gap: 18px; }
.setup-head { display: flex; gap: 14px; align-items: flex-start; }
.setup-head h2 { margin: 0 0 2px; font-size: 1.15rem; }
.setup-head p { margin: 0; }
.setup-badge { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; }
.setup-badge.is-busy { border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
.setup-badge.is-ok { background: var(--ok-soft); }
.setup-badge.is-ok::after { content: ""; width: 12px; height: 7px; border: 2.5px solid var(--ok); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -2px); }
.setup-badge.is-bad { background: var(--bad-soft); }
.setup-badge.is-bad::after { content: "!"; color: var(--bad); font-weight: 750; font-size: 1.2rem; }
.setup-progress { display: block; width: 100%; height: 6px; }
.setup-progress .track { fill: var(--surface-2); }
.setup-progress .fill { fill: var(--primary); }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.setup-steps li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius); color: var(--text-3); font-weight: 500; }
.setup-steps li.is-ok { color: var(--text-2); }
.setup-steps li.is-busy { color: var(--text); font-weight: 600; background: var(--primary-soft); }
.setup-steps li.is-bad { color: var(--bad); font-weight: 600; background: var(--bad-soft); }
.setup-mark { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; }
.setup-steps li.is-ok .setup-mark { border-color: var(--ok); background: var(--ok); }
.setup-steps li.is-ok .setup-mark::after { content: ""; width: 7px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(0.5px, -1px); }
.setup-steps li.is-busy .setup-mark { border-color: var(--primary-soft); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
.setup-steps li.is-bad .setup-mark { border-color: var(--bad); background: var(--bad); }
.setup-steps li.is-bad .setup-mark::after { content: "×"; color: #fff; font-size: 13px; line-height: 1; font-weight: 700; }
.setup-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.setup-actions form { margin: 0; }
/* "Show details" jumps to the log: step aside so it can be read. */
body:has(#full-log:target) .setup-backdrop { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .setup-badge.is-busy, .setup-steps li.is-busy .setup-mark { animation-duration: 2.4s; }
}

/* ---------- connection problems (dashboard, server list, server page) ---------- */
.link-warning { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; margin: 0 0 20px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--bad); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.link-warning h2 { margin: 0 0 4px; font-size: 1.07rem; }
.link-warning p { margin: 0 0 6px; color: var(--text-2); max-width: 70ch; }
.link-warning-icon { width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--bad-soft); display: grid; place-items: center; }
.link-warning-icon::after { content: "!"; color: var(--bad); font-weight: 750; font-size: 1.07rem; }
.link-warning-actions { display: flex; gap: 8px; }
.link-warning-actions form { margin: 0; }
.link-detail { margin-top: 6px; font-size: 0.857rem; color: var(--text-3); }
.link-detail summary { cursor: pointer; }
.link-detail code { display: block; margin-top: 6px; }
.link-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.link-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.link-list li .btn { margin-left: auto; }
.link-list-name { font-weight: 600; color: var(--text); }
.server-row.is-down { box-shadow: inset 3px 0 0 var(--bad); }
.key-list { display: grid; gap: 8px; margin-top: 10px; }
.key-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 720px) {
  .link-warning { grid-template-columns: auto minmax(0, 1fr); }
  .link-warning-actions { grid-column: 1 / -1; }
}

/* ---------- clients and the client portal ---------- */
.side-account { margin-top: auto; }
.side-account + .side-foot { margin-top: 0; }
.auth-card-wide { width: min(560px, 100%); }
.auth-card .panel { box-shadow: none; padding: 16px; }
.auth-card h2 { font-size: 1.071rem; margin: 0; }
.code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 0; padding: 12px 16px; list-style: none; background: var(--surface-2); border-radius: var(--radius); }
.qr { display: grid; place-items: center; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.qr svg { width: 200px; height: 200px; }
.portal-topbar { justify-content: space-between; gap: 12px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tool { display: grid; gap: 6px; align-content: start; color: var(--text); }
.tool:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.tool h2 { font-size: 1.071rem; margin: 0; }
.tool p { margin: 0; }
.tool .btn { justify-self: start; margin-top: 6px; }
.stat-grid .stat-value { font-size: 1.25rem; display: flex; align-items: center; gap: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0; }
.facts div { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.facts dt { font-size: 0.857rem; color: var(--text-3); }
.facts dd { margin: 2px 0 0; font-weight: 600; word-break: break-all; }
.perm-table td input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.perm-table .row-actions form { display: inline-block; }
.perm-table .row-actions form + form { margin-left: 6px; }
.table-card .inline-form { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); }
.pad { padding: 16px 20px; border-top: 1px solid var(--border); }
.pad h3 { margin: 0; font-size: 1rem; }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
label.check input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--primary); }
.block { display: block; font-weight: 400; }
.danger-zone { border-color: #f3c2c4; }
.invite-card { border-color: var(--primary); background: var(--primary-soft); }
.invite-card input { width: 100%; }

/* Team roles. Only hides what a role cannot use; the router refuses it either way (web::router). */
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain legend { font-weight: 560; margin-bottom: 6px; }
.actions-end { justify-content: flex-end; }
.role-form { flex-wrap: nowrap; }
.role-form select { width: auto; }
.role-viewer main form[method="post"],
.role-viewer .needs-developer,
.role-viewer .needs-admin,
.role-developer .needs-admin { display: none !important; }


/* WordPress.org directory picker: cards laid out like wordpress.org/plugins and /themes,
   in the panel's own colours. Text uses --text and --text-2 only (both above 7:1 on white). */
.dir-picked { display: grid; gap: 12px; padding: 16px 20px; margin-bottom: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.dir-picked-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.dir-picked-label { margin: 0; padding-top: 5px; font-size: 0.821rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.dir-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dir-chip { display: inline-flex; align-items: center; gap: 2px; height: 1.93rem; margin: 0; padding: 0 4px 0 10px; border-radius: 999px; background: var(--primary-soft); color: #0b4fb0; font-size: 0.893rem; font-weight: 560; }
.dir-chip.is-empty { padding: 0 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2); font-weight: 500; }
.dir-chip-x { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border: 0; border-radius: 999px; background: none; color: inherit; font: 600 1.05rem/1 var(--font); cursor: pointer; }
.dir-chip-x:hover { background: var(--bad-soft); color: var(--bad); }
.dir-chip-x:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 1px; }

.dir-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.dir-search { display: flex; gap: 8px; flex: 1 1 380px; margin: 0; }
.dir-search .toolbar-search { max-width: none; }
.dir-count { margin: 0 0 14px; color: var(--text-2); font-size: 0.929rem; }
.dir-count strong { color: var(--text); }
.dir-num { color: var(--text-2); font-size: 0.857rem; font-variant-numeric: tabular-nums; }

/* Star bar: five grey stars with a gold copy clipped to the rating (CSS only, no inline styles). */
.stars { position: relative; display: inline-block; font-size: 0.95rem; line-height: 1; letter-spacing: 1px; color: #d0d5dc; vertical-align: -1px; }
.stars::before { content: "★★★★★"; }
.stars::after { content: "★★★★★"; position: absolute; inset: 0 auto 0 0; overflow: hidden; color: #f0a915; width: 0; white-space: nowrap; }
.stars-1::after { width: 10%; } .stars-2::after { width: 20%; } .stars-3::after { width: 30%; } .stars-4::after { width: 40%; }
.stars-5::after { width: 50%; } .stars-6::after { width: 60%; } .stars-7::after { width: 70%; } .stars-8::after { width: 80%; }
.stars-9::after { width: 90%; } .stars-10::after { width: 100%; }

.dir-name { margin: 0; font-size: 1.071rem; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); }
.dir-name a { color: inherit; }
.dir-name a:hover { color: var(--primary); text-decoration: none; }

.dir-plugins { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.dir-plugin { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.dir-plugin:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lift); }
.dir-plugin.is-picked { border-color: #9cc4ff; box-shadow: 0 0 0 1px #9cc4ff; }
.dir-plugin-main { display: flex; gap: 16px; padding: 18px 18px 14px; flex: 1; }
.dir-icon { flex: none; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--surface-2); box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.06); }
.dir-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dir-icon-empty, .dir-shot-empty { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(135deg, var(--primary-soft), #dbe9ff); color: var(--primary); font-size: 2.2rem; font-weight: 700; }
.dir-plugin-text { min-width: 0; display: grid; gap: 4px; align-content: start; }
.dir-plugin-text .dir-by { margin: 0; white-space: normal; }
.dir-rating { display: flex; align-items: center; gap: 6px; margin: 0; }
.dir-summary { margin: 2px 0 0; color: var(--text-2); font-size: 0.929rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dir-plugin-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.dir-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; padding: 0; list-style: none; min-width: 0; color: var(--text-2); font-size: 0.857rem; }
.dir-meta li { white-space: nowrap; }
.dir-meta strong { color: var(--text); font-weight: 620; font-variant-numeric: tabular-nums; }
.dir-action { display: flex; align-items: center; gap: 8px; margin: 0; flex: none; }

.dir-themes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.dir-theme { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.dir-theme:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lift); }
.dir-theme.is-picked { border-color: #9cc4ff; box-shadow: 0 0 0 1px #9cc4ff; }
.dir-shot { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--border); overflow: hidden; }
.dir-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 300ms var(--ease); }
.dir-theme:hover .dir-shot img { transform: scale(1.02); }
.dir-theme-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; }
.dir-theme-foot form { margin: 0; flex: none; }
.dir-theme-text { min-width: 0; }
.dir-theme-text .dir-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-by { margin: 1px 0 0; color: var(--text-2); font-size: 0.857rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0; padding: 4px 14px 14px; color: var(--text-2); font-size: 0.857rem; }

@media (max-width: 640px) {
  .dir-picked-row { grid-template-columns: 1fr; gap: 6px; }
  .dir-plugin-main { padding: 14px; gap: 12px; }
  .dir-icon { width: 64px; height: 64px; }
  .dir-plugin-foot { flex-direction: column; align-items: stretch; padding: 10px 14px; }
  .dir-action { justify-content: flex-end; }
  .dir-search { flex-basis: 100%; }
}
