/* Browser Pool console. Text colours are chosen for >= 4.5:1 contrast on
   their backgrounds; nothing is smaller than 12px. */
:root {
  --ink: #1f2d3d;
  --ink-2: #526071;          /* secondary text: 5.9:1 on --page, 6.4:1 on white */
  --page: #f3f5f8;
  --surface: #ffffff;
  --subtle: #f7f9fb;
  --border: #dfe5ec;
  --divider: #edf1f5;
  --accent: #00756f;         /* filled buttons: white text 5.6:1 */
  --accent-hover: #00625d;
  --accent-text: #00706a;    /* accent text on white: 6.0:1 */
  --accent-soft: #e6f4f3;
  --danger: #b42318;         /* white text 6.6:1 */
  --danger-hover: #971c13;
  --danger-text: #a12f2f;
  --focus: #1b8f89;
  --sidebar: #1d2939;
  --sidebar-text: #c3cfdd;
  --sidebar-muted: #8fa2b8;
  --kind-idle: #1f9d6c;
  --kind-leased: #3b73c4;
  --kind-health: #7a55c7;
  --kind-spawning: #d99a1e;
  --kind-draining: #8c99a8;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Source Code Pro", "DejaVu Sans Mono", "Liberation Mono", monospace;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(22, 38, 58, .06);
  --sidebar-width: 232px;
}

/* ───────────── base ───────────── */
[hidden] { display: none !important; }
html { font-size: 14px; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.55; }
h1, h2, h3, .ui.button, .ui.form input, .ui.form select, .ui.input input, input, select, button { font-family: var(--font); }
h1, h2, h3 { color: var(--ink); line-height: 1.3; }
a { color: var(--accent-text); }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ui.button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 13px; }
code { background: #eef2f6; color: #3a4a5c; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--ink-2); }
.muted-line { display: block; color: var(--ink-2); font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 200; background: var(--surface); color: var(--accent-text); padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }
.clipboard-buffer { position: fixed; top: -1000px; left: -1000px; opacity: 0; }

/* ───────────── buttons (Semantic overrides) ───────────── */
.ui.button { font-weight: 600; border-radius: 6px; }
.ui.button > .icon:not(.button) { opacity: 1; }
.ui.button.primary, .ui.primary.button { background: var(--accent); color: #fff; }
.ui.button.primary:hover, .ui.button.primary:focus { background: var(--accent-hover); color: #fff; }
.ui.button.danger { background: var(--danger); color: #fff; }
.ui.button.danger:hover, .ui.button.danger:focus { background: var(--danger-hover); color: #fff; }
.ui.button.danger-outline, .ui.basic.button.danger-outline { background: var(--surface) !important; color: var(--danger-text) !important; box-shadow: inset 0 0 0 1px #e4b4ae !important; }
.ui.button.danger-outline:hover, .ui.basic.button.danger-outline:hover { background: #fdf1f0 !important; }
.ui.basic.button { color: var(--ink) !important; }
.ui.small.button { font-size: 13px; }

/* ───────────── badges ───────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.badge + .badge { margin-left: 6px; }
.badge-idle { background: #e6f5ee; color: #17694f; }
.badge-leased { background: #e8f0fb; color: #28599a; }
.badge-health { background: #f1ebfb; color: #5b3d99; }
.badge-spawning { background: #fdf3e1; color: #8a5a0b; }
.badge-draining { background: #eef1f4; color: #4b5968; }
.badge-error { background: #fbeaea; color: #a12f2f; }
.badge-mine { background: var(--accent-soft); color: #005f5a; margin-left: 6px; }
.role-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f4; color: #4b5968; }
.role-badge[data-role="admin"] { background: #f1ebfb; color: #5b3d99; }
.count-pill { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: #eef1f4; color: #3a4a5c; font-size: 12px; font-weight: 600; vertical-align: middle; }

/* ───────────── login ───────────── */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; box-sizing: border-box; background: radial-gradient(ellipse at 20% 15%, #e2f1ef, transparent 50%), var(--page); }
.login-card { width: min(420px, 100%); box-sizing: border-box; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: 12px; padding: 36px 32px 28px; box-shadow: 0 8px 30px rgba(22, 38, 58, .08); }
.login-card h1 { font-size: 22px; margin: 16px 0 8px; }
.login-card h1:focus { outline: none; }
.login-lead { color: var(--ink-2); margin: 0 0 24px; }
.login-card .ui.button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.login-status { margin: 16px 0 0; color: var(--ink-2); font-size: 14px; }
.login-status[data-tone="error"] { color: var(--danger-text); }
.login-status[data-tone="success"] { color: #145c43; }
.ui.disabled.button, .ui.button[aria-disabled="true"] { pointer-events: none; }

/* ───────────── shell ───────────── */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); box-sizing: border-box; background: var(--sidebar); color: var(--sidebar-text); padding: 18px 14px; display: flex; flex-direction: column; z-index: 50; overflow-y: auto; }
.sidebar :focus-visible { outline-color: #7fe0d8; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 17px; font-weight: 700; padding: 4px 8px; text-decoration: none; border-radius: 6px; }
.brand:hover { color: #fff; }
.drawer-close { display: none; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav li + li { margin-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; box-sizing: border-box; border: 0; border-radius: 6px; background: transparent; color: var(--sidebar-text); font: inherit; font-size: 14px; text-align: left; text-decoration: none; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(33, 189, 179, .16); color: #7fe0d8; font-weight: 600; box-shadow: inset 3px 0 #21bdb3; }
.nav-item > .icon { margin: 0; width: 18px; }
.nav-count { margin-left: auto; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #dce4ef; font-size: 12px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-user { display: none; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 35, .5); z-index: 40; }

.workspace { margin-left: var(--sidebar-width); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--border); }
.menu-button { display: none; }
.topbar-status { display: flex; align-items: center; gap: 16px; color: var(--ink-2); font-size: 13px; min-width: 0; }
.connection { display: inline-flex; align-items: center; gap: 6px; color: #145c43; font-weight: 600; }
.connection[data-state="offline"] { color: var(--danger-text); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kind-idle); flex: none; }
.connection[data-state="offline"] .status-dot { background: var(--danger); }
.updated { white-space: nowrap; }
#last-updated { font-variant-numeric: tabular-nums; color: var(--ink); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.topbar-user .ui.button { margin: 0 0 0 4px; }

main { max-width: 1440px; margin: 0 auto; padding: 28px 32px 48px; box-sizing: border-box; }
main:focus { outline: none; }
.view > * + * { margin-top: 20px; }

/* ───────────── view heading ───────────── */
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-title h1 { display: inline-block; font-size: 24px; margin: 0; letter-spacing: -.3px; }
.view-title h1:focus { outline: none; }
.view-title h1:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.view-description { margin: 6px 0 0; color: var(--ink-2); max-width: 760px; }
.view-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.view-actions .ui.button { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.view-actions .ui.button > .icon { margin: 0; }

/* ───────────── cards and panels ───────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px 14px; }
.panel-heading h2 { font-size: 16px; margin: 0; }
.panel-description { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.panel-body { padding: 0 20px 20px; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.callout { padding: 12px 16px; border-radius: var(--radius); border: 1px solid #c5d7f0; background: #e8f0fb; color: #28599a; margin: 0; }
.callout[data-tone="warning"], .callout.warning { border-color: #f0d9a0; background: #fff6e0; color: #7a5200; }
.callout[data-tone="error"] { border-color: #f0c4c4; background: #fbeaea; color: var(--danger-text); }
.callout[data-tone="success"] { border-color: #bfe3d0; background: #eaf6f0; color: #145c43; }

.empty-state { padding: 32px 20px; text-align: center; color: var(--ink-2); }
.empty-state strong { display: block; color: var(--ink); font-size: 15px; }
.empty-state p { margin: 6px 0 0; }
.empty-state .ui.button { margin-top: 12px; }

/* ───────────── overview ───────────── */
.health-banner { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid #d6dde5; background: var(--surface); color: var(--ink); }
.health-banner .banner-icon .icon { margin: 0; font-size: 18px; }
.banner-text { margin: 0; flex: 1; min-width: 0; }
.banner-state { font-weight: 700; }
.banner-link { font-weight: 600; white-space: nowrap; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.health-banner[data-tone="ok"] { background: #eaf6f0; border-color: #bfe3d0; color: #145c43; }
.health-banner[data-tone="warning"] { background: #fff6e0; border-color: #f0d9a0; color: #7a5200; }
.health-banner[data-tone="error"] { background: #fbeaea; border-color: #f0c4c4; color: var(--danger-text); }
.health-banner[data-tone="info"] { background: #e8f0fb; border-color: #c5d7f0; color: #28599a; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { padding: 18px 20px; }
.stat-card.attention { border-color: #f0d9a0; box-shadow: inset 4px 0 #d99a1e; }
.stat-label { margin: 0; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.stat-value { margin: 8px 0 6px; display: flex; align-items: baseline; gap: 6px; }
.stat-number { font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-number.small { font-size: 24px; }
.stat-unit { color: var(--ink-2); font-size: 14px; }
.stat-foot { margin: 0; color: var(--ink-2); font-size: 13px; }

.composition-bar { display: flex; height: 16px; border-radius: 8px; background: #e9edf2; overflow: hidden; }
.bar-segment { height: 100%; }
.bar-segment + .bar-segment { box-shadow: inset 2px 0 var(--surface); }
.kind-idle { background: var(--kind-idle); }
.kind-leased { background: var(--kind-leased); }
.kind-health { background: var(--kind-health); }
.kind-spawning { background: var(--kind-spawning); }
.kind-draining { background: var(--kind-draining); }
.kind-free { background: #e9edf2; box-shadow: inset 0 0 0 1px #b7c1cc; }
.composition-legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.composition-legend li { display: flex; align-items: center; gap: 8px; }
.composition-legend li.zero strong { color: var(--ink-2); font-weight: 500; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend-label { color: var(--ink-2); }

.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; color: var(--ink-2); font-size: 13px; }
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.line-swatch { width: 16px; height: 3px; border-radius: 2px; }
.line-swatch.leased { background: var(--kind-idle); }
.line-swatch.queued { background: #c47f0a; }
.chart-body { min-height: 24px; }
.chart { display: block; }
.chart-grid { stroke: #e5e9ef; stroke-dasharray: 3 4; }
.chart-label { fill: var(--ink-2); font-size: 12px; font-family: var(--font); }
.chart-area { fill: rgba(31, 157, 108, .08); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart-line.leased { stroke: var(--kind-idle); }
.chart-line.queued { stroke: #c47f0a; }
.chart-hint { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ───────────── toolbar, filters, search ───────────── */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 20px; }
.panel-heading + .toolbar { padding-top: 0; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segment { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; }
.segment:hover { background: var(--subtle); }
.segment[aria-pressed="true"] { background: var(--accent-soft); border-color: #8fcfca; color: #005f5a; font-weight: 700; }
.segment-count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.segment[aria-pressed="true"] .segment-count { color: #005f5a; }
.search-field { position: relative; width: 280px; max-width: 100%; }
.search-field > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); margin: 0; color: var(--ink-2); pointer-events: none; }
.search-field input { width: 100%; box-sizing: border-box; height: 36px; padding: 0 12px 0 32px; border: 1px solid #c9d2dc; border-radius: 6px; font-size: 14px; color: var(--ink); background: var(--surface); }
.search-field input::placeholder, .ui.form input::placeholder { color: #6b7888; opacity: 1; }
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.inline-field select { height: 36px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 0 8px; font-size: 14px; background: var(--surface); color: var(--ink); }
.list-count { margin: 0; padding: 12px 20px; border-top: 1px solid var(--divider); color: var(--ink-2); font-size: 13px; }

/* ───────────── tables ───────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--subtle); padding: 10px 14px; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td.actions { text-align: right; white-space: nowrap; }
.data-table td.actions .ui.button { margin: 0 0 0 6px; }
.data-table tr.inactive td { color: var(--ink-2); }
.data-table tr.expanded td { background: #f6fbfa; }
.details-row td { background: var(--subtle) !important; padding: 14px 20px 16px !important; }
.id-line { display: flex; align-items: center; gap: 2px; }
.row-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font-size: 13px; }
.row-toggle:hover { background: #eef2f6; }
.row-toggle .icon { margin: 0; color: var(--ink-2); }
.copy-button { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--ink-2); flex: none; }
.copy-button:hover { background: #eef2f6; color: var(--ink); }
.copy-button.copied { color: var(--accent-text); }
.copy-button .icon { margin: 0; }
.holder { max-width: 240px; overflow-wrap: anywhere; }
.countdown { white-space: nowrap; font-variant-numeric: tabular-nums; }
.countdown.urgent { color: var(--danger-text); font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 24px; margin: 0; }
.detail-item dt { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.detail-item dd { margin: 4px 0 0; display: flex; align-items: center; gap: 4px; min-width: 0; }
.detail-item dd .mono { overflow-wrap: anywhere; min-width: 0; }
.events-scroll { max-height: 440px; overflow-y: auto; }
.events-scroll thead th { position: sticky; top: 0; z-index: 1; }
.repeat { color: var(--ink-2); font-weight: 600; }
.key-name { display: block; }
.key-prefix { display: block; color: var(--ink-2); }
.scope-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.scope-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.soon { display: block; color: #7a5200; font-weight: 600; font-size: 13px; }

/* ───────────── forms ───────────── */
.ui.form .field > label, .field-label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.ui.form .field { margin-bottom: 16px; }
.ui.form input:not([type="checkbox"]):not([type="radio"]), .ui.form select { font-size: 14px; border-color: #c9d2dc; }
.ui.form select { height: 38px; }
.hint { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; }
.field-error { margin: 6px 0 0; color: var(--danger-text); font-size: 13px; font-weight: 600; }
.ui.form .field.error input:not([type="checkbox"]):not([type="radio"]) { background: #fff; border-color: #d98a84; color: var(--ink); }
.field-row { display: grid; gap: 0 16px; margin-bottom: 16px; }
.field-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.unit-input { display: flex; gap: 6px; }
.unit-input input { flex: 1; min-width: 0; }
.ui.form .unit-input select { width: 84px; flex: none; }
.check, .ui.form .field > label.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 500; }
.check input, .preset input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.form-actions .ui.button { margin: 0; }
.dirty-note { margin: 0 auto 0 0; color: #7a5200; font-weight: 600; font-size: 13px; }
.dirty-note .icon { margin-right: 4px; }
.preset-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.preset { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.preset:hover { border-color: #9fb0c2; }
.preset:has(input:checked) { border-color: var(--accent); background: #f0f9f8; box-shadow: inset 0 0 0 1px var(--accent); }
.preset:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.preset-text { display: flex; flex-direction: column; gap: 2px; }
.preset-description { color: var(--ink-2); font-size: 13px; }
.scope-codes { font-family: var(--mono); font-size: 12px; color: #3a4a5c; }
.scope-fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.scope-fieldset legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.scope-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.scope { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.scope:has(input:checked) { border-color: #8fcfca; background: #f6fbfb; }
.scope-name { display: block; font-weight: 600; }
.scope code { font-size: 12px; }

/* ───────────── security ───────────── */
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.summary-card { padding: 16px 18px; }
.summary-value { margin-top: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.summary-note { color: var(--ink-2); font-size: 13px; }
.counter { color: var(--ink-2); font-size: 13px; }
.counter strong { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }

/* ───────────── accounts ───────────── */
.sync-status { margin: 0 0 12px; }
.sync-cooldown { margin: -4px 0 12px; color: var(--ink-2); font-size: 13px; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: #e8f0fb; color: #28599a; font-size: 13px; }
.chip.zero { background: #f1f4f7; color: var(--ink-2); }
.sync-body .callout { margin-top: 12px; }
.notice-list { margin: 12px 0 0; padding-left: 20px; color: var(--ink); font-size: 13px; }

/* ───────────── toasts ───────────── */
.toasts { position: fixed; top: 72px; right: 16px; z-index: 1000; width: min(380px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-region { display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--kind-leased); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(22, 38, 58, .14); pointer-events: auto; }
.toast-success { border-left-color: var(--kind-idle); }
.toast-error { border-left-color: var(--danger); }
.toast-symbol .icon { margin: 0; }
.toast-success .toast-symbol { color: #17694f; }
.toast-error .toast-symbol { color: var(--danger-text); }
.toast-info .toast-symbol { color: #28599a; }
.toast-text { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--ink-2); font-size: 18px; line-height: 1; flex: none; }
.toast-close:hover { background: #eef2f6; }

/* ───────────── dialogs ───────────── */
.dialog { border: 0; border-radius: 12px; padding: 0; width: min(520px, calc(100% - 32px)); box-sizing: border-box; color: var(--ink); box-shadow: 0 24px 80px rgba(15, 23, 35, .3); }
.dialog.wide { width: min(680px, calc(100% - 32px)); }
.dialog::backdrop { background: rgba(15, 23, 35, .55); }
.dialog form { margin: 0; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 8px; }
.dialog-heading h2 { font-size: 18px; margin: 0; }
.dialog-close { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: #f1f4f7; color: var(--ink-2); flex: none; }
.dialog-close:hover { background: #e6eaef; color: var(--ink); }
.dialog-close .icon { margin: 0; }
.dialog-body { padding: 8px 24px 8px; }
.dialog-body p { margin: 0 0 10px; }
.dialog-body.help { max-height: min(62vh, 560px); overflow-y: auto; }
.dialog-body.help h3 { font-size: 15px; margin: 16px 0 6px; }
.dialog-body.help h3:first-child { margin-top: 0; }
.dialog-body.help ul { margin: 0 0 8px; padding-left: 20px; }
.dialog-body.help li { margin-bottom: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; }
.dialog-actions .ui.button { margin: 0; }
.dialog-label, .dialog-body .dialog-label { display: block; margin: 16px 0 6px; font-weight: 600; }
.copy-field { display: flex; gap: 8px; align-items: stretch; }
.copy-field input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid #c9d2dc; border-radius: 6px; font-family: var(--mono); font-size: 13px; color: var(--ink); background: var(--subtle); }
.copy-field .ui.button { margin: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.copy-field .ui.button .icon { margin: 0; }
.copy-field pre { flex: 1; min-width: 0; margin: 0; padding: 12px 14px; border-radius: 6px; background: var(--sidebar); color: #e6edf5; font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.copy-field.code { align-items: flex-start; }

/* ───────────── responsive ───────────── */
@media (max-width: 1180px) {
  .stat-grid, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .preset-options { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .sidebar { width: min(300px, 86vw); transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.drawer-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  .drawer-close { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .08); color: #fff; }
  .drawer-close .icon { margin: 0; }
  .sidebar-user { display: block; margin-top: 12px; padding: 12px; border-radius: 8px; background: rgba(255, 255, 255, .05); }
  .sidebar-user .user-line { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: #fff; }
  .sidebar-user .user-name { max-width: 160px; }
  .sidebar-user .ui.button { width: 100%; margin: 0; background: transparent; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); }
  .sidebar-user .ui.button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .workspace { margin-left: 0; }
  .topbar { height: 56px; padding: 0 12px; gap: 10px; }
  .menu-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); flex: none; }
  .menu-button .icon { margin: 0; font-size: 16px; }
  .topbar-status { gap: 12px; flex-wrap: wrap; }
  .updated-label { display: none; }
  .topbar-user { display: none; }
  main { padding: 20px 16px 40px; }
  .view-heading { align-items: flex-start; }
  .view-title h1 { font-size: 22px; }
  .stat-number { font-size: 26px; }
  .stat-card { padding: 14px 16px; }
  .health-banner { align-items: flex-start; flex-wrap: wrap; }
  .banner-text { flex-basis: calc(100% - 40px); }
  .banner-link { margin-left: 30px; }
  .panel-heading { padding: 16px 16px 12px; }
  .panel-body { padding: 0 16px 16px; }
  .toolbar { padding: 12px 16px; }
  .search-field { width: 100%; }
  .field-row.two, .field-row.three { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .summary-card { padding: 14px; }
  .list-count { padding: 12px 16px; }
  .composition-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
  .chart-legend { width: 100%; }

  /* Tables become one card per row. */
  .table-wrap { overflow: visible; padding: 0 12px 4px; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; box-sizing: border-box; }
  .data-table tr { margin: 0 0 12px; padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .data-table tr.expanded { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; border-bottom: 0; }
  .data-table tr.details-row { margin-top: 0; border-top: 1px dashed var(--border); border-top-left-radius: 0; border-top-right-radius: 0; background: var(--subtle); }
  .data-table td, .data-table td:first-child, .data-table td:last-child { display: flow-root; padding: 8px 0; border: 0; text-align: right; overflow-wrap: anywhere; }
  .data-table td::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-2); }
  .data-table td + td { border-top: 1px solid var(--divider); }
  .data-table tr.expanded td { background: transparent; }
  .data-table td.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 10px; }
  .data-table td.actions::before, .details-row td::before { display: none; }
  .data-table td.actions .ui.button { margin: 0; flex: 1 1 auto; }
  .data-table td.actions.empty { display: none; }
  .data-table .details-row td { display: block; padding: 12px 0 !important; text-align: left; background: transparent !important; }
  .scope-list { align-items: flex-end; }
  .data-table .id-line { justify-content: flex-start; }
  .holder { max-width: none; }
  /* Browser cards: ID and state share the header line; empty fields are left out. */
  .browsers-table tr:not(.details-row) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .browsers-table td { grid-column: 1 / -1; }
  .browsers-table td.id-cell { grid-column: 1; }
  .browsers-table td.state-cell { grid-column: 2; border-top: 0; }
  .browsers-table td.id-cell::before, .browsers-table td.state-cell::before { display: none; }
  .browsers-table td.is-empty { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .events-scroll { max-height: none; }
  .dialog-heading { padding: 18px 18px 6px; }
  .dialog-body { padding: 6px 18px; }
  .dialog-actions { padding: 12px 18px 18px; }
  .copy-field { flex-direction: column; }
  .toasts { top: 64px; right: 8px; width: calc(100% - 16px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
