/* Harbor: reading-room calm with harbor-signal accents.
   Tokens follow the system theme; data-theme on <html> forces one. */
:root {
  --brand-word: #000;
  --ground: #e3eefa;
  --surface: #f7fbff;
  --surface-2: #edf4fc;
  --ink: #0b1a2b;
  --ink-2: #33475c;
  --muted: #4d6177;
  --line: #c5d6e8;
  --line-strong: #8fa8c2;
  --signal: #b53c10; /* buoy orange, text-safe on surface */
  --signal-fill: #e2562b;
  --signal-soft: #fbe6dd;
  --tide: #0d6a70; /* teal */
  --tide-soft: #d9eeee;
  --ok: #1d6b3a;
  --ok-soft: #dcefe2;
  --warn: #8a5a00;
  --warn-soft: #f7ebcf;
  --bad: #a11f2a;
  --bad-soft: #f6dcdd;
  --film: #0a1218; /* preview "lightbox" ground, both themes */
  --film-ink: #d6e3e8;
  --shadow:
    0 1px 2px rgb(16 42 74 / 0.07), 0 8px 24px -12px rgb(16 42 74 / 0.2);
  --radius: 10px;
  --radius-s: 6px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --display:
    "Avenir Next", "Avenir", "Segoe UI Variable Display", "Segoe UI", system-ui,
    sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-word: #fff;
    --ground: #091117;
    --surface: #0f1a21;
    --surface-2: #13212a;
    --ink: #e5edf0;
    --ink-2: #b9c7ce;
    --muted: #93a6b0;
    --line: #22343e;
    --line-strong: #3a5160;
    --signal: #ff8a5c;
    --signal-fill: #e2562b;
    --signal-soft: #3a1a0f;
    --tide: #5cc7cc;
    --tide-soft: #0f3134;
    --ok: #6fd391;
    --ok-soft: #12301d;
    --warn: #f0c055;
    --warn-soft: #33270b;
    --bad: #ff8c94;
    --bad-soft: #3a1418;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 28px -14px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-word: #fff;
  --ground: #091117;
  --surface: #0f1a21;
  --surface-2: #13212a;
  --ink: #e5edf0;
  --ink-2: #b9c7ce;
  --muted: #93a6b0;
  --line: #22343e;
  --line-strong: #3a5160;
  --signal: #ff8a5c;
  --signal-fill: #e2562b;
  --signal-soft: #3a1a0f;
  --tide: #5cc7cc;
  --tide-soft: #0f3134;
  --ok: #6fd391;
  --ok-soft: #12301d;
  --warn: #f0c055;
  --warn-soft: #33270b;
  --bad: #ff8c94;
  --bad-soft: #3a1418;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 28px -14px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  outline: none;
}
a {
  color: var(--tide);
  text-underline-offset: 2px;
}
a:hover {
  color: var(--ink);
}
h1,
h2,
h3 {
  font-family: var(--display);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.15;
}
h1 {
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 700;
}
h2 {
  font-size: 20px;
  font-weight: 650;
}
h3 {
  font-size: 16px;
  font-weight: 650;
}
p {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--signal-fill);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px;
  top: 8px;
  z-index: 50;
  background: var(--surface);
  padding: 8px 12px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 20px 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 28px;
  height: 28px;
  color: #3b82f6;
}
.brand-word {
  color: var(--brand-word);
  font-family: var(--display);
  font-weight: 750;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.sandbox-badge {
  font: 600 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 9px;
  border-radius: 99px;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  white-space: nowrap;
}
.topbar-spacer {
  flex: 1;
}
.persona {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.persona button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.persona button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}
.persona button:hover:not([aria-pressed="true"]) {
  background: var(--surface-2);
  color: var(--ink);
}
.tabs {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs a {
  padding: 10px 12px 11px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  gap: 7px;
  align-items: center;
}
.tabs a:hover {
  color: var(--ink);
}
.tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--signal-fill);
}
.tabs .count {
  font: 600 11px/1 var(--mono);
  background: var(--signal-fill);
  color: #fff;
  border-radius: 99px;
  padding: 3px 6px;
}

/* ---------- layout primitives ---------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head p {
  color: var(--ink-2);
  max-width: 64ch;
  margin-top: 6px;
}
.eyebrow {
  font: 600 11px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 960px) {
  .split {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  main {
    padding: 20px 16px 56px;
  }
  .topbar-inner,
  .tabs {
    padding-left: 16px;
    padding-right: 16px;
  }
  .sandbox-badge {
    order: 3;
  }
  .persona {
    width: 100%;
    order: 4;
  }
  .persona button {
    flex: 1;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad {
  padding: 20px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.sticky {
  position: sticky;
  top: 84px;
}
@media (max-width: 960px) {
  .sticky {
    position: static;
  }
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
  border: 0;
}

/* ---------- stats ---------- */
.stat {
  padding: 16px 18px;
}
.stat .label {
  font: 600 11px/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .value {
  font: 650 28px/1.1 var(--mono);
  margin-top: 8px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat .unit {
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
  font-family: var(--sans);
  font-weight: 500;
}
.stat .sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--ink-2);
}
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--ink) 85%, var(--signal-fill));
  border-color: transparent;
  color: var(--surface);
}
.btn-signal {
  background: var(--signal-fill);
  border-color: var(--signal-fill);
  color: #fff;
}
.btn-signal:hover {
  background: #c94a22;
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--tide);
  padding: 0 10px;
}
.btn-ghost:hover {
  background: var(--tide-soft);
  border-color: transparent;
}
.btn-danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 45%, transparent);
}
.btn-danger:hover {
  background: var(--bad-soft);
  border-color: var(--bad);
}
.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
}
.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn[aria-busy="true"]::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label,
.field .label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
}
.field .hint {
  font-size: 12px;
  color: var(--muted);
}
.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface);
}
textarea.input {
  min-height: 96px;
  resize: vertical;
}
.input:focus {
  outline: 2px solid var(--signal-fill);
  outline-offset: 0;
  border-color: transparent;
}
.input[aria-invalid="true"] {
  border-color: var(--bad);
}
.search {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search .input {
  padding-left: 38px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  border: 0;
  background: transparent;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-2);
  border-right: 1px solid var(--line);
}
.seg button:last-child {
  border-right: 0;
}
.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}
.seg.wide {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: 100%;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
button.chip {
  cursor: pointer;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}
button.chip[aria-pressed="true"] {
  background: var(--tide);
  border-color: var(--tide);
  color: var(--surface);
}

/* ---------- status pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 650 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 5px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill-active,
.pill-published,
.pill-passed {
  color: var(--ok);
  background: var(--ok-soft);
}
.pill-pending,
.pill-draft {
  color: var(--warn);
  background: var(--warn-soft);
}
.pill-declined,
.pill-failed {
  color: var(--bad);
  background: var(--bad-soft);
}
.pill-expired,
.pill-paused,
.pill-neutral {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* ---------- dataset cards ---------- */
.listings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.listing {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.15s ease,
    border-color 0.15s;
}
.listing:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: inherit;
}
.film {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--film);
  color: var(--film-ink);
  overflow: hidden;
}
.film img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.92;
}
.film .tint {
  position: absolute;
  inset: 0;
  mix-blend-mode: color;
  opacity: 0.28;
}
.film .corner {
  position: absolute;
  font: 600 10.5px/1.35 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--film-ink);
  text-shadow: 0 1px 2px #000;
}
.film .tl {
  top: 10px;
  left: 12px;
}
.film .tr {
  top: 10px;
  right: 12px;
  text-align: right;
}
.film .bl {
  bottom: 10px;
  left: 12px;
}
.film .br {
  bottom: 10px;
  right: 12px;
  text-align: right;
}
.film .synthetic {
  color: #ffb08f;
}
.listing-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.listing-body .summary {
  color: var(--ink-2);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.listing-foot {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px dashed var(--line);
}
.price {
  font: 700 20px/1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.price small {
  font: 500 12px var(--sans);
  color: var(--muted);
  margin-left: 4px;
}
.host {
  font-size: 13px;
  color: var(--muted);
}
.host b {
  color: var(--ink-2);
  font-weight: 600;
}

/* ---------- detail ---------- */
.detail-film {
  aspect-ratio: 21 / 9;
  border-radius: var(--radius);
}
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.facts > div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}
.facts > div:last-child {
  border-right: 0;
}
.facts dt {
  font: 600 11px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.facts dd {
  margin: 6px 0 0;
  font: 650 17px/1.2 var(--mono);
}
@media (max-width: 620px) {
  .facts {
    grid-template-columns: 1fr 1fr;
  }
  .facts > div:nth-child(2) {
    border-right: 0;
  }
  .facts > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}
.prose {
  color: var(--ink-2);
  max-width: 70ch;
  white-space: pre-line;
}
.terms {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 14px 16px;
  font-size: 14px;
  white-space: pre-line;
  color: var(--ink-2);
}

/* ---------- quote / booking panel ---------- */
.quote-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.qline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.qline:last-child {
  border-bottom: 0;
}
.qline .num {
  white-space: nowrap;
}
.qtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 12px;
  border-top: 2px solid var(--ink);
}
.qtotal .num {
  font-size: 26px;
  font-weight: 700;
}
.timer {
  font: 600 12px/1 var(--mono);
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--tide-soft);
  color: var(--tide);
}
.timer.low {
  background: var(--warn-soft);
  color: var(--warn);
}
.timer.gone {
  background: var(--bad-soft);
  color: var(--bad);
}
.callout {
  padding: 12px 14px;
  border-radius: var(--radius-s);
  font-size: 14px;
  border: 1px solid;
}
.callout-info {
  background: var(--tide-soft);
  border-color: color-mix(in srgb, var(--tide) 35%, transparent);
  color: var(--ink);
}
.callout-warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  color: var(--ink);
}
.callout-error {
  background: var(--bad-soft);
  border-color: color-mix(in srgb, var(--bad) 45%, transparent);
  color: var(--ink);
}
.callout-error strong {
  color: var(--bad);
}
.callout-ok {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
}
.assume {
  font-size: 12px;
  color: var(--muted);
  border-left: 0;
}
.assume::before {
  content: "";
  font: 600 10.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warn);
}

/* bundle tray */
.tray {
  position: sticky;
  bottom: 16px;
  z-index: 15;
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 18px;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px -16px rgb(0 0 0 / 0.6);
  flex-wrap: wrap;
}
.tray .tray-items {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.tray .chip {
  background: color-mix(in srgb, var(--surface) 12%, transparent);
  color: var(--surface);
  border-color: transparent;
}
.tray .btn {
  border-color: transparent;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  font: 600 11px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-2);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tr:last-child td {
  border-bottom: 0;
}
td.r,
th.r {
  text-align: right;
}
.pos {
  color: var(--ok);
}
.neg {
  color: var(--bad);
}
tr.expandable {
  cursor: pointer;
}
tr.expandable:hover td {
  background: var(--surface-2);
}
tr.lines td {
  background: var(--surface-2);
  padding-top: 4px;
}
.ledger {
  font: 13px/1.6 var(--mono);
  width: 100%;
  max-width: 520px;
}
.ledger td {
  padding: 3px 8px;
  border: 0;
  background: transparent !important;
}

/* ---------- rentals ---------- */
.rental {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 18px;
  padding: 16px;
  align-items: center;
}
.rental .film {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-s);
}
.rental .film .corner:not(.tl) {
  display: none;
}
.rental-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.rental-meta b {
  color: var(--ink);
  font-weight: 600;
  font-family: var(--mono);
}
.rental-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.clockbar {
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin-top: 10px;
  max-width: 360px;
}
.clockbar span {
  display: block;
  height: 100%;
  background: var(--tide);
}
@media (max-width: 620px) {
  .rental {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .rental-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .rental-actions .btn {
    flex: 1;
  }
}

.workspace {
  background: var(--film);
  color: var(--film-ink);
  border-radius: var(--radius);
  overflow: hidden;
}
.workspace header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #22323c;
}
.workspace .files {
  font: 13px/1.5 var(--mono);
}
.workspace .file {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid #16242d;
}
.workspace .file:last-child {
  border-bottom: 0;
}
.workspace .ftype {
  color: #ffb08f;
  text-transform: uppercase;
  font-size: 11px;
}
.workspace .fdesc {
  color: #93a6b0;
  font-family: var(--sans);
  font-size: 13px;
}

/* ---------- empty / boot / error ---------- */
.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty h3 {
  color: var(--ink);
}
.empty svg {
  width: 44px;
  height: 44px;
  color: var(--line-strong);
}
.storage-provider { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; color: var(--ink); cursor: pointer; }
.storage-provider[aria-pressed="true"] { border-color: var(--tide); box-shadow: 0 0 0 1px var(--tide); }
.storage-provider strong { font-size: 18px; }
.storage-hash { overflow-wrap: anywhere; }
.dedup-group > summary { padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.dedup-group > summary > span:first-child { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dedup-group > summary::after { content: "+"; color: var(--muted); }
.dedup-group[open] > summary::after { content: "−"; }
.dedup-group .table-wrap { margin: 0; }
.dedup-group td { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .dedup-group > summary { flex-wrap: wrap; }
}
.boot {
  padding: 80px 0;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
}
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: currentColor;
  border-radius: 50%;
  vertical-align: middle;
  animation: harbor-spin 0.8s linear infinite;
}
@keyframes harbor-spin {
  to { transform: rotate(360deg); }
}
.fatal {
  max-width: 560px;
  margin: 60px auto;
}

/* ---------- charts ---------- */
.chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart .gridline {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .area {
  fill: var(--tide-soft);
}
.chart .lineplot {
  fill: none;
  stroke: var(--tide);
  stroke-width: 2;
}
.chart .dot {
  fill: var(--surface);
  stroke: var(--tide);
  stroke-width: 2;
}
.chart text {
  fill: var(--muted);
  font: 11px var(--mono);
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) 76px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.bar-row .track {
  display: block;
  height: 10px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar-row .fill {
  display: block;
  height: 100%;
  background: var(--line-strong);
}
.bar-row.mine .fill {
  background: var(--signal-fill);
}
.bar-row.mine .name {
  font-weight: 700;
}
.bar-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- editor rows ---------- */
.inline-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.inline-form .input {
  width: 140px;
}
.field-error {
  color: var(--bad);
  font-size: 13px;
  font-weight: 600;
}
details.disclose > summary {
  cursor: pointer;
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
details.disclose > summary::-webkit-details-marker {
  display: none;
}
details.disclose > summary::before {
  content: "+";
  font-family: var(--mono);
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}
details.disclose[open] > summary::before {
  content: "−";
}
pre.output {
  background: var(--film);
  color: var(--film-ink);
  padding: 16px;
  border-radius: var(--radius-s);
  overflow: auto;
  font: 12.5px/1.55 var(--mono);
  max-height: 480px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  padding: 12px 18px;
  border-radius: var(--radius-s);
  font-weight: 600;
  font-size: 14px;
  transition: 0.2s ease;
  z-index: 60;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.foot {
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
.detail-film img {
  object-fit: contain;
}

[hidden] {
  display: none !important;
}

/* ---------- sign-in gate (shown when the API reports no/expired/denied session) ---------- */
body.gated .topbar,
body.gated .foot {
  display: none;
}
body.gated main {
  max-width: none;
  padding: 0;
  display: flex;
}
.gate {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
}
.gate-film {
  position: relative;
  background: #05090c;
  color: var(--film-ink);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.gate-film img {
  position: absolute;
  top: 6%;
  left: 0;
  width: 100%;
  height: 62%;
  object-fit: contain;
  opacity: 0.5;
}
.gate-film-atrium img {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 1;
}
.gate-film-atrium::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgb(3 12 25 / .16), transparent 42%, rgb(3 12 25 / .35) 68%, rgb(3 12 25 / .88));
  pointer-events: none;
}
.gate-film-atrium .corner { text-shadow: 0 1px 8px rgb(0 0 0 / .7); }
.gate-film-atrium::after { display: none; }
.gate-film::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(214 227 232 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(214 227 232 / 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.gate-film .corner {
  position: absolute;
  z-index: 2;
  font: 600 11px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--film-ink);
}
.gate-film .tl {
  top: 24px;
  left: 28px;
}
.gate-film .tr {
  top: 24px;
  right: 28px;
  text-align: right;
}
.gate-film .bl {
  bottom: 24px;
  left: 28px;
}
.gate-film .br {
  bottom: 24px;
  right: 28px;
  text-align: right;
}
.gate-film .synthetic {
  color: #ffb08f;
}
.gate-film-copy {
  position: relative;
  z-index: 2;
  padding: 0 28px 72px;
  max-width: 560px;
}
.gate-kicker {
  font: 700 clamp(30px, 3.6vw, 46px)/1.05 var(--display);
  letter-spacing: -0.025em;
  color: #fff;
}
.gate-sub {
  margin-top: 14px;
  color: #b9c7ce;
  font-size: 16px;
  max-width: 46ch;
}
.gate-panel {
  padding: 48px clamp(24px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  border-left: 1px solid var(--line);
}
.gate-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.gate-brand .brand-mark {
  width: 32px;
  height: 32px;
  color: #3b82f6;
}
.gate-brand .brand-word {
  font-family: var(--display);
  font-weight: 750;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.gate h1 {
  font-size: clamp(28px, 3vw, 36px);
}
.gate-lead {
  color: var(--ink-2);
  font-size: 16px;
}
.gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 8px;
}
.gate-actions .btn {
  min-height: 48px;
  font-size: 15px;
}
.gate-facts {
  list-style: none;
  margin: 18px 0 0;
  padding: 18px 0 0;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gate-facts li {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.gate-facts b {
  font: 600 11px/1.6 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.gate-code {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
@media (max-width: 860px) {
  .gate {
    grid-template-columns: 1fr;
  }
  .gate-film {
    min-height: 240px;
  }
  .gate-film-copy {
    padding-bottom: 56px;
  }
  .gate-kicker {
    font-size: 26px;
  }
  .gate-sub {
    display: none;
  }
  .gate-panel {
    border-left: 0;
    padding: 28px 16px 40px;
    justify-content: flex-start;
  }
  .gate-brand {
    margin-bottom: 12px;
  }
  .gate-facts li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Administrator system guide */
.architecture-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.architecture-context {
  margin-bottom: 28px;
}
.architecture-intro {
  max-width: 820px;
  margin-bottom: 28px;
}
.architecture-intro h2 {
  font: 700 clamp(26px, 3vw, 38px)/1.15 var(--display);
  letter-spacing: -0.025em;
  margin: 10px 0 16px;
}
.architecture-principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.architecture-section {
  margin-top: 24px;
}
.architecture-pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  margin: 0;
  list-style: none;
}
.architecture-pipeline li {
  padding: 24px;
  border-right: 1px solid var(--line);
}
.architecture-pipeline li:last-child {
  border: 0;
}
.architecture-pipeline h3 {
  margin: 12px 0;
}
.architecture-adapters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.architecture-adapters > div {
  padding: 24px;
}
.architecture-adapters h3 {
  margin: 10px 0;
}
.architecture-walkthrough {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.5fr);
  gap: 24px;
  align-items: start;
}
.architecture-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.architecture-steps button {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  padding: 16px;
  color: var(--ink-2);
  font: 600 14px var(--sans);
  cursor: pointer;
}
.architecture-steps button > span:nth-child(2) {
  flex: 1;
}
.architecture-steps button.current {
  background: var(--tide-soft);
  color: var(--tide);
  border-color: var(--tide);
}
.step-number {
  font: 500 12px var(--mono);
}
.architecture-step-detail h2 {
  margin: 14px 0 20px;
}
.architecture-boundary {
  border-left: 3px solid var(--tide);
  background: var(--surface-2);
  padding: 18px;
  margin: 24px 0;
}
.architecture-boundary p {
  margin-top: 8px;
}
.architecture-next {
  margin-top: 24px;
  justify-content: space-between;
}
.architecture-code-map {
  padding: 8px 24px;
}
.architecture-code-map details {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.architecture-code-map details:last-child {
  border: 0;
}
.architecture-code-map summary {
  font-weight: 650;
  cursor: pointer;
}
.architecture-code-map p {
  margin: 14px 0;
}
.architecture-code-map ul {
  padding-left: 20px;
}
.architecture-code-map code,
.architecture-hash code {
  overflow-wrap: anywhere;
}
.architecture-hash {
  margin: 16px 0;
}
.architecture-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.architecture-rule-grid p {
  margin-top: 12px;
}
@media (max-width: 1000px) {
  .architecture-pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .architecture-pipeline li {
    border-bottom: 1px solid var(--line);
  }
  .architecture-walkthrough {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .architecture-principles,
  .architecture-pipeline,
  .architecture-adapters,
  .architecture-rule-grid {
    grid-template-columns: 1fr;
  }
  .architecture-nav .btn {
    flex: 1 1 40%;
  }
  .architecture-pipeline li {
    border-right: 0;
  }
  .architecture-steps button {
    padding: 12px;
  }
}

/* ---------- workspace (researcher): file list | viewer/editor, terminal below ---------- */
body.ws-mode {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.ws-mode main {
  max-width: none;
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
}
body.ws-mode .foot {
  display: none;
}
.ws {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "bar bar" "side pane" "term term";
  background: var(--surface);
}
.ws-loading {
  display: block;
  padding: 40px 20px;
}
.ws-fail {
  max-width: 560px;
  margin: 0 auto;
}
.ws-bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ws-title {
  font-size: 18px;
}
.ws-bar-sub {
  font-size: 13px;
  color: var(--muted);
}
.ws-spacer {
  flex: 1;
}
.ws-side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}
.ws-side-head {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.ws-side-head .input {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}
.ws-side-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 0 16px;
}
.ws-group {
  padding: 6px 0;
}
.ws-group + .ws-group {
  border-top: 1px solid var(--line);
}
.ws-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 36px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font-weight: 650;
  font-size: 13px;
  color: var(--ink);
}
.ws-group-head:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
.ws-caret {
  width: 12px;
  color: var(--muted);
  font-size: 11px;
}
.ws-group-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-group-sub {
  padding: 0 12px 6px 30px;
  font-size: 12px;
  color: var(--muted);
}
.ws-tag {
  font: 600 10px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.ws-files {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ws-file {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 12px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font: 13px/1.3 var(--mono);
  color: var(--ink-2);
  border-left: 2px solid transparent;
}
.ws-file:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}
.ws-file[aria-current="true"] {
  background: var(--tide-soft);
  color: var(--ink);
  border-left-color: var(--tide);
}
.ws-fname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-ico {
  display: inline-flex;
  flex: none;
}
.ws-ico-image {
  color: var(--signal);
}
.ws-ico-code {
  color: var(--tide);
}
.ws-ico-data {
  color: var(--warn);
}
.ws-ico-text {
  color: var(--muted);
}
.ws-dirty {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal-fill);
  flex: none;
}
.ws-none {
  padding: 4px 30px;
  font-size: 12px;
  color: var(--muted);
}
.ws-add {
  margin: 4px 12px 0 26px;
  border: 0;
  background: none;
  color: var(--tide);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  min-height: 32px;
  padding: 0 4px;
}
.ws-add:hover {
  text-decoration: underline;
}
.ws-new {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px 0 26px;
}
.ws-new .input {
  flex: 1 1 140px;
  min-height: 36px;
  padding: 6px 8px;
  font: 13px var(--mono);
}
.ws-new .callout {
  flex-basis: 100%;
  font-size: 12px;
  padding: 8px 10px;
}

.ws-pane {
  grid-area: pane;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.ws-pane > .empty {
  margin: auto;
}
.ws-pane > .callout {
  margin: 10px 14px 0;
}
.safeviewer {display:flex;flex-direction:column;flex:1;min-height:0;overflow:auto;background:var(--surface);}
.sv-context {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px;flex-wrap:wrap;border-bottom:1px solid var(--line);}
.sv-context>div {display:flex;gap:12px;align-items:baseline;flex-wrap:wrap;}
.sv-canvas {flex:1;min-height:200px;overflow:auto;background:#090d12;cursor:grab;container-type:size;display:grid;place-items:start;}
.sv-image {position:relative;width:min(100%,calc(100cqh * 1.25));max-width:900px;margin:auto;display:grid;}
.sv-image img {display:block;width:100%;height:100%;min-width:0;user-select:none;}
.sv-tiles {width:min(100%,100cqh);grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;}
.sv-overlay {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;}
.sv-overlay.drawing {pointer-events:auto;cursor:crosshair;touch-action:none;}
.sv-annotation {padding:12px 14px;border-top:1px solid var(--line);background:var(--surface);}
.sv-region-fields {display:flex;gap:8px;align-items:end;flex-wrap:wrap;margin-bottom:6px;}
.sv-region-fields label {display:flex;flex-direction:column;gap:4px;flex:1;min-width:65px;font-size:12px;color:var(--muted);}
.sv-region-fields label:first-child {flex:2;min-width:150px;}
.sv-region-fields .input {min-width:0;width:100%;}
.sv-service-inputs {display:grid;grid-template-columns:1fr 1fr;gap:12px;border-bottom:1px solid var(--line);}
.sv-service-inputs p {grid-column:1/-1;}
.service-run+.service-run {border-top:1px solid var(--line);}
.service-run .num {overflow-wrap:anywhere;}
@media(max-width:600px) {.sv-service-inputs {grid-template-columns:1fr;}.sv-context {align-items:start;}.safeviewer .ws-range input {width:80px;}}
.ws-pathbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  min-height: 40px;
}
.ws-path {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.ws-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ws-tools .btn-sm {
  min-height: 32px;
  padding: 0 10px;
}
.ws-tools .btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.ws-zoomval {
  min-width: 48px;
  text-align: center;
  font-size: 13px;
}
.ws-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  margin-left: 6px;
}
.ws-range input {
  width: 120px;
  accent-color: var(--tide);
}
.ws-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #05090c;
  display: grid;
  place-items: center;
}
.ws-stage img {
  display: block;
  max-width: none;
  user-select: none;
}
.ws-stage.fit img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ws-stage .corner {
  position: absolute;
  font: 600 10.5px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--film-ink);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.ws-stage .tl {
  top: 10px;
  left: 12px;
}
.ws-stage .tr {
  top: 10px;
  right: 12px;
  text-align: right;
}
.ws-stage .br {
  bottom: 10px;
  right: 12px;
}

.ws-editor {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  background: var(--surface);
}
.ws-gutter {
  margin: 0;
  padding: 12px 10px 12px 14px;
  overflow: hidden;
  text-align: right;
  color: var(--muted);
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  font: 13px/1.6 var(--mono);
  user-select: none;
  min-width: 48px;
}
.ws-text {
  margin: 0;
  border: 0;
  resize: none;
  padding: 12px 14px;
  font: 13px/1.6 var(--mono);
  tab-size: 4;
  background: transparent;
  color: var(--ink);
  white-space: pre;
  overflow: auto;
  outline: none;
  min-height: 0;
}
.ws-text[readonly] {
  color: var(--ink-2);
}
.ws-text:focus-visible {
  box-shadow: inset 0 0 0 2px var(--signal-fill);
}
.ws-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  min-height: 44px;
}
.ws-status .btn-sm {
  min-height: 32px;
}

.ws-term {
  grid-area: term;
  background: #05090c;
  color: #d6e3e8;
  border-top: 1px solid #22323c;
  display: flex;
  flex-direction: column;
  height: 210px;
}
.ws-term.closed {
  height: auto;
}
.ws-term-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 4px 14px;
  border-bottom: 1px solid #16242d;
  min-height: 38px;
}
.ws-term.closed .ws-term-head {
  border-bottom: 0;
}
.ws-term-note {
  font-size: 12px;
  color: #93a6b0;
}
.ws-term-btn {
  color: #9fd9dc;
  min-height: 30px;
}
.ws-term-btn:hover {
  background: #12232b;
  color: #fff;
}
.ws-term-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 14px 10px;
  font: 12.5px/1.55 var(--mono);
  cursor: text;
}
.ws-term-body .tl {
  white-space: pre-wrap;
  word-break: break-word;
}
.tl-cmd {
  color: #ffffff;
}
.tl-cmd::before {
  content: "› ";
  color: #ff8a5c;
}
.tl-out {
  color: #c9d6dc;
}
.tl-err {
  color: #ff9aa2;
}
.tl-sys {
  color: #7fb8bc;
}
.ws-prompt {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.ws-ps1 {
  color: #5cc7cc;
  white-space: nowrap;
}
.ws-term-in {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: #fff;
  font: inherit;
  outline: none;
  caret-color: #ff8a5c;
  padding: 2px 0;
}

@media (max-width: 860px) {
  body.ws-mode {
    height: auto;
    overflow: visible;
  }
  .ws {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas: "bar" "side" "pane" "term";
  }
  .ws-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .ws-side-body {
    max-height: 260px;
  }
  .ws-pane {
    min-height: 60vh;
  }
  .ws-stage {
    min-height: 50vh;
  }
  .ws-editor {
    min-height: 50vh;
  }
  .ws-term {
    height: 300px;
  }
}
@media (max-width: 620px) {
  .ws-term-note {
    display: none;
  }
}

/* ---------- profile menu (top right) ---------- */
.profile {
  position: relative;
}
.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 3px 10px 3px 3px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.profile-btn:hover,
.profile-btn[aria-expanded="true"] {
  border-color: var(--line-strong);
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--ink);
  color: var(--surface);
  font: 700 13px/1 var(--sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.profile-role {
  color: var(--ink-2);
}
.profile-btn svg {
  color: var(--muted);
}
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 18px 40px -16px rgb(16 42 74 / 0.35),
    0 2px 6px rgb(16 42 74 / 0.08);
  padding: 6px;
}
.menu[hidden] {
  display: none;
}
.menu-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.menu-email {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.menu-label {
  font: 600 11px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 8px 12px 4px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  color: var(--ink);
  font: 500 14px var(--sans);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}
.menu-item .check {
  width: 16px;
  color: var(--tide);
  flex: none;
}
.menu-item[aria-checked="true"] {
  font-weight: 650;
}
.menu-sep {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
  border: 0;
}
.menu-item.danger {
  color: var(--bad);
}
@media (max-width: 620px) {
  .profile-role {
    display: none;
  }
  .menu {
    width: min(280px, calc(100vw - 32px));
  }
}

/* ---------- preferences ---------- */
.prefs {
  max-width: 760px;
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.theme-opt {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font: inherit;
}
.theme-opt:hover {
  border-color: var(--line-strong);
}
.theme-opt[aria-checked="true"] {
  border-color: var(--tide);
  outline: 2px solid var(--tide);
  outline-offset: 0;
}
.theme-opt .name {
  font-weight: 650;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.theme-opt .hint {
  font-size: 12px;
  color: var(--muted);
}
.swatch {
  height: 72px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  grid-template-rows: 14px 1fr;
}
.swatch i {
  display: block;
}
.sw-light {
  background: #e3eefa;
}
.sw-light i:first-child {
  background: #f7fbff;
  border-bottom: 1px solid #c5d6e8;
}
.sw-light i:last-child {
  margin: 10px;
  border-radius: 4px;
  background: #f7fbff;
  border: 1px solid #c5d6e8;
}
.sw-dark {
  background: #091117;
}
.sw-dark i:first-child {
  background: #0f1a21;
  border-bottom: 1px solid #22343e;
}
.sw-dark i:last-child {
  margin: 10px;
  border-radius: 4px;
  background: #0f1a21;
  border: 1px solid #22343e;
}
.sw-system {
  background: linear-gradient(135deg, #e3eefa 0 50%, #091117 50% 100%);
}
.sw-system i:first-child {
  background: linear-gradient(135deg, #f7fbff 0 50%, #0f1a21 50% 100%);
}
.sw-system i:last-child {
  margin: 10px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f7fbff 0 50%, #0f1a21 50% 100%);
  border: 1px solid #8fa8c2;
}
.kv {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px 16px;
  font-size: 14px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 620px) {
  .theme-options {
    grid-template-columns: 1fr;
  }
  .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .kv dd {
    margin-bottom: 8px;
  }
}
.unavailable-link {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* ---------- app shell: left sidebar navigation ---------- */
body.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.shell { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.shell > .topbar { flex: none; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 12px 20px; background: var(--surface); border-right: 1px solid var(--line); z-index: 30; }
.sidebar-brand { padding: 6px 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-label { font: 600 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 10px 12px 8px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--tide-soft); color: var(--ink); }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal-fill); }
.side-nav a[aria-current="page"] .side-ico { color: var(--tide); }
.side-ico { display: inline-flex; color: var(--muted); flex: none; }
.side-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav .count { font: 600 11px/1 var(--mono); background: var(--signal-fill); color: #fff; border-radius: 99px; padding: 3px 7px; }
.topbar { position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: none; padding: 10px 24px; flex-wrap: nowrap; min-height: 64px; }
.topbar-title { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--display); font-weight: 650; font-size: 15px; color: var(--ink-2); }
.nav-toggle { display: none; width: 44px; height: 44px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; place-items: center; }
.nav-scrim { display: none; }
body.app-shell.gated, body.app-shell.ws-mode { display: grid; }
body.gated { grid-template-columns: 1fr; }
body.gated .sidebar, body.gated .nav-scrim { display: none; }
body.gated .shell { min-height: 100vh; }
body.gated main { flex: 1; }
body.ws-mode .shell { height: 100vh; height: 100dvh; min-height: 0; }
@media (max-width: 860px) {
  body.app-shell { grid-template-columns: minmax(0, 1fr); }
  body.nav-open { overflow: hidden; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgb(0 0 0 / .25); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(11 26 43 / .35); }
  .nav-toggle { display: inline-grid; flex: none; }
  .topbar-title { display: inline; }
  .topbar-inner { padding: 10px 16px; }
  body.ws-mode .shell { height: auto; }
}

/* Account identity, organization administration and developer operations. */
.profile-identity { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.35; max-width: 260px; min-width: 0; }
.profile-name { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.profile-context { color: var(--muted); font-size: 11px; font-weight: 500; text-align: left; }
.profile-btn .avatar { flex-shrink: 0; }
.dev-toolbar,.dev-chart-head,.dev-chart-foot,.dev-event { display: flex; align-items: center; gap: 12px; }
.dev-toolbar { justify-content: space-between; margin-bottom: 20px; }
.dev-chart text { fill: var(--muted); font: 10px var(--sans); }
.dev-node { display: flex; flex-direction: column; gap: 7px; min-height: 88px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; box-shadow: 0 3px 10px rgb(0 0 0 / .04); }
.dev-node strong { font-size: 13px; }.dev-node > span { font-size: 11px; }.dev-node-type { color: var(--muted); }
.dev-node:hover,.dev-node.selected,.org-card.selected { border-color: #5f91b9; outline: 2px solid rgb(95 145 185 / .2); }
.dev-detail { min-width: 0; overflow-wrap: anywhere; }.dev-detail li { margin-bottom: 8px; }
.dev-charts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-bottom: 24px; }
.dev-chart { min-width: 0; }.dev-chart-head { align-items: flex-start; justify-content: space-between; }.dev-chart h2,.dev-chart h3 { font-size: 14px; }.dev-chart-head strong { font-size: 22px; white-space: nowrap; }.dev-chart-head small { font-size: 11px; margin-left: 5px; font-weight: 500; color: var(--muted); }
.dev-chart svg { display: block; width: 100%; height: auto; }.dev-chart-grid line { stroke: var(--line); stroke-dasharray: 3 4; }.dev-chart-foot { justify-content: space-between; color: var(--muted); font-size: 11px; }
.dev-event { align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }.dev-event time { font-size: 12px; color: var(--muted); white-space: nowrap; }.dev-event p { margin-top: 5px; }
@media(max-width:700px) { .dev-charts { grid-template-columns: minmax(0,1fr); }.dev-toolbar { flex-wrap: wrap; }.profile-identity { max-width: 230px; }.profile-name { font-size: 12px; }.profile-context { font-size: 10px; } }

/* Developer API catalogue. */
.dev-api-layout { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
.dev-api-operation { text-align: left; display: flex; flex-direction: column; gap: 8px; color: var(--ink); cursor: pointer; min-width: 0; }
.dev-api-operation code { overflow-wrap: anywhere; font-size: 12px; }
.dev-api-operation.selected { border-color: var(--tide); background: var(--tide-soft); }
.dev-api-layout > section { min-width: 0; }
@media (max-width: 960px) { .dev-api-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- organizations & member editor ---------- */
.org-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.org-list { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 84px; }
.org-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.org-item:hover:not(:disabled) { background: var(--surface); border-color: var(--line); }
.org-item.selected { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.org-item.selected .org-mark { background: var(--tide); color: var(--surface); }
.org-item:disabled { cursor: default; opacity: .7; }
.org-mark { width: 36px; height: 36px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font: 700 12px var(--sans); color: var(--ink-2); }
.org-item-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.org-item-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-item-text > span { font-size: 12px; color: var(--muted); }
.org-locked { font: 600 10px/1 var(--mono) !important; text-transform: uppercase; letter-spacing: .06em; }
.member-list { list-style: none; margin: 0; padding: 0; }
.member-row { display: grid; grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 14px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.member-row:first-child { border-top: 0; }
.member-avatar { width: 40px; height: 40px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); font-size: 13px; }
.member-id { display: flex; flex-direction: column; min-width: 0; }
.member-id strong { font-size: 14px; }
.member-id span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-role { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.role-chip { font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.role-provider { background: var(--signal-soft); border-color: color-mix(in srgb, var(--signal) 30%, transparent); color: var(--signal); }
.role-researcher { background: var(--tide-soft); border-color: color-mix(in srgb, var(--tide) 30%, transparent); color: var(--tide); }
.role-auditor { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.mgr-tag { font-size: 11px; color: var(--muted); }
.member-access { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.member-editor { padding: 22px 24px 24px; scroll-margin-top: 84px; }
.member-editor-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.member-form { display: flex; flex-direction: column; gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset legend { padding: 0; margin-bottom: 6px; }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role-opt { position: relative; display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; }
.role-opt:hover { border-color: var(--ink-2); }
.role-opt input { margin: 3px 0 0; accent-color: var(--tide); flex: none; }
.role-opt:has(input:checked) { border-color: var(--tide); box-shadow: 0 0 0 1px var(--tide); background: color-mix(in srgb, var(--tide-soft) 55%, var(--surface)); }
.role-opt:has(input:focus-visible) { outline: 2px solid var(--signal-fill); outline-offset: 2px; }
.role-opt-body { display: flex; flex-direction: column; gap: 2px; }
.role-opt-name { font-weight: 650; font-size: 14px; }
.role-opt-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.seg-opt { flex: 1; position: relative; display: flex; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { flex: 1; display: grid; place-items: center; min-height: 44px; padding: 0 14px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); }
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:checked + span { background: var(--ink); color: var(--surface); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--signal-fill); outline-offset: -2px; }
.seg.wide:has(.seg-opt) { display: flex; }
.expiry-presets { margin-top: 2px; }
.expiry-presets .chip { min-height: 32px; padding: 0 12px; }
.switch-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); cursor: pointer; }
.switch-row.locked { cursor: default; opacity: .75; }
.switch-title { display: block; font-weight: 650; font-size: 14px; }
.switch-row .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; margin: 0; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch:checked { background: var(--tide); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { cursor: not-allowed; opacity: .6; }
.switch:focus-visible { outline: 2px solid var(--signal-fill); outline-offset: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 1100px) {
  .member-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .member-role, .member-access { grid-column: 2 / 3; }
  .member-row > .btn { grid-column: 3; grid-row: 1; }
}
@media (max-width: 760px) {
  .org-layout { grid-template-columns: minmax(0, 1fr); }
  .org-list { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .org-item { min-width: 220px; }
  .form-grid, .role-options { grid-template-columns: minmax(0, 1fr); }
  .member-editor { padding: 18px 16px; }
  .member-row { padding: 14px 16px; }
}

/* ---------- audit log table ---------- */
.audit-wrap { overflow-x: auto; container-type: inline-size; }
.audit-table { table-layout: fixed; width: 100%; }
.audit-table .c-when { width: 116px; }
.audit-table .c-actor { width: 21%; }
.audit-table .c-action { width: 19%; }
.audit-table .c-entity { width: 150px; }
.audit-table .c-details { width: auto; }
.audit-table td { vertical-align: top; font-size: 13px; line-height: 1.45; }
.audit-table th, .audit-table td { padding: 12px 14px; }
.audit-table .a-when time { display: flex; flex-direction: column; white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-table .a-when .muted { font-size: 12px; }
.audit-table .a-actor { overflow-wrap: anywhere; }
.a-trunc { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-table .a-action .chip { display: inline-block; max-width: 100%; vertical-align: top; font-family: var(--mono); font-size: 11.5px; line-height: 1.4; padding: 2px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.audit-table .a-entity code { font: 12px/1.45 var(--mono); color: var(--muted); }
.audit-table .a-details { overflow-wrap: anywhere; color: var(--ink-2); }
.audit-table tbody tr:hover td { background: var(--surface-2); }
/* Narrow content area (small screens, or sidebar + narrow window): one card per entry. */
@container (max-width: 760px) {
  .audit-table { table-layout: auto; }
  .audit-table colgroup, .audit-table thead { display: none; }
  .audit-table, .audit-table tbody { display: block; width: auto; }
  .audit-table tr { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 12px; row-gap: 6px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .audit-table tr:last-child { border-bottom: 0; }
  .audit-table tbody tr:hover td { background: none; }
  .audit-table td { display: contents; }
  .audit-table td::before { content: attr(data-label); font: 600 10.5px/1.9 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .audit-table td > * { min-width: 0; justify-self: start; }
  .audit-table .a-when time { flex-direction: row; gap: 8px; }
}

.org-item.org-own { border-color: var(--tide); background: var(--tide-soft); }
.org-item.org-own .org-mark { background: var(--tide); color: var(--surface); }
.org-item-text > .org-own-label { color: var(--tide); font-weight: 700; }

/* Global sample-data switch, immediately before the profile chip. */
.sample-data-info { position: relative; align-self: center; flex: none; width: 0; height: 0; z-index: 30; }
.sample-data-info:has(+ .sample-data-toggle[hidden]) { display: none; }
.sample-data-info summary { position: absolute; left: 56px; top: -29px; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--surface); font: 600 13px/1 var(--sans); cursor: pointer; list-style: none; }
.sample-data-info summary::-webkit-details-marker { display: none; }
.sample-data-info summary:hover, .sample-data-info[open] summary { color: var(--tide); border-color: var(--tide); }
.sample-data-info summary:focus-visible { outline: 2px solid var(--tide); outline-offset: 3px; }
.sample-data-help { position: fixed; top: 64px; right: 16px; width: min(310px, calc(100vw - 32px)); padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: 0 8px 24px rgb(0 0 0 / .2); font: 400 13px/1.5 var(--sans); white-space: normal; }
.sample-data-toggle { display: inline-flex; align-items: center; gap: 10px; border: 0; padding: 6px; background: transparent; color: var(--ink-2); font: 600 12px/1.2 var(--sans); white-space: nowrap; cursor: pointer; }
.sample-data-track { display: inline-flex; align-items: center; width: 38px; height: 23px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.sample-data-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / .25); transition: transform .15s; }
.sample-data-toggle[aria-checked="true"] .sample-data-track { background: var(--tide); border-color: var(--tide); }
.sample-data-toggle[aria-checked="true"] .sample-data-thumb { transform: translateX(14px); }
.sample-data-toggle:focus-visible { outline: 2px solid var(--tide); outline-offset: 3px; border-radius: 6px; }
.sidebar { overflow: hidden; }
.sidebar-brand, .side-label { flex: none; }
.side-nav { flex: 1; min-height: 0; overflow: hidden; gap: 0; }
.side-links { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px; }
.side-footer { flex: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
@media(max-width:600px) { .topbar-title { display: none; } .sample-data-toggle { gap: 6px; font-size: 11px; } .profile-identity { display: none; } }

/* One person per roster entry, with independent role grants grouped together. */
.member-row.member-person { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.member-person .member-memberships { list-style: none; margin: 0; padding: 0; min-width: 0; }
.member-person .member-membership { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 12px; align-items: center; }
.member-person .member-membership + .member-membership { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.member-person .member-role, .member-person .member-access { grid-column: auto; min-width: 0; }
.member-person .role-chip { max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .member-row.member-person { grid-template-columns: 40px minmax(0, 1fr); }
  .member-person .member-memberships { grid-column: 2 / -1; }
}
@media (max-width: 600px) {
  .member-person .member-membership { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .member-person .member-role, .member-person .member-access { grid-column: 1; }
  .member-person .member-membership > .btn { grid-column: 2; grid-row: 1 / 3; }
}

/* Organization directory. */
.org-directory-create { margin-bottom: 24px; padding: 18px 22px; }
.org-directory-create summary { cursor: pointer; font-weight: 650; }
.org-directory-create summary span { margin-left: 12px; font-weight: 400; }
.org-directory-form { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr) minmax(0,1fr); gap: 16px; margin-top: 22px; }
.org-directory-form > button { justify-self: start; }
.org-directory-form > [role="alert"] { grid-column: 1 / -1; }
.org-directory-layout { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(260px,1fr); gap: 24px; align-items: start; }
.org-directory, .org-directory-detail { min-width: 0; }
.org-directory-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px; border-bottom: 1px solid var(--line); }
.org-directory-heading h2 { font-size: 18px; }
.org-directory-heading p { margin-top: 6px; }
.org-directory-heading .chip { flex-shrink: 0; }
.org-directory-tools { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); gap: 12px; padding: 20px 22px 12px; }
.org-directory-count { padding: 0 22px 16px; }
.org-directory-columns { display: grid; grid-template-columns: minmax(0,1fr) 48px 20px; gap: 14px; padding: 10px 22px; background: var(--surface-2); border-block: 1px solid var(--line); font-size: 11px; font-weight: 650; color: var(--muted); }
.org-directory-list .org-item { display: grid; grid-template-columns: 36px minmax(0,1fr) 48px 20px; gap: 14px; padding: 16px 22px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.org-directory-list .org-item:last-child { border-bottom: 0; }
.org-directory-list .org-item.selected { background: var(--tide-soft); box-shadow: inset 3px 0 var(--tide); }
.org-directory-list .org-item:hover { background: var(--surface-2); }
.org-directory-list .org-item:focus-visible { outline: 2px solid var(--tide); outline-offset: -3px; }
.org-directory-list .org-item-text strong { white-space: normal; overflow-wrap: anywhere; }
.org-directory-list .org-item-text > span { overflow-wrap: anywhere; }
.org-directory-users { display: grid; gap: 2px; text-align: center; }
.org-directory-users strong { font-size: 14px; }
.org-directory-arrow { color: var(--muted); }
.org-directory-empty { padding: 32px 22px; }
.org-directory-empty p { margin-top: 8px; }
.org-directory-detail { position: sticky; top: 84px; padding: 24px; overflow-wrap: anywhere; }
.org-directory-identity .org-mark { width: 52px; height: 52px; font-size: 17px; margin-bottom: 20px; background: var(--tide-soft); color: var(--tide); }
.org-directory-identity h2 { margin: 10px 0 16px; font-size: 24px; line-height: 1.25; }
.org-directory-facts { display: grid; gap: 20px; margin: 24px 0; padding-block: 22px; border-block: 1px solid var(--line); }
.org-directory-facts dt { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.org-directory-facts dd { margin: 0; font-size: 14px; font-weight: 600; }
.org-directory-sources h3 { font-size: 14px; margin-bottom: 6px; }
.org-directory-sources details { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.org-directory-sources summary { cursor: pointer; font-weight: 600; }
.org-directory-sources summary span { display: block; margin-top: 6px; font-weight: 400; }
.org-directory-sources details p { padding-top: 12px; line-height: 1.6; }
@media (max-width: 1150px) {
  .org-directory-layout { grid-template-columns: minmax(0,1fr); }
  .org-directory-detail { position: static; grid-row: 1; scroll-margin-top: 84px; }
}
@media (max-width: 600px) {
  .org-directory-form, .org-directory-tools { grid-template-columns: minmax(0,1fr); }
  .org-directory-create summary span { display: block; margin: 6px 0 0; }
  .org-directory-list .org-item { padding: 14px; gap: 10px; grid-template-columns: 32px minmax(0,1fr) 36px; }
  .org-directory-list .org-mark { width: 32px; height: 32px; }
  .org-directory-arrow { display: none; }
  .org-directory-columns { padding-inline: 14px; grid-template-columns: minmax(0,1fr) 36px; }
  .org-directory-heading, .org-directory-detail { padding: 20px; }
}

.menu-role { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 6px 0; }
.menu-role-scope { color: var(--muted); font-size: 11px; line-height: 1.3; white-space: nowrap; }

.developer-plan { margin-bottom: 24px; border-top: 3px solid var(--tide); }
.developer-plan > p { margin: 10px 0 14px; max-width: 90ch; line-height: 1.65; }
.developer-plan summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--tide); }
.developer-plan ul { margin: 14px 0 0; padding-left: 20px; }
.developer-plan li { margin-top: 8px; font-size: 13px; line-height: 1.6; }


/* Credit purchasing dialog and global Researcher action. */
.credit-dialog { width: min(480px,calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.credit-dialog::backdrop { background: rgb(5 15 27 / .58); }
.credit-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.credit-dialog-head h2 { margin-bottom: 8px; }
.purchase-credits-trigger { flex-shrink: 0; white-space: nowrap; }
@media(max-width:600px) {
  .topbar-inner:has(.purchase-credits-trigger:not([hidden])) { gap: 6px; }
  .purchase-credits-trigger { max-width: 104px; padding: 6px 8px; font-size: 12px; line-height: 1.25; white-space: normal; }
  .credit-dialog { padding: 20px; }
}
@media(max-width:380px) { .topbar-inner:has(.purchase-credits-trigger:not([hidden])) .sample-data-label { display: none; } }

.provider-resource-facts { display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px 20px;margin:8px 0; }
.provider-resource-facts dt { font-size:12px;color:var(--muted);margin-bottom:4px; }
.provider-resource-facts dd { margin:0;overflow-wrap:anywhere; }

/* Intended Developer architecture: semantic domain columns and navigable connections. */
.planned-topology-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 20px; align-items: start; }
.planned-topology { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; min-width: 0; }
.planned-domain { min-width: 0; overflow: hidden; }
.planned-domain header { padding: 18px; border-bottom: 1px solid var(--line); }
.planned-domain h2 { font-size: 16px; overflow-wrap: anywhere; }
.planned-domain header p { font-size: 12px; margin: 8px 0 0; }
.planned-components { display: grid; gap: 10px; padding: 14px; }
.dev-node.planned-node { position: static; width: 100%; min-height: 84px; overflow-wrap: anywhere; }
.planned-detail { position: sticky; top: 84px; min-width: 0; scroll-margin-top: 90px; }
.planned-connections { list-style: none; padding: 0; display: grid; gap: 12px; }
.planned-connections li { display: grid; gap: 4px; font-size: 12px; }
.planned-connections button { text-align: left; white-space: normal; justify-content: flex-start; }
.planned-detail a { overflow-wrap: anywhere; }
@media(max-width:1400px) { .planned-topology-layout { grid-template-columns: minmax(0,1fr); }.dev-detail.planned-detail { position: static; display: flex; } }
@media(max-width:760px) { .planned-topology { grid-template-columns: minmax(0,1fr); } }

/* Monitoring signals follow intended Hub, Spoke and federation boundaries. */
.dev-monitoring-group { margin-bottom: 28px; }
.dev-monitoring-group > header { margin-bottom: 14px; }
.dev-monitoring-group > header p { margin-top: 8px; }
.dev-monitoring-group .dev-charts { grid-template-columns: repeat(3,minmax(0,1fr)); }
.dev-monitoring-group .dev-chart-head { margin-top: 10px; }
.dev-metric-description { margin: 12px 0; min-height: 4.5em; }
.dev-metric-source { margin-top: 12px; }
@media(max-width:1250px) { .dev-monitoring-group .dev-charts { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:760px) { .dev-monitoring-group .dev-charts { grid-template-columns: minmax(0,1fr); }.dev-metric-description { min-height: 0; } }

.dev-dependency-monitoring { margin-bottom: 28px; }
.dev-dependency-monitoring > header p { margin-top: 10px; }
.dev-dependency-groups { margin-top: 18px; }
.dev-dependency-groups > details { border-top: 1px solid var(--line); }
.dev-dependency-groups > details > summary { cursor: pointer; padding: 16px 0; font-weight: 600; }
.dev-dependency-groups > details > summary span { margin-left: 12px; font-size: 12px; font-weight: 400; }
.dev-dependency-checks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; padding: 0 0 20px; }
.dev-dependency-check { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 9px; overflow-wrap: anywhere; }
.dev-dependency-check h3 { margin: 8px 0 16px; font-size: 16px; }
.dev-dependency-check dl { margin: 0 0 16px; font-size: 13px; }
.dev-dependency-check dt { font-weight: 600; margin-top: 12px; }
.dev-dependency-check dd { margin: 5px 0 0; color: var(--ink-2); }
@media(max-width:760px) { .dev-dependency-checks { grid-template-columns: minmax(0,1fr); }.dev-dependency-groups > details > summary span { display: block; margin: 6px 0 0 18px; } }

/* Harbor Admin roster: one last successful login per person. */
.member-columns,.member-row.member-with-login { display: grid; grid-template-columns: 40px minmax(150px,1fr) minmax(240px,2fr) 150px; gap: 14px; }
.member-columns { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.member-columns > :first-child { grid-column: 1 / 3; }
.member-last-login { min-width: 0; overflow-wrap: anywhere; }
.member-last-login time,.member-last-login time span { display: block; }
.member-last-login-label { display: none; }
@media(max-width:1100px) { .member-columns { display: none; }.member-row.member-with-login { grid-template-columns: 40px minmax(0,1fr) 150px; }.member-with-login .member-memberships { grid-column: 2 / -1; grid-row: 2; }.member-last-login { grid-column: 3; grid-row: 1; }.member-last-login-label { display: block; margin-bottom: 4px; } }
@media(max-width:600px) { .member-row.member-with-login { grid-template-columns: 40px minmax(0,1fr); }.member-last-login { grid-column: 2; grid-row: 3; } }

/* Authenticated product documentation */
.documentation-layout{display:grid;grid-template-columns:minmax(200px,260px) minmax(0,1fr);gap:24px;align-items:start;margin-top:20px}
.documentation-toc a{display:block;padding:7px 8px;border-radius:6px;color:var(--muted);text-decoration:none;overflow-wrap:anywhere}
.documentation-toc a[aria-current=page]{color:var(--ink);background:var(--surface-2);font-weight:600}
.documentation-toc section+section{margin-top:20px}.documentation-article{min-width:0;overflow-wrap:anywhere}.documentation-article section{margin:28px 0}.documentation-article p{max-width:78ch;line-height:1.7}.documentation-print{display:none}
@media(max-width:760px){.documentation-layout{grid-template-columns:1fr}.documentation-toc{max-height:320px;overflow:auto}.documentation [role=search] .row{flex-wrap:wrap}.documentation [role=search] input{min-width:0;width:100%}}
@media print{body:has(.documentation){display:block}body:has(.documentation) .sidebar,body:has(.documentation) .topbar,.documentation>.page-head,.documentation>[role=search],.documentation>.small,.documentation-layout{display:none!important}.documentation-print{display:block}.documentation-print article{break-before:page}.documentation-print article:first-child{break-before:auto}.documentation-print p{line-height:1.5}}

.member-account-controls {grid-column:2 / -1;grid-row:2;display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-top:6px;}
@media(min-width:1101px){.member-with-login>.member-last-login{grid-column:4;grid-row:1;}}
@media(max-width:1100px){.member-with-login>.member-account-controls{grid-row:3;}}
@media(max-width:600px){.member-with-login>.member-account-controls{grid-row:4;}}

@media(max-width:600px){.sample-data-label{max-width:64px;white-space:normal;text-align:left;}}
