/* Edusav Control Center stylesheet.
   Tokens live in tokens.css. Everything else here is either the app shell,
   a component (each <ep-*> element has one banner section below), a page
   specific block, or a utility. Components are light DOM: they render plain
   children and are styled from here, because the CSP forbids inline <style>
   (style-src 'self'), including inside a shadow root. */

@import url("/tokens.css?v=20260923-1");

/* -- fonts --------------------------------------------------------------- */
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Metric-compatible fallbacks so text set in the system font before Geist
   arrives occupies the same width, and the swap does not reflow the page. */
@font-face {
  font-family: "Geist Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 22%;
}
@font-face {
  font-family: "Geist Mono Fallback";
  src: local("Menlo"), local("Consolas"), local("Courier New");
  size-adjust: 100%;
}

/* -- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01", "tnum";
}
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); letter-spacing: -.01em; font-weight: var(--fw-semibold); }
h1 { font-size: var(--fs-2xl); letter-spacing: -.02em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, .mono, kbd { font-family: var(--font-mono); font-size: var(--fs-sm); font-feature-settings: normal; }
kbd {
  padding: .05rem .35rem; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-2xs); background: var(--panel);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--brand-soft); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.boot { padding: 4rem 2rem; color: var(--muted); text-align: center; }

/* -- utilities ----------------------------------------------------------- */
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: var(--sp-2); }
.grow { flex: 1; min-width: 0; }
.contents { display: contents; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; }
.right { text-align: right; }
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.ml-1 { margin-left: var(--sp-1); } .ml-2 { margin-left: var(--sp-2); }
.w-40 { width: 40%; } .w-42 { width: 42%; }
.max-w-sm { max-width: 220px; }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.eyebrow {
  color: var(--faint); font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
  letter-spacing: .07em; text-transform: uppercase; margin: 0 0 .2rem;
}
.sub { color: var(--muted); font-size: var(--fs-sm); }
.key { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: var(--fw-semibold); word-break: break-all; }
.src { color: var(--faint); font-size: var(--fs-2xs); font-family: var(--font-mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.page-title { font-size: var(--fs-2xl); letter-spacing: -.02em; text-transform: capitalize; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.page-head .sub { margin-top: var(--sp-1); max-width: 70ch; }
.page-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.page { display: grid; gap: var(--sp-4); }

/* -- icons (ep-icon) ------------------------------------------------------ */
ep-icon { display: inline-flex; flex: none; line-height: 0; vertical-align: -.125em; }
ep-icon[label] { vertical-align: middle; }
.ico { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; stroke: currentColor; fill: none; }
ep-icon .ico { width: var(--icon-size, 16px); height: var(--icon-size, 16px); vertical-align: 0; }
.ico-missing { stroke-dasharray: 3 2; color: var(--err); }
.spin-icon { animation: spin .8s linear infinite; }

/* -- app shell (ep-app-shell / ep-rail / ep-topbar) ---------------------- */
ep-app-shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "rail topbar" "rail main";
  min-height: 100vh;
  transition: grid-template-columns var(--dur) var(--ease);
}
ep-app-shell[collapsed] { grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr); }
ep-app-shell > ep-rail { grid-area: rail; }
ep-app-shell > ep-topbar { grid-area: topbar; }
ep-app-shell > main { grid-area: main; }
main {
  padding: var(--sp-6) var(--sp-6) 6rem;
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  min-width: 0;
}

/* Rail. Sticky column: env switcher, view list, then footer actions. */
ep-rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  overflow: hidden;
  z-index: 30;
}
ep-rail::before {
  /* The environment band, kept: a 3px line at the top of the whole rail. */
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--env, var(--accent));
}
ep-rail[env="dev"] { --env: var(--env-dev); }
ep-rail[env="stag"] { --env: var(--env-stag); }
ep-rail[env="prod"], ep-rail[env="live"] { --env: var(--env-prod); }
.rail-brand {
  display: grid; gap: .3rem; justify-items: start; min-height: 32px;
  padding: var(--sp-2) var(--sp-2) var(--sp-1); margin-top: var(--sp-1);
  color: var(--ink); text-decoration: none;
}
.rail-brand:hover { text-decoration: none; }
.rail-brand img { height: 22px; width: auto; display: block; }
.rail-brand img.rail-brand-mark { display: none; height: 24px; width: 24px; }
.rail-brand-text { display: block; color: var(--faint); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }

.rail-env {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--panel); position: relative;
}
.rail-env:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px var(--brand-soft); }
.rail-env select {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; appearance: none;
}
.rail-env select:focus-visible { outline: none; }
.rail-env-label { display: grid; min-width: 0; line-height: 1.15; }
.rail-env-label strong { font-size: var(--fs-md); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-env-label span { color: var(--faint); font-size: var(--fs-2xs); }
.rail-env > ep-icon { color: var(--faint); }

.rail-nav { display: grid; gap: 2px; padding: 0; margin: 0; list-style: none; }
.rail-section { color: var(--faint); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .07em; text-transform: uppercase; padding: var(--sp-3) var(--sp-2) var(--sp-1); }
.rail-item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: .5rem var(--sp-2); border: 0; border-radius: var(--r-sm);
  background: none; color: var(--muted); text-align: left; text-decoration: none;
  font-size: var(--fs-md); font-weight: var(--fw-medium); white-space: nowrap;
  position: relative; transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.rail-item ep-icon { color: var(--faint); transition: color var(--dur-fast) var(--ease); }
.rail-item:hover { background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.rail-item:hover ep-icon { color: var(--ink); }
.rail-item[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.rail-item[aria-current="page"] ep-icon { color: var(--brand); }
.rail-item[aria-current="page"]::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.rail-item .rail-count {
  margin-left: auto; font-size: var(--fs-2xs); color: var(--faint);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 .4rem; line-height: 1.5;
}
.rail-footer { margin-top: auto; display: grid; gap: 2px; }
.rail-toggle { color: var(--faint); }

/* Collapsed: icons only. Labels are clipped rather than removed so the
   accessible name stays; a tooltip via title covers the sighted case. */
ep-app-shell[collapsed] ep-rail { padding-inline: var(--sp-2); }
ep-app-shell[collapsed] .rail-brand img,
ep-app-shell[collapsed] .rail-brand-text,
ep-app-shell[collapsed] .rail-env-label,
ep-app-shell[collapsed] .rail-env > ep-icon,
ep-app-shell[collapsed] .rail-item > span,
ep-app-shell[collapsed] .rail-section { display: none; }
ep-app-shell[collapsed] .rail-brand img.rail-brand-mark { display: block; }
ep-app-shell[collapsed] .rail-brand { justify-items: center; padding-inline: 0; }
ep-app-shell[collapsed] .rail-env { grid-template-columns: 1fr; justify-items: center; padding: var(--sp-2); }
ep-app-shell[collapsed] .rail-item { justify-content: center; padding-inline: 0; }
ep-app-shell[collapsed] .rail-item[aria-current="page"]::before { left: -8px; }

/* Topbar. */
ep-topbar {
  position: sticky; top: 0; z-index: 25;
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-6);
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(1px)) { ep-topbar { background: var(--bg); } }
.topbar-crumbs { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; color: var(--muted); font-size: var(--fs-md); }
.topbar-crumbs .crumb { white-space: nowrap; }
.topbar-crumbs .crumb.current { color: var(--ink); font-weight: var(--fw-medium); }
.topbar-crumbs ep-icon { color: var(--faint); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.topbar-menu-btn { display: none; }

/* Env switcher chip inside the rail and elsewhere. */
.envtag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 20px; padding: 0 .4rem; border-radius: var(--r-sm);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--env-none);
}
.envtag.dev  { background: var(--env-dev); }
.envtag.stag { background: var(--env-stag); }
.envtag.prod, .envtag.live { background: var(--env-prod); }

/* GitOps sync indicator. */
.gitops-status { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.gitops-status.ok { color: var(--ok); }
.gitops-status.warn, .gitops-status.stale { color: var(--warn); }

/* Profile menu: <details> as a dropdown. */
.profile-menu { position: relative; }
.profile-menu > summary { list-style: none; cursor: pointer; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-dropdown {
  position: absolute; top: calc(100% + .4rem); right: 0; z-index: 40;
  min-width: 200px; padding: var(--sp-1);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 1px;
}
.profile-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; text-align: left; border: none; background: none;
  color: var(--ink); padding: .45rem .6rem; border-radius: var(--r-sm); font-size: var(--fs-md);
}
.profile-item:hover { background: var(--accent-soft); }
.profile-item ep-icon { color: var(--faint); }
.profile-role {
  display: grid; font-size: var(--fs-xs); color: var(--muted); padding: .45rem .6rem .55rem;
  border-bottom: 1px solid var(--line); margin-bottom: var(--sp-1);
}
.profile-role strong { color: var(--ink); font-size: var(--fs-sm); }

/* -- search box ----------------------------------------------------------- */
.searchbox {
  display: flex; align-items: stretch; height: 34px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--panel); min-width: 220px; overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.searchbox .ico-slot { display: flex; align-items: center; padding-left: .6rem; color: var(--faint); flex: none; pointer-events: none; }
.searchbox input, .searchbox input[type=search] { border: none; background: none; outline: none; box-shadow: none; border-radius: 0; min-height: 0; font-size: var(--fs-sm); color: var(--ink); width: 100%; min-width: 0; padding: 0 .5rem; }
.searchbox input::placeholder { color: var(--faint); }
.searchbox input::-webkit-search-cancel-button { cursor: pointer; }
.searchbox kbd { align-self: center; margin-right: .45rem; }
.searchbox:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--brand-soft); }
.searchbox:focus-within .ico-slot { color: var(--brand); }
.searchbox input:focus-visible { outline: none; }

/* -- buttons (ep-button / .btn) ------------------------------------------- */
/* justify-content/align-items: without these, a button whose host gets a
   layout width (e.g. .signin-action's width: 100%) leaves its inner
   <button> content packed at the flex start instead of centered, since
   inline-flex alone has no default alignment — invisible on a
   content-sized button, visible as a left-stuck label on any full-width
   one. */
ep-button { display: inline-flex; justify-content: center; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  height: 32px; padding: 0 .8rem;
  font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: 1;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--panel); color: var(--ink); cursor: pointer;
  white-space: nowrap; text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--faint); background: var(--panel-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.pri, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: var(--fw-semibold); }
.btn.pri:hover:not(:disabled), .btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.pri:disabled { opacity: 1; background: color-mix(in srgb, var(--accent) 32%, var(--panel)); border-color: var(--line-strong); color: var(--faint); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); color: var(--ink); border-color: transparent; }
.btn.danger { border-color: color-mix(in srgb, var(--err) 55%, var(--line-strong)); color: var(--err); }
.btn.danger:hover:not(:disabled) { background: var(--err); border-color: var(--err); color: #fff; }
.btn.caution { border-color: color-mix(in srgb, var(--warn) 55%, var(--line-strong)); color: var(--warn); }
.btn.caution:hover:not(:disabled) { border-color: var(--warn); background: var(--warn-soft); }
.btn.link { border: none; background: none; color: var(--brand); padding: 0 .3rem; height: auto; font-weight: var(--fw-medium); }
.btn.link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; background: none; }
.btn.sm { height: 28px; padding: 0 .6rem; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn.icon-only { width: 32px; padding: 0; }
.btn.icon-only.sm { width: 28px; }
.btn ep-icon { color: inherit; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--ink); border-top-color: transparent; animation: spin .7s linear infinite;
}
.btn.pri[aria-busy="true"]::after { border-color: var(--accent-ink); border-top-color: transparent; }
.btn-group { display: inline-flex; gap: var(--sp-1); }

/* -- badges (ep-badge / .tag / .status) ----------------------------------- */
ep-badge, .tag, .status {
  display: inline-flex; align-items: center; gap: .3rem;
  min-height: 20px; padding: 0 .45rem; border-radius: var(--r-sm);
  font-size: var(--fs-2xs); font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
  border: 1px solid var(--line-strong); color: var(--muted); background: transparent;
}
ep-badge[tone="ok"], .tag.ok, .tag.self, .tag.vault { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
ep-badge[tone="warn"], .tag.warn, .tag.backend, .tag.alert-warning { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
ep-badge[tone="err"], .tag.err, .tag.alert-critical { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); background: var(--err-soft); }
ep-badge[tone="info"], .tag.staged, .tag.info { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: var(--brand-soft); }
ep-badge[tone="accent"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
ep-badge[pill] { border-radius: var(--r-pill); padding-inline: .55rem; }
ep-badge .dot, .status .dot, .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
/* .status is text-like: a tone word with an icon, no box. */
.status { border: 0; padding: 0; min-height: 0; font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--muted); }
.status.ok { color: var(--ok); } .status.warn { color: var(--warn); } .status.err { color: var(--err); }
.status ep-icon, .status .ico { flex: none; }
.chip {
  display: inline-flex; align-items: center; min-height: 20px; padding: 0 .45rem;
  color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: var(--fs-2xs); line-height: 1; white-space: nowrap;
}
.chip.accent { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.staged-value { color: var(--brand); }

/* -- cards (ep-card / .card) ---------------------------------------------- */
ep-card, .card {
  display: block;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  min-width: 0;
}
.card { margin-bottom: 0; }
ep-card > .head, .card > .head {
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
}
ep-card > .head h2, .card > .head h2 { font-size: var(--fs-lg); }
ep-card > .head .sub, .card > .head .sub { margin-top: .15rem; }
ep-card > .head .head-title, .category-title { display: grid; gap: .1rem; min-width: 0; }
ep-card > .head .head-actions, .card > .head .head-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex: none; flex-wrap: wrap; }
ep-card > .body, .card > .body { padding: var(--sp-4); }
ep-card > .body.flush, .card > .body.flush { padding: 0; }
ep-card > .body + .body, .card > .body + .body { border-top: 1px solid var(--line); }
ep-card[tone="warn"] { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
ep-card[tone="err"] { border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
ep-card[flat] { box-shadow: none; }

/* -- tabs (ep-tabs) ------------------------------------------------------- */
ep-tabs { display: flex; align-items: center; gap: var(--sp-1); flex-wrap: wrap; }
ep-tabs[variant="underline"] { gap: 0; border-bottom: 1px solid var(--line); width: 100%; }
ep-tabs .tab {
  display: inline-flex; align-items: center; gap: .4rem; height: 30px; padding: 0 .7rem;
  border: 1px solid transparent; border-radius: var(--r-pill); background: none;
  color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
ep-tabs .tab:hover { color: var(--ink); background: var(--accent-soft); }
ep-tabs .tab[aria-selected="true"] { color: var(--ink); background: var(--panel-2); border-color: var(--line-strong); }
ep-tabs .tab .count { color: var(--faint); font-size: var(--fs-2xs); }
ep-tabs[variant="underline"] .tab { height: 38px; border-radius: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 0 .85rem; }
ep-tabs[variant="underline"] .tab:hover { background: none; }
ep-tabs[variant="underline"] .tab[aria-selected="true"] { background: none; border-bottom-color: var(--brand); color: var(--ink); }

/* -- tables (ep-data-table / table) --------------------------------------- */
ep-data-table { display: block; min-width: 0; }
.scroll-x { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
th {
  text-align: left; font-weight: var(--fw-medium); color: var(--faint);
  border-bottom: 1px solid var(--line); padding: .55rem var(--sp-4);
  font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  background: var(--panel); position: sticky; top: 0; z-index: 1;
}
td { padding: .6rem var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
td.top, .diff-cell { vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover > td { background: var(--accent-soft); }
tr.selected-row > td { background: var(--brand-soft); }
th.right, td.right { text-align: right; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
ep-data-table[density="compact"] td { padding-block: .35rem; }
ep-data-table .table-empty { padding: 0; }
.table-skeleton td span { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--panel-2), var(--accent-soft), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.nested-table th { position: static; background: transparent; }

/* -- empty state (ep-empty) ----------------------------------------------- */
ep-empty, .empty {
  display: grid; justify-items: center; gap: .35rem;
  padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--faint); font-size: var(--fs-md);
}
ep-empty .empty-title, .empty .empty-title { color: var(--muted); font-weight: var(--fw-medium); }
ep-empty .empty-hint { font-size: var(--fs-sm); max-width: 52ch; }
ep-empty ep-icon, .empty .ico { --icon-size: 24px; color: var(--faint); margin-bottom: .25rem; }
.empty .ico { width: 24px; height: 24px; }
ep-empty[tone="ok"] ep-icon, .empty.ok .ico { color: var(--ok); }
.spin { padding: 2.5rem; text-align: center; color: var(--muted); }
.spin::before {
  content: ''; display: block; width: 18px; height: 18px; margin: 0 auto .6rem;
  border: 2px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -- messages (ep-msg / .msg / .note-inline) ------------------------------ */
ep-msg, .msg {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .6rem .8rem; border-radius: var(--r-md); font-size: var(--fs-sm);
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
}
ep-msg > ep-icon { margin-top: .1em; flex: none; }
ep-msg .msg-body, .msg-body { min-width: 0; flex: 1; }
ep-msg .msg-dismiss { margin-left: auto; }
.msg strong, ep-msg strong { color: inherit; font-weight: var(--fw-semibold); }
ep-msg[tone="warn"], .msg.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
ep-msg[tone="err"], .msg.err  { background: var(--err-soft);  border-color: color-mix(in srgb, var(--err) 40%, transparent);  color: var(--err); }
ep-msg[tone="ok"], .msg.ok   { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
ep-msg[tone="info"], .msg.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand); }
.msg pre, ep-msg pre {
  margin: .45rem 0 0; background: var(--panel); padding: .45rem .6rem; border-radius: var(--r-sm);
  overflow-x: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink); border: 1px solid var(--line);
}
.note-inline { font-size: var(--fs-sm); margin-top: .25rem; display: flex; gap: .35rem; align-items: flex-start; color: var(--muted); }
.note-inline.error { color: var(--err); }
.note-inline.warn  { color: var(--warn); }
.note-inline ep-icon, .note-inline .ico { flex: none; margin-top: .15em; }

/* -- metric (ep-metric) --------------------------------------------------- */
ep-metric {
  display: grid; gap: .15rem; align-content: start; min-width: 0;
  padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel); box-shadow: var(--shadow);
}
ep-metric .metric-label { color: var(--faint); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: .4rem; }
ep-metric .metric-value { font-size: var(--fs-3xl); line-height: 1.1; font-weight: var(--fw-semibold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
ep-metric .metric-hint { color: var(--muted); font-size: var(--fs-xs); }
ep-metric[size="sm"] { padding: var(--sp-3) var(--sp-4); border: 0; box-shadow: none; background: transparent; }
ep-metric[size="sm"] .metric-value { font-size: var(--fs-lg); }
ep-metric[tone="warn"] .metric-value { color: var(--warn); }
ep-metric[tone="err"] .metric-value { color: var(--err); }
ep-metric[tone="ok"] .metric-value { color: var(--ok); }
ep-metric[mono] .metric-value { font-family: var(--font-mono); font-size: var(--fs-lg); }
ep-metric[inline] { border: 0; box-shadow: none; background: transparent; padding: 0; }
ep-metric[inline] .metric-value { font-size: var(--fs-lg); }

/* -- key/value list (ep-kv) ----------------------------------------------- */
ep-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
ep-kv .kv {
  display: grid; gap: .15rem; min-width: 0; padding: .7rem var(--sp-4);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
ep-kv .kv-k { color: var(--faint); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .05em; text-transform: uppercase; }
ep-kv .kv-v { font-size: var(--fs-sm); font-weight: var(--fw-medium); overflow-wrap: anywhere; display: flex; align-items: center; gap: .4rem; }
ep-kv .kv-v.mono { font-family: var(--font-mono); font-weight: var(--fw-regular); }
ep-kv .kv-copy { color: var(--faint); }

/* -- forms (ep-field / ep-select / ep-checkbox / ep-textarea) ------------- */
ep-field, ep-select, ep-textarea { display: grid; gap: .3rem; min-width: 0; }
ep-field .field-label, ep-select .field-label, ep-textarea .field-label, .field-label { color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
ep-field .field-hint, ep-select .field-hint, ep-textarea .field-hint, .field-hint { color: var(--faint); font-size: var(--fs-xs); }
ep-field .field-error, .field-error { color: var(--err); font-size: var(--fs-xs); display: flex; gap: .3rem; align-items: flex-start; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=email], textarea, select.plain, .input {
  width: 100%; min-height: 34px; padding: .35rem .6rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); font-size: var(--fs-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
input[type=text].mono, input.mono, textarea.mono, .cell-input { font-family: var(--font-mono); font-size: var(--fs-sm); }
input:focus-visible, textarea:focus-visible, select.plain:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--brand-soft); }
input.changed { border-color: var(--brand); background: var(--brand-soft); }
input.bad, ep-field[invalid] input { border-color: var(--err); background: var(--err-soft); }
input[readonly] { background: var(--bg-2); color: var(--muted); cursor: default; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select.plain { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; cursor: pointer; }
ep-checkbox, .check { display: flex; gap: .6rem; align-items: flex-start; font-size: var(--fs-sm); }
ep-checkbox label, .check { cursor: pointer; }
ep-checkbox input, .check input { width: 16px; height: 16px; margin: .15rem 0 0; flex: none; accent-color: var(--brand); }
ep-checkbox .field-hint { display: block; margin-top: .15rem; }
.cell-input { min-height: 30px; padding-block: .25rem; }

/* -- dialog (ep-dialog / dialog) ------------------------------------------ */
dialog {
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 0;
  background: var(--panel); color: var(--ink);
  max-width: 620px; width: min(92vw, 620px); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog:focus-visible { outline: none; }
dialog[open] { animation: dialog-in var(--dur) var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
dialog.wide, dialog[size="lg"] { max-width: 880px; width: min(94vw, 880px); }
dialog[size="sm"] { max-width: 440px; }
dialog .dhead { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-2); }
dialog .dhead .dhead-text { display: grid; gap: .2rem; min-width: 0; flex: 1; }
dialog .dhead h3 { font-size: var(--fs-lg); overflow-wrap: anywhere; }
dialog .dhead .dhead-actions { display: flex; gap: var(--sp-2); align-items: center; flex: none; }
dialog .dbody { padding: var(--sp-2) var(--sp-5) var(--sp-2); max-height: 62vh; overflow: auto; display: grid; gap: var(--sp-3); align-content: start; }
dialog .dfoot {
  padding: var(--sp-3) var(--sp-5); margin-top: var(--sp-2);
  border-top: 1px solid var(--line); display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap;
  background: var(--bg-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
dialog .dfoot ep-msg, dialog .dfoot .msg { flex-basis: 100%; }
dialog .dfoot .grow { flex: 1; }
.changelist { font-size: var(--fs-sm); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.changelist .row { display: flex; gap: .6rem; align-items: baseline; padding: .45rem .7rem; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.changelist .row:last-child { border-bottom: none; }

/* -- toasts (ep-toast-stack) ---------------------------------------------- */
ep-toast-stack {
  position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 100;
  display: flex; flex-direction: column-reverse; align-items: flex-end; gap: var(--sp-2);
  pointer-events: none; max-width: min(420px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: .55rem;
  max-width: 100%; box-shadow: var(--shadow-lg);
  margin: 0; padding: .7rem .8rem .7rem .9rem; border-radius: var(--r-lg); border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); font-size: var(--fs-md);
  overflow-wrap: anywhere; animation: toast-in var(--dur) var(--ease);
}
.toast > ep-icon { margin-top: .1em; flex: none; }
.toast .toast-text { flex: 1; min-width: 0; }
.toast .toast-close { color: var(--faint); }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }
.toast.leaving { opacity: 0; transition: opacity 150ms ease-in; }
.toast.ok  { border-color: color-mix(in srgb, var(--ok) 45%, var(--line-strong)); }
.toast.ok > ep-icon { color: var(--ok); }
.toast.err { border-color: color-mix(in srgb, var(--err) 45%, var(--line-strong)); }
.toast.err > ep-icon { color: var(--err); }
.toast.note > ep-icon { color: var(--brand); }

/* -- diff (ep-diff) ------------------------------------------------------- */
ep-diff, .history-diff { display: block; border: 1px solid var(--line); border-radius: var(--r-md); overflow: auto; max-height: 52vh; background: var(--bg); }
.diff-line { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: .3rem; padding: .18rem .6rem; font: var(--fs-sm)/1.45 var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.diff-line .diff-mark { text-align: center; color: var(--faint); user-select: none; }
.diff-line.added { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.diff-line.added .diff-mark { color: var(--ok); }
.diff-line.removed { background: color-mix(in srgb, var(--err) 10%, transparent); }
.diff-line.removed .diff-mark { color: var(--err); }
.diff-line code { font: inherit; color: var(--ink); }

/* -- progress list (ep-progress-list) ------------------------------------- */
ep-progress-list, .commit-progress { display: grid; gap: .4rem; }
.progress-row { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: var(--fs-sm); }
.progress-row.running { color: var(--brand); }
.progress-row.done { color: var(--ok); }
.progress-row.err { color: var(--err); }
.progress-mark { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; flex: none; }
.progress-row.running .progress-mark ep-icon { animation: spin 1s linear infinite; }

/* -- service picker (ep-service-picker, combobox) ------------------------- */
ep-service-picker { position: relative; display: block; min-width: 240px; }
.picker-trigger {
  display: flex; align-items: center; gap: .55rem; width: 100%; height: 34px; padding: 0 .55rem 0 .7rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--panel);
  color: var(--ink); font-size: var(--fs-md); text-align: left;
}
.picker-trigger:hover { border-color: var(--faint); }
.picker-mark {
  display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: var(--r-sm);
  background: var(--brand-soft); color: var(--brand); font: var(--fw-semibold) 9.5px var(--font-mono); letter-spacing: .03em;
}
.picker-option .picker-mark { background: var(--accent-soft); color: var(--muted); width: 20px; height: 20px; }
.picker-option ep-icon { width: 20px; justify-content: center; }
.picker-trigger .picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.picker-trigger .picker-label.placeholder { color: var(--faint); text-transform: none; }
.picker-trigger > ep-icon { color: var(--faint); }
.picker-pop {
  position: absolute; top: calc(100% + .35rem); left: 0; z-index: 45; width: max(100%, 300px);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: min(60vh, 460px); overflow: hidden;
}
.picker-pop .searchbox { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; height: 40px; background: transparent; }
.picker-pop .searchbox:focus-within { box-shadow: none; }
.picker-list { overflow-y: auto; padding: var(--sp-1); margin: 0; list-style: none; }
.picker-group { color: var(--faint); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; padding: .55rem .6rem .25rem; }
.picker-option {
  display: flex; align-items: center; gap: .55rem; padding: .4rem .6rem; border-radius: var(--r-sm); cursor: pointer;
  font-size: var(--fs-md); color: var(--ink);
}
.picker-option .picker-code { margin-left: auto; color: var(--faint); font: var(--fs-2xs) var(--font-mono); }
.picker-option[aria-selected="true"] { background: var(--accent-soft); }
.picker-option.active { background: var(--brand-soft); }
.picker-option ep-icon { color: var(--brand); }
.picker-option .picker-name { text-transform: capitalize; }
.picker-empty { padding: var(--sp-4); color: var(--faint); font-size: var(--fs-sm); text-align: center; }

/* -- save bar (ep-savebar) ------------------------------------------------ */
ep-savebar {
  position: fixed; left: var(--rail-w); right: 0; bottom: 0; z-index: 50;
  display: block; background: var(--panel); border-top: 1px solid var(--line-strong);
  box-shadow: var(--bar-shadow); padding: var(--sp-3) var(--sp-6);
  transition: left var(--dur) var(--ease);
}
ep-app-shell[collapsed] ep-savebar { left: var(--rail-w-collapsed); }
ep-savebar .inner { max-width: var(--content-max); margin: 0 auto; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
ep-savebar .count { font-weight: var(--fw-semibold); display: inline-flex; align-items: center; gap: .5rem; }
ep-savebar .count ep-icon { color: var(--brand); }
ep-savebar .blocked { color: var(--warn); font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: .35rem; }

/* -- sign in -------------------------------------------------------------- */
.signin-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem 5rem; background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 60%); }
.signin-card { width: min(100%, 400px); padding: 2.25rem 2rem; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.signin-logo { display: block; height: 36px; width: auto; margin: 0 auto 1.35rem; }
.signin-card h1 { font-size: var(--fs-2xl); }
.signin-copy { color: var(--muted); margin: .75rem auto 1.5rem; max-width: 34ch; }
.signin-action { width: 100%; height: 38px; }
.signin-note { color: var(--faint); font-size: var(--fs-xs); line-height: 1.5; margin: 1rem auto 0; max-width: 36ch; }

/* -- page: dashboard / operations ---------------------------------------- */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-6); border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--panel), color-mix(in srgb, var(--brand-soft) 35%, var(--panel)));
  box-shadow: var(--shadow);
}
.hero.compact { padding-block: var(--sp-4); }
.hero h1 { font-size: var(--fs-2xl); }
.hero .sub { max-width: 68ch; margin-top: .35rem; }
.hero-health { display: grid; min-width: 9rem; padding-left: var(--sp-5); border-left: 1px solid var(--line-strong); text-align: right; }
.hero-health strong { font-size: var(--fs-3xl); line-height: 1.1; letter-spacing: -.02em; }
.hero-health span { color: var(--muted); font-size: var(--fs-xs); }
.hero-health.attention strong { color: var(--warn); }
.queue-list { display: grid; }
.queue-row {
  display: grid; grid-template-columns: minmax(9rem, .7fr) 1fr auto; gap: var(--sp-4); align-items: center;
  width: 100%; padding: .75rem var(--sp-4); border: 0; border-bottom: 1px solid var(--line);
  background: none; color: var(--ink); text-align: left; cursor: pointer; font-size: var(--fs-md);
}
.queue-row:last-child { border-bottom: 0; }
.queue-row:hover { background: var(--accent-soft); }
.queue-row ep-icon { color: var(--faint); }
.service-link { font-family: var(--font-mono); font-size: var(--fs-sm); }
.alert-list, .seeder-list { display: grid; gap: var(--sp-3); }
.acknowledged-list { margin-top: var(--sp-3); }
.alert-row, .seeder-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4);
  padding: .8rem .9rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2);
}
.alert-row.critical { border-left: 3px solid var(--err); }
.alert-row.warning { border-left: 3px solid var(--warn); }
.alert-row.info { border-left: 3px solid var(--brand); }
.alert-row.acked { opacity: .7; }
.alert-copy, .seeder-copy { min-width: 0; display: grid; gap: .3rem; }
.alert-copy p, .seeder-copy p { overflow-wrap: anywhere; }
.seeder-actions { display: flex; gap: var(--sp-2); flex: none; }
.job-log {
  min-height: 12rem; max-height: 58vh; margin: 0; padding: .8rem; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); color: var(--ink);
  font: var(--fs-xs)/1.55 var(--font-mono); white-space: pre-wrap;
}
details.more > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--brand); padding: .3rem 0; list-style: none; display: flex; align-items: center; gap: .3rem; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary ep-icon { transition: transform var(--dur-fast) var(--ease); }
details.more[open] > summary ep-icon { transform: rotate(90deg); }

/* -- page: configuration ------------------------------------------------- */
.config-summary { padding: var(--sp-3) var(--sp-4); display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--line); background: var(--bg-2); }
.config-summary ep-tabs { margin-left: auto; }
.category-card { scroll-margin-top: calc(var(--topbar-h) + 8px); }
.category-alert { color: var(--warn); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.config-key { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.head-comment { color: var(--faint); font-size: var(--fs-xs); white-space: pre-wrap; margin-top: .2rem; }

/* -- page: status -------------------------------------------------------- */
.topology-label { color: var(--faint); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .05em; text-transform: uppercase; margin-bottom: .45rem; }
.topology-flow { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.topology-node { border: 1px solid var(--line-strong); border-radius: var(--r-pill); color: var(--muted); font-size: var(--fs-sm); line-height: 1.25; padding: .3rem .6rem; }
.topology-node.current { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: var(--fw-semibold); }
.topology-arrow { color: var(--faint); display: inline-flex; align-items: center; }
.deployment-details { padding: 0 var(--sp-4) var(--sp-3); }

/* -- page: secrets ------------------------------------------------------- */
.secrets-category { border-bottom: 1px solid var(--line); }
.secrets-category:last-child { border-bottom: none; }
.secrets-category-title { padding: .8rem var(--sp-4) .2rem; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: var(--fw-semibold); }
.reveal-value {
  display: block; padding: .7rem .9rem; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); font: var(--fs-md)/1.5 var(--font-mono); word-break: break-all; user-select: all;
}

/* -- secret activation / next steps -------------------------------------- */
.next-step-list { display: grid; gap: .45rem; }
.next-step { display: flex; align-items: center; gap: .55rem; min-width: 0; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); }
.next-step-number { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); flex: none; }
.next-step code { min-width: 0; overflow: auto; color: var(--ink); font-size: var(--fs-xs); white-space: nowrap; }
.revealed { font-family: var(--font-mono); font-size: var(--fs-sm); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); padding: .35rem .5rem; border-radius: var(--r-sm); word-break: break-all; user-select: all; }
.countdown { color: var(--warn); font-size: var(--fs-2xs); }

/* -- monitoring vocabulary (components/monitoring.js) --------------------- */
/* Severity is never colour-only: every state also carries its own icon from
   monitoring.js, and unavailable/stale get a neutral tone so an evidence gap
   can never read as healthy. */
.severity-indicator { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-sm); color: var(--muted); }
.severity-indicator .severity-label { font-weight: var(--fw-medium); }
.severity-indicator .severity-threshold { color: var(--faint); font-size: var(--fs-xs); }
.severity-indicator.tone-ok { color: var(--status-normal); }
.severity-indicator.tone-watch { color: var(--status-watch); }
.severity-indicator.tone-warn { color: var(--status-warning); }
.severity-indicator.tone-err { color: var(--status-critical); }
.severity-indicator.tone-stale { color: var(--status-stale); }
.severity-indicator.tone-unavailable { color: var(--status-unavailable); }

.cluster-context {
  display: grid; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-card); box-shadow: var(--shadow);
}
.cluster-context-row { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; }
.cluster-context-row:last-child { border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.cluster-context-cluster { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-secondary); }
.cluster-context-select {
  height: 28px; padding: 0 var(--sp-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--bg-2); color: var(--ink); font-size: var(--fs-sm);
}
.cluster-context-collected { font-size: var(--fs-xs); }
.cluster-context-row .btn { margin-left: auto; }

/* The bar is a native <meter>: the value is an attribute, not an inline
   style, so it works under style-src 'self' with no unsafe-inline. */
.resource-pressure { display: grid; gap: .3rem; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); }
.resource-pressure-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.resource-pressure-label { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.resource-pressure-pct { font-size: var(--fs-lg); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.resource-pressure-foot { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-xs); }
.resource-pressure-meter { width: 100%; height: 6px; appearance: none; -webkit-appearance: none; border: 0; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.resource-pressure-meter::-webkit-meter-bar { background: var(--line); border: 0; border-radius: var(--r-pill); height: 6px; }
.resource-pressure-meter::-webkit-meter-optimum-value,
.resource-pressure-meter::-webkit-meter-suboptimum-value,
.resource-pressure-meter::-webkit-meter-even-less-good-value { background: currentColor; border-radius: var(--r-pill); }
.resource-pressure-meter::-moz-meter-bar { background: currentColor; border-radius: var(--r-pill); }
.resource-pressure.tone-ok { color: var(--status-normal); }
.resource-pressure.tone-watch { color: var(--status-watch); }
.resource-pressure.tone-warn { color: var(--status-warning); }
.resource-pressure.tone-err { color: var(--status-critical); }
.resource-pressure.tone-stale { color: var(--status-stale); }
.resource-pressure.tone-unavailable { color: var(--status-unavailable); }
.resource-pressure .resource-pressure-foot, .resource-pressure .resource-pressure-label { color: var(--muted); }

.evidence-provenance { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--faint); }
.evidence-provenance-reason { color: var(--status-warning); }

.degraded-state {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: var(--sp-4); border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--bg-2);
}
.degraded-state-body { display: grid; gap: .2rem; min-width: 0; }
.degraded-state .btn { margin-left: auto; }
.degraded-state.tone-ok { color: var(--status-normal); }
.degraded-state.tone-stale { color: var(--status-stale); }
.degraded-state.tone-unavailable { color: var(--status-unavailable); }
.degraded-state strong { color: var(--ink); }

.top-consumer-panel { display: grid; gap: var(--sp-2); }
.top-consumer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.top-consumer-title { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.top-consumer-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.top-consumer-table th { text-align: left; color: var(--faint); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; padding: .3rem .5rem; }
.top-consumer-table td { padding: .35rem .5rem; border-top: 1px solid var(--line); }

/* -- dev gallery --------------------------------------------------------- */
.gallery-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

/* -- responsive ---------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  ep-app-shell, ep-app-shell[collapsed] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "topbar" "main";
  }
  ep-rail {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); height: 100vh;
    transform: translateX(-100%); transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  ep-app-shell[drawer-open] ep-rail { transform: none; }
  ep-app-shell[collapsed] .rail-brand img, ep-app-shell[collapsed] .rail-brand-text, ep-app-shell[collapsed] .rail-env-label,
  ep-app-shell[collapsed] .rail-env > ep-icon, ep-app-shell[collapsed] .rail-item > span, ep-app-shell[collapsed] .rail-section { display: revert; }
  ep-app-shell[collapsed] .rail-brand img.rail-brand-mark { display: none; }
  ep-app-shell[collapsed] .rail-env { grid-template-columns: auto 1fr auto; justify-items: start; }
  ep-app-shell[collapsed] .rail-item { justify-content: flex-start; padding-inline: var(--sp-2); }
  .rail-toggle { display: none; }
  .rail-scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 29; }
  ep-topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  .topbar-menu-btn { display: inline-flex; }
  .topbar-crumbs .crumb:not(.current) { display: none; }
  .topbar-crumbs .crumb-sep { display: none; }
  main { padding: var(--sp-4) var(--sp-4) 7rem; }
  ep-savebar, ep-app-shell[collapsed] ep-savebar { left: 0; padding: var(--sp-3) var(--sp-4); }
  ep-toast-stack { left: var(--sp-4); right: var(--sp-4); max-width: none; align-items: stretch; }
  ep-service-picker { min-width: 0; flex: 1; }
  .searchbox { min-width: 0; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { display: grid; }
  .hero-health { padding: .75rem 0 0; border-left: 0; border-top: 1px solid var(--line-strong); text-align: left; }
  .config-summary ep-tabs { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .signin-card { padding: 1.75rem 1.25rem; }
  .queue-row { grid-template-columns: 1fr auto; gap: .15rem .75rem; }
  .queue-row .muted { grid-column: 1; }
  .queue-row > :last-child { grid-column: 2; grid-row: 1 / span 2; }
  .alert-row, .seeder-row { display: grid; }
  .seeder-actions { justify-content: flex-end; }
  .topbar-actions .searchbox { display: none; }
  dialog .dhead, dialog .dbody, dialog .dfoot { padding-inline: var(--sp-4); }
}

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