/* ==========================================================================================================
   Enterprise theme — bright, decisive, panel-based (Azure / GCP / AWS console family).

   Loaded after console.css by both layouts, so it re-themes every one of the 113 templates at once. It only
   restyles: no class, id, name or data-* hook is renamed, and every colour still comes from a token, so both
   themes keep working and scripts/contrast-check.ts keeps gating the pairs.

   Anatomy:
   - A solid brand top bar carries the product name, search and the user: the strongest colour on screen.
   - A light sidebar under it, with the active page marked by a bold accent bar and a tinted row.
   - Page titles sit on their own white band with a rule beneath, so "where am I" never competes with content.
   - Cards are panels: a tinted header strip with a rule, a soft shadow, and a body with room.
   - Tables have a tinted header row, zebra rows and a clear hover.
   ========================================================================================================== */

:root {
  /* brand: a deep, saturated enterprise blue */
  --brand: oklch(48% 0.19 259);
  --brand-hover: oklch(42% 0.18 259);
  --brand-fg: oklch(100% 0 0);
  --brand-soft: oklch(95.5% 0.035 255);
  --brand-strong: oklch(33% 0.12 259);

  /* surfaces: a cool grey canvas so white panels read as objects */
  --bg-canvas: oklch(96.4% 0.006 255);
  --bg-surface: oklch(100% 0 0);
  --bg-sunken: oklch(97.4% 0.005 255);
  --panel-head: oklch(97.8% 0.005 255);
  --border: oklch(89.5% 0.008 255);
  --border-strong: oklch(80% 0.012 255);
  --fg: oklch(19% 0.02 260);
  --muted-fg: oklch(45% 0.018 260);

  /* top bar */
  --topbar-bg: var(--brand-strong);
  --topbar-fg: oklch(98% 0.005 255);
  --topbar-muted: oklch(83% 0.04 255);
  --topbar-field: oklch(100% 0 0 / .12);
  --topbar-field-border: oklch(100% 0 0 / .22);

  /* light sidebar */
  --sidebar: oklch(100% 0 0);
  --sidebar-foreground: oklch(25% 0.02 260);
  --sidebar-accent: oklch(96% 0.012 255);
  --sidebar-accent-foreground: oklch(19% 0.02 260);
  --sidebar-muted: oklch(45% 0.018 260);
  --sidebar-border: oklch(90% 0.008 255);
  --sidebar-active-bg: var(--brand-soft);
  --sidebar-active-fg: oklch(38% 0.17 259);

  --radius: .375rem; --radius-sm: .3rem; --radius-lg: .5rem;
  --shadow-panel: 0 1px 2px oklch(25% 0.03 260 / .06), 0 1px 3px oklch(25% 0.03 260 / .08);
  --topbar-height: 3.25rem;
}

:root[data-theme="dark"] {
  --brand: oklch(68% 0.15 255);
  --brand-hover: oklch(74% 0.13 255);
  --brand-fg: oklch(15% 0.02 260);
  --brand-soft: oklch(30% 0.07 258);
  --brand-strong: oklch(26% 0.07 259);

  --bg-canvas: oklch(15.5% 0.01 260);
  --bg-surface: oklch(20% 0.012 260);
  --bg-sunken: oklch(23% 0.013 260);
  --panel-head: oklch(22.5% 0.014 260);
  --border: oklch(100% 0 0 / .11);
  --border-strong: oklch(100% 0 0 / .2);
  --fg: oklch(96% 0.004 260);
  --muted-fg: oklch(75% 0.014 260);

  --topbar-bg: oklch(23% 0.06 259);
  --topbar-fg: oklch(97% 0.005 255);
  --topbar-muted: oklch(80% 0.03 255);

  --sidebar: oklch(18% 0.012 260);
  --sidebar-foreground: oklch(90% 0.006 260);
  --sidebar-accent: oklch(24% 0.014 260);
  --sidebar-accent-foreground: oklch(98% 0.004 260);
  --sidebar-muted: oklch(72% 0.014 260);
  --sidebar-border: oklch(100% 0 0 / .09);
  --sidebar-active-bg: oklch(28% 0.07 258);
  --sidebar-active-fg: oklch(88% 0.08 255);
  --shadow-panel: 0 1px 2px oklch(0% 0 0 / .4);
}

/* ---------- frame: top bar across, sidebar and workspace beneath ---------- */
.app.shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); grid-template-rows: var(--topbar-height) minmax(0, 1fr); }
.app[data-collapsed="true"] { grid-template-columns: var(--sidebar-width-icon) minmax(0, 1fr); }

/* The sidebar's brand block becomes the left end of the top bar. */
.context-panel { grid-row: 1 / 3; grid-column: 1; position: sticky; top: 0; height: 100vh; z-index: 41;
  background: var(--sidebar); border-right: 1px solid var(--sidebar-border); }
.context-heading { height: var(--topbar-height); background: var(--topbar-bg); border-bottom: 0; }
.context-heading .brand { color: var(--topbar-fg); }
.context-heading .brand-mark { background: oklch(100% 0 0); color: var(--brand-strong); box-shadow: none; }
.context-heading .brand-text { font-size: var(--text-md); font-weight: 700; letter-spacing: -.01em; }
.context-heading .brand-text small { color: var(--topbar-muted); }

.workspace { grid-row: 1 / 3; grid-column: 2; }
.command-bar { height: var(--topbar-height); padding: 0 var(--space-6); border-bottom: 0; background: var(--topbar-bg); color: var(--topbar-fg);
  backdrop-filter: none; box-shadow: 0 1px 0 oklch(0% 0 0 / .08); }
.command-bar .breadcrumb { color: var(--topbar-muted); }
.command-bar .breadcrumb a { color: var(--topbar-muted); }
.command-bar .breadcrumb a:hover { color: var(--topbar-fg); }
.command-bar .breadcrumb .current { color: var(--topbar-fg); font-weight: 600; }
.command-bar .command-trigger { min-width: 18rem; border-color: var(--topbar-field-border); background: var(--topbar-field); color: var(--topbar-muted); }
.command-bar .command-trigger:hover { border-color: oklch(100% 0 0 / .4); color: var(--topbar-fg); }
/* Notification bell: the count reuses the brand button pair (--brand-fg on --brand), already contrast-checked in both themes. */
.command-bar .inbox-bell { position: relative; color: var(--topbar-muted); }
.command-bar .inbox-bell:hover { color: var(--topbar-fg); }
.inbox-count { position: absolute; top: -.2rem; right: -.2rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: 999px; background: var(--brand); color: var(--brand-fg); font-size: .65rem; font-weight: 700; line-height: 1.05rem; text-align: center; box-shadow: 0 0 0 2px var(--bg-surface); pointer-events: none; }
.inbox-count[hidden] { display: none; }
.command-bar kbd { border-color: var(--topbar-field-border); background: oklch(100% 0 0 / .1); color: var(--topbar-fg); }
.command-bar .env-chip { border-color: var(--topbar-field-border); background: oklch(100% 0 0 / .1); color: var(--topbar-fg); }
.command-bar .btn.ghost { color: var(--topbar-fg); }
.command-bar .btn.ghost:hover { background: oklch(100% 0 0 / .12); }
.command-bar .avatar { background: oklch(100% 0 0); color: var(--brand-strong); }
.command-bar :focus-visible { outline-color: oklch(100% 0 0); }

/* ---------- light sidebar ---------- */
.context-nav { padding: var(--space-3) var(--space-2); }
.nav-label { color: var(--sidebar-muted); font-size: var(--text-xs); letter-spacing: .04em; }
.nav-label::after { display: none; }
.nav-item { min-height: 2.25rem; padding: .5rem .75rem; border-radius: var(--radius-sm); color: var(--sidebar-foreground); font-weight: 500; }
.nav-item .icon { opacity: .75; }
.nav-item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.nav-item[aria-current="page"] { background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); font-weight: 600; }
.nav-item[aria-current="page"]::before { left: -.5rem; width: 3px; height: 1.4rem; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-item[aria-current="page"] .icon { opacity: 1; color: var(--brand); }
.context-cluster { background: var(--panel-head); border-bottom: 1px solid var(--sidebar-border); }
.context-cluster .sidebar-cluster-meta .name { color: var(--fg); }
.context-footer { border-top: 1px solid var(--sidebar-border); }

/* ---------- page header: its own white band ---------- */
.content { padding: 0 var(--space-8) var(--space-8); }
.content > .page-header:first-child,
.content > :first-child:is(.page-header) {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4);
  margin: 0 calc(-1 * var(--space-8)) var(--space-6); padding: var(--space-6) var(--space-8) var(--space-5);
  background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.page-header h1, .content h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.page-header .desc { margin-top: var(--space-2); color: var(--muted-fg); font-size: var(--text-base); max-width: 70ch; }
/* pages whose first element is not a .page-header still get room under the bar */
.content > :first-child:not(.page-header) { margin-top: var(--space-6); }

/* ---------- cards are panels ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-panel); }
.card > .card-header { padding: var(--space-3) var(--space-5); background: var(--panel-head); border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; align-items: center; min-height: 3.25rem; }
.card > .card-header .card-title { font-size: var(--text-md); font-weight: 700; }
.card > .card-header .card-desc { margin-top: .1rem; }
.card > .card-header + .card-body { padding-top: var(--space-5); }
.card-footer { background: var(--panel-head); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ---------- tables ---------- */
.table thead th, .table th { background: var(--panel-head); color: var(--muted-fg); font-size: var(--text-xs); font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; border-bottom: 1px solid var(--border-strong); }
.table tbody tr:nth-child(even) td { background: color-mix(in oklab, var(--panel-head) 60%, var(--bg-surface)); }
.table tbody tr:hover td { background: var(--brand-soft); }
.table td { padding-top: .65rem; padding-bottom: .65rem; }

/* ---------- controls ---------- */
.btn { height: 2.25rem; border-radius: var(--radius-sm); font-weight: 600; }
.btn.sm { height: 2rem; }
.btn.primary { box-shadow: 0 1px 2px oklch(30% 0.15 259 / .35); }
.input, .select, textarea.input { border-radius: var(--radius-sm); }

/* tabs: a thick underline marks the active one */
.tabs button[aria-selected="true"], .tab-nav .tab-item.active, .cluster-subtabs .tab-item.active, .comp-tabs button[aria-selected="true"] {
  color: var(--brand); border-bottom-color: var(--brand); border-bottom-width: 3px; font-weight: 700; }

/* ---------- status strip sits on the workspace edge ---------- */
.status-strip { background: var(--bg-surface); }

/* ---------- mobile: the top bar keeps its colour; the sidebar becomes a light sheet ---------- */
@media (max-width: 767px) {
  .app.shell, .app[data-collapsed="true"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  /* the desktop rules above set widths and visibility the phone bar has no room for */
  .command-bar .command-trigger { min-width: 0; width: 2.25rem; justify-content: center; padding: 0; }
  .command-bar .command-trigger-label, .command-bar .command-trigger kbd, .command-bar .env-chip { display: none; }
  .command-bar .user-name { display: none; }
  .workspace { grid-column: 1; grid-row: 1; }
  .context-panel { grid-column: auto; grid-row: auto; position: fixed; }
  .content { padding: 0 var(--space-4) var(--space-6); }
  .content > .page-header:first-child, .content > :first-child:is(.page-header) {
    margin: 0 calc(-1 * var(--space-4)) var(--space-4); padding: var(--space-4); }
  .page-header h1, .content h1 { font-size: 1.4rem; }
  .tabbar { background: var(--bg-surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 8px oklch(25% 0.03 260 / .06); }
  .tabbar-item { color: var(--muted-fg); }
  .tabbar-item:hover { color: var(--fg); }
  .tabbar-item.is-active { color: var(--brand); }
  .tabbar-item.is-active .icon { color: var(--brand); }
}
@media (min-width: 768px) and (max-width: 1280px) {
  .content { padding: 0 var(--space-5) var(--space-6); }
  .content > .page-header:first-child, .content > :first-child:is(.page-header) {
    margin: 0 calc(-1 * var(--space-5)) var(--space-5); padding: var(--space-5); }
}

/* ---------- sign-in: brand panel left, form right ----------
   console.css colours this panel with the --sidebar-* tokens, which this theme turns light (the sidebar is white
   here). The panel stays brand blue, so its text takes the top-bar tokens instead — dark-on-blue was unreadable. */
.login-identity { background: var(--brand-strong); color: var(--topbar-fg); }
.login-brand, .login-intro h1, .login-facts dd { color: var(--topbar-fg); }
.login-sub, .login-facts dt, .login-identity-foot { color: var(--topbar-muted); }
.login-brand .brand-mark { background: oklch(100% 0 0); color: var(--brand-strong); }

/* ==========================================================================================================
   Cluster list: a status strip of filters, then one card per cluster (the table stays one click away).
   ========================================================================================================== */
.fleet-summary { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-4) var(--space-4) 0; }
.fleet-stat { display: flex; min-width: 7.5rem; flex-direction: column; gap: .1rem; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--fg); }
.fleet-stat:hover { border-color: var(--border-strong); text-decoration: none; background: var(--panel-head); }
.fleet-stat[aria-current="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.fleet-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.fleet-stat-label { display: flex; align-items: center; gap: .4rem; color: var(--muted-fg); font-size: var(--text-sm); font-weight: 600; }
.fleet-stat-label::before { width: .55rem; height: .55rem; border-radius: 50%; background: var(--border-strong); content: ""; }
.fleet-stat[data-tone="success"] .fleet-stat-label::before { background: var(--success); }
.fleet-stat[data-tone="info"] .fleet-stat-label::before { background: var(--info); }
.fleet-stat[data-tone="warning"] .fleet-stat-label::before { background: var(--warning); }
.fleet-stat[data-tone="danger"] .fleet-stat-label::before { background: var(--danger); }
.fleet-stat[data-phase="All"] .fleet-stat-label::before { background: var(--brand); }

.cluster-cards { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  margin: 0; padding: var(--space-4); list-style: none; }
.cluster-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-panel); transition: border-color .12s, box-shadow .12s; }
.cluster-card::before { position: absolute; inset: 0 0 auto; height: 3px; background: var(--border-strong); content: ""; }
.cluster-card[data-tone="success"]::before { background: var(--success); }
.cluster-card[data-tone="info"]::before { background: var(--info); }
.cluster-card[data-tone="warning"]::before { background: var(--warning); }
.cluster-card[data-tone="danger"]::before { background: var(--danger); }
.cluster-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px oklch(30% 0.1 259 / .12); }
.cluster-card:focus-within { border-color: var(--brand); }
.cluster-card-head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-3); }
.cluster-card-head .engine-mark .logo { width: 2.25rem; height: 2.25rem; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.cluster-card-title { flex: 1; min-width: 0; }
.cluster-card-name { display: block; overflow: hidden; color: var(--fg); font-family: var(--font-mono); font-size: var(--text-md); font-weight: 700;
  text-overflow: ellipsis; white-space: nowrap; }
/* the whole card is the link target; nested controls stay clickable above it */
.cluster-card-name::after { position: absolute; inset: 0; content: ""; }
.cluster-card-name:hover { color: var(--brand); text-decoration: none; }
.cluster-card-sub { overflow: hidden; margin-top: .15rem; color: var(--muted-fg); font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }
.cluster-card-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; margin: 0;
  padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); background: var(--panel-head); }
.cluster-card-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.cluster-card-facts dt { flex-shrink: 0; color: var(--muted-fg); font-size: var(--text-sm); }
.cluster-card-facts dd { min-width: 0; overflow: hidden; margin: 0; font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right;
  text-overflow: ellipsis; white-space: nowrap; }
.cluster-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: auto;
  padding: var(--space-2) var(--space-4); border-top: 1px solid var(--border); }
.cluster-card-flags { position: relative; z-index: 1; display: flex; gap: var(--space-1); }

.view-switch { display: inline-flex; margin-left: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-switch .btn { height: 2rem; border: 0; border-radius: 0; box-shadow: none; }
.view-switch .btn + .btn { border-left: 1px solid var(--border); }
.view-switch .btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 767px) {
  .view-switch { margin-left: 0; }
  .fleet-stat { min-width: calc(50% - var(--space-1)); }
}

/* ==========================================================================================================
   Shared content patterns. These change how the contents of every page are laid out, not only their colour:
   section tabs become a segmented bar, key/value lists become a grid of fact tiles, stat blocks become a
   tile row with a coloured edge, tables live in framed panels with a toolbar strip, empty states become a
   guided panel, and forms get labelled sections with an action bar.
   ========================================================================================================== */

/* section tabs → segmented bar (page-level navigation between sibling pages) */
.tabs { display: inline-flex; max-width: 100%; gap: 2px; margin: 0 0 var(--space-5); padding: 3px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-sunken); overflow-x: auto; }
.tabs a, .tabs button { margin: 0; padding: .45rem .9rem; border: 0; border-radius: calc(var(--radius) - 2px); color: var(--muted-fg);
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap; transition: background-color .12s, color .12s; }
.tabs a:hover, .tabs button:hover { background: var(--bg-surface); color: var(--fg); }
.tabs a[aria-current="page"], .tabs button[aria-selected="true"] { border: 0; background: var(--bg-surface); color: var(--brand);
  box-shadow: 0 1px 2px oklch(25% 0.03 260 / .12), 0 0 0 1px var(--border); font-weight: 700; }
/* the page-header band and its tabs read as one block */
.content > .page-header:first-child + .tabs { margin-top: calc(-1 * var(--space-2)); }

/* key/value lists → fact tiles */
.kv, .kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: var(--space-2); }
.kv > div, .kv-grid > div { min-width: 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel-head); }
.kv dt, .kv-grid dt { margin-bottom: .3rem; color: var(--muted-fg); font-size: var(--text-xs); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.kv dd, .kv-grid dd { margin: 0; color: var(--fg); font-size: var(--text-base); font-weight: 600; overflow-wrap: anywhere; }
.kv.small > div { padding: var(--space-2) var(--space-3); }

/* stat blocks → tiles with a coloured top edge and a big figure */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--space-3); }
.stat { position: relative; overflow: hidden; padding: var(--space-4) var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-surface); box-shadow: var(--shadow-panel); }
.stat::before { position: absolute; inset: 0 0 auto; height: 3px; background: var(--brand); content: ""; }
.stat .label { color: var(--muted-fg); font-size: var(--text-xs); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.stat .value { margin-top: .4rem; font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .sub { margin-top: .4rem; }
.stat.clickable:hover { border-color: var(--brand); box-shadow: 0 4px 14px oklch(30% 0.1 259 / .12); }

/* table panels: a toolbar strip on top, the table framed, a footer strip with the count */
.card.flush { overflow: hidden; }
.table-toolbar { gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--panel-head); border-bottom: 1px solid var(--border); border-radius: 0; }
.table-toolbar .search { flex: 1 1 16rem; max-width: 28rem; }
.table-footer { padding: var(--space-2) var(--space-4); background: var(--panel-head); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* empty states → a guided panel */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); margin: var(--space-4); padding: var(--space-8) var(--space-5);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--panel-head); }
.empty .icon { width: 2.5rem; height: 2.5rem; margin: 0 0 var(--space-2); padding: .55rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); opacity: 1; }
.empty h3 { font-size: var(--text-md); font-weight: 700; }
.card .empty { margin: var(--space-4); }
td .empty, .table .empty { margin: var(--space-2) 0; }

/* callouts: an icon column and a heavier body */
.callout { padding: var(--space-3) var(--space-4); border-radius: var(--radius); }
.callout > .icon { width: 1.15rem; height: 1.15rem; }

/* forms: grouped, labelled, with an action bar */
.form-grid { gap: var(--space-4) var(--space-5); }
.label, label.label { color: var(--fg); font-size: var(--text-sm); font-weight: 700; }
.hint { color: var(--muted-fg); font-size: var(--text-sm); }
.radio-card { padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--bg-surface); }
.radio-card:has(input:checked) { background: var(--brand-soft); }
.card > form > .card-footer, .card-footer { gap: var(--space-2); }

/* grids of cards breathe the same way everywhere */
.grid { gap: var(--space-4); }
.stack { gap: var(--space-4); }
.content > .card + .card, .content > .card + .grid, .content > .grid + .card, .content > .stats + .card, .content > .callout + .card { margin-top: var(--space-4); }

/* A table whose only row is an empty-state panel shows the panel alone: column headers over "No tasks found"
   read as a broken table. Covers every list (16 templates) without touching their markup. */
.table:has(> tbody > tr:only-child > td > .empty) > thead { display: none; }
.table:has(> tbody > tr:only-child > td > .empty) > tbody > tr > td { padding: 0; border: 0; background: transparent; }
.table:has(> tbody > tr:only-child > td > .empty) > tbody > tr:hover > td { background: transparent; }

/* Breadcrumbs stay on one line in the top bar: earlier crumbs shrink and ellipsise, the current page keeps its
   name. Long trails (cluster › Log Management › Slow Query Log) wrapped into two lines and pushed the bar. */
.command-bar .breadcrumb { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.command-bar .breadcrumb a { min-width: 0; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.command-bar .breadcrumb .sep { flex-shrink: 0; }
.command-bar .breadcrumb .current { flex-shrink: 0; max-width: 22rem; }
.command-bar .spacer { flex: 0 0 var(--space-2); }

/* ==========================================================================================================
   Apps list: one card per application, like the cluster fleet view.
   ========================================================================================================== */
.app-cards { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); margin: 0; padding: var(--space-4); list-style: none; }
.app-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-surface); box-shadow: var(--shadow-panel); transition: border-color .12s, box-shadow .12s; }
.app-card::before { position: absolute; inset: 0 0 auto; height: 3px; background: var(--border-strong); content: ""; }
.app-card[data-tone="success"]::before { background: var(--success); }
.app-card[data-tone="info"]::before { background: var(--info); }
.app-card[data-tone="warning"]::before { background: var(--warning); }
.app-card[data-tone="danger"]::before { background: var(--danger); }
.app-card:hover, .app-card:focus-within { border-color: var(--brand); box-shadow: 0 4px 14px oklch(30% 0.1 259 / .12); }
.app-card-head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-2); }
.app-card-icon { display: grid; width: 2.25rem; height: 2.25rem; flex-shrink: 0; place-items: center; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); }
.app-card-icon .icon { width: 1.15rem; height: 1.15rem; }
.app-card-title { flex: 1; min-width: 0; }
.app-card-name { display: block; overflow: hidden; color: var(--fg); font-family: var(--font-mono); font-size: var(--text-md); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.app-card-name::after { position: absolute; inset: 0; content: ""; }
.app-card-name:hover { color: var(--brand); text-decoration: none; }
.app-card-url { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .25rem; max-width: 100%; margin-top: .15rem; overflow: hidden;
  font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }
.app-card-error { margin: 0 var(--space-4) var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--tone-danger-bg);
  color: var(--tone-danger-fg); font-size: var(--text-sm); }
.app-card-components { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: 0 var(--space-4) var(--space-3); }
.app-card-facts { display: grid; gap: .35rem; margin: 0; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); background: var(--panel-head); }
.app-card-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.app-card-facts dt { color: var(--muted-fg); font-size: var(--text-sm); }
.app-card-facts dd { margin: 0; font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.app-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: auto; padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border); }
.app-card-actions { position: relative; z-index: 1; display: flex; gap: var(--space-1); }
.app-card[hidden] { display: none; }

/* Toolbar controls never push past the panel on a phone: a long option label (cluster modes) set the select's
   intrinsic width wider than the screen. */
.table-toolbar > *, .table-toolbar select, .table-toolbar .select { max-width: 100%; min-width: 0; }
@media (max-width: 767px) { .table-toolbar .select.w-auto, .table-toolbar select.w-auto { width: auto; max-width: 100%; } }

/* Overview (wave 1) */
.ov-health { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-5); border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-lg);
  background: var(--bg-surface); box-shadow: var(--shadow-panel); }
.ov-health-ok { border-left-color: var(--success); }
.ov-health-attention { border-left-color: var(--warning); }
.ov-health-degraded { border-left-color: var(--danger); }
.ov-health-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted-fg); }
.ov-health-ok .ov-health-dot { background: var(--success); }
.ov-health-attention .ov-health-dot { background: var(--warning); }
.ov-health-degraded .ov-health-dot { background: var(--danger); }
.ov-health-text { font-size: var(--text-md); font-weight: 700; }
.ov-health-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0 0 0 auto; padding: 0; list-style: none; }
.ov-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: stretch; }
/* Attention spans the height of Happening now + Coming up: no empty area beside them on desktop. */
.ov-attention { grid-column: 1; grid-row: span 2; display: flex; flex-direction: column; min-height: 0; }
.ov-attention > .card-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ov-attention .card-body > .empty { margin: auto; }
.ov-attention .ov-list { max-height: 100%; overflow-y: auto; }
.ov-now, .ov-soon { grid-column: 2; }
.ov-estate, .ov-activity { grid-column: 1 / -1; }
.ov-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.ov-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-head); }
.ov-item-body { flex: 1; min-width: 0; }
.ov-item-title { font-weight: 600; overflow-wrap: anywhere; }
.ov-tiles { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ov-tiles .stat { display: flex; flex-direction: column; gap: 0; text-decoration: none; }
.ov-tiles .stat .sub { margin-top: .35rem; }
.ov-tile-link { margin-top: auto; padding-top: var(--space-3); color: var(--brand); font-size: var(--text-sm); font-weight: 600; }
.ov-timeline { margin: 0; padding: 0; list-style: none; }
.ov-activity-table { width: 100%; }
@media (max-width: 1279px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  /* One column in reading order: attention, happening now, coming up, estate, activity. No row spans. */
  .ov-attention, .ov-now, .ov-soon, .ov-estate, .ov-activity { grid-column: 1; grid-row: auto; }
  .ov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .ov-health-facts { margin-left: 0; }
  .ov-tiles { grid-template-columns: minmax(0, 1fr); }
  .ov-activity-table th:nth-child(2), .ov-activity-table td:nth-child(2) { display: none; }
}

/* Cluster detail v2 (wave 1B) */
.cluster-v2-page { display: grid; gap: var(--space-4); min-width: 0; }
.cluster-v2-identity, .cluster-v2-health { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-panel); }
.cluster-v2-identity { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4); }
.cluster-v2-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-width: 0; }
.cluster-v2-name h1 { margin: 0; font-size: var(--text-xl); }
.cluster-v2-name .desc { margin-top: .2rem; overflow-wrap: anywhere; }
.cluster-v2-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.cluster-v2-health { padding: var(--space-4); }
.cluster-v2-health-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.cluster-v2-health h2 { margin: 0; font-size: var(--text-md); }
.cluster-v2-health-head p { margin: .2rem 0 0; }
.cluster-v2-findings, .cluster-v2-timeline { display: grid; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.cluster-v2-finding, .cluster-v2-event { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-sunken); }
.cluster-v2-finding p, .cluster-v2-event p { margin: .2rem 0 0; }
.cluster-v2-empty { margin: var(--space-3) 0 0; color: var(--muted-fg); }
.cluster-v2-activity, .cluster-v2-settings { min-width: 0; }
.cluster-v2-event time { color: var(--muted-fg); font: var(--text-sm) var(--font-mono); }
.cluster-v2-event > div { display: grid; justify-items: start; gap: var(--space-1); min-width: 0; }
.cluster-v2-event a { overflow-wrap: anywhere; }
.cluster-v2-settings-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cluster-v2-impact { margin-top: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-sunken); }
.cluster-v2-impact h3 { margin: 0 0 var(--space-2); font-size: var(--text-sm); }
.cluster-v2-impact ul { margin: 0; padding-left: 1.2rem; color: var(--fg); font-size: var(--text-sm); }
.cluster-v2-impact-blocked { color: var(--tone-danger-fg); font-weight: 700; }
dialog.dialog.cluster-v2-drawer[open] { position: fixed; inset: 0 0 0 auto; width: min(42rem, 100vw); max-width: 100vw; max-height: 100vh; height: 100vh; margin: 0; border-radius: 0; border: 0; overflow-y: auto; }
dialog.dialog.cluster-v2-drawer .dialog-body { max-height: none; }
dialog.dialog.cluster-v2-drawer .dialog-header { border-bottom: 1px solid var(--border); }
@media (max-width: 767px) {
  .cluster-v2-identity { align-items: flex-start; }
  .cluster-v2-name { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .cluster-v2-name > .badge { grid-column: 2; justify-self: start; }
  .cluster-v2-name > button { grid-column: 1 / -1; max-width: 100%; overflow-wrap: anywhere; }
  .cluster-v2-actions { width: 100%; }
  .cluster-v2-actions > * { max-width: 100%; }
  .cluster-v2-settings-grid { grid-template-columns: minmax(0, 1fr); }
  .cluster-v2-event { grid-template-columns: minmax(0, 1fr); }
}
