/* Podman Manager
   Extends the Qdrant Management design system: marine shell, mineral field, amber
   marker. Flat surfaces, 2px corners, monospace reserved for identifiers and logs.
   Both themes are first-class; nothing here depends on a dark-only assumption. */

/* ---------------------------------------------------------------- fonts -- */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------- tokens -- */
:root {
  --marine: #112d39;
  --marine-raise: #1a3f4e;
  --field: #e9efeb;
  --surface: #fbfcfa;
  --surface-2: #e2e9e5;
  --ink: #132c34;
  --ink-muted: #465f67;
  --rule: #bac9c4;
  --rule-strong: #728b88;
  --amber: #f0c14d;
  --warm-focus: #b84828;
  --healthy: #17644c;
  --warning: #9a6500;
  --danger: #9f3335;
  --neutral: #62777a;

  --on-shell: #ffffff;
  --on-shell-muted: #b7cdcd;
  --focus: var(--warm-focus);

  --shell: var(--marine);
  --shadow-dialog: 0 18px 48px rgb(0 0 0 / 22%);
  --shadow-toast: 0 8px 20px rgb(0 0 0 / 18%);

  --r: 2px;
  --s-compact: 8px;
  --s-standard: 16px;
  --s-page: clamp(18px, 3vw, 42px);
  --sidebar-w: 232px;
  --topbar-h: 72px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --field: #0e1b21;
  --surface: #142630;
  --surface-2: #1c313c;
  --ink: #e6eeea;
  --ink-muted: #a8bdbe;
  --rule: #2c4650;
  --rule-strong: #567479;
  --marine: #0b1a21;
  --marine-raise: #17323e;
  --healthy: #4ec9a0;
  --warning: #e0a83c;
  --danger: #f08585;
  --neutral: #94a9ac;
  --focus: var(--amber);
  --shadow-dialog: 0 18px 48px rgb(0 0 0 / 58%);
  --shadow-toast: 0 8px 20px rgb(0 0 0 / 50%);
}

/* ----------------------------------------------------------------- base -- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--field);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* `display` values declared below would otherwise beat the `hidden` attribute and
   leave an invisible overlay intercepting clicks. */
[hidden] { display: none !important; }

a { color: var(--warm-focus); text-decoration-thickness: 1px; text-underline-offset: 2px; }
[data-theme="dark"] a { color: var(--amber); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 90;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
}
.skip-link:focus { left: 8px; top: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- glyphs -- */
/* Icon set drawn for this product: square, machined strokes that echo the
   register character of the shell. Deliberately not a stock icon library. */
.nav__glyph, .btn__glyph, .row-glyph {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: none;
  position: relative;
}
.nav__glyph::before, .btn__glyph::before, .row-glyph::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid currentColor;
}
[data-g="overview"]::before { border-width: 1.5px; }
[data-g="overview"]::after,
[data-g="containers"]::after,
[data-g="system"]::after {
  content: "";
  position: absolute;
  background: currentColor;
}
[data-g="overview"]::after { left: 3px; top: 3px; right: 3px; height: 1.5px; box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor; }
[data-g="containers"]::before { border-radius: 1px; }
[data-g="containers"]::after { left: 3px; top: 5px; width: 4px; height: 1.5px; box-shadow: 0 4px 0 currentColor; }
[data-g="create"]::before { border-radius: 1px; }
[data-g="create"]::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 1.5px;
  margin: -0.75px 0 0 -4px;
  background: currentColor;
  box-shadow: 0 3.5px 0 -0.2px currentColor;
}
[data-g="images"]::before { transform: rotate(45deg) scale(0.72); }
[data-g="volumes"]::before { border-radius: 1px; }
[data-g="volumes"]::after {
  content: "";
  position: absolute;
  left: 2.5px; top: 6.5px;
  width: 8px; height: 1.5px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}
[data-g="networks"]::before { border-radius: 1px; }
[data-g="networks"]::after {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 4px; height: 4px;
  border: 1.5px solid currentColor;
  box-shadow: 6px 6px 0 -1px var(--marine), 6px 6px 0 0.5px currentColor;
}
[data-g="logs"]::before { border-radius: 1px; }
[data-g="logs"]::after {
  content: "";
  position: absolute;
  left: 3px; top: 3.5px;
  width: 2px; height: 8px;
  background: currentColor;
  box-shadow: 4px 0 0 currentColor;
}
[data-g="system"]::before { border-radius: 50%; }
[data-g="system"]::after { left: 2.5px; top: 2.5px; width: 8px; height: 1.5px; box-shadow: 0 0 0 0 currentColor; transform: rotate(35deg); }
[data-g="qdrant"]::before { border-radius: 1px; }
[data-g="qdrant"]::after {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 3px; height: 3px;
  background: currentColor;
  box-shadow: 5px 1px 0 currentColor, 2px 5px 0 currentColor;
}
[data-g="theme"]::before { border-radius: 50%; }
[data-g="theme"]::after {
  content: "";
  position: absolute;
  left: 50%; top: -1.5px;
  width: 1.5px; height: 19px;
  margin-left: -0.75px;
  background: currentColor;
  transform-origin: 50% 8.5px;
  transform: rotate(38deg);
}
[data-g="logout"]::before { border: none; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; top: 4px; }
[data-g="logout"]::after {
  content: "";
  position: absolute;
  left: 1px; top: 1.5px;
  width: 9px; height: 1.5px;
  background: currentColor;
  box-shadow: -3px 0 0 -0.1px currentColor;
}
[data-g="menu"]::after {
  content: "";
  position: absolute;
  left: 1px; top: 3.5px;
  width: 12px; height: 1.5px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}
[data-g="refresh"]::before { border-radius: 50%; border-top-color: transparent; }
[data-g="refresh"]::after {
  content: "";
  position: absolute;
  right: 0; top: 0;
  width: 0; height: 0;
  border: 3.5px solid transparent;
  border-bottom-color: currentColor;
  transform: translateY(-2px);
}
[data-g="search"]::before { border-radius: 50%; width: 11px; height: 11px; left: 0; top: 0; }
[data-g="search"]::after {
  content: "";
  position: absolute;
  right: 1px; bottom: 1px;
  width: 6px; height: 1.5px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: 100% 50%;
}
[data-g="copy"]::before { border-radius: 1px; }
[data-g="copy"]::after {
  content: "";
  position: absolute;
  left: 4px; top: 4px;
  width: 8px; height: 8px;
  border: 1.5px solid currentColor;
  background: var(--surface);
}
[data-g="download"]::before { border: none; border-bottom: 1.5px solid currentColor; left: 2px; right: 2px; top: 10px; }
[data-g="download"]::after {
  content: "";
  position: absolute;
  left: 7px; top: 1px;
  width: 1.5px; height: 8px;
  background: currentColor;
}
[data-g="external"]::before { border-top: none; border-left: none; border-bottom: none; left: 2px; top: 6px; right: 0; bottom: 0; transform: rotate(-1deg); }
[data-g="external"]::after {
  content: "";
  position: absolute;
  right: 0; top: 0;
  width: 9px; height: 9px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}
[data-g="trash"]::before { border: none; border-top: 1.5px solid currentColor; left: 1px; right: 1px; top: 4px; }
[data-g="trash"]::after {
  content: "";
  position: absolute;
  left: 3px; top: 6px;
  width: 8px; height: 9px;
  border: 1.5px solid currentColor;
  border-top: none;
}
[data-g="play"]::before { border: none; }
[data-g="play"]::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 0; height: 0;
  border: 7px solid transparent;
  border-left-color: currentColor;
}
[data-g="stop"]::before { border-radius: 1px; }
[data-g="stop"]::after {
  content: "";
  position: absolute;
  left: 4px; top: 4px;
  width: 8px; height: 8px;
  background: currentColor;
}
[data-g="pause"]::before { border: none; }
[data-g="pause"]::after {
  content: "";
  position: absolute;
  left: 4px; top: 2px;
  width: 3px; height: 12px;
  background: currentColor;
  box-shadow: 5px 0 0 currentColor;
}
[data-g="restart"]::before { border-radius: 50%; border-top-color: transparent; border-left-color: transparent; }
[data-g="restart"]::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  border: 3.5px solid transparent;
  border-bottom-color: currentColor;
}
[data-g="info"]::before { border-radius: 50%; }
[data-g="info"]::after {
  content: "i";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 11px/1 var(--sans);
  font-style: italic;
}
[data-g="warning"]::before { border-radius: 1px; border-top: none; transform: perspective(14px) rotateX(28deg); }
[data-g="warning"]::after {
  content: "!";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 9px/1 var(--sans);
  margin-top: 1px;
}

/* ------------------------------------------------------------------ mark -- */
/* Brand mark: a filled square inside an outlined square. The container inside
   the host, which is the whole product in one glyph. */
.mark {
  width: 34px;
  height: 34px;
  flex: none;
  position: relative;
  border: 1.5px solid var(--amber);
  display: grid;
  place-items: center;
}
.mark__glyph {
  width: 13px;
  height: 13px;
  background: var(--amber);
  display: block;
}
.mark--sm { width: 28px; height: 28px; }
.mark--sm .mark__glyph { width: 11px; height: 11px; }

/* ----------------------------------------------------------------- login -- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--s-page);
  background: var(--marine);
}
.login__panel {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 30px 28px 24px;
  box-shadow: var(--shadow-dialog);
}
.login__panel .mark { margin-bottom: 18px; }
.login__title { font-size: 25px; font-weight: 700; letter-spacing: -0.03em; }
.login__sub { color: var(--ink-muted); margin-top: 6px; font-size: 14px; }
.login__form { margin-top: 22px; display: grid; gap: 14px; }
.login__foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-muted);
}
.login__error {
  font-size: 13px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  padding: 8px 10px;
}

/* ----------------------------------------------------------------- shell -- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--shell);
  color: var(--on-shell);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 2px solid var(--amber);
}
.sidebar__brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 17px var(--s-standard) 15px;
  border-bottom: 1px solid color-mix(in srgb, var(--on-shell) 16%, transparent);
}
.sidebar__brand-text { display: grid; min-width: 0; }
.sidebar__name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.sidebar__host {
  font-size: 11.5px;
  color: var(--on-shell-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav { padding: 10px 0; overflow-y: auto; flex: 1; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px var(--s-standard);
  color: var(--on-shell-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 14px;
}
.nav__item:hover { background: var(--marine-raise); color: var(--on-shell); }
.nav__item.is-active {
  background: var(--marine-raise);
  color: var(--on-shell);
  border-left-color: var(--amber);
  font-weight: 600;
}
.nav__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__count {
  font: 400 12px/1 var(--mono);
  color: var(--on-shell-muted);
  font-variant-numeric: tabular-nums;
}
.sidebar__foot {
  padding: 12px var(--s-compact);
  border-top: 1px solid color-mix(in srgb, var(--on-shell) 16%, transparent);
  display: grid;
  gap: 6px;
}

.frame { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 var(--s-page);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 21px; font-weight: 700; }
.topbar__sub { font-size: 13px; color: var(--ink-muted); margin-top: 1px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.topbar__menu { display: none; }

.podman-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-muted);
  padding: 5px 10px;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: var(--r);
}
.podman-state__dot {
  width: 8px; height: 8px;
  background: var(--neutral);
  flex: none;
}
.podman-state.is-up .podman-state__dot { background: var(--healthy); }
.podman-state.is-down .podman-state__dot { background: var(--danger); }

/* The dot marks a real state: the Podman API answering or not. No pulse. */

.main { padding: var(--s-page); flex: 1; min-width: 0; }
.stack { display: grid; gap: 20px; }

.scrim {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 46%);
  z-index: 25;
}

/* --------------------------------------------------------------- panels --- */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.panel__title { font-size: 15px; font-weight: 700; letter-spacing: -0.015em; }
.panel__note { font-size: 12.5px; color: var(--ink-muted); }
.panel__tools { margin-left: auto; display: flex; gap: var(--s-compact); align-items: center; flex-wrap: wrap; }
.panel__body { padding: 14px; }
.panel__body--flush { padding: 0; }

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 9px;
}

/* --------------------------------------------------------- register strip --
   Summary figures sit on one ruled line rather than in a row of metric cards.
   Reason: these are a register to read across, not four separate features. */
.register {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 4px 0;
}
.register__cell {
  flex: 1 1 132px;
  padding: 10px 16px;
  border-right: 1px solid var(--rule);
  min-width: 0;
}
.register__cell:last-child { border-right: none; }
.register__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.register__value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.register__value--sm { font-size: 17px; font-weight: 600; }
.register__foot { font-size: 12px; color: var(--ink-muted); margin-top: 1px; }

/* Timestamp and refresh rate sit on one short ruled line above the figures, so the
   operator can tell how old the numbers are without hunting for a control. */
.register-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: -12px;
}
.register-top .panel__note { margin-left: auto; }
.refresh-ctl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.refresh-ctl select {
  width: auto;
  min-height: 32px;
  padding: 3px 8px;
  font: 600 12px/1.2 var(--sans);
  text-transform: none;
  letter-spacing: 0;
}

/* ---------------------------------------------------------------- meters -- */
.meter { margin-top: 7px; }
.meter__track {
  height: 6px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.meter__fill { height: 100%; background: var(--marine-raise); }
.meter__fill--warn { background: var(--warning); }
.meter__fill--hot { background: var(--danger); }
.meter__scale {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.gauge { background: var(--surface); padding: 14px 16px; }
.gauge__label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-muted);
}
.gauge__value {
  font-size: 21px; font-weight: 700; letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums; margin-top: 2px;
}

/* ---------------------------------------------------------------- tables -- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--surface-2);
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.data th button.sort {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.data th button.sort:hover { color: var(--ink); }
.data th button.sort::after {
  content: "";
  width: 0; height: 0;
  border: 4px solid transparent;
  opacity: 0;
}
.data th button.sort[aria-sort="ascending"]::after,
.data th button.sort[aria-sort="descending"]::after { opacity: 1; }
.data th button.sort[aria-sort="ascending"]::after { border-bottom-color: currentColor; transform: translateY(2px); }
.data th button.sort[aria-sort="descending"]::after { border-top-color: currentColor; transform: translateY(-2px); }
.data tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.data tbody tr:hover { background: var(--surface-2); }
.data tbody tr:last-child td { border-bottom: none; }
.data .cell-name { font-weight: 600; }
.data .mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.data .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Long identifiers keep the row one line tall; the full value stays reachable
   through the cell's title attribute and the Inspect panel. */
.data td.trunc {
  max-width: 148px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data td.trunc-wide { max-width: 210px; }
.data td.trunc-tight { max-width: 118px; }
.data td.nowrap { white-space: nowrap; }
/* Secondary line inside a cell, such as the start time under the state mark. */
.cell-sub {
  font-size: 11.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.link-btn {
  all: unset;
  cursor: pointer;
  font: 600 13.5px/1.35 var(--sans);
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.link-btn:hover { color: var(--warm-focus); text-decoration: underline; }
[data-theme="dark"] .link-btn:hover { color: var(--amber); }
/* Action buttons stay on one line: a wrapped action column triples the row height
   and makes a dense inventory hard to scan. With nine data columns the table is
   wider than a 1440px viewport, so the action column pins to the right edge and
   stays reachable without scrolling the inventory sideways. */
.data .actions {
  display: flex;
  gap: 3px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.data td.actions, .data th.actions {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--surface);
}
.data th.actions { z-index: 2; }
.data thead th.actions { background: var(--surface-2); }
.data tbody tr:hover td.actions { background: var(--surface-2); }
/* A hairline marks where the pinned column begins over the scrolled content. */
.data td.actions::before,
.data th.actions::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}

/* --------------------------------------------------------- status marks --- */
.mark-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mark-state__box {
  width: 9px; height: 9px;
  flex: none;
  background: var(--neutral);
}
.mark-state--running .mark-state__box { background: var(--healthy); }
.mark-state--stopped .mark-state__box { background: var(--neutral); }
.mark-state--paused .mark-state__box { background: var(--warning); }
.mark-state--error .mark-state__box { background: var(--danger); }
.mark-state--exited .mark-state__box { background: var(--ink-muted); }

.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 6px;
  background: var(--surface-2);
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  white-space: nowrap;
}
.tag--inuse { color: var(--healthy); border-color: color-mix(in srgb, var(--healthy) 35%, transparent); background: color-mix(in srgb, var(--healthy) 8%, transparent); }
.tag--dangling { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  font: 600 13.5px/1.2 var(--sans);
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 8%, var(--surface-2)); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--marine); color: #fff; }
.btn--primary:hover { background: var(--marine-raise); }
[data-theme="dark"] .btn--primary { background: var(--marine-raise); color: var(--ink); border-color: var(--rule-strong); }
[data-theme="dark"] .btn--primary:hover { background: color-mix(in srgb, var(--amber) 14%, var(--marine-raise)); }
.btn--secondary { background: transparent; border-color: var(--rule-strong); color: var(--ink); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger); color: #fff; }
[data-theme="dark"] .btn--danger { color: #20100f; }
.btn--danger:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; color: var(--on-shell-muted); border-color: color-mix(in srgb, var(--on-shell) 22%, transparent); }
.btn--ghost:hover { background: var(--marine-raise); color: var(--on-shell); }
.btn--sm { min-height: 32px; padding: 4px 7px; font-size: 12px; gap: 4px; }
.btn--block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- fields -- */
.field { display: grid; gap: 5px; min-width: 0; }
.field__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}
.field__hint { font-size: 12px; color: var(--ink-muted); }
.field__error { font-size: 12px; color: var(--danger); }
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font: 400 14px/1.35 var(--sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: var(--field);
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); opacity: 1; }
textarea { min-height: 92px; font-family: var(--mono); font-size: 12.5px; resize: vertical; }
select { cursor: pointer; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--marine); cursor: pointer; }
[data-theme="dark"] input[type="checkbox"] { accent-color: var(--amber); }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 200px;
}
.search .btn__glyph { position: absolute; left: 10px; color: var(--ink-muted); pointer-events: none; }
.search input { padding-left: 33px; }

.filter-group { display: flex; gap: 0; border: 1px solid var(--rule-strong); border-radius: var(--r); overflow: hidden; }
.filter-group button {
  all: unset;
  cursor: pointer;
  padding: 8px 12px;
  font: 600 12.5px/1.2 var(--sans);
  color: var(--ink-muted);
  border-right: 1px solid var(--rule);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-group button:last-child { border-right: none; }
.filter-group button:hover { background: var(--surface-2); color: var(--ink); }
.filter-group button[aria-pressed="true"] { background: var(--marine); color: #fff; }
[data-theme="dark"] .filter-group button[aria-pressed="true"] { background: var(--marine-raise); color: var(--ink); }
.filter-group .count { font-variant-numeric: tabular-nums; opacity: 0.8; }

/* --------------------------------------------------------------- states --- */
.state {
  padding: 40px 22px;
  text-align: center;
  color: var(--ink-muted);
}
.state__title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.state__body { font-size: 13.5px; max-width: 440px; margin: 0 auto 14px; }
.state--error .state__title { color: var(--danger); }
.state__action { margin-top: 4px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--ink) 6%, var(--surface-2)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: sweep 1.4s linear infinite;
  height: 12px;
  border-radius: var(--r);
}
@keyframes sweep { to { background-position: -200% 0; } }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--rule-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- modal --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 52%);
}
.modal__panel {
  width: min(500px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  box-shadow: var(--shadow-dialog);
  padding: 20px;
}
.modal__title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.modal__body { font-size: 14px; color: var(--ink); display: grid; gap: 11px; }
.modal__body ul { display: grid; gap: 5px; font-size: 13px; color: var(--ink-muted); }
.modal__body li { padding-left: 14px; position: relative; }
.modal__body li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 6px; height: 6px;
  background: var(--rule-strong);
}
.modal__body li.is-risk::before { background: var(--danger); }
.modal__actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }

/* --------------------------------------------------------------- toasts --- */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  display: grid;
  gap: 9px;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--healthy);
  box-shadow: var(--shadow-toast);
  padding: 11px 13px;
  font-size: 13.5px;
  animation: rise 0.16s ease-out;
}
.toast--error { border-left-color: var(--danger); }
.toast--info { border-left-color: var(--rule-strong); }
.toast__title { font-weight: 700; }
.toast__body { color: var(--ink-muted); margin-top: 2px; word-break: break-word; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------ code views -- */
.kv {
  display: grid;
  grid-template-columns: minmax(130px, 200px) 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.kv__key, .kv__val {
  background: var(--surface);
  padding: 8px 12px;
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.kv__key { color: var(--ink-muted); font-weight: 600; font-size: 12px; }

.log-view {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  background: var(--field);
  border: 1px solid var(--rule);
  height: min(60vh, 560px);
  overflow: auto;
  padding: 10px 12px;
}
[data-theme="dark"] .log-view { background: #0a1519; }
.log-line { display: block; white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 0; }
.log-line__ts { color: var(--ink-muted); margin-right: 8px; }
.log-line mark { background: var(--amber); color: #16232a; }
.log-view__empty { color: var(--ink-muted); padding: 18px 4px; }

.stream-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.stream-state__box { width: 8px; height: 8px; background: var(--neutral); flex: none; }
.stream-state.is-live .stream-state__box { background: var(--healthy); }
.stream-state.is-paused .stream-state__box { background: var(--warning); }
.stream-state.is-error .stream-state__box { background: var(--danger); }

/* ---------------------------------------------------------------- misc ---- */
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 2px; }
.page-head__text { flex: 1; min-width: 220px; }
.page-head h2 { font-size: 17px; font-weight: 700; }
.page-head p { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }

.two-col { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; }
.three-col { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.list-rows { display: grid; }
.list-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.list-row:last-child { border-bottom: none; }
.list-row__main { min-width: 0; flex: 1; }
.list-row__title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-row__meta { color: var(--ink-muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }

.timeline { display: grid; gap: 0; }
.timeline__item {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
}
.timeline__item:last-child { border-bottom: none; }
.timeline__when { color: var(--ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline__what { min-width: 0; overflow-wrap: anywhere; }

.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.pager__info { font-size: 12.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pager__info strong { color: var(--ink); }
.pager__nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.cmd-preview {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--field);
  border: 1px solid var(--rule);
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
[data-theme="dark"] .cmd-preview { background: #0a1519; }

.repeater { display: grid; gap: 9px; }
.repeater__row {
  display: grid;
  gap: 9px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--rule);
  background: var(--field);
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}
[data-theme="dark"] .repeater__row { background: var(--field); }
.repeater__row .btn--sm { height: 38px; }

.qdrant-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 20px;
  display: grid;
  gap: 14px;
}
.qdrant-card__url {
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: var(--field);
  padding: 10px 12px;
  border: 1px solid var(--rule);
}
[data-theme="dark"] .qdrant-card__url { background: #0a1519; }
.qdrant-card__note { font-size: 12.5px; color: var(--ink-muted); }

.masked-value { color: var(--ink-muted); letter-spacing: 0.08em; }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  :root { --topbar-h: 64px; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.18s ease-out;
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .topbar__menu { display: inline-grid; }
  .data { font-size: 13px; }
  .data tbody td, .data thead th { padding: 8px 10px; }
  .main { padding: 16px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv__key { padding-bottom: 0; background: var(--surface-2); }
}

@media (max-width: 640px) {
  .register { display: grid; grid-template-columns: 1fr 1fr; }
  .register__cell { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .register__cell:nth-child(2n) { border-right: none; }
  .register__cell:nth-last-child(-n+2) { border-bottom: none; }
  .register__value { font-size: 21px; }
  .panel__head { gap: 9px; }
  .panel__tools { margin-left: 0; width: 100%; }
  .search { min-width: 0; width: 100%; }
  .timeline__item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .topbar__sub { display: none; }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; min-height: 44px; }
}

/* Records replace the table at this width: every column keeps a label. */
@media (max-width: 720px) {
  table.responsive thead { display: none; }
  table.responsive tbody tr {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--rule);
  }
  table.responsive tbody td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 10px;
    padding: 2px 0;
    border: none;
    align-items: center;
  }
  table.responsive tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }
  table.responsive tbody td[data-label="Actions"] { padding-top: 8px; }
  table.responsive tbody td[data-label="Actions"]::before { display: none; }
  /* Records stack vertically here, so pinning the action column would be wrong. */
  table.responsive tbody td.actions,
  table.responsive thead th.actions { position: static; }
  table.responsive tbody td.actions::before,
  table.responsive thead th.actions::before { display: none; }
  /* Below the record breakpoint the actions wrap freely: a narrow column cannot
     hold five buttons on one line without truncating their labels. */
  table.responsive tbody td[data-label="Actions"] .actions { flex-wrap: wrap; }
  .data tbody tr:hover { background: transparent; }
}

@media (max-width: 420px) {
  .register { grid-template-columns: 1fr; }
  .register__cell { border-right: none; }
  .register__cell:nth-last-child(2) { border-bottom: 1px solid var(--rule); }
}

@media (max-width: 360px) {
  .main { padding: 12px; }
  .panel__body { padding: 11px; }
  .pager__nav { margin-left: 0; width: 100%; }
  .pager__nav .btn { flex: 1; min-height: 44px; }
}

/* Touch targets stay at 44px on coarse pointers. */
@media (pointer: coarse) {
  .btn, .icon-btn, .filter-group button { min-height: 44px; }
  .nav__item { padding-top: 12px; padding-bottom: 12px; }
}