/* MLS Host Manager brand theme. Palette follows docs/styling.md (logo quadrants + crimson). */
:root {
  --navy: #00355f;
  --navy-1: #d3dde8;
  --navy-2: #aebfd2;
  --navy-3: #869fb9;
  --sky-5: #25abe2;
  --sky-6: #1a7cad;
  --sky-7: #15668f;
  --sun-5: #fcdf06;
  --ember-5: #f37920;
  --ember-6: #db6614;
  --green-5: #1fa650;
  --green-6: #178a42;
  --crimson-6: #c2253f;
  --crimson-7: #a31d34;
  --brand-stripe: linear-gradient(90deg, #25abe2 0 33.3%, #fcdf06 33.3% 66.6%, #f37920 66.6% 100%);
  --radius-sm: 4px;
  --radius-md: 8px;
  --font: "Public Sans Variable", "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --nav-width: 232px;

  /* Light scheme */
  --paper: #f2f6fa;
  --surface: #fff;
  --surface-2: #f5f8fb;
  --border: #d3dde8;
  --border-soft: #e4ebf2;
  --text: #14212e;
  --dim: #466686;
  --brand-text: #00355f;
  --link: #15668f;
  --field: #fff;
  --field-border: #aebfd2;
  --track: #e4ebf2;
  --ok-text: #15668f;
  --ok-bg: #e6f6fd;
  --ok-border: #95d7f3;
  --positive-text: #127036;
  --positive-bg: #e8f7ed;
  --warn-text: #b4520c;
  --warn-bg: #fef1e6;
  --danger-text: #c2253f;
  --danger-bg: #fdecef;
  --danger-border: #efa6b2;
  --neutral-text: #466686;
  --neutral-bg: #edf2f7;
  --shadow: 0 1px 2px rgb(0 36 68 / 0.06), 0 8px 24px rgb(0 36 68 / 0.12);
  --backdrop: rgb(8 17 26 / 0.55);
  --show-sun: none;
  --show-moon: block;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1622; --surface: #13202e; --surface-2: #1d2a3b; --border: #2c3b50; --border-soft: #1d2a3b;
    --text: #dbe3eb; --dim: #8fa0b4; --brand-text: #fff; --link: #3db5e7; --field: #0d1824; --field-border: #3f5068; --track: #2c3b50;
    --ok-text: #3db5e7; --ok-bg: rgb(37 171 226 / 0.14); --ok-border: rgb(37 171 226 / 0.4);
    --positive-text: #37b865; --positive-bg: rgb(31 166 80 / 0.16);
    --warn-text: #f5883a; --warn-bg: rgb(243 121 32 / 0.15);
    --danger-text: #e57589; --danger-bg: rgb(194 37 63 / 0.18); --danger-border: rgb(219 76 102 / 0.5);
    --neutral-text: #a9b6c5; --neutral-bg: rgb(134 159 185 / 0.14);
    --shadow: 0 8px 28px rgb(0 0 0 / 0.45); --backdrop: rgb(4 9 14 / 0.7);
    --show-sun: block; --show-moon: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b1622; --surface: #13202e; --surface-2: #1d2a3b; --border: #2c3b50; --border-soft: #1d2a3b;
  --text: #dbe3eb; --dim: #8fa0b4; --brand-text: #fff; --link: #3db5e7; --field: #0d1824; --field-border: #3f5068; --track: #2c3b50;
  --ok-text: #3db5e7; --ok-bg: rgb(37 171 226 / 0.14); --ok-border: rgb(37 171 226 / 0.4);
  --positive-text: #37b865; --positive-bg: rgb(31 166 80 / 0.16);
  --warn-text: #f5883a; --warn-bg: rgb(243 121 32 / 0.15);
  --danger-text: #e57589; --danger-bg: rgb(194 37 63 / 0.18); --danger-border: rgb(219 76 102 / 0.5);
  --neutral-text: #a9b6c5; --neutral-bg: rgb(134 159 185 / 0.14);
  --shadow: 0 8px 28px rgb(0 0 0 / 0.45); --backdrop: rgb(4 9 14 / 0.7);
  --show-sun: block; --show-moon: none;
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2 { font-weight: 650; margin: 0; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 17px; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sky-6); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.muted, .subtext { color: var(--dim); font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }

/* Logo tile: the navy quadrant disappears on dark surfaces, so it always sits on white. */
.brand-mark { flex: none; display: block; background: #fff; border-radius: 22%; padding: 4px; }
.brand-mark-ring { box-shadow: 0 0 0 1px var(--navy-1); }

/* Navigation (navy in both schemes) */
.nav { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--nav-width); display: flex; flex-direction: column; padding: 22px 12px 14px; background: var(--navy); color: var(--navy-1); overflow-y: auto; overscroll-behavior: contain; }
.nav::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--brand-stripe); }
.nav :focus-visible { outline-color: var(--sun-5); }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 6px; margin-bottom: 24px; }
.brand { display: grid; color: #fff; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.brand small { color: var(--navy-2); font-size: 0.78rem; font-weight: 500; letter-spacing: 0; }
.nav-links { display: grid; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 10px; border-radius: 6px; color: var(--navy-1); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-link:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
.nav-link.active { background: var(--sky-6); color: #fff; box-shadow: inset 3px 0 0 var(--sun-5); }
.nav-count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--sun-5); color: var(--navy); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.nav-footer { margin-top: auto; padding: 14px 6px 0; border-top: 1px solid rgb(255 255 255 / 0.1); display: flex; align-items: center; gap: 4px; }
.nav-user { display: grid; min-width: 0; margin-right: auto; line-height: 1.3; }
.nav-user-name { color: #fff; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-role { color: var(--navy-3); font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.nav-icon-btn { color: var(--navy-2); }
.nav-icon-btn:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
.icon-sun { display: var(--show-sun); }
.icon-moon { display: var(--show-moon); }
.mobile-header, .nav-scrim { display: none; }

/* Main layout */
main { margin-left: var(--nav-width); padding: 24px 32px 56px; max-width: calc(1500px + var(--nav-width)); }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; min-height: 40px; }
.page-header h1 { min-width: 0; overflow-wrap: anywhere; }
.headline { font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.6rem); font-weight: 350; line-height: 1.2; letter-spacing: -0.01em; max-width: 28ch; margin: 0 0 20px; text-wrap: balance; }
.headline strong { font-weight: 750; }
.headline-calm strong { color: var(--positive-text); }
.headline-alert strong { color: var(--danger-text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--sky-6); border-color: var(--sky-6); color: #fff; }
.btn-primary:hover { background: var(--sky-7); border-color: var(--sky-7); }
.btn-danger { background: var(--crimson-6); border-color: var(--crimson-6); color: #fff; }
.btn-danger:hover { background: var(--crimson-7); border-color: var(--crimson-7); }
.btn-small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn-small.btn-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger-text); }
.btn-small.btn-danger:hover { border-color: var(--danger-border); }
.btn:disabled, .btn:disabled:hover { cursor: not-allowed; opacity: 0.55; }

/* Cards and panels */
.stat, .panel, .host-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px; min-width: 0; }
.stat-label { color: var(--dim); font-size: 13px; font-weight: 500; }
.stat-value { margin-top: 4px; font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-value small { color: var(--dim); font-size: 13px; font-weight: 500; }
.panel { padding: 20px; margin-bottom: 20px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.empty { padding: 36px 16px; text-align: center; color: var(--dim); }
.empty .btn { margin-top: 16px; }

/* Host cards */
.host-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.host-card { overflow: hidden; min-width: 0; }
.host-card:hover { border-color: var(--navy-3); }
.host-card-link { display: block; padding: 16px 18px; color: inherit; text-decoration: none; }
.host-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.host-card-top > div { min-width: 0; }
.host-name { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.host-address { margin: 2px 0 14px; color: var(--dim); font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.host-metrics { display: flex; flex-wrap: wrap; gap: 12px 20px; padding-top: 12px; border-top: 1px solid var(--border-soft); color: var(--dim); font-size: 12px; }
.host-metrics strong { display: block; color: var(--text); font-size: 16px; }
.host-resource-meters { display: grid; gap: 10px; margin-top: 14px; }
.host-refresh { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "updated management" "controls controls"; align-items: center; gap: 8px 12px; padding: 10px 18px; border-top: 1px solid var(--border-soft); background: var(--surface-2); }
.host-updated { grid-area: updated; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 12px; }
.host-management-actions { grid-area: management; display: flex; gap: 6px; }
.host-refresh-controls { grid-area: controls; display: flex; align-items: center; gap: 8px; min-width: 0; }
.host-refresh label { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; }
.host-refresh select { width: auto; padding: 4px 6px; font-size: 13px; }

/* Resource meters */
.resource-meter { display: grid; gap: 6px; }
.resource-meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 12px; font-weight: 500; }
.resource-meter-head strong { color: var(--text); font-size: 12px; font-weight: 600; text-align: right; }
.resource-stat { display: flex; align-items: center; }
.resource-stat .resource-meter { width: 100%; }
.resource-meter-track { display: block; width: 100%; height: 7px; border: 0; border-radius: 999px; background: var(--track); overflow: hidden; -webkit-appearance: none; appearance: none; }
.resource-meter-track::-webkit-progress-bar { background: var(--track); border-radius: 999px; }
/* Each vendor pseudo-element needs its own rule: one unknown selector voids the whole list. */
.resource-meter-track::-webkit-progress-value { background: var(--sky-5); border-radius: 999px; }
.resource-meter-track::-moz-progress-bar { background: var(--sky-5); border-radius: 999px; }
.resource-meter.level-warn .resource-meter-track::-webkit-progress-value { background: var(--ember-5); }
.resource-meter.level-warn .resource-meter-track::-moz-progress-bar { background: var(--ember-5); }
.resource-meter.level-high .resource-meter-track::-webkit-progress-value { background: var(--crimson-6); }
.resource-meter.level-high .resource-meter-track::-moz-progress-bar { background: var(--crimson-6); }
.resource-meter.unavailable .resource-meter-track::-webkit-progress-value { background: var(--navy-3); }
.resource-meter.unavailable .resource-meter-track::-moz-progress-bar { background: var(--navy-3); }
.host-summary-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Badges and status: green = online/positive, red = offline/negative, ember = transitional, neutral = inactive. */
.pill, .health { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.pill::before, .health::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; flex: none; }
.pill-run, .health.online { color: var(--positive-text); background: var(--positive-bg); }
.pill-exit, .health.offline { color: var(--danger-text); background: var(--danger-bg); }
.pill-warn { color: var(--warn-text); background: var(--warn-bg); }
.pill-stop { color: var(--neutral-text); background: var(--neutral-bg); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--dim); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.actions { display: flex; gap: 6px; justify-content: flex-end; min-width: max-content; }
/* A table cell must stay display: table-cell, or its borders and height drift from the rest of the row. */
td.actions { display: table-cell; text-align: right; white-space: nowrap; width: 1%; }
td.actions > * { vertical-align: middle; }
td.actions > * + * { margin-left: 6px; }
tr.muted-row td:not(.actions) { opacity: .6; }

/* Host detail */
.detail-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 20px; }
.detail-top .mono { overflow-wrap: anywhere; }
.back { color: var(--link); font-size: 14px; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }
.tabs { display: flex; gap: 20px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { min-height: 40px; padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--dim); font-weight: 600; white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--sky-6); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.full { grid-column: 1 / -1; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 14px; }
input, textarea, select { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--field-border); border-radius: var(--radius-sm); background: var(--field); font-size: 14px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--sky-6); outline-offset: 0; border-color: var(--sky-6); }
input::placeholder, textarea::placeholder { color: var(--dim); opacity: 0.8; }
textarea { min-height: 104px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 1px 0 0; padding: 0; flex: none; accent-color: var(--sky-6); }
.error { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--danger-border); border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger-text); font-size: 14px; }
.notice { margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--ok-border); border-radius: var(--radius-sm); background: var(--ok-bg); color: var(--text); font-size: 14px; line-height: 1.55; }
.notice .fingerprint { display: block; margin: 6px 0; font-size: 14px; }
.fingerprint { overflow-wrap: anywhere; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Read-only role: management controls are removed before first paint; the server enforces the same rule. */
.read-only [data-admin-only] { display: none !important; }
.no-release [data-releaser-only] { display: none !important; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset:disabled input, fieldset:disabled textarea, fieldset:disabled select { opacity: 0.7; cursor: not-allowed; }

/* Audit log */
.audit-filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; margin-bottom: 16px; }
.audit-filters .panel-actions { grid-column: 1 / -1; justify-content: flex-end; }
.audit-time { white-space: nowrap; }
.audit-detail { min-width: 180px; max-width: 360px; color: var(--dim); overflow-wrap: anywhere; }
.audit-target { max-width: 260px; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; color: var(--dim); font-size: 14px; }

/* Logs keep a terminal look in both schemes. */
pre.logs { margin: 0; padding: 14px; max-height: 480px; overflow: auto; border-radius: var(--radius-sm); background: #0d1824; color: #c9d3de; font: 12px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Dialogs (native <dialog>, top layer) */
.modal-dialog { width: min(560px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible; }
.modal-dialog::backdrop { background: var(--backdrop); }
.modal-dialog.modal-wide { width: min(960px, calc(100% - 32px)); }
.confirm-dialog { width: min(440px, calc(100% - 32px)); }
.modal { max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.modal h2 { font-size: 19px; margin-bottom: 6px; }
.modal > p { margin: 0 0 18px; color: var(--dim); font-size: 14px; line-height: 1.55; }
.modal .panel-head h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* Toasts (top right) */
.toast { position: fixed; top: 16px; right: 16px; z-index: 50; max-width: min(420px, calc(100% - 32px)); padding: 12px 14px 12px 16px; border: 1px solid var(--border); border-left: 4px solid var(--green-5); border-radius: var(--radius-md); background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 14px; opacity: 0; transform: translateY(-8px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.toast.toast-error { border-left-color: var(--crimson-6); }
.toast.show { opacity: 1; transform: none; }

/* Responsive */
@media (max-width: 1100px) {
  .audit-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-filters .audit-search { grid-column: 1 / -1; }
  .host-summary-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .mobile-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0 max(8px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--border); }
  .mobile-brand { color: var(--brand-text); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
  .mobile-header .icon-btn { width: 44px; height: 44px; }
  .mobile-header .icon-btn .icon { width: 22px; height: 22px; }
  .nav { width: min(280px, 85vw); padding-top: calc(22px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); visibility: hidden; transform: translateX(-100%); transition: transform 0.2s ease, visibility 0s linear 0.2s; }
  .nav.mobile-open { visibility: visible; transform: none; box-shadow: 16px 0 40px rgb(0 0 0 / 0.35); transition: transform 0.2s ease; }
  .nav-link { min-height: 44px; }
  .icon-btn.nav-icon-btn { width: 44px; height: 44px; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 25; background: var(--backdrop); }
  .nav-scrim[hidden] { display: none; }
  main { margin-left: 0; padding: 16px max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  h1 { font-size: 22px; }
  .page-header { margin-bottom: 16px; }
  .panel { padding: 16px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 22px; }
  .host-summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .host-summary-stats .resource-stat:last-child { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .audit-filters { grid-template-columns: 1fr 1fr; }
  /* 16px inputs stop iOS Safari from zooming on focus. */
  input, textarea, select, .host-refresh select { font-size: 16px; }
  .btn { min-height: 40px; }
  .btn-small { min-height: 36px; }
  .modal { padding: 18px; }
  .modal-actions .btn { flex: 1 1 auto; }
  .toast { top: calc(60px + env(safe-area-inset-top)); left: 16px; right: 16px; max-width: none; }
  table { font-size: 13px; }
}
@media (max-width: 460px) {
  .stats { gap: 10px; }
  .stat-value small { display: block; }
  .host-refresh { grid-template-columns: 1fr; grid-template-areas: "updated" "management" "controls"; }
  .host-management-actions, .host-refresh-controls { flex-wrap: wrap; }
  .host-management-actions .btn { flex: 1; }
  .resource-meter-head { flex-direction: column; align-items: flex-start; gap: 0; }
  .resource-meter-head strong { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Releases */
.release-table td { vertical-align: top; }
.release-cell { min-width: 220px; }
.release-version { margin-bottom: 6px; }
.release-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.release-actions, .panel-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.connection-panel .panel-head { margin-bottom: 0; }
.service-map { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.service-map legend { padding: 0 4px; font-weight: 600; font-size: 14px; }
.service-map p { grid-column: 1 / -1; margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 767px) { .service-map, .facts { grid-template-columns: 1fr; } }

/* Agent setup (Add host / new enrollment code) */
.setup-heading { margin: 20px 0 8px; font-size: 15px; }
.setup-more, .setup-files { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.setup-more > summary, .setup-files > summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--sky-6); }
.setup-more[open] > summary, .setup-files[open] > summary { margin-bottom: 12px; }
.setup-files { margin-top: 10px; }
.setup-files .setup-block + .setup-block { margin-top: 12px; }
.setup-login { align-self: end; }
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.setup-head > span { min-width: 0; overflow-wrap: anywhere; }
pre.setup-code { max-height: 300px; }
@media (max-width: 640px) { .modal .form-grid { grid-template-columns: 1fr; } }
.setup-more textarea { min-height: 56px; }

/* Stack settings help */
.hint { display: block; font-weight: 400; font-size: 12px; line-height: 1.45; color: var(--dim); }
label.check .hint { margin-top: 2px; }
.stack-intro { margin: 0 0 14px; color: var(--dim); font-size: 14px; line-height: 1.55; }
.notice .basis { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }

/* Live service restart status */
.service-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice.notice-ok { border-color: var(--positive-text); background: var(--positive-bg); color: var(--positive-text); }
.notice.service-status:not(.notice-ok) { border-color: var(--warn-text); background: var(--warn-bg); color: var(--warn-text); }
.spinner { width: 14px; height: 14px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-right-color: currentColor; opacity: 0.6; } }
