/* Subscription Explorer - design tokens and layout.
   Dark is the default: index.html sets data-theme="dark" unless the
   header toggle saved Light. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --border-strong: #c6ccd4;
  --text: #1a1f26;
  --text-muted: #5c6672;
  --text-faint: #8a939e;

  --accent: #6b3fc4;
  --accent-weak: #f1ebfc;
  --accent-text: #5a2eab;
  --on-accent: #fff;

  --ok: #1f7a4d;
  --ok-weak: #e4f3ea;
  --warn: #8a6100;
  --warn-weak: #fdf3dd;
  --danger: #b3261e;
  --danger-weak: #fce9e7;
  --neutral-weak: #eceff3;

  /* The two data sources. Deliberately not green/amber/red, which already
     mean subscription status here; and each badge also carries a shape. */
  --pws: #6b3fc4;
  --pws-weak: #f1ebfc;
  --lake: #6b3fc4;
  --lake-weak: #f1ebfc;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 12px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, .16);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #14171c;
  --surface: #1c2027;
  --surface-2: #232830;
  --border: #2f3641;
  --border-strong: #414a57;
  --text: #e8eaed;
  --text-muted: #a3acb9;
  --text-faint: #7b8492;

  --accent: #b79cf3;
  --accent-weak: #251d3a;
  --accent-text: #d4c4f8;
  --on-accent: #1c1233;

  --ok: #5bc48a;
  --ok-weak: #15291f;
  --warn: #e0b24d;
  --warn-weak: #2c2617;
  --danger: #f08b82;
  --danger-weak: #331d1c;
  --neutral-weak: #262b33;

  --pws: #b79cf3;
  --pws-weak: #251d3a;
  --lake: #b79cf3;
  --lake-weak: #251d3a;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #232830;
    --border: #2f3641;
    --border-strong: #414a57;
    --text: #e8eaed;
    --text-muted: #a3acb9;
    --text-faint: #7b8492;

    --accent: #b79cf3;
    --accent-weak: #251d3a;
    --accent-text: #d4c4f8;
    --on-accent: #1c1233;

    --ok: #5bc48a;
    --ok-weak: #15291f;
    --warn: #e0b24d;
    --warn-weak: #2c2617;
    --danger: #f08b82;
    --danger-weak: #331d1c;
    --neutral-weak: #262b33;

    --pws: #b79cf3;
    --pws-weak: #251d3a;
    --lake: #b79cf3;
    --lake-weak: #251d3a;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* Class rules like .view{display:grid} and .loading{display:flex} outrank the
   UA's [hidden]{display:none}, so hidden elements would otherwise still show. */
[hidden] { display: none !important; }

body {
  margin: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

code, pre, .mono { font-family: var(--mono); }

/* ---------- top bar ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  flex: none;
  width: 22px; height: 22px;
  background: url(logo.png) center / contain no-repeat, var(--accent);
  background-blend-mode: luminosity;
  -webkit-mask: url(logo.png) center / contain no-repeat;
  mask: url(logo.png) center / contain no-repeat;
}

.brand h1 { font-size: 17px; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: stretch;
  flex: 1 1 auto; min-height: 0; overflow: hidden;
}
.sidebar {
  align-self: stretch; min-height: 0; overflow: auto;
  display: flex; flex-direction: column;
  padding: 10px 12px 18px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.side-link {
  display: flex; align-items: center; gap: 10px; margin: 2px 0; padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: 14px;
}
.side-link i { width: 16px; text-align: center; color: var(--text-faint); }
.side-link.is-on i { color: inherit; }
.side-link:hover { background: var(--surface-2); }
.side-link.is-on { background: var(--accent-weak); color: var(--accent-text); font-weight: 600; }
.side-status {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 16px;
}
.side-status:empty { display: none; }
.side-status .source-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 10px; min-width: 0;
}
.side-status-name { font: 500 13px var(--sans); color: var(--text); }
.side-status .source-card { flex-wrap: wrap; cursor: pointer; user-select: none; }
.side-status .source-card:hover { border-color: var(--border-strong); }
.side-status .source-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.source-tip {
  display: none; flex-basis: 100%;
  margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border);
  font: 400 12px/1.45 var(--sans); color: var(--text-muted); white-space: normal;
}
.source-card.is-open .source-tip { display: block; }
.source-tip-about { margin: 0; }
.side-status .badge {
  padding: 2px 9px; border-radius: 20px;
  font: 600 11.5px var(--sans); letter-spacing: 0; text-transform: none;
}
.side-status .badge.is-accent { background: var(--accent-weak); color: var(--accent-text); }
.app-main {
  min-width: 0; min-height: 0; overflow: auto;
  display: flex; flex-direction: column;
}

@media (max-width: 800px) {
  body { overflow: auto; }
  .app-shell { grid-template-columns: 1fr; overflow: visible; }
  .sidebar {
    height: auto;
    overflow: visible; padding: 10px 12px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .side-nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
  .side-link { white-space: nowrap; margin: 0; }
  .side-status { margin-top: 12px; }
}

.account-menu { position: relative; }
.account-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 6px 10px; border-radius: var(--radius);
  font: 500 13px var(--sans); cursor: pointer; max-width: 280px;
}
.account-btn:hover { border-color: var(--accent); }
.account-btn > i:first-child { color: var(--accent); font-size: 16px; }
.account-btn #accountLabel {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-chevron { font-size: 10px; color: var(--text-faint); }
.account-btn[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-weak); }
.account-drop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  min-width: 220px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.account-drop-label {
  margin: 0 0 8px;
  font: 600 11px var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint);
}
.account-drop .theme-toggle { width: 100%; }
.account-drop .theme-toggle button { flex: 1; }
.account-signout {
  display: block; width: 100%; margin-top: 10px;
  border: 0; border-top: 1px solid var(--border); background: none;
  padding: 10px 4px 2px; text-align: left;
  font: 500 13px var(--sans); color: var(--danger); cursor: pointer;
}
.account-signout:hover { color: var(--text); }

.theme-toggle {
  display: flex; gap: 2px; background: var(--surface-2);
  padding: 3px; border-radius: var(--radius);
}
.theme-toggle button {
  border: 0; background: transparent; color: var(--text-muted);
  padding: 3px 8px; border-radius: var(--radius-sm);
  font: 500 12px var(--sans); cursor: pointer;
}
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button.is-active {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}

.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 2px; border-radius: var(--radius); }

.tab {
  border: 0; background: transparent; color: var(--text-muted);
  padding: 3px 10px; border-radius: var(--radius-sm);
  font: 500 12px var(--sans); cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.badge {
  font: 600 11px var(--sans); letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 20px; white-space: nowrap;
}
.badge-live { background: var(--ok-weak); color: var(--ok); }
.badge-demo { background: var(--warn-weak); color: var(--warn); }
.badge-muted { background: var(--neutral-weak); color: var(--text-muted); }

/* Source badges: colour plus shape, so they never rely on colour alone -
   a round dot for the live API, a square for the stored snapshot. */
.badge-pws { background: var(--pws-weak); color: var(--pws); }
.badge-lake { background: var(--lake-weak); color: var(--lake); }
.badge-pws::before, .badge-lake::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  margin-right: 6px; vertical-align: 1px; background: currentColor;
}
.badge-pws::before { border-radius: 50%; }
.badge-lake::before { border-radius: 1px; }
.badge-pws.is-demo, .badge-lake.is-demo { background: var(--warn-weak); color: var(--warn); }

/* ---------- layout ---------- */

.view { margin: 0; padding: 22px 24px; display: grid; gap: 18px; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}

.search-intro { margin-bottom: 18px; }
.search-intro h2 { font-size: 17px; margin-bottom: 0; }
.search-intro .search-req {
  font-weight: 400; font-size: 13.5px; color: var(--text-muted);
  letter-spacing: 0;
}
.search-intro .search-req::before { content: "("; }
.search-intro .search-req::after { content: ")"; }

/* ---------- notices ---------- */

.notice {
  margin: 16px 22px 0; padding: 11px 14px; border-radius: var(--radius);
  font-size: 13.5px; border: 1px solid transparent; line-height: 1.55;
}
.view .notice, form .notice { margin: 16px 0 0; }
.notice-demo { background: var(--warn-weak); color: var(--warn); border-color: rgba(138, 97, 0, .25); }
.notice-error { background: var(--danger-weak); color: var(--danger); border-color: rgba(179, 38, 30, .25); }
.notice-warn { background: var(--warn-weak); color: var(--warn); border-color: rgba(138, 97, 0, .25); }
.notice code { background: rgba(0, 0, 0, .07); padding: 1px 5px; border-radius: 3px; font-size: .92em; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- search form ---------- */

.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.f-wide { grid-column: span 3; }
.f-full { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .field-grid { grid-template-columns: 1fr; }
  .f-wide { grid-column: span 1; }
}

.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.f label {
  font: 600 12.5px var(--sans); color: var(--text);
  display: flex; align-items: center; gap: 7px;
}

.anchor-dot { color: var(--accent); font-size: 8px; line-height: 1; }

.filter-tag {
  font: 500 10.5px var(--sans); text-transform: uppercase; letter-spacing: .04em;
  background: var(--neutral-weak); color: var(--text-muted);
  padding: 2px 7px; border-radius: 20px;
}

.f small { color: var(--text-faint); font-size: 12px; }

input[type=text], input[type=date], input[type=search], select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 11px; font: 14px var(--sans); width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); padding: 5px 13px; border-radius: 20px;
  font: 500 13px var(--sans); cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.is-on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-text); }

.search-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 8px 16px; border-radius: var(--radius-sm);
  font: 500 13.5px var(--sans); cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-small { padding: 5px 11px; font-size: 12.5px; }
.btn.btn-highlight {
  background: var(--accent-weak); border-color: var(--accent); color: var(--accent-text);
}
.btn.btn-highlight:hover { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-text); }
.btn.btn-highlight.is-on,
.btn.btn-highlight.is-on:hover {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.linkish {
  border: 0; background: none; color: var(--accent-text);
  font: 500 12.5px var(--sans); cursor: pointer; padding: 2px 4px; text-decoration: underline;
}
.linkish:hover { filter: brightness(1.15); }

.presets { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.presets > span { color: var(--text-faint); font-size: 12.5px; }

/* ---------- results ---------- */

.results-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.results-head h2 { font-size: 16px; }
.results-meta { margin: 3px 0 0; color: var(--text-muted); font-size: 12.5px; }
.results-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Paging is explicit: the next ten rows cost a click, never a scroll. */
.results-more {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 4px; justify-content: center;
}
.results-more:empty { display: none; }

/* A date window wider than the service allows, flagged before the call is made. */
.span-bad { color: var(--danger); font-weight: 500; }

.results-filters {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.results-filter-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.results-filter-label {
  font: 600 12.5px var(--sans); color: var(--text-muted); flex: none;
}
.results-filters input[type=search] { width: 210px; flex: none; }

.request-preview {
  margin: 0 0 14px; padding: 11px 13px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-muted); overflow-x: auto; white-space: pre-wrap;
  word-break: break-all;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left; font: 600 11.5px var(--sans); letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 10px 13px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
thead th.num { text-align: right; }

tbody td { padding: 10px 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }

.cell-id { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.cell-strong { font-weight: 500; }
.cell-sub { display: block; color: var(--text-faint); font-size: 11.5px; margin-top: 2px; }
.cell-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font: 600 11.5px var(--sans); white-space: nowrap;
}
.pill-active { background: var(--ok-weak); color: var(--ok); }
.pill-expired { background: var(--neutral-weak); color: var(--text-muted); }
.pill-canceled { background: var(--danger-weak); color: var(--danger); }
.pill-suspended { background: var(--warn-weak); color: var(--warn); }
.pill-inactive { background: var(--neutral-weak); color: var(--text-muted); }
.pill-alert { background: var(--danger-weak); color: var(--danger); }
.pill-other { background: var(--warn-weak); color: var(--warn); }

.flag {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 4px;
  font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .03em;
  background: var(--warn-weak); color: var(--warn);
}

.empty { text-align: center; color: var(--text-muted); padding: 34px 0; font-size: 14px; }

/* ---------- detail ---------- */

.detail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.detail-tools { display: flex; align-items: center; gap: 12px; }

.switch { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; }
.switch input { accent-color: var(--accent); }

.detail-hero {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px;
}
.detail-hero h2 { font-size: 20px; margin-bottom: 4px; }
.detail-hero .hero-id { font-family: var(--mono); font-size: 13px; color: var(--text-muted); }
.detail-hero .hero-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.hero-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 13px; min-width: 96px;
}
.hero-stat-label {
  display: block; font: 600 10.5px var(--sans); text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-faint); margin-bottom: 3px;
}
.hero-stat-value { font-size: 14px; font-weight: 600; }

.group { margin-bottom: 22px; }
.group-head { margin-bottom: 10px; }
.group-head h3 { font-size: 14.5px; }
.group-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); max-width: 80ch; }

/* Separators are drawn per-cell rather than as grid gaps, so a partially
   filled last row leaves surface colour behind rather than a grey block. */
.kv-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}

.kv {
  background: var(--surface); padding: 11px 14px; min-width: 0;
  box-shadow: inset -1px -1px 0 var(--border);
}
.kv-label {
  display: flex; align-items: center; gap: 6px;
  font: 600 11.5px var(--sans); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .03em; margin-bottom: 5px;
}
.kv-value { font-size: 14px; word-break: break-word; }
.kv-value.is-null { color: var(--text-faint); font-style: italic; }
.kv-value.is-mono { font-family: var(--mono); font-size: 12.5px; }
.kv-null-why { margin-top: 5px; font-size: 11.5px; color: var(--text-faint); line-height: 1.45; }
/* Under a silver column's name: the bronze field its value came from, where the names differ. */
.kv-source { font: 400 11px var(--mono); color: var(--text-faint); text-transform: none; letter-spacing: 0; }
.kv-label:has(.kv-source) { flex-wrap: wrap; row-gap: 2px; }

.info {
  border: 0; background: var(--neutral-weak); color: var(--text-muted);
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  font: 600 10px var(--sans); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.info:hover { background: var(--accent); color: #fff; }

.addr-line { font-size: 13.5px; }
.addr-codes { margin-top: 5px; font-size: 11.5px; color: var(--text-faint); }

.sub-link {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent-text);
  cursor: pointer; text-decoration: underline; background: none; border: 0; padding: 0;
}

/* Marks the links that leave for another search, rather than drilling in place. */
.link-out {
  font-family: var(--sans); text-decoration: none;
  margin-left: 4px; font-size: 11px; opacity: 0.75;
}

/* ---------- popover ---------- */

.popover {
  position: absolute; z-index: 90; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 13px 15px;
  font-size: 13px; line-height: 1.55;
}
.popover h4 { font-size: 13px; margin-bottom: 3px; }
.popover .pop-type { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); margin-bottom: 8px; }
.popover .pop-desc { color: var(--text-muted); margin: 0 0 9px; }
.popover .pop-note {
  background: var(--accent-weak); color: var(--accent-text);
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 12.5px; margin: 0 0 9px;
}
.popover .pop-values-label {
  font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); margin-bottom: 5px;
}
.popover .pop-values { display: flex; flex-wrap: wrap; gap: 5px; }
.popover .pop-val {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 4px; font: 500 11.5px var(--mono);
}
.popover .pop-val.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- reference ---------- */

.ref-search { margin-bottom: 18px; max-width: 460px; }

.ref-group { margin-bottom: 26px; }
.ref-group h3 { font-size: 14.5px; margin-bottom: 3px; }
.ref-group > p { margin: 0 0 12px; font-size: 12.5px; color: var(--text-muted); max-width: 80ch; }

.ref-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.ref-row {
  display: grid; grid-template-columns: minmax(190px, 260px) 1fr;
  gap: 18px; padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.ref-row:last-child { border-bottom: 0; }
.ref-row:nth-child(even) { background: var(--surface-2); }

@media (max-width: 760px) { .ref-row { grid-template-columns: 1fr; gap: 7px; } }

.ref-name { font: 600 13px var(--sans); }
.ref-path { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); margin-top: 3px; word-break: break-all; }
.ref-type { font-family: var(--mono); font-size: 11px; color: var(--accent-text); margin-top: 3px; }
.ref-desc { font-size: 13px; color: var(--text-muted); margin: 0; }
.ref-note {
  margin: 8px 0 0; padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--accent-weak); color: var(--accent-text); font-size: 12.5px;
}
.ref-null {
  margin: 8px 0 0; padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--neutral-weak); color: var(--text-muted); font-size: 12.5px;
}
.ref-values { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.ref-values .pop-val { background: var(--surface); }

/* ---------- loading ---------- */

.loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 0; }
.loading p { margin: 0; color: var(--text-muted); font-size: 13.5px; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

/* ---------- bulk export ---------- */

.job {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--surface);
}
.job:last-child { margin-bottom: 0; }
.job-ready { border-color: var(--ok); }
.job-failed { border-color: var(--danger); }

.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.job-title { font-size: 15px; font-weight: 600; }
.job-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.job-id { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.job-head-right { display: flex; align-items: center; gap: 10px; }
.job-elapsed { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* The service's own workflow, made visible: queued, downloaded, decrypted,
   unzipped, read. A spinner would hide exactly the part worth seeing. */
.job-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.job-step {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--neutral-weak); color: var(--text-faint); white-space: nowrap;
}
.job-step + .job-step::before {
  content: "→"; margin: 0 9px 0 -3px; color: var(--text-faint);
}
.job-step.is-done { background: var(--ok-weak); color: var(--ok); }
.job-step.is-now {
  background: var(--accent-weak); color: var(--accent-text); font-weight: 600;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .job-step.is-now { animation: none; } }

.job-note { margin: 11px 0 0; font-size: 12.5px; color: var(--text-muted); max-width: 90ch; }

.job-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.job-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.job-actions a.btn { text-decoration: none; display: inline-block; }

/* ---------- opportunities: the window readout ---------- */
/* The form's most important output before anything is submitted. It says what
   window will actually be sent, and - when that window is wider than Autodesk's
   cap - which of the three rules it breaks, without refusing to send it. */

.window-readout {
  margin-top: 18px; padding: 12px 15px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
}
.window-readout.is-over {
  background: var(--warn-weak); border-color: rgba(138, 97, 0, .25); border-left-color: var(--warn);
}

.window-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.window-line strong { font: 600 15px var(--mono); color: var(--text); }
.window-span {
  font: 600 12px var(--sans); background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border-strong); padding: 2px 9px; border-radius: 20px;
}
.window-readout.is-over .window-span { background: var(--warn); border-color: var(--warn); color: #fff; }
.window-detail { font-size: 12.5px; color: var(--text-faint); }
.window-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text-muted); max-width: 95ch; }
.window-readout.is-over .window-note { color: var(--warn); }

.notice-info {
  background: var(--accent-weak); color: var(--accent-text); border-color: rgba(107, 63, 196, .22);
}

/* Presets that exist to be rejected, marked so they are not clicked by accident. */
.linkish.is-testy { color: var(--warn); }

.job-flag {
  margin: 11px 0 0; padding: 7px 11px; border-radius: var(--radius-sm);
  background: var(--warn-weak); color: var(--warn);
  font-size: 12.5px; line-height: 1.5;
}

.job-request { margin-top: 14px; }
.job-request summary {
  cursor: pointer; font-size: 12.5px; color: var(--text-muted); user-select: none;
}
.job-request summary:hover { color: var(--accent-text); }
.job-request .request-preview { margin-top: 9px; margin-bottom: 0; }

/* ---------- opportunities: the ready file ---------- */

.job-ready-prompt {
  margin-top: 14px; padding: 14px 16px;
  background: var(--ok-weak); border: 1px solid rgba(31, 122, 77, .25);
  border-radius: var(--radius);
}
.job-ready-title { margin: 0; font: 600 14.5px var(--sans); color: var(--ok); }
.job-ready-sub {
  margin: 4px 0 0; font-size: 12.5px; color: var(--text-muted);
  font-family: var(--mono); word-break: break-all; line-height: 1.6;
}
.job-ready-prompt .job-actions { margin-top: 12px; }

/* ---------- exports: service picker, preview ---------- */

/* The one-line "POST /v1/export/accounts · no filters" under the chips. It is
   the quickest way to see that a service takes nothing, or is not polled. */
.service-note {
  margin: 8px 0 16px;
  font-size: 12.5px;
  color: var(--text-faint);
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}

.svc-fields { margin-bottom: 4px; }
.svc-fields[hidden] { display: none; }

.inline-check {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-muted); font-weight: 400;
}
.inline-check input { width: auto; }

.hint { font-size: 12.5px; color: var(--text-faint); }

/* Preview rows are clickable: the table shows six columns, the detail below
   shows every populated field of whichever row was picked. */
#previewTable tbody tr { cursor: pointer; }
#previewTable tbody tr:hover { background: var(--surface-2); }
#previewTable tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#previewTable td.is-empty { color: var(--text-faint); }
/* The narrow faint column is the generic preview's row counter. A subscriptions
   preview has no counter - its .num column is Qty, which is data. */
#previewTable:not(.is-subscriptions) td.num,
#previewTable:not(.is-subscriptions) th.num { width: 34px; text-align: right; color: var(--text-faint); }

.preview-detail {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---------- export explorer ---------- */

/* Between the preview's head and its table: what the pass over the file found,
   then the two filters. The table underneath shows whatever they match. */
.explorer {
  margin-bottom: 14px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.xp-check { margin-bottom: 10px; }
.xp-facts { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.xp-issues { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--warn); }
.xp-error { margin: 6px 0 0; font-size: 12.5px; color: var(--danger); }

.xp-controls { display: flex; align-items: flex-start; gap: 16px 28px; flex-wrap: wrap; }
.xp-field { flex: 1 1 300px; }
.xp-clear { align-self: flex-end; margin-bottom: 6px; }

.xp-picker { position: relative; }
.xp-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); color: var(--text); text-align: left; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 11px; font: 14px var(--sans);
}
.xp-trigger:disabled { color: var(--text-faint); cursor: progress; }
.xp-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.xp-caret { color: var(--text-muted); font-size: 14px; line-height: 1; }

.xp-menu {
  position: absolute; z-index: 80; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px;
}
.xp-note {
  display: flex; flex-direction: column; gap: 3px;
  margin: 7px 2px 5px; font-size: 12px; color: var(--text-faint);
}
.xp-note > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.xp-missing { color: var(--warn); }
.xp-options {
  max-height: 280px; overflow-y: auto;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.xp-option {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 4px; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.xp-option:hover { background: var(--surface-2); }
.xp-option input { width: auto; margin: 0; }
.xp-key { font-family: var(--mono); font-size: 12.5px; }
.xp-tag {
  margin-left: auto; padding: 1px 8px; border-radius: 20px;
  background: var(--neutral-weak); color: var(--text-muted); font-size: 11.5px;
}
.xp-dup { font-size: 11.5px; color: var(--warn); }
.xp-menu-actions { display: flex; justify-content: space-between; padding-top: 6px; }

.xp-picked { margin-top: 8px; }
.xp-picked:empty { display: none; }
.xp-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; }
.xp-x { font-family: var(--sans); font-size: 13px; opacity: .7; }
.xp-count { margin-left: 7px; font-size: 11.5px; color: var(--text-faint); }
.chip.is-on .xp-count { color: var(--accent-text); }
/* A status the manual does not list is shown, not hidden - and marked. */
.chip.xp-undocumented { border-style: dashed; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 2px 18px;
  margin-top: 10px;
  font-size: 13px;
}
.detail-grid dt {
  color: var(--text-muted);
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12px;
  padding: 4px 0;
  overflow-wrap: anywhere;
}
.detail-grid dd {
  margin: 0;
  padding: 4px 0;
  overflow-wrap: anywhere;
}
.detail-grid dt:nth-of-type(odd), .detail-grid dt:nth-of-type(odd) + dd {
  background: var(--surface-2);
}

/* Record detail: breadcrumb, the collection tables under a record, and the
   raw-JSON fallback. A preview record is nested - an opportunity has line
   items, a line item can have true-ups - so the detail view is a drill-down,
   not a single flat list. */

.detail-crumbs {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; min-width: 0;
}
.crumb {
  font: 600 15px var(--sans); color: var(--text);
  background: none; border: 0; padding: 0; cursor: default;
}
button.crumb { color: var(--accent-text); cursor: pointer; }
button.crumb:hover { text-decoration: underline; }
button.crumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.crumb-here { color: var(--text); }
.crumb-sep { color: var(--text-faint); font-size: 14px; }
.crumb-note { font-size: 12.5px; color: var(--text-faint); }

.detail-actions { display: flex; align-items: center; gap: 14px; flex: none; }

/* Typed values. Enough to tell the number 0 from the string "0" and the real
   boolean false from the string "false" - both of which this data has. */
.jv-num { font-family: var(--mono); font-size: 12.5px; }
.jv-bool { font-family: var(--mono); font-size: 12.5px; color: var(--accent-text); }
.jv-null { color: var(--text-faint); font-style: italic; }

.detail-coll { margin-top: 20px; }
.coll-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.coll-head h4 { font-size: 13.5px; margin: 0 0 2px; }
.coll-path {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-faint);
}
.coll-count {
  font: 600 11.5px var(--sans); color: var(--text-muted);
  background: var(--neutral-weak); border-radius: 20px; padding: 2px 9px; flex: none;
}

.coll-table { font-size: 12.5px; }
.coll-table thead th { padding: 7px 11px; }
.coll-table tbody td { padding: 7px 11px; }
.coll-table tbody td.is-empty { color: var(--text-faint); }
.coll-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.coll-table td.coll-open, .coll-table th.coll-open {
  text-align: right; white-space: nowrap; width: 1%;
  color: var(--text-faint); font-size: 11.5px;
}
.coll-table tbody tr:hover td.coll-open { color: var(--accent-text); }

.detail-json { margin-top: 20px; }
.detail-json .request-preview { max-height: 360px; overflow: auto; margin-bottom: 0; }

/* ---------- orders: the two-phase view ----------
   Orders are the only service in this app where one endpoint answers as two
   different operations. Nothing in the request says which; the styling here
   exists to make that split legible rather than something you infer. */

.phase-flow {
  display: flex; align-items: stretch; gap: 10px; margin: 4px 0 10px;
  flex-wrap: wrap;
}

.phase-card {
  flex: 1 1 260px; display: flex; flex-direction: column; gap: 3px;
  padding: 11px 13px; text-align: left; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: var(--radius); font: inherit;
}
.phase-card:hover { border-color: var(--border-strong); }
.phase-card.is-on {
  background: var(--accent-weak); border-color: var(--accent);
  border-left-color: var(--accent);
}

.phase-tag {
  font: 700 10.5px var(--sans); text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint);
}
.phase-card.is-on .phase-tag { color: var(--accent-text); }
.phase-op { font: 600 14px var(--mono); }
.phase-args { font: 12px var(--mono); color: var(--text-muted); }
.phase-out { font: 12px var(--sans); color: var(--text-faint); }

.phase-arrow {
  align-self: center; color: var(--text-faint); font-size: 18px;
}

.phase-note {
  margin: 0 0 14px; font: 12.5px var(--sans); color: var(--text-muted);
}

.phase-form { margin-top: 2px; }

/* The banner above each result set. It names the operation that produced the
   rows below it, so a result is never orphaned from the call that made it. */
.phase-banner {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius-sm);
  font: 12px var(--mono);
}
.phase-banner-a { background: var(--accent-weak); color: var(--accent-text); }
.phase-banner-b { background: var(--ok-weak); color: var(--ok); }
.phase-banner strong { font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .05em; }
.phase-banner .phase-url { word-break: break-all; opacity: .85; }

.phase-footnote {
  margin: 10px 0 0; font: 12.5px var(--sans); color: var(--text-muted);
  padding-top: 9px; border-top: 1px dashed var(--border);
}

/* Order status - three documented values, plus the return flag. */
.pill-completed { background: var(--ok-weak); color: var(--ok); }
.pill-processing { background: var(--warn-weak); color: var(--warn); }
.pill-rejected { background: var(--danger-weak); color: var(--danger); }

.ord-return {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 4px;
  font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .03em;
  background: var(--danger-weak); color: var(--danger);
}

/* ---------- Phase B: the sub-items ---------- */

.ord-section { margin-top: 18px; }
.ord-section > h3 {
  margin: 0 0 4px; font: 600 13px var(--sans);
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.ord-section-note {
  margin: 0 0 8px; font: 12.5px var(--sans); color: var(--text-faint);
}

/* One card per line item. A table would fit the columns but not the nesting -
   an item carries its own subscription id, serial and billing block, and those
   read as properties of the line, not as more columns. */
.ord-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; background: var(--surface-2); overflow: hidden;
}
.ord-item-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; cursor: pointer;
}
.ord-item-head:hover { background: var(--surface); }
.ord-item-line {
  font: 600 11.5px var(--mono); color: var(--text-faint);
  min-width: 52px;
}
.ord-item-sku { font: 600 13px var(--mono); }
.ord-item-name { color: var(--text-muted); font-size: 13px; flex: 1 1 200px; }
.ord-item-qty { font: 600 13px var(--sans); }
.ord-item-net { font: 600 13px var(--sans); min-width: 96px; text-align: right; }
.ord-item-net.is-credit { color: var(--danger); }
.ord-item-caret { color: var(--text-faint); font-size: 11px; width: 12px; }

.ord-item-body {
  padding: 2px 12px 12px; border-top: 1px solid var(--border);
  background: var(--surface);
}

.ord-badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0 0; }
.ord-badge {
  padding: 2px 8px; border-radius: 4px; font: 600 11px var(--sans);
  background: var(--neutral-weak); color: var(--text-muted);
}
.ord-badge-new { background: var(--accent-weak); color: var(--accent-text); }
.ord-badge-renewal { background: var(--ok-weak); color: var(--ok); }

.ord-partners { display: flex; flex-wrap: wrap; gap: 8px; }
.ord-partner {
  flex: 1 1 200px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.ord-partner-type {
  font: 700 10.5px var(--sans); text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint);
}
.ord-partner-name { font-weight: 600; font-size: 13px; }
.ord-partner-csn { font: 12px var(--mono); color: var(--text-muted); }

.ord-billing { width: 100%; border-collapse: collapse; font-size: 13px; }
.ord-billing th {
  text-align: left; font: 600 11px var(--sans); text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-faint);
  padding: 4px 10px 4px 0; border-bottom: 1px solid var(--border);
}
.ord-billing td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); }
.ord-billing tr:last-child td { border-bottom: 0; }

.ord-partial {
  margin: 10px 0 0; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--warn-weak); color: var(--warn);
  font: 12.5px var(--sans);
}

/* ---------- lakehouse tab ---------- */

/* The tab's one column may be narrower than what is in it. Without this a grid
   column is at least as wide as its widest content, so a view with many columns
   (dbo.opportunities_current has 28) widened the whole tab to the table's
   width, and every panel with it - "Query PWS" ended up screens to the right.
   With it, a wide table scrolls inside its own frame (.table-wrap). */
#view-lakehouse { grid-template-columns: minmax(0, 1fr); }
.lake-split { display: contents; }
#view-lakehouse.is-split {
  padding: 0; gap: 0;
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
}
#view-lakehouse.is-split .lake-split {
  display: grid;
  grid-template-columns: minmax(520px, 680px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  height: 100%; min-height: 0;
}
#view-lakehouse.is-split .lake-split > .panel {
  height: 100%; min-width: 0; margin: 0; overflow: auto;
  background: var(--surface);
  border: 0; border-radius: 0; box-shadow: none;
  padding: 18px 12px;
}
#view-lakehouse.is-split #lakeBrowse {
  display: flex; flex-direction: column; overflow: hidden;
  padding: 0; border-right: 1px solid var(--border);
}
#view-lakehouse.is-split #lakeSubsHead,
#view-lakehouse.is-split #lakeOppHead,
#view-lakehouse.is-split #lakeProdHead,
#view-lakehouse.is-split #lakeQuoteHead,
#view-lakehouse.is-split #lakeOrderHead,
#view-lakehouse.is-split #lakeAccountHead {
  flex: none; margin: 0; padding: 12px 12px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
#view-lakehouse.is-split #lakeBrowse > #lakeData {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  padding: 4px 12px 18px;
}
#lakeData tbody tr.is-selected,
#lakeData tbody tr.is-selected:hover { background: var(--accent-weak); }
.search-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.search-row .opp-find { flex: 1; min-width: 0; }
.filter-menu { position: relative; flex: none; }
.filter-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-muted); cursor: pointer; font-size: 13px;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.is-on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.filter-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  width: max-content; min-width: 272px; padding: 6px 6px 8px;
  max-height: calc(100vh - 140px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
/* Two columns once a menu has more than two groups; a group never splits. */
.filter-pop:has(.filter-sec:nth-child(3)) {
  width: min(540px, calc(100vw - 32px));
  columns: 2; column-gap: 6px; column-rule: 1px solid var(--border);
}
.filter-sec { break-inside: avoid; padding-bottom: 4px; }
.filter-foot {
  column-span: all; display: flex; justify-content: flex-end;
  margin-top: 4px; padding: 6px 4px 0; border-top: 1px solid var(--border);
}
.filter-reset {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; border-radius: 6px; padding: 6px 10px; cursor: pointer;
  font: 500 12.5px var(--sans); color: var(--text-muted);
}
.filter-reset i { font-size: 11px; }
.filter-reset:hover { background: var(--surface-2); color: var(--accent-text); }
.filter-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-group {
  padding: 8px 10px 2px;
  font: 600 11px var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint);
}
.filter-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  border-radius: 6px; padding: 8px 10px; font: 400 13px var(--sans); cursor: pointer;
}
.filter-opt:hover { background: var(--surface-2); }
.filter-opt.is-on { color: var(--accent-text); }
.filter-opt .fa-check { font-size: 11px; color: var(--accent); }
.filter-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.sub-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sub-filter {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 10px; font: 500 12px var(--sans); cursor: pointer;
}
.sub-filter:hover { border-color: var(--accent); }
.sub-filter.is-on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.sub-count {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  width: 100%; margin: 10px 0 0;
  font: 400 12px var(--sans); color: var(--text-faint);
}
.sub-sort { display: inline-flex; align-items: center; gap: 4px; }
.sort-menu { position: relative; }
.sort-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; padding: 0; background: transparent; cursor: pointer;
  font: 500 12px var(--sans); color: var(--text-muted);
}
.sort-btn:hover { color: var(--accent-text); }
.sort-btn .fa-chevron-down { font-size: 9px; color: var(--text-faint); }
.sort-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 180px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.sort-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  border-radius: 6px; padding: 8px 10px; font: 400 13px var(--sans); cursor: pointer;
}
.sort-opt:hover { background: var(--surface-2); }
.sort-opt .fa-check { font-size: 11px; color: var(--accent); }
.sub-count strong { font: inherit; font-weight: 500; color: var(--text-muted); }
.sub-count .sub-total { color: var(--text-faint); }
.sub-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.sub-more { margin: 14px 0 4px; color: var(--text-faint); font-size: 12.5px; }
.sub-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  padding: 12px; cursor: pointer; text-align: left;
}
.sub-card:hover { border-color: var(--accent); }
.sub-card.is-on { border-color: var(--accent); background: var(--accent-weak); }
.sub-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sub-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sub-card-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.pill-problem { position: relative; background: var(--warn-weak); color: var(--warn); cursor: help; }
.problem-tip {
  display: none; position: absolute; z-index: 6; top: calc(100% + 8px); right: 0;
  width: max-content; max-width: 280px; padding: 8px 10px; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  font: 400 12.5px/1.4 var(--sans); white-space: normal;
}
.pill-problem:hover .problem-tip { display: block; }
.sub-card-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sub-card-icon { flex: none; font-size: 13px; line-height: 1; color: var(--text-faint); }
.sub-card h3 { margin: 0; font: 600 14px var(--mono); overflow-wrap: anywhere; }
.sub-card-meta { margin-top: 8px; display: grid; gap: 4px; }
.sub-card-meta.is-two { grid-template-columns: 1fr 1fr; column-gap: 16px; }
.sub-card-meta div { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.sub-card-meta b { font-weight: 500; color: var(--text); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.sub-card-terms { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.sub-card-terms.quote-lines { max-height: 420px; overflow-y: auto; }
.change-list { margin-top: 4px; }
.change-card h3 { font-family: var(--sans); }
.change-card .card-fold.is-shut { transform: rotate(-90deg); }
.change-card-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); cursor: default; }
#view-lakehouse.is-split #lakeDetail .change-card.is-on {
  border-color: var(--accent); background: var(--surface);
}
.sub-caret {
  border: 0; background: none; color: var(--text-muted); cursor: pointer;
  width: 18px; padding: 0; margin-right: 4px; font-size: 11px; line-height: 1;
}
#lakeData tbody tr.sub-terms,
#lakeData tbody tr.sub-terms:hover { background: var(--surface-2); cursor: default; }
.sub-terms > td { padding: 6px 10px 10px 28px; }
.sub-term-note { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.sub-term-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sub-term-table th {
  text-align: left; font: 600 11px var(--sans); letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-faint); padding: 2px 8px 4px 0;
}
.sub-term-table td { padding: 3px 8px 3px 0; vertical-align: middle; }
.sub-term-table th:last-child,
.sub-term-table td:last-child { text-align: right; padding-right: 0; }
.sub-term-table .term-num { width: 1%; padding-right: 14px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.sub-term-table tr:has(td) { cursor: pointer; }
.sub-term-table tr:has(td):hover td { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.sub-term-table tr.is-on td,
.sub-term-table tr.is-on:hover td { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.side-kicker {
  margin: 4px 0 10px; font: 600 11px var(--sans); letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint);
}
.field-block { margin-top: 16px; }
.field-block:first-of-type { margin-top: 0; }
.field-block .side-kicker { margin: 0 0 8px; }
#view-lakehouse.is-split #lakeDetail {
  background: var(--surface);
  padding: 0 0 24px;
}
#view-lakehouse.is-split #lakeDetail .detail-head { margin-bottom: 14px; }
#view-lakehouse.is-split #lakeDetail .src-section {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 16px 18px 18px;
  margin: 0;
}
#view-lakehouse.is-split #lakeDetail .detail-part:last-child > .src-section { border-bottom: 0; }
#view-lakehouse.is-split #lakeDetail .load-panel,
#view-lakehouse.is-split #lakeDetail .detail-hero {
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  padding: 0; margin: 0 0 8px;
}
#view-lakehouse.is-split #lakeDetail .src-section-head.is-fold { cursor: pointer; }
#view-lakehouse.is-split #lakeDetail .src-section-head.is-fold .results-tools { cursor: default; }
#view-lakehouse.is-split #lakeDetail .card-fold {
  width: 12px; font-size: 10px; color: var(--text-faint);
  transition: transform .15s ease;
}
#view-lakehouse.is-split #lakeDetail .src-section.is-folded .card-fold { transform: rotate(-90deg); }
#view-lakehouse.is-split #lakeDetail .src-section.is-folded { padding-bottom: 14px; }
#view-lakehouse.is-split #lakeDetail .src-section.is-folded > :not(.src-section-head) { display: none; }
#view-lakehouse.is-split #lakeDetail .src-section.is-folded .src-section-head { margin-bottom: 0; }
#view-lakehouse.is-split #lakeDetail .agree-line {
  margin: 0 0 12px; font-size: 13.5px; line-height: 1.45;
}
#view-lakehouse.is-split #lakeDetail .agree-line strong { font-weight: 600; }
#view-lakehouse.is-split #lakeDetail .agree-line.is-ok strong { color: var(--ok); }
#view-lakehouse.is-split #lakeDetail .agree-line.is-danger strong { color: var(--danger); }
#view-lakehouse.is-split #lakeDetail .agree-line.is-warn strong { color: var(--warn); }
#view-lakehouse.is-split #lakeDetail .agree-line.is-info strong { color: var(--accent-text); }
#view-lakehouse.is-split #lakeDetail .agree-line.is-muted strong { color: var(--text-muted); }
#view-lakehouse.is-split #lakeDetail .kv-grid,
#view-lakehouse.is-split #lakeDetail .kv-grid.is-flat {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  border: 0; border-radius: 0; background: transparent; overflow: visible;
}
#view-lakehouse.is-split #lakeDetail .kv,
#view-lakehouse.is-split #lakeDetail .kv-grid.is-flat .kv {
  background: var(--surface-2); box-shadow: none;
  border: 0; border-radius: 6px;
  padding: 8px 10px 9px;
  min-width: 0;
}
#view-lakehouse.is-split #lakeDetail .kv-label {
  text-transform: capitalize; letter-spacing: .01em;
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  margin-bottom: 3px;
}
#view-lakehouse.is-split #lakeDetail .kv-value {
  font-size: 13.5px; line-height: 1.35;
}
#view-lakehouse.is-split #lakeDetail .kv:has(.kv-long) { grid-column: 1 / -1; }
.side-empty {
  min-height: 280px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 6px;
  color: var(--text-muted);
}
.side-empty h2, .side-empty p { margin: 0; }
.side-empty h2 { font-size: 16px; color: var(--text); }
@media (max-width: 1100px) {
  body { overflow: auto; }
  #view-lakehouse.is-split { overflow: visible; flex: none; }
  #view-lakehouse.is-split .lake-split { grid-template-columns: minmax(0, 1fr); height: auto; }
  #view-lakehouse.is-split .lake-split > .panel { height: auto; max-height: none; }
  #view-lakehouse.is-split #lakeBrowse { border-right: 0; border-bottom: 1px solid var(--border); }
}
.side-close { margin-left: auto; }
#view-lakehouse.is-split #lakeDetail .own-title { overflow-wrap: anywhere; }
#view-lakehouse.is-split .subs-head { display: block; width: 100%; }
#view-lakehouse.is-split .subs-head .lake-finders {
  display: block; margin-left: 0; width: 100%;
}
#view-lakehouse.is-split .search-row .opp-find { width: auto; flex: 1; min-width: 0; }
#view-lakehouse.is-split .opp-find { width: 100%; }
#view-lakehouse.is-split .opp-find input[type=search] {
  width: 100%; border-radius: var(--radius-sm);
}
#view-lakehouse.is-split #lakeData .lake-cell { max-width: none; white-space: nowrap; }
#view-lakehouse.is-split #lakeData th { white-space: nowrap; }

/* The dashboard (#lakehouse/dashboard): one page, full width. Same 12px edge
   as the desks' search heads, so the sidebar lines up with both. */
#view-lakehouse:has(> #lakeDash:not([hidden])) { padding: 12px; }
.dash { display: grid; gap: 12px; min-width: 0; }
.dash .is-link { cursor: pointer; }
.dash .is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.dash-tile {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
}
.dash-tile.is-link:hover { border-color: var(--accent); }
.dash-tile-label { font-size: 12.5px; color: var(--text-muted); }
.dash-tile-value { font: 600 26px/1.15 var(--sans); color: var(--text); }
.dash-tile-note { font-size: 12px; color: var(--text-faint); }

.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dash-card, .dash-health {
  min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 18px;
}
.dash-card.is-wide { grid-column: 1 / -1; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-card h3, .dash-health h3 { margin: 0; font-size: 15px; }
.dash-card-head { position: relative; margin-bottom: 12px; }
.dash-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dash-open {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 0; background: none; padding: 2px 0; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--text-faint);
}
.dash-open i { font-size: 10px; transition: transform 0.15s; }
.dash-open:hover, .dash-open:focus-visible { color: var(--accent-text); }
.dash-open:hover i { transform: translateX(2px); }
.dash-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.dash-help {
  border: 0; background: none; padding: 2px; cursor: help;
  color: var(--text-faint); font-size: 13px; line-height: 1;
}
.dash-help:hover, .dash-help:focus-visible { color: var(--accent); }
.dash-help:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }
.dash-tip {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  width: max-content; max-width: min(340px, 100%); padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font: 400 12.5px/1.45 var(--sans); color: var(--text-muted); text-align: left;
  display: none; pointer-events: none;
}
.dash-help:hover .dash-tip, .dash-help:focus-visible .dash-tip { display: block; }
.dash-tip.is-up { top: auto; bottom: calc(100% + 6px); }
.dash-subhead { margin: 16px 0 8px; font: 600 12px var(--sans); color: var(--text-muted); }
.dash-subrow {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: 4px 14px; margin: 16px 0 8px;
}
.dash-subrow .dash-subhead { margin: 0; }
.dash-subrow .dash-legend { margin: 0; }
.dash-foot { margin: 12px 0 0; color: var(--text-faint); font-size: 12px; line-height: 1.45; }
.dash-foot-tight { margin-top: 4px; }
.dash-footer {
  padding: 0; text-align: center;
  font-size: 11.5px; color: var(--text-faint); letter-spacing: .01em;
}
.dash-foot strong { font-weight: 600; color: var(--text-muted); }

.dash-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-stat {
  flex: 1 1 96px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 6px; padding: 8px 10px;
}
.dash-stat strong { font: 600 17px var(--sans); color: var(--text); }
.dash-stat span { font-size: 12px; color: var(--text-muted); }
.dash-stat.is-link:hover { border-color: var(--accent); }
.dash-stat:has(.dash-help) { position: relative; }
.dash-stat .dash-help { margin-left: 5px; font-size: 11.5px; vertical-align: -1px; }
.dash-stat .dash-tip { font-size: 12.5px; }
.dash-stat.is-ok strong { color: var(--ok); }
.dash-stat.is-warn strong { color: var(--warn); }
.dash-stat.is-danger strong { color: var(--danger); }

.dash-card { display: flex; flex-direction: column; }
.dash-cols { display: flex; align-items: stretch; gap: 6px; height: 150px; }
.dash-card > .dash-cols { flex: 1 1 auto; height: auto; min-height: 150px; }
.dash-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* The value rides on top of its bar; the track's top padding is room for the
   tallest bar's value, since bar heights are a share of the space below it. */
.dash-col-value {
  flex: none; display: flex; justify-content: center; margin-bottom: 4px;
  font-size: 11px; line-height: 14px; color: var(--text-muted); white-space: nowrap;
}
.dash-col-track {
  flex: 1 1 auto; width: 100%; max-width: 44px; min-height: 0; padding-top: 18px;
  display: flex; flex-direction: column-reverse;
  border-bottom: 1px solid var(--border);
}
.dash-col-bar { flex: none; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }
.dash-col-bar.is-soft { background: var(--accent-weak); box-shadow: inset 0 0 0 1px var(--accent); opacity: .9; }
.dash-col-track:has(.is-soft) .dash-col-bar:not(.is-soft) { border-radius: 0; }
.dash-col-month { font-size: 11px; line-height: 14px; white-space: nowrap; color: var(--text-faint); }
.dash-col:hover .dash-col-bar:not(.is-soft) { filter: brightness(1.12); }

.dash-legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-muted); }
.dash-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dash-swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.dash-swatch.is-soft { background: var(--accent-weak); box-shadow: inset 0 0 0 1px var(--accent); }

.dash-bars { display: grid; grid-template-columns: fit-content(38%) minmax(0, 1fr) auto; column-gap: 10px; row-gap: 5px; }
.dash-bar {
  grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center;
  padding: 3px 6px; margin: 0 -6px; border-radius: var(--radius-sm); font-size: 12.5px;
}
.dash-bar.is-link:hover { background: var(--surface-2); }
.dash-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.dash-bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.dash-bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.dash-bar-value { font-variant-numeric: tabular-nums; color: var(--text-muted); text-align: right; min-width: 48px; }

.dash-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.dash-split > div > .dash-subhead:first-child { margin-top: 4px; }
.dash-health { display: grid; gap: 10px; }
.dash-health .dash-foot { margin: 0; }

@media (max-width: 1100px) {
  .dash-grid, .dash-split { grid-template-columns: minmax(0, 1fr); }
}

.lake-connect { max-width: 70ch; }
.lake-connect p { color: var(--text-muted); font-size: 13.5px; }
.lake-connect .loading { padding: 18px 0 6px; align-items: flex-start; }

/* The listed pages - subscriptions, opportunities - as links to each other,
   and on the right boxes that open any subscription's or opportunity's own
   page by its key. */
.lake-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.lake-page-links { display: flex; flex-wrap: wrap; gap: 7px; }
.lake-page { text-decoration: none; }
.lake-page.is-on { background: var(--lake-weak); border-color: var(--lake); color: var(--lake); }
.opp-find { display: flex; align-items: stretch; height: 32px; }
.opp-find:focus-within { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--radius-sm); }
.opp-find > * + * { margin-left: -1px; }
.opp-find-prefix,
.opp-find select,
.opp-find input[type=search],
.opp-find .btn {
  height: 32px; box-sizing: border-box; margin-top: 0; margin-bottom: 0;
}
.opp-find-prefix {
  display: flex; align-items: center; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface-2); color: var(--text-muted);
  font: 500 12.5px var(--sans); white-space: nowrap;
}
.opp-find select {
  width: auto; max-width: none; appearance: none;
  padding: 0 28px 0 10px; font: 500 12.5px var(--sans); line-height: 30px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background-color: var(--surface-2);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.opp-find input[type=search] {
  width: 280px; padding: 0 10px; font: 13px var(--sans); line-height: 30px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  -webkit-appearance: none; appearance: none;
}
.opp-find input[type=search]::-webkit-search-decoration,
.opp-find input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.opp-find .btn {
  display: inline-flex; align-items: center; padding: 0 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 12.5px;
}
.opp-find input:focus, .opp-find select:focus { outline: none; }
.lake-finders { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.subs-head { align-items: center; }
.subs-head .results-tools .btn {
  height: 32px; box-sizing: border-box; padding: 0 12px;
  display: inline-flex; align-items: center;
}
.subs-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.subs-title h2 { margin: 0; }
.subs-head .lake-finders { margin-left: auto; }

/* One subscription's or opportunity's own page: its key beside the way back,
   and a subscription's product after it. */
.detail-head.is-own { justify-content: flex-start; }
.detail-head.is-own a.btn,
.src-section-head a.btn { text-decoration: none; }
.own-title { font: 600 16px var(--mono); }
.own-name { font-size: 13.5px; color: var(--text-muted); }

/* Browse: the views on offer as a choice above the table, then the open one. */
.lake-picker { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.lake-pick { font-family: var(--mono); font-size: 12.5px; }
.lake-pick.is-on { background: var(--lake-weak); border-color: var(--lake); color: var(--lake); }
.lake-pick-desc { margin: 10px 0 0; font-size: 12.5px; color: var(--text-muted); max-width: 100ch; }

/* The explorer (#lakehouse): every table and view down the left, the open one
   on the right. The list scrolls on its own, so a long catalog never pushes
   the table out of sight. */
.lake-browse.is-explore { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.lake-browse.is-explore .lake-picker {
  padding: 0 18px 0 0; margin: 0; border-bottom: 0; border-right: 1px solid var(--border);
  position: sticky; top: 12px;
}
@media (max-width: 900px) {
  .lake-browse.is-explore { grid-template-columns: 1fr; }
  .lake-browse.is-explore .lake-picker {
    position: static; padding: 0 0 14px; border-right: 0; border-bottom: 1px solid var(--border);
  }
}
.lake-find { width: 100%; }
.lake-list-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 8px 0 6px; font-size: 12px; color: var(--text-faint);
}
.lake-list { max-height: calc(100vh - 160px); overflow-y: auto; padding-right: 2px; }
@media (max-width: 900px) { .lake-list { max-height: 320px; } }
.lake-list-schema {
  margin: 12px 0 4px; font: 600 11px var(--sans); letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted);
}
.lake-list-schema:first-child { margin-top: 2px; }
.lake-obj {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 5px 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; color: var(--text); text-align: left; cursor: pointer;
}
.lake-obj:hover { background: var(--surface-2); }
.lake-obj:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lake-obj.is-on { background: var(--lake-weak); border-color: var(--lake); color: var(--lake); }
.lake-obj-name { font: 12.5px var(--mono); overflow-wrap: anywhere; min-width: 0; }
.lake-obj-type {
  flex: none; font: 600 10px var(--sans); text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 4px; background: var(--neutral-weak); color: var(--text-muted);
}
.lake-obj-type.is-view { background: var(--lake-weak); color: var(--lake); }
.lake-obj-type.is-query { background: var(--lake-weak); color: var(--lake); font-style: italic; }
.lake-data-head .lake-pick-desc { margin-top: 4px; }

.lake-data { min-width: 0; }
.lake-data-head h2 { font: 600 15px var(--mono); overflow-wrap: anywhere; }
.lake-data-head h2.lake-friendly-title { font: 600 16px var(--sans); }
.lake-asof { margin-left: 8px; }

.lake-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.lake-toolbar select, .lake-toolbar input { width: auto; }
.lake-toolbar .grow { flex: 1; }
.lake-toolbar label { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

.lake-filters { display: grid; gap: 8px; margin: 10px 0 0; }
.lake-filter {
  display: grid; grid-template-columns: minmax(130px, 1fr) 150px minmax(130px, 1fr) auto;
  gap: 8px; align-items: center;
}
@media (max-width: 700px) { .lake-filter { grid-template-columns: 1fr; } }

/* Browse sorts from the column heads: both arrows faint means the column does
   not order the rows; one arrow alone, lit, means it does, that way. The other
   keeps its space (no jump) and comes back on hover, to turn the order round. */
.th-sort { display: inline-flex; align-items: center; gap: 7px; }
.sort-arrows { display: inline-flex; flex-direction: column; gap: 1px; }
.sort-arrow {
  display: block; background: none; border: 0; margin: 0; padding: 0 2px;
  font-size: 8px; line-height: 1; color: var(--text-faint); cursor: pointer;
}
.sort-arrow:hover { color: var(--text); }
.sort-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
.sort-arrow.is-on { color: var(--accent); }
.sort-arrow.is-off { visibility: hidden; }
thead th:hover .sort-arrow.is-off,
thead th:focus-within .sort-arrow.is-off { visibility: visible; }

.lake-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-null { color: var(--text-faint); font-style: italic; }
.flag-cut { background: var(--danger-weak); color: var(--danger); }

.lake-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 12px; font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap;
}
.lake-pager .btns { display: flex; gap: 6px; }

/* "Not queried": PWS shows nothing until asked, and says so rather than
   leaving a blank that could be mistaken for an empty answer. */
.not-fetched { color: var(--text-faint); font-style: italic; font-size: 12.5px; margin-right: 6px; }

.verdict { display: inline-block; padding: 2px 9px; border-radius: 20px; font: 600 11.5px var(--sans); white-space: nowrap; }
.verdict-ok { background: var(--ok-weak); color: var(--ok); }
.verdict-info { background: var(--accent-weak); color: var(--accent-text); }
.verdict-warn { background: var(--warn-weak); color: var(--warn); }
.verdict-danger { background: var(--danger-weak); color: var(--danger); }
.verdict-muted { background: var(--neutral-weak); color: var(--text-muted); }

/* Detail: one section per source, each with its own badge and timestamp. */
/* A detail's parts each sit in a box of their own, redrawn alone; the box
   takes no part in the layout. */
.detail-part { display: contents; }
.src-section {
  border: 1px solid var(--border); border-left: 4px solid var(--lake);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
}
.src-section.is-pws { border-left-color: var(--pws); }
.src-section.is-check { border-left-color: var(--border-strong); }
.src-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.src-section-head h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.src-section .request-preview { margin: 10px 0 0; }
.kv-long { max-height: 180px; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; }

.src-notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.src-notes li { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; }
.src-tag {
  flex: none; font: 600 10px var(--sans); text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 4px; background: var(--neutral-weak); color: var(--text-muted);
}
.src-tag.is-lakehouse { background: var(--lake-weak); color: var(--lake); }
.src-tag.is-pws { background: var(--pws-weak); color: var(--pws); }

/* A live PWS record drawn in full under a lakehouse row, by the Search tab's
   own renderer. Its hero sits a little tighter here, inside the PWS section. */
.pws-record { margin-top: 12px; }
.pws-record .detail-hero { margin-bottom: 16px; }
.pws-record-count { margin: 18px 0 0; font-size: 13px; color: var(--text-muted); }

/* History: one row per load, newest first. A load whose statuses moved is
   marked down the left edge as well as flagged. */
.history-table tbody tr { cursor: default; }
.history-table tbody tr:hover { background: none; }
.history-table td .pill + .pill { margin-left: 4px; }
.history-table tr.is-changed td:first-child { box-shadow: inset 3px 0 0 var(--lake); }

/* A history line, or a change, opens on its load: the rows that line counted,
   in a panel under it - several open at once, to read one day against another. */
.history-table tbody tr.is-openable { cursor: pointer; }
.history-table tbody tr.is-openable:hover { background: var(--surface-2); }
.history-table tbody tr.is-openable:focus-visible { outline: 2px solid var(--lake); outline-offset: -2px; }
.history-table tbody tr.is-open > td { background: var(--lake-weak); border-bottom-color: transparent; }
.history-table tbody tr.is-target > td { animation: load-target 1.6s ease-out; }
@keyframes load-target { from { background: var(--lake-weak); } }
.load-caret { display: inline-block; width: 1.1em; color: var(--text-faint); font-size: 11px; }
.load-hint { margin: 2px 0 10px; }
.history-table tbody tr.load-detail:hover,
.history-table tbody tr.term-detail:hover { background: none; }
.history-table tbody tr.load-detail > td { padding: 0 12px 14px; background: var(--lake-weak); }
.load-panel {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--lake);
  border-radius: var(--radius); padding: 12px 14px;
}
.load-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.load-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; flex-wrap: wrap; }
.load-panel .request-preview { margin: 0 0 10px; }
/* Which layer an opened load shows: silver's version, or the bronze rows. */
.load-panel.is-bronze { border-left-color: #a8742a; }
.layer-tag { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 4px; }
.layer-tag.is-silver { background: #eef1f4; color: #4d5866; }
.layer-tag.is-bronze { background: #f6ecdc; color: #7a5212; }
.term-table td .pill { margin-left: 2px; }
.history-table tbody tr.term-detail > td { padding: 4px 12px 16px; background: var(--surface-2); }
.load-record .detail-hero { margin-bottom: 16px; }
.load-record .group:last-child { margin-bottom: 0; }
.load-source { margin: 10px 0 0; font-size: 12px; color: var(--text-faint); }
.flag-gap { background: var(--neutral-weak); color: var(--text-muted); }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}

/* A subscription's change, opened: the load before and the load after, side by
   side - one above the other where the page is too narrow for two. */
.compare-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px 0; align-items: stretch; container-type: inline-size;
}
.compare-side { min-width: 0; padding-right: 18px; }
.compare-side + .compare-side {
  border-left: 1px solid var(--border-strong);
  padding-left: 18px; padding-right: 0;
}
@container (max-width: 839px) {
  .compare-side { padding-right: 0; }
  .compare-side + .compare-side {
    border-left: 0; padding-left: 0;
    border-top: 1px solid var(--border-strong); padding-top: 16px;
  }
}
.snap-block { display: flex; flex-direction: column; gap: 16px; }
.snap-kicker { margin: 0 0 8px; font: 600 13px var(--sans); }
.snap-term { padding-top: 4px; }
.compare-label {
  margin: 10px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted);
}
.compare-side .kv.is-diff,
.compare-side .hero-stat.is-diff,
.compare-side td.is-diff { background: var(--accent-weak); box-shadow: none; }
.compare-side .kv.is-diff .kv-value { color: var(--accent-text); }
.compare-side tr.is-added td { box-shadow: inset 3px 0 0 var(--ok); }
.compare-side tr.is-removed td { box-shadow: inset 3px 0 0 var(--danger); }
#view-lakehouse.is-split #lakeDetail .compare-side .kv.is-diff,
#view-lakehouse.is-split #lakeDetail .compare-side .hero-stat.is-diff {
  background: var(--accent-weak); box-shadow: none;
}
#view-lakehouse.is-split #lakeDetail .compare-side .kv.is-diff .kv-value { color: var(--accent-text); }

/* The change log: before -> after, one field per line. */
.change-table .change-arrow { color: var(--text-faint); padding-left: 0; padding-right: 0; width: 1%; }
.change-table .change-value { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.change-table .cell-sub-cell { color: var(--text-faint); font-size: 12px; white-space: nowrap; }

/* ---------- an opportunity, read like a subscription ----------
   The hero and the field groups are the subscription's own (.detail-hero,
   .group, .kv-grid); what is new is the line items table, whose rows open in
   place on everything about the line. */

.hero-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.hero-flags .flag { margin-left: 0; }

.opp-record .detail-hero { margin-bottom: 18px; }
.opp-record .group:last-of-type { margin-bottom: 0; }

.opp-lines-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.opp-lines-table { font-size: 13px; }
.opp-lines-table thead th { padding: 8px 11px; }
.opp-lines-table tbody td { padding: 8px 11px; vertical-align: top; }
.opp-lines-table td.num:first-child, .opp-lines-table th.num:first-child { width: 1%; color: var(--text-faint); }
.opp-lines-table td.coll-open, .opp-lines-table th.coll-open {
  text-align: right; white-space: nowrap; width: 1%; color: var(--text-faint); font-size: 12px;
}
.opp-lines-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.opp-lines-table tbody tr:hover td.coll-open { color: var(--accent-text); }
.opp-lines-table tbody tr.is-open > td { background: var(--accent-weak); border-bottom-color: transparent; }
.opp-lines-table td .flag { margin-left: 5px; }
.opp-line-product { font-weight: 600; }

/* A line, opened: its groups on a quieter ground, a little tighter than the
   record's own. */
.opp-lines-table tbody tr.opp-line-open { cursor: default; }
.opp-lines-table tbody tr.opp-line-open:hover { background: none; }
.opp-lines-table tbody tr.opp-line-open > td { padding: 4px 12px 16px; background: var(--accent-weak); }
.opp-line-detail {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.opp-line-detail .group { margin-bottom: 16px; }
.opp-line-detail .group-head h3 { font-size: 13.5px; }
.opp-line-detail .kv-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.opp-line-detail .detail-json { margin-top: 4px; }

.kv-label-path { font-family: var(--mono); text-transform: none; letter-spacing: 0; font-weight: 500; }
.team-member { font-size: 14px; }
.team-role { margin-left: 8px; font-size: 12px; color: var(--text-muted); }

/* An opportunity's own page: the last-seen view's row, folded above the
   snapshot row drawn in full. */
.view-row { margin: 4px 0 12px; }
.view-row .kv-grid { margin-top: 9px; }

/* ---------- sign-in ---------- */

/* Until someone is let in (auth.js), the page is the sign-in and nothing else:
   no tabs, no source badges, no views. */
body.is-gated .view,
body.is-gated .tabs,
body.is-gated #modeBadge,
body.is-gated #lakeBadge,
body.is-gated #demoNotice { display: none !important; }

.auth-gate { display: flex; justify-content: center; padding: 56px 24px; }
.auth-card { width: 100%; max-width: 580px; }
.auth-card h2 { font-size: 18px; margin-bottom: 8px; }
.auth-lead { color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }
.auth-card .loading { align-items: flex-start; padding: 16px 0 4px; }

.auth-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.auth-user { font-weight: 600; color: var(--text); }
