/* Pioneer, civic skin.
   Institutional-calm design language: soft cool canvas, white cards, navy ink,
   one working blue for interaction. Color that isn't the action blue is data:
   the three extraction-confidence tiers (green / yellow / red) and match status.
   Every colored chip also carries a text label so nothing relies on hue alone.
   Font: Inter, the house stand-in for civic's unidentified grotesque. */

:root {
  /* canvas & surfaces */
  --bg: #f0f5f7;
  --card: #ffffff;
  --muted: #f7fafb;
  --wash: #f0f6fe;
  --line: #e6ebed;
  --hairline: #d9e2ea;

  /* ink */
  --text: #0f1632;
  --body: #26292b;
  --dim: #5e676b;
  --faint: #a4acaf;

  /* one blue does all interactive work */
  --accent: #255be3;
  --accent-dim: #244cd1;
  --accent-deep: #233faa;
  --tint: #dbeffe;

  /* data color: confidence tiers + match status (tint bg + deep ink) */
  --conf-high: #2a6b3c;       --conf-high-tint: #e2f6e3;      --conf-high-line: #bfe6c4;
  --conf-medium: #8a6116;     --conf-medium-tint: #fdf1dd;    --conf-medium-line: #f3d9a6;
  --conf-low: #a70d0d;        --conf-low-tint: #fff1f1;       --conf-low-line: #f4c9c9;

  --status-match: var(--conf-high);
  --status-match-tint: var(--conf-high-tint);
  --status-match-line: var(--conf-high-line);
  --status-gap-minor: #cb6015;
  --status-gap-minor-tint: #fdf1dd;
  --status-gap-minor-line: #f3d9a6;
  --status-gap-major: var(--conf-low);
  --status-gap-major-tint: var(--conf-low-tint);
  --status-gap-major-line: var(--conf-low-line);

  --radius: 8px;
  --radius-lg: 16px;
  --border: 1px solid var(--line);
  --shadow: 0 4px 14px rgb(15 22 50 / 0.06);
  --shadow-hover: 0 10px 24px rgb(15 22 50 / 0.1);
  --motion: 160ms ease;

  /* theme hooks: ink on accent fills, drawing plates, display/numeral faces */
  --accent-ink: #ffffff;
  --plate: #ffffff;
  --font: "Inter", system-ui, sans-serif;
  --font-display: var(--font);
  --font-mono: var(--font);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--body);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------- landing ---------- */

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  gap: 0.5rem;
}

.scroll-cue {
  display: flex;
  justify-content: center;
  padding-bottom: 2rem;
  color: var(--faint);
  transition: color var(--motion);
}

.scroll-cue:hover {
  color: var(--accent);
  text-decoration: none;
}

.chev-down {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.landing-wordmark {
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 200;
  letter-spacing: 0.28em;
  margin-left: 0.28em; /* optically recenter the tracked type */
  color: var(--text);
}

.landing-tag {
  font-size: 1.05rem;
  color: var(--dim);
  margin: 0.25rem 0 2.25rem;
  font-weight: 300;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(340px, 90vw);
}

.login-form input {
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--card);
  padding: 0 1rem;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
}

.login-form input::placeholder {
  color: var(--faint);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-form .btn {
  height: 44px;
  margin-top: 0.2rem;
}

.login-error {
  font-size: 0.8rem;
  color: var(--conf-low);
  margin: 0.4rem 0 0;
}

/* ---------- login page ---------- */

.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 1.5rem;
  text-align: center;
}

.login-back {
  position: absolute;
  top: 2rem;
  left: 2rem;
  font-size: 0.85rem;
  color: var(--dim);
}

.login-back:hover {
  color: var(--accent);
}

.landing-footer {
  border-top: none;
  background: transparent;
  line-height: 1.8;
}

/* ---------- landing marketing sections ---------- */

.landing-section-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 2rem;
}

.landing-section {
  padding: 4rem 0;
}

.landing-section.alt {
  background: var(--card);
  border-top: var(--border);
  border-bottom: var(--border);
}

.section-heading {
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--text);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.section-sub {
  color: var(--dim);
  font-size: 0.92rem;
  margin: 0 0 2rem;
}

/* stats bar */

.landing-stats {
  background: var(--card);
  border-top: var(--border);
  border-bottom: var(--border);
  padding: 2.5rem 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  text-align: center;
}

.stat-num {
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}

/* about */

.landing-about {
  max-width: 74ch;
}

.landing-about p {
  color: var(--body);
  font-size: 0.98rem;
  line-height: 1.65;
  margin: 0 0 1rem;
}

/* core capabilities */

.capability-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.capability-card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
}

.capability-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.capability-desc {
  font-size: 0.86rem;
  color: var(--dim);
  line-height: 1.5;
}

/* platform modules (landing, non-interactive) */

.landing-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.landing-module-card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.tag-chip {
  font-size: 0.7rem;
  color: var(--dim);
  background: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

/* dashboard examples */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.dashboard-panel {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
}

.panel-title {
  font-size: 0.8rem;
  color: var(--dim);
  margin-top: 0.6rem;
}

.panel-stat {
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 0.3rem;
}

.panel-caption {
  font-size: 0.78rem;
  color: var(--dim);
  margin-top: 0.5rem;
  line-height: 1.45;
}

/* development updates timeline */

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}

.timeline-entry:first-child {
  border-top: none;
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--dim);
  font-weight: 600;
  white-space: nowrap;
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.timeline-desc {
  font-size: 0.86rem;
  color: var(--dim);
  line-height: 1.5;
}

/* final cta */

.landing-final-cta {
  background: var(--wash);
  border-top: var(--border);
  border-bottom: var(--border);
  text-align: center;
  padding: 3.5rem 2rem;
}

.landing-final-cta h2 {
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--text);
  margin: 0 0 1.25rem;
}

/* ---------- shell ---------- */

.shell-header {
  border-bottom: var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--card);
}

.wordmark-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text);
}

.module-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.mod-link {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--dim);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}

.mod-link:hover {
  color: var(--accent);
  background: var(--muted);
}

.mod-link.active {
  background: var(--tint);
  color: var(--accent-deep);
  font-weight: 600;
}

.user-cluster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-chip {
  font-size: 0.78rem;
  color: var(--dim);
  background: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}

/* ---------- admin client-setup menu ---------- */

.admin-menu {
  position: relative;
}

.admin-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 40;
  width: 22rem;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  padding: 1rem;
}

.admin-head {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.admin-note {
  font-size: 0.75rem;
  color: var(--dim);
  margin: 0.75rem 0 0.5rem;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-sub {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin: 0.6rem 0 0.15rem;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-row.facility {
  margin-bottom: 0.25rem;
}

.admin-word {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--body);
}

.admin-row input {
  flex: 0 0 9rem;
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--text);
  background: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
}

.admin-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: var(--border);
}

/* ---------- open-TDP tab bar ---------- */

.tab-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 2rem;
  border-bottom: var(--border);
  background: var(--muted);
}

.tab-bar-scroll {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tdp-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  max-width: 15rem;
  padding: 0.4rem 0.4rem 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--dim);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--motion), color var(--motion), border-color var(--motion);
}

.tdp-tab:hover {
  border-color: var(--hairline);
  color: var(--text);
}

.tdp-tab.active {
  background: var(--tint);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}

.tdp-tab-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tdp-tab-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}

.tdp-tab.active .tdp-tab-mark {
  background: var(--accent);
}

.tdp-tab.loading .tdp-tab-mark {
  background: var(--accent);
  animation: tab-pulse 0.9s ease-in-out infinite;
}

@keyframes tab-pulse {
  50% {
    opacity: 0.25;
  }
}

.tdp-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: var(--radius);
  color: var(--faint);
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}

.tdp-tab-close:hover {
  background: rgb(15 22 50 / 0.08);
  color: var(--text);
}

.tab-add {
  flex: 0 0 auto;
  border: 1px dashed var(--hairline);
  background: transparent;
  color: var(--dim);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--motion), border-color var(--motion);
}

.tab-add:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- within-tab pane toggle (spec / verdict) ---------- */

.pane-toggle {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--muted);
  border: var(--border);
  border-radius: var(--radius);
}

.pane-opt {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--dim);
  padding: 0.4rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}

.pane-opt:hover {
  color: var(--accent);
}

.pane-opt.active {
  background: var(--card);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* open marker on intake cards already loaded in a tab */

.part-card {
  position: relative;
}

.part-open-tag {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-deep);
  background: var(--tint);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.part-card.is-open {
  border-color: var(--accent);
}

main {
  flex: 1;
  padding: 2.5rem 2rem;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.view-title {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text);
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.view-subtitle {
  color: var(--dim);
  margin: 0 0 2rem;
  font-size: 0.95rem;
  max-width: 68ch;
}

.view-subtitle.slim {
  margin-bottom: 0.75rem;
}

.dim-cell {
  color: var(--dim);
  font-size: 0.82rem;
}

.shell-footer {
  border-top: var(--border);
  padding: 1rem 2rem;
  font-size: 0.72rem;
  color: var(--dim);
  text-align: center;
  background: var(--card);
}

/* ---------- buttons ---------- */

.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.88rem;
  height: 40px;
  padding: 0 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion), color var(--motion);
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: var(--accent-ink);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--dim);
}

.btn.ghost:hover {
  color: var(--accent);
}

.btn.slim {
  height: 30px;
  padding: 0 0.9rem;
  font-size: 0.78rem;
}

/* ---------- module hub ---------- */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.module-card {
  text-align: left;
  font-family: inherit;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 190px;
  color: inherit;
}

.module-card.active {
  cursor: pointer;
  transition: transform var(--motion), box-shadow var(--motion), border-color var(--motion);
}

.module-card.active:hover,
.module-card.active:focus-visible {
  transform: translateY(-2px);
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.module-card.planned {
  background: var(--muted);
  border: 1px dashed var(--hairline);
  box-shadow: none;
}

.module-topline {
  display: flex;
  justify-content: flex-end;
}

.module-status {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: var(--card);
}

.module-status.live {
  color: var(--conf-high);
  background: var(--conf-high-tint);
  border-color: var(--conf-high-line);
}

.module-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.module-card.planned .module-name {
  color: var(--dim);
}

.module-desc {
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.45;
  flex: 1;
}

.module-extra {
  font-size: 0.75rem;
  color: var(--accent-deep);
  background: var(--tint);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  align-self: flex-start;
}

.module-cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- intake ---------- */

.part-search {
  margin: 0 0 1.5rem;
}

.part-search input {
  width: 100%;
  max-width: 360px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--card);
  padding: 0 0.9rem;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
}

.part-search input::placeholder {
  color: var(--faint);
}

.part-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.part-search-empty {
  color: var(--dim);
  font-size: 0.88rem;
  margin: 1.25rem 0 0;
}

.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.part-card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  transition: transform var(--motion), box-shadow var(--motion), border-color var(--motion);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.part-card:hover,
.part-card:focus-visible {
  transform: translateY(-2px);
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.part-card-art {
  background: var(--plate);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  border-bottom: var(--border);
}

.part-card-art img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.part-card-body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.part-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.part-card-meta {
  font-size: 0.72rem;
  color: var(--dim);
}

.upload-tile {
  border: 1px dashed var(--hairline);
  box-shadow: none;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-size: 0.85rem;
  min-height: 236px;
  text-align: center;
  padding: 1rem;
  cursor: default;
}

/* ---------- analyzing ---------- */

.analyzing-panel {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.analyzing-line {
  font-size: 0.9rem;
  color: var(--dim);
  min-height: 1.2em;
}

/* ---------- confidence chips ---------- */

.conf-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.conf-chip.conf-high {
  color: var(--conf-high);
  background: var(--conf-high-tint);
  border-color: var(--conf-high-line);
}

.conf-chip.conf-medium {
  color: var(--conf-medium);
  background: var(--conf-medium-tint);
  border-color: var(--conf-medium-line);
}

.conf-chip.conf-low {
  color: var(--conf-low);
  background: var(--conf-low-tint);
  border-color: var(--conf-low-line);
}

/* per-section rollup counters */
.conf-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.conf-dot.conf-high {
  color: var(--conf-high);
  background: var(--conf-high-tint);
}

.conf-dot.conf-medium {
  color: var(--conf-medium);
  background: var(--conf-medium-tint);
}

.conf-dot.conf-low {
  color: var(--conf-low);
  background: var(--conf-low-tint);
}

.conf-legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.legend-note {
  font-size: 0.75rem;
  color: var(--faint);
  margin-left: 0.25rem;
}

/* ---------- extract summary head ---------- */

.extract-head {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.extract-thumb {
  background: var(--plate);
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
}

.extract-thumb img {
  width: 100%;
  display: block;
}

.extract-id .view-title {
  margin-bottom: 0.2rem;
}

.extract-id .view-subtitle {
  margin-bottom: 0;
}

.extract-conf {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.conf-score {
  font-size: 2.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.conf-score-high {
  color: var(--conf-high);
}

.conf-score-medium {
  color: var(--conf-medium);
}

.conf-score-low {
  color: var(--conf-low);
}

.conf-score-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
  margin-bottom: 0.5rem;
}

/* ---------- collapsible sections ---------- */

/* two-up always; section bodies are designed to fit the half-width column.
   minmax(0, 1fr) stops long nowrap summaries from inflating their track. */
.collapse-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.collapse-stack > .collapse:only-child {
  grid-column: 1 / -1;
}

/* compact table variant sized for the half-width collapse column */
.data-table.compact th {
  padding: 0.5rem 0.6rem;
  font-size: 0.72rem;
}

.data-table.compact td {
  padding: 0.55rem 0.6rem;
  font-size: 0.82rem;
}

/* note as a small second line inside a cell, instead of its own column */
.cell-note {
  font-size: 0.76rem;
  color: var(--dim);
  margin-top: 0.15rem;
  font-weight: 400;
}

.collapse {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 0; /* grid item may shrink below its content's natural width */
}

.collapse summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  cursor: pointer;
  border-radius: var(--radius-lg);
}

.collapse summary::-webkit-details-marker {
  display: none;
}

.collapse summary:hover {
  background: var(--muted);
}

.collapse-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  flex-shrink: 0;
}

.collapse-sub {
  font-size: 0.82rem;
  color: var(--dim);
  flex: 1;
  min-width: 0; /* lets the nowrap text shrink so the ellipsis engages */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapse-dots {
  display: flex;
  gap: 0.25rem;
}

.chev {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg);
  transition: transform var(--motion);
  flex-shrink: 0;
}

.collapse[open] > summary .chev {
  transform: rotate(-135deg);
}

.collapse[open] > summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.collapse-body {
  padding: 1.1rem 1.4rem 1.3rem;
}

/* ---------- field rows & lists ---------- */

.field-row {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--body);
}

.field-row:first-of-type {
  border-top: none;
}

.field-label {
  color: var(--text);
  font-weight: 600;
  min-width: 150px;
  flex-shrink: 0;
  font-size: 0.82rem;
}

.field-value {
  flex: 1;
}

.list-plain {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  color: var(--body);
}

.list-plain li {
  margin-bottom: 0.35rem;
}

/* ---------- data tables ---------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.data-table th {
  text-align: left;
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: var(--border);
  background: var(--muted);
}

.data-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--body);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.num-cell {
  font-variant-numeric: tabular-nums;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.cat-tag {
  font-size: 0.68rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ref-note {
  color: var(--dim);
  font-size: 0.78rem;
  margin-top: 0.2rem;
}

/* ---------- matching engine ---------- */

.empty-state {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 3rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.empty-state p {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.empty-state .dim-cell {
  font-weight: 400;
  max-width: 44ch;
  margin-bottom: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--muted);
  color: var(--text);
  white-space: nowrap;
}

.status-pill.match {
  background: var(--status-match-tint);
  border-color: var(--status-match-line);
  color: var(--status-match);
}

.status-pill.match::before {
  content: "\2713";
}

.status-pill.gap-minor {
  background: var(--status-gap-minor-tint);
  border-color: var(--status-gap-minor-line);
  color: var(--status-gap-minor);
}

.status-pill.gap-minor::before {
  content: "!";
}

.status-pill.gap-major {
  background: var(--status-gap-major-tint);
  border-color: var(--status-gap-major-line);
  color: var(--status-gap-major);
}

.status-pill.gap-major::before {
  content: "\2715";
}

.verdict-banner {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.verdict-banner.make {
  background: var(--status-match-tint);
  border-color: var(--status-match-line);
}

.verdict-banner.borderline {
  background: var(--status-gap-minor-tint);
  border-color: var(--status-gap-minor-line);
}

.verdict-banner.hard {
  background: var(--status-gap-major-tint);
  border-color: var(--status-gap-major-line);
}

.verdict-word {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.verdict-banner.make .verdict-word {
  color: var(--status-match);
}

.verdict-banner.make .verdict-word::before {
  content: "\2713  ";
}

.verdict-banner.borderline .verdict-word {
  color: var(--status-gap-minor);
}

.verdict-banner.hard .verdict-word {
  color: var(--status-gap-major);
}

.verdict-banner.hard .verdict-word::before,
.verdict-banner.borderline .verdict-word::before {
  content: "\2715  ";
}

.verdict-sub {
  color: var(--body);
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
  max-width: 50ch;
}

.confidence-block {
  text-align: right;
}

.confidence-num {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.confidence-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
}

.match-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.summary-stat {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  min-width: 128px;
}

.summary-stat .num {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.summary-stat .lbl {
  font-size: 0.68rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 0.15rem;
}

.gap-list {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
}

.gap-list h3 {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.gap-item {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.gap-item:first-of-type {
  border-top: none;
}

.gap-item-head {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.gap-item-body {
  color: var(--dim);
  font-size: 0.85rem;
  padding-left: 1.5rem;
}

/* ---------- three-state match: pills, verdict, scores ---------- */

.status-pill.maybe {
  background: var(--status-gap-minor-tint);
  border-color: var(--status-gap-minor-line);
  color: var(--status-gap-minor);
}
.status-pill.maybe::before {
  content: "~";
}
.status-pill.none {
  background: var(--status-gap-major-tint);
  border-color: var(--status-gap-major-line);
  color: var(--status-gap-major);
}
.status-pill.none::before {
  content: "\2715";
}

/* make-caveat: still a MAKE, styled green like make */
.verdict-banner.make-caveat {
  background: var(--status-match-tint);
  border-color: var(--status-match-line);
}
.verdict-banner.make-caveat .verdict-word {
  color: var(--status-match);
}
.verdict-banner.make-caveat .verdict-word::before {
  content: "\2713  ";
}

.verdict-main {
  flex: 1 1 20rem;
}

.verdict-scores {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.score-block {
  text-align: right;
  min-width: 8rem;
}
.score-num {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.score-block.ghost .score-num {
  color: var(--dim);
  font-size: 1.5rem;
}
.score-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-top: 0.3rem;
}
.score-counts {
  font-size: 0.72rem;
  color: var(--faint);
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- facility bar ---------- */

.facility-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.facility-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
}
.facility-select {
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
}
.facility-select:disabled {
  opacity: 1;
  cursor: default;
}
.facility-note {
  font-size: 0.78rem;
  color: var(--faint);
}

/* ---------- capability rollup ---------- */

.rollup-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.rollup-card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.7rem 0.85rem;
  flex: 0 1 10.5rem;
  max-width: 13rem;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--motion), transform var(--motion);
}
.rollup-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.rollup-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rollup-more {
  color: var(--faint);
  font-size: 1.1rem;
  line-height: 1;
}
.rollup-card:hover .rollup-more { color: var(--accent); }

/* group drill-down modal */
.gd-modal { max-width: 32rem; text-align: left; }
.gd-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  padding: 1.3rem 1.4rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.gd-count { font-size: 0.78rem; font-weight: 500; color: var(--dim); }
.gd-list { padding: 0.4rem 1.4rem 1.3rem; max-height: 60vh; overflow-y: auto; }
.gd-item { padding: 0.8rem 0; border-top: 1px solid var(--line); }
.gd-item:first-child { border-top: none; }
.gd-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.gd-label { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.gd-detail { font-size: 0.82rem; color: var(--body); margin-top: 0.35rem; }
.gd-body { font-size: 0.82rem; color: var(--dim); margin-top: 0.3rem; }
.gd-ref { font-size: 0.76rem; color: var(--faint); margin-top: 0.35rem; }
.rollup-counts {
  font-size: 0.72rem;
  color: var(--dim);
  margin-top: 0.4rem;
  font-variant-numeric: tabular-nums;
}
.mini-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--muted);
}
.mini-seg {
  display: block;
}
.mini-match {
  background: var(--status-match);
}
.mini-maybe {
  background: var(--status-gap-minor);
}
.mini-none {
  background: var(--status-gap-major);
}

/* ---------- gap badges + watch items ---------- */

.bridge-badge {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.bridge-badge.bridge {
  background: var(--status-gap-minor-tint);
  border: 1px solid var(--status-gap-minor-line);
  color: var(--status-gap-minor);
}
.bridge-badge.blocker {
  background: var(--status-gap-major-tint);
  border: 1px solid var(--status-gap-major-line);
  color: var(--status-gap-major);
}
.inferred-tag,
.caveat-tag {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.5rem;
}
.inferred-tag {
  background: var(--status-gap-minor-tint);
  border: 1px solid var(--status-gap-minor-line);
  color: var(--status-gap-minor);
}
.caveat-tag {
  background: var(--muted);
  border: 1px solid var(--line);
  color: var(--dim);
}

/* ---------- confidence drill-down ---------- */

.collapse-stack.single {
  grid-template-columns: 1fr;
}
.drill-line {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}
.drill-line:first-child {
  border-top: none;
}
.drill-k {
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.drill-v {
  color: var(--dim);
  font-size: 0.85rem;
}
.drill-list {
  margin: 0.2rem 0 0.4rem;
  padding-left: 13rem;
  color: var(--dim);
  font-size: 0.85rem;
}
.drill-list li {
  margin: 0.25rem 0;
}
.drill-list strong {
  color: var(--text);
  font-weight: 600;
}

/* visual drill-down: each number drawn as the cells that build it */
.drill {
  --contrib-track: var(--muted);
}
.drill-metric {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.drill-metric:first-child {
  border-top: none;
  padding-top: 0.2rem;
}
.drill-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.drill-metric-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.drill-metric-val {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.metric-match {
  color: var(--status-match);
}
.metric-read {
  color: var(--dim);
}
.contrib-bar {
  display: flex;
  gap: 3px;
  width: 100%;
}
.contrib-cell {
  flex: 1 1 0;
  min-width: 6px;
  height: 28px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--c) var(--fill, 0%), var(--contrib-track) var(--fill, 0%));
}
.contrib-match {
  --c: var(--status-match);
}
.contrib-maybe {
  --c: var(--status-gap-minor);
}
.contrib-none {
  --c: var(--status-gap-major);
  background: repeating-linear-gradient(135deg, var(--status-gap-major-tint), var(--status-gap-major-tint) 4px, transparent 4px, transparent 8px);
  border-color: var(--status-gap-major-line);
}
.conf-cell-high {
  --c: var(--conf-high);
}
.conf-cell-medium {
  --c: var(--conf-medium);
}
.conf-cell-low {
  --c: var(--conf-low);
}
.drill-caption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.5;
}
.drill-meet {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 1rem;
  padding: 0.8rem 0 0.2rem;
  border-top: 1px solid var(--line);
  margin-top: 0.2rem;
}

/* ---------- capability ingestion (add to catalogue) ---------- */

.cap-adder {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.cap-adder > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  border-radius: var(--radius-lg);
}
.cap-adder > summary::-webkit-details-marker {
  display: none;
}
.cap-adder > summary:hover {
  background: var(--muted);
}
.cap-adder-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  flex-shrink: 0;
}
.cap-adder-sub {
  font-size: 0.82rem;
  color: var(--dim);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cap-adder[open] > summary .chev {
  transform: rotate(-135deg);
}
.cap-adder[open] > summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.cap-adder-body {
  padding: 1.1rem 1.4rem 1.3rem;
}
.cap-type-row {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}
.cap-type {
  padding: 0.45rem 0.95rem;
  background: var(--card);
  border: none;
  border-right: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.cap-type:last-child {
  border-right: none;
}
.cap-type:hover {
  background: var(--muted);
  color: var(--text);
}
.cap-type.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.cap-lookup {
  display: flex;
  gap: 0.6rem;
  max-width: 34rem;
}
.cap-name-input {
  flex: 1;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 0.9rem;
}
.cap-name-input:focus {
  outline: none;
  border-color: var(--accent);
}
.cap-adder-hint {
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 0.5rem;
}
.cap-preview {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  background: var(--muted);
  max-width: 34rem;
}
.cap-prev-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.cap-prev-name {
  font-weight: 600;
  color: var(--text);
}
.cap-prev-row {
  display: flex;
  gap: 0.8rem;
  font-size: 0.84rem;
  padding: 0.15rem 0;
}
.cap-prev-k {
  color: var(--dim);
  width: 7rem;
  flex-shrink: 0;
}
.cap-prev-v {
  color: var(--body);
}
.cap-prev-note {
  font-size: 0.8rem;
  color: var(--dim);
  margin: 0.5rem 0 0;
}
.cap-preview .btn {
  margin-top: 0.75rem;
}
.added-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.25rem 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--conf-high-tint);
  border: 1px solid var(--conf-high-line);
  color: var(--conf-high);
  margin-left: 0.4rem;
  vertical-align: middle;
}
.added-remove {
  border: none;
  background: transparent;
  color: var(--conf-high);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.1rem 0 0.25rem;
}
.added-remove:hover {
  color: var(--status-gap-major);
}

.conf-score-note {
  font-size: 0.75rem;
  color: var(--faint);
  max-width: 26ch;
  margin: 0.3rem 0 0.8rem;
  margin-left: auto;
  text-align: right;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ---------- extract identity + tabs ---------- */

.extract-desc {
  color: var(--body);
  font-size: 0.9rem;
  margin: 0.6rem 0 0.3rem;
  max-width: 68ch;
}
.extract-meta {
  color: var(--dim);
  font-size: 0.82rem;
  margin: 0 0 0.5rem;
}
.extract-framing {
  color: var(--faint);
  font-size: 0.8rem;
  margin: 0 0 0.7rem;
  max-width: 68ch;
  padding-left: 0.7rem;
  border-left: 2px solid var(--line);
}

.tab-strip {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.1rem;
}
.tab-btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--motion), border-color var(--motion);
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-count {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  background: var(--muted);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}
.tab-btn.active .tab-count {
  background: var(--tint);
  color: var(--accent-deep);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
.panel-sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin: 1.2rem 0 0.5rem;
  font-weight: 600;
}
.tab-panel > .panel-sub:first-child {
  margin-top: 0;
}

.step-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
}
.step-list li {
  margin: 0.55rem 0;
  font-size: 0.88rem;
}
.step-name {
  font-weight: 600;
  margin-right: 0.4rem;
}

/* ---------- source provenance: button + drawing viewer ---------- */

.src-btn {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--tint);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--motion), color var(--motion);
}
.src-btn::before {
  content: "\25C9  ";
  font-size: 0.7em;
}
.src-btn:hover {
  background: var(--accent);
  color: #fff;
}
.src-btn.inferred {
  color: var(--status-gap-minor);
  background: var(--status-gap-minor-tint);
  border-color: var(--status-gap-minor-line);
}
.src-btn.inferred::before {
  content: "\25CB  ";
}
.src-btn.inferred:hover {
  background: var(--status-gap-minor);
  color: #fff;
}

.prov-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(10 14 30 / 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: prov-fade 120ms ease;
}
@keyframes prov-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.prov-modal {
  position: relative;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
}
/* Under the glass themes --card is translucent; give the modal a more solid
   surface than the page panels so its content stays readable. */
[data-theme="flora-glass"] .prov-modal { background: rgba(14, 12, 24, 0.9); }
[data-theme="op-glass"] .prov-modal { background: rgba(255, 255, 255, 0.88); }
.prov-close {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
}
.prov-close:hover {
  color: var(--text);
}
.prov-head {
  margin-bottom: 0.9rem;
  padding-right: 2rem;
}
.prov-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.prov-locator {
  font-size: 0.8rem;
  color: var(--dim);
  margin-top: 0.25rem;
}
.prov-stage {
  position: relative;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  line-height: 0;
}
.prov-stage img {
  width: 100%;
  height: auto;
  display: block;
}
.prov-stage.dimmed img {
  opacity: 0.4;
  filter: grayscale(0.4);
}
.prov-box {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgb(37 91 227 / 0.12);
  border-radius: 3px;
  box-shadow: 0 0 0 9999px rgb(10 14 30 / 0.28);
  animation: prov-pulse 1.4s ease-in-out infinite;
}
@keyframes prov-pulse {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: var(--tint); }
}
.prov-inferred-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--status-gap-minor);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  line-height: 1.3;
  text-align: center;
  box-shadow: var(--shadow);
}
.prov-foot {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--dim);
}

/* ========== CUI redaction (controlled sheets) ========== */
.drawing-frame {
  position: relative;
  display: block;
  line-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.drawing-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.cui-mark {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: var(--conf-low);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.18rem 0.4rem;
  line-height: 1.3;
}
.redaction-box {
  position: absolute;
  z-index: 2;
  background: #0b0d12;
  border: 1px solid #000;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.redaction-box span {
  color: rgb(255 255 255 / 0.55);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.prov-cui-note {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--conf-low);
  font-weight: 500;
}
.cui-line {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.78rem;
  color: var(--dim);
  margin: 0.5rem 0 0;
  line-height: 1.4;
}
.cui-tag {
  flex: none;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--conf-low);
  border-radius: 4px;
  padding: 0.1rem 0.34rem;
}
/* Full-width banner across the top of a CUI thumbnail card. Flush to the
   rounded top corners (the card clips with overflow:hidden). "CUI" centered,
   established red treatment, white text for WCAG contrast. */
.part-cui-banner {
  background: var(--conf-low);
  color: #fff;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.32rem 0.4rem;
}

/* ========== catalogue: unavailable flags ========== */
.avail-flag {
  font-weight: 600;
}
.cell-note.avail-note {
  color: var(--conf-low);
  font-weight: 500;
}
.avail-banner {
  border: 1px solid var(--conf-low-line);
  background: var(--conf-low-tint);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.1rem;
}
.avail-banner-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--conf-low);
}
.avail-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--conf-low);
}
.avail-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.avail-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.6rem;
  font-size: 0.8rem;
}
.avail-k {
  font-weight: 600;
  color: var(--text);
}
.avail-v {
  color: var(--body);
}
.avail-banner-foot {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--dim);
}

/* ========== matching: bid / no-bid handoff ========== */
.footer-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.bid-modal {
  max-width: 540px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.bid-head-k {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}
.bid-head-part {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-top: 0.15rem;
}
.bid-posture {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}
.bid-posture.go {
  border-left-color: var(--conf-high);
  background: var(--conf-high-tint);
}
.bid-posture.cond {
  border-left-color: var(--status-gap-minor);
  background: var(--status-gap-minor-tint);
}
.bid-posture.no {
  border-left-color: var(--conf-low);
  background: var(--conf-low-tint);
}
.bid-posture-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.bid-posture-line {
  font-size: 0.82rem;
  color: var(--body);
  margin-top: 0.2rem;
  line-height: 1.4;
}
.bid-nums {
  display: flex;
  gap: 0.6rem;
}
.bid-num {
  flex: 1;
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  text-align: center;
}
.bid-num.ghost {
  background: var(--muted);
}
.bid-num-v {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.bid-num-l {
  font-size: 0.68rem;
  color: var(--dim);
  margin-top: 0.1rem;
}
.bid-split-title,
.bid-bridge-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 0.4rem;
}
.bid-split-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.bid-split-row:last-child {
  border-bottom: none;
}
.bid-split-k {
  color: var(--body);
}
.bid-split-v {
  font-weight: 600;
  color: var(--text);
}
.bid-split-v.go {
  color: var(--conf-high);
}
.bid-split-v.cond {
  color: var(--status-gap-minor);
}
.bid-split-v.no {
  color: var(--conf-low);
}
.bid-bridge-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.bid-bridge-list li {
  font-size: 0.85rem;
  color: var(--text);
}
.bid-bridge-note {
  font-size: 0.76rem;
  color: var(--dim);
  margin-top: 0.15rem;
  line-height: 1.4;
}
.bid-foot {
  font-size: 0.74rem;
  color: var(--dim);
  line-height: 1.5;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}
.bid-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .extract-head {
    grid-template-columns: 1fr;
  }
  .collapse-stack {
    grid-template-columns: 1fr;
  }
  .drill-line {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
  .drill-list {
    padding-left: 1rem;
  }
  .verdict-scores {
    width: 100%;
    justify-content: flex-start;
  }
  .score-block {
    text-align: left;
  }
  .conf-score-note {
    text-align: left;
    margin-left: 0;
  }
  .extract-conf {
    align-items: flex-start;
    text-align: left;
  }
  .module-nav {
    order: 3;
    width: 100%;
  }
  .field-label {
    min-width: 110px;
  }
  .data-table {
    display: block;
    overflow-x: auto;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .capability-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline-entry {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}

/* ================================================================
   THEMES. The civic light skin above is the default. Each theme swaps
   the token set (data-theme lives on <html>) plus a few signature
   component rules. Switcher: bottom-right, persisted in localStorage.
   ================================================================ */

/* display + numeral font hooks (default: inherit the body face) */
.view-title,
.wordmark,
.landing-wordmark,
.section-heading,
.module-name,
.collapse-title,
.capability-title,
.verdict-word {
  font-family: var(--font-display);
}

.stat-num,
.panel-stat,
.summary-stat .num,
.confidence-num,
.score-num,
.conf-score,
.conf-dot {
  font-family: var(--font-mono);
}

/* ---------- theme switcher control ---------- */

.theme-switcher {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 0.3rem 0.5rem 0.3rem 0.9rem;
}

.theme-switcher label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
}

.theme-switcher select {
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
}

.theme-switcher select option {
  color: #1c1c1c;
  background: #ffffff;
}

/* ---------- civic dark ---------- */

[data-theme="dark"] {
  --bg: #0d1330;
  --card: #171f3f;
  --muted: #1c2549;
  --wash: #182147;
  --line: #283463;
  --hairline: #33406e;
  --text: #e8edf8;
  --body: #c6cfe6;
  --dim: #93a0c2;
  --faint: #5d6a92;
  --accent: #7da2ff;
  --accent-dim: #93b2ff;
  --accent-deep: #b7c9ff;
  --tint: rgba(125, 162, 255, 0.16);
  --accent-ink: #0d1330;
  --conf-high: #8fdcab;    --conf-high-tint: rgba(66, 150, 94, 0.2);    --conf-high-line: rgba(110, 190, 138, 0.45);
  --conf-medium: #f1c574;  --conf-medium-tint: rgba(196, 148, 44, 0.16); --conf-medium-line: rgba(220, 175, 84, 0.45);
  --conf-low: #ff9c9c;     --conf-low-tint: rgba(200, 60, 60, 0.16);    --conf-low-line: rgba(230, 110, 110, 0.45);
  --status-gap-minor: #f0a468;
  --status-gap-minor-tint: rgba(203, 96, 21, 0.16);
  --status-gap-minor-line: rgba(222, 140, 70, 0.45);
  --plate: #eef1f7;
  --shadow: 0 4px 14px rgb(0 0 0 / 0.35);
  --shadow-hover: 0 10px 24px rgb(0 0 0 / 0.5);
}

/* ---------- flora: cyberpunk HUD, black glass, UV lilac ---------- */

[data-theme="flora"],
[data-theme="flora-glass"] {
  --bg: #05050a;
  --card: #0a0a10;
  --muted: #11111c;
  --wash: #0d0d17;
  --line: #2a2740;
  --hairline: #232035;
  --text: #ffffff;
  --body: #d8d4e6;
  --dim: #9b96ac;
  --faint: #5d5975;
  --accent: #b39ddb;
  --accent-dim: #c5b3e6;
  --accent-deep: #d8ccf0;
  --tint: rgba(179, 157, 219, 0.14);
  --accent-ink: #0a0a10;
  --conf-high: #7de8b0;    --conf-high-tint: rgba(60, 200, 130, 0.12);   --conf-high-line: rgba(90, 220, 155, 0.35);
  --conf-medium: #f0d080;  --conf-medium-tint: rgba(220, 180, 80, 0.12); --conf-medium-line: rgba(230, 195, 110, 0.35);
  --conf-low: #ff8db0;     --conf-low-tint: rgba(230, 90, 130, 0.12);    --conf-low-line: rgba(250, 120, 155, 0.35);
  --status-gap-minor: #f0b080;
  --status-gap-minor-tint: rgba(230, 140, 70, 0.12);
  --status-gap-minor-line: rgba(240, 165, 105, 0.35);
  --plate: #efedf5;
  --radius: 2px;
  --radius-lg: 4px;
  --shadow: 0 18px 40px rgb(0 0 0 / 0.6), inset 0 0 40px rgb(179 157 219 / 0.06);
  --shadow-hover: 0 18px 48px rgb(0 0 0 / 0.7), inset 0 0 46px rgb(179 157 219 / 0.14);
  --font: "Chakra Petch", system-ui, sans-serif;
  --font-display: "Chakra Petch", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

[data-theme="flora"] body {
  background: radial-gradient(1100px 700px at 75% -10%, #16102c 0%, #05050a 60%) fixed, #05050a;
}

/* UV rail on the left edge of interactive cards, flora's hover signature */
[data-theme="flora"] .module-card.active:hover,
[data-theme="flora"] .part-card:hover,
[data-theme="flora-glass"] .module-card.active:hover,
[data-theme="flora-glass"] .part-card:hover {
  box-shadow: var(--shadow-hover), inset 3px 0 0 var(--accent);
}

[data-theme="flora"] .wordmark,
[data-theme="flora"] .landing-wordmark,
[data-theme="flora-glass"] .wordmark,
[data-theme="flora-glass"] .landing-wordmark {
  text-shadow: 0 0 24px rgb(179 157 219 / 0.5);
}

/* ---------- flora-glass: flora + liquid glass ---------- */

[data-theme="flora-glass"] {
  --card: rgba(18, 15, 32, 0.55);
  --muted: rgba(34, 28, 58, 0.45);
  --wash: rgba(24, 20, 44, 0.5);
  --line: rgba(179, 157, 219, 0.22);
  --hairline: rgba(179, 157, 219, 0.13);
  --tint: rgba(179, 157, 219, 0.2);
  --radius: 10px;
  --radius-lg: 18px;
  --shadow: 0 18px 40px rgb(0 0 0 / 0.5), inset 0 1px 0 rgb(255 255 255 / 0.08);
  --shadow-hover: 0 22px 52px rgb(0 0 0 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.12);
}

[data-theme="flora-glass"] body {
  background:
    radial-gradient(700px 500px at 12% 8%, rgb(109 90 168 / 0.55), transparent 65%),
    radial-gradient(800px 600px at 88% 30%, rgb(58 90 200 / 0.35), transparent 65%),
    radial-gradient(700px 700px at 55% 95%, rgb(170 70 150 / 0.3), transparent 65%),
    #05050a;
  background-attachment: fixed;
}

/* ---------- op: pocket-instrument hardware panel ---------- */

[data-theme="op"],
[data-theme="op-glass"] {
  --bg: #d7d5d0;
  --card: #e5e3de;
  --muted: #dbd9d3;
  --wash: #deded8;
  --line: #c6c4be;
  --hairline: #c6c4be;
  --text: #26272a;
  --body: #3a3b3d;
  --dim: #6e6e69; /* op-muted darkened for AA on the body plate */
  --faint: #98978f;
  --accent: #ff4d00;
  --accent-dim: #e64500;
  --accent-deep: #c73c00;
  --tint: #ffddcc;
  --accent-ink: #ffffff;
  --conf-high: #0b7a5c;    --conf-high-tint: #d9efe7;   --conf-high-line: #b0dccc;
  --conf-medium: #8a6116;  --conf-medium-tint: #efe9d2; --conf-medium-line: #d8cfae;
  --conf-low: #c22318;     --conf-low-tint: #f7ddda;    --conf-low-line: #eab8b2;
  --status-gap-minor: #b45309;
  --status-gap-minor-tint: #f6e5d2;
  --status-gap-minor-line: #e3c8a4;
  --plate: #f4f3f0;
  --radius: 7px;
  --radius-lg: 14px;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.8) inset, 0 3px 8px rgb(0 0 0 / 0.08);
  --shadow-hover: 0 1px 0 rgb(255 255 255 / 0.8) inset, 0 6px 14px rgb(0 0 0 / 0.14);
  --motion: 80ms linear;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* buttons are pressable keys: hard bottom edge, press = key drops */
[data-theme="op"] .btn,
[data-theme="op-glass"] .btn {
  background: #f4f3f0;
  border-color: var(--line);
  box-shadow: 0 2px 0 #b9b7b1, 0 3px 5px rgb(0 0 0 / 0.15);
}

[data-theme="op"] .btn:active,
[data-theme="op-glass"] .btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #b9b7b1, 0 1px 2px rgb(0 0 0 / 0.1);
}

[data-theme="op"] .btn.primary,
[data-theme="op-glass"] .btn.primary {
  background: var(--accent);
  box-shadow: 0 2px 0 #b53700, 0 3px 5px rgb(0 0 0 / 0.2);
}

[data-theme="op"] .btn.ghost,
[data-theme="op-glass"] .btn.ghost {
  background: transparent;
  box-shadow: none;
  border-color: transparent;
}

/* stat readouts become the positive LCD */
[data-theme="op"] .summary-stat,
[data-theme="op"] .dashboard-panel {
  background: #c9cbc0;
  border-color: #b6b8ab;
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 0.13);
}

[data-theme="op"] .summary-stat .num,
[data-theme="op"] .panel-stat {
  color: #23251f;
}

/* ---------- op-glass: op + liquid glass ---------- */

[data-theme="op-glass"] {
  --bg: #e8e6e1;
  --card: rgba(255, 255, 255, 0.52);
  --muted: rgba(255, 255, 255, 0.4);
  --wash: rgba(255, 255, 255, 0.35);
  --line: rgba(38, 39, 42, 0.13);
  --hairline: rgba(38, 39, 42, 0.09);
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px rgb(30 30 30 / 0.1), inset 0 1px 0 rgb(255 255 255 / 0.7);
  --shadow-hover: 0 14px 34px rgb(30 30 30 / 0.16), inset 0 1px 0 rgb(255 255 255 / 0.8);
}

[data-theme="op-glass"] body {
  background:
    radial-gradient(700px 500px at 10% 10%, rgb(255 77 0 / 0.16), transparent 60%),
    radial-gradient(800px 600px at 90% 25%, rgb(75 98 216 / 0.14), transparent 60%),
    radial-gradient(700px 700px at 50% 100%, rgb(15 181 137 / 0.14), transparent 60%),
    #e8e6e1;
  background-attachment: fixed;
}

/* ---------- shared glass surface rule ---------- */

[data-theme="flora-glass"] :is(.shell-header, .shell-footer, .collapse, .module-card, .part-card, .summary-stat, .verdict-banner, .gap-list, .extract-head, .analyzing-panel, .empty-state, .capability-card, .landing-module-card, .dashboard-panel, .theme-switcher, .login-form input),
[data-theme="op-glass"] :is(.shell-header, .shell-footer, .collapse, .module-card, .part-card, .summary-stat, .verdict-banner, .gap-list, .extract-head, .analyzing-panel, .empty-state, .capability-card, .landing-module-card, .dashboard-panel, .theme-switcher, .login-form input) {
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
}

/* landing bands go translucent under glass so the blobs read through */
[data-theme="flora-glass"] :is(.landing-stats, .landing-section.alt),
[data-theme="op-glass"] :is(.landing-stats, .landing-section.alt) {
  background: var(--wash);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
}

/* ================= ADMIN CONSOLE ================= */

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 0.3rem;
}

/* hub stat cards */
.admin-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.2rem 0 1.6rem;
}
.admin-stat {
  --tone: var(--accent);
  background: var(--card);
  border: var(--border);
  border-left: 3px solid var(--tone);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.admin-stat-top {
  display: flex;
  justify-content: flex-end;
}
.admin-stat-tag {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tone);
}
.admin-stat-num {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}
.admin-stat-label {
  font-size: 0.8rem;
  color: var(--dim);
  margin-top: 0.1rem;
}
.c-primary { --tone: var(--accent); }
.c-blue { --tone: #2f6fb0; }
.c-green { --tone: var(--conf-high); }
.c-amber { --tone: var(--conf-medium); }
.c-violet { --tone: #6b4bb0; }

/* hub feature cards */
.admin-feat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.admin-feat {
  --tone: var(--accent);
  text-align: left;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color var(--motion), transform var(--motion);
}
.admin-feat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--tone);
  transform: scaleY(0.3);
  transform-origin: top;
  transition: transform var(--motion);
}
.admin-feat:hover {
  border-color: var(--tone);
  transform: translateY(-2px);
}
.admin-feat:hover::before { transform: scaleY(1); }
.admin-feat-code {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--tone);
}
.admin-feat-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.3rem 0 0.2rem;
}
.admin-feat-desc {
  font-size: 0.85rem;
  color: var(--dim);
  margin-bottom: 0.7rem;
}
.admin-feat-stats {
  display: flex;
  gap: 1.2rem;
  font-size: 0.76rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}
.admin-feat-cta {
  margin-top: 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tone);
}

/* tool tabs + crumbs */
.admin-crumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--faint);
  margin-bottom: 0.8rem;
}
.crumb-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
}
.crumb-sep { color: var(--faint); }
.admin-tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.3rem;
}
.atab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  margin-bottom: -1px;
}
.atab:hover { color: var(--text); }
.atab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.admin-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.roster-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}
.roster-tab {
  background: var(--card);
  border: none;
  border-right: 1px solid var(--line);
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
}
.roster-tab:last-child { border-right: none; }
.roster-tab.active { background: var(--accent); color: var(--accent-ink); }
.mono-cell {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--dim);
}
.row-action { text-align: right; }

/* ---- editor ---- */
.ec-identity {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.2rem;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.ec-avatar {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.ec-avatar.sm { width: 2rem; height: 2rem; font-size: 0.8rem; }
.ec-identity-name { font-weight: 600; color: var(--text); }
.ec-identity-sub { font-size: 0.82rem; color: var(--dim); }
.ec-identity .btn { margin-left: auto; }

.ec-section {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}
.ec-section-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.ec-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.ec-section-sub { font-size: 0.8rem; color: var(--dim); }
.ec-section-body { padding: 1.1rem 1.2rem; }

.ec-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.ec-field { display: flex; flex-direction: column; gap: 0.3rem; }
.ec-field.span2 { grid-column: 1 / -1; }
.ec-field > span {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--dim);
}
.ec-field input,
.ec-field textarea,
.ec-field select,
.ec-pick {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}
.ec-field input:focus,
.ec-field textarea:focus,
.ec-field select:focus,
.ec-pick:focus { outline: none; border-color: var(--accent); }
.ec-field input:disabled { background: var(--muted); color: var(--faint); }
.ec-pick { width: 100%; margin-bottom: 0.6rem; }

.ec-toggle-card,
.ec-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.ec-toggle-card.on, .ec-toggle-row.on { border-color: var(--accent); }
.ec-toggle-text { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; }
.ec-toggle-title { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.ec-toggle-sub { font-size: 0.76rem; color: var(--dim); }
.ec-badge {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.ec-badge.ok { background: var(--conf-high-tint); color: var(--conf-high); border: 1px solid var(--conf-high-line); }
.ec-badge.crit { background: var(--conf-low-tint); color: var(--conf-low); border: 1px solid var(--conf-low-line); }
.ec-switch {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  flex-shrink: 0;
  transition: background var(--motion);
}
.ec-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--motion);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
}
.ec-switch.on { background: var(--accent); }
.ec-switch.on::after { transform: translateX(16px); }

.ec-radio-grid { display: grid; gap: 0.7rem; }
.ec-radio-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.ec-radio-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.ec-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
}
.ec-radio.on { border-color: var(--accent); background: var(--accent-wash, var(--muted)); }
.ec-radio-dot {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.ec-radio.on .ec-radio-dot { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 40%, transparent 45%); }
.ec-radio-text { display: flex; flex-direction: column; gap: 0.1rem; }
.ec-radio-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.ec-radio-sub { font-size: 0.74rem; color: var(--dim); }

.ec-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ec-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  padding: 0.25rem 0.3rem 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-tint, var(--muted));
  border: 1px solid var(--line);
  color: var(--text);
}
.ec-chip-x {
  border: none;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 0.15rem;
}
.ec-chip-x:hover { color: var(--conf-low); }
.ec-empty { font-size: 0.8rem; color: var(--faint); font-style: italic; }

.ec-custom { display: flex; gap: 0.5rem; margin: 0.6rem 0; }
.ec-custom-input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
}
.ec-custom-input:focus { outline: none; border-color: var(--accent); }

.ec-sub { margin-top: 1rem; }
.ec-sub-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.ec-sub-label span { font-weight: 400; color: var(--dim); margin-left: 0.3rem; }

.ec-env-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.ec-env {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--dim);
  text-align: left;
}
.ec-env-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
}
.ec-env.on { border-color: var(--conf-high-line); color: var(--text); background: var(--conf-high-tint); }
.ec-env.on .ec-env-dot { background: var(--conf-high); }

.ec-footer {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.9rem 1.2rem;
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  backdrop-filter: blur(6px);
}
.ec-summary-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.ec-summary-stats > div { display: flex; flex-direction: column; }
.ec-sum-k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); }
.ec-sum-v { font-size: 0.9rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ec-sum-v.ok { color: var(--conf-high); }
.ec-sum-v.crit { color: var(--conf-low); }
.ec-footer-actions { display: flex; gap: 0.6rem; align-items: center; }
.btn.danger { color: var(--conf-low); }
.btn.danger:hover { border-color: var(--conf-low); }

/* ---- hierarchy ---- */
.hint-line { font-size: 0.82rem; color: var(--dim); margin-bottom: 0.8rem; }
.hier-toolbar { margin-bottom: 0.8rem; }
.subtabs { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.subtab {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
}
.subtab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.tree-panel {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid var(--line);
}
.tree-row:first-child { border-top: none; }
.tree-chev {
  width: 14px; height: 14px;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.tree-chev::before {
  content: '';
  position: absolute;
  top: 3px; left: 4px;
  width: 6px; height: 6px;
  border-right: 2px solid var(--dim);
  border-bottom: 2px solid var(--dim);
  transform: rotate(-45deg);
  transition: transform var(--motion);
}
.tree-chev.open::before { transform: rotate(45deg); }
.tree-chev.empty { cursor: default; }
.tree-count { font-size: 0.74rem; color: var(--accent); }
.tree-admins { font-size: 0.74rem; color: var(--conf-medium); }
.tree-actions { margin-left: auto; display: flex; gap: 0.2rem; opacity: 0; transition: opacity var(--motion); }
.tree-row:hover .tree-actions { opacity: 1; }
.tree-ico {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--dim);
  font-size: 0.95rem;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.tree-ico:hover { background: var(--muted); color: var(--text); }
.attr-chip {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  border: 1px solid;
}
.attr-chip.kind-org { color: var(--dim); border-color: var(--line); background: var(--muted); }
.attr-chip.kind-region { color: #2f6fb0; border-color: #a9cbe8; background: #eaf3fb; }
.attr-chip.kind-site { color: var(--conf-high); border-color: var(--conf-high-line); background: var(--conf-high-tint); }
.attr-chip.kind-warehouse { color: #6b4bb0; border-color: #cebfe8; background: #f1ecfa; }
.attr-chip.kind-shift { color: var(--conf-medium); border-color: var(--conf-medium-line); background: var(--conf-medium-tint); }
.attr-chip.kind-program { color: var(--accent); border-color: #b9c8f2; background: #eaeffc; }

.deleg-card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.deleg-head { display: flex; align-items: center; gap: 0.8rem; }
.deleg-name { font-weight: 600; color: var(--text); }
.deleg-role { font-size: 0.8rem; color: var(--dim); }
.deleg-head .btn { margin-left: auto; }
.deleg-head .attr-chip { margin-left: 0.4rem; }
.deleg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1rem; }
.deleg-col-h {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.deleg-col-h::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.deleg-col-h.ok { color: var(--conf-high); }
.deleg-col-h.ok::before { background: var(--conf-high); }
.deleg-col-h.crit { color: var(--conf-low); }
.deleg-col-h.crit::before { background: var(--conf-low); }
.deleg-list { list-style: none; padding: 0; margin: 0; font-size: 0.82rem; color: var(--body); }
.deleg-list li { padding: 0.2rem 0 0.2rem 1.3rem; position: relative; }
.deleg-list.ok li::before { content: '\2713'; position: absolute; left: 0; color: var(--conf-high); }
.deleg-list.crit li::before { content: '\2715'; position: absolute; left: 0; color: var(--conf-low); }

.conflict-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  background: var(--card);
  border: var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.8rem 1rem;
  margin-bottom: 0.7rem;
}
.conflict-main { display: flex; align-items: center; gap: 0.6rem; }
.conflict-name { font-weight: 600; color: var(--text); }
.conflict-desc { font-size: 0.82rem; color: var(--dim); flex: 1; min-width: 12rem; }
.conflict-row .tree-ico { margin-left: auto; }
.sev-badge {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid;
}
.sev-badge.critical { color: var(--conf-low); background: var(--conf-low-tint); border-color: var(--conf-low-line); }
.sev-badge.high { color: var(--conf-medium); background: var(--conf-medium-tint); border-color: var(--conf-medium-line); }
.sev-badge.medium { color: #2f6fb0; background: #eaf3fb; border-color: #a9cbe8; }

.conflict-example {
  background: var(--conf-medium-tint);
  border: 1px solid var(--conf-medium-line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin-top: 1rem;
}
.ce-title { font-weight: 700; color: var(--conf-medium); margin-bottom: 0.6rem; }
.ce-scenario { font-size: 0.85rem; color: var(--body); margin-bottom: 0.6rem; }
.ce-list { list-style: none; padding: 0; margin: 0 0 0.7rem; }
.ce-list li { padding: 0.25rem 0 0.25rem 1.4rem; position: relative; font-size: 0.85rem; font-weight: 600; color: var(--text); }
.ce-list li span { display: block; font-weight: 400; font-size: 0.8rem; color: var(--dim); }
.ce-list li.ok::before { content: '\2713'; position: absolute; left: 0; color: var(--conf-high); }
.ce-list li.crit::before { content: '\2715'; position: absolute; left: 0; color: var(--conf-low); }
.ce-res { font-size: 0.85rem; color: var(--body); line-height: 1.6; }

/* ---- module assignment wizard ---- */
.wiz-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dim);
  margin: 1.2rem 0 0.6rem;
}
.wiz-module-list { display: flex; flex-direction: column; gap: 0.6rem; }
.wiz-module {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--card);
  border: var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  text-align: left;
}
.wiz-module:hover { border-color: var(--accent); }
.wiz-code {
  width: 2.6rem; height: 2.6rem;
  border-radius: 8px;
  background: var(--muted);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.wiz-mtext { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.wiz-mname { font-weight: 600; color: var(--text); }
.wiz-mdesc { font-size: 0.8rem; color: var(--dim); }
.wiz-arrow { color: var(--faint); }
.wiz-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.wiz-method {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
}
.wiz-method.on { border-color: var(--accent); color: var(--accent); background: var(--muted); }
.wiz-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.wiz-target {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.wiz-target.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.wiz-stack { display: flex; flex-direction: column; gap: 0.5rem; }
.wiz-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  width: 100%;
  justify-content: space-between;
}
.wiz-row.on { border-color: var(--accent); }
.wiz-row-text { display: flex; flex-direction: column; }
.wiz-row-meta { font-size: 0.76rem; color: var(--dim); }
.wiz-ava {
  width: 1.9rem; height: 1.9rem;
  border-radius: 50%;
  background: var(--muted);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dim);
  flex-shrink: 0;
}
.wiz-ava.sm { width: 1.4rem; height: 1.4rem; font-size: 0.6rem; }
.wiz-search {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 0.7rem;
}
.wiz-search:focus { outline: none; border-color: var(--accent); }
.wiz-selected { margin-top: 1rem; }
.wiz-sel-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--dim);
  margin-bottom: 0.4rem;
}
.wiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.wiz-footer-right { display: flex; gap: 0.6rem; }

/* ---- toasts ---- */
.toast-host {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.toast {
  background: var(--text);
  color: var(--card);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  min-width: 15rem;
  max-width: 24rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  animation: toast-in var(--motion) ease-out;
}
.toast.out { opacity: 0; transition: opacity 0.3s; }
.toast-title { font-weight: 600; font-size: 0.86rem; }
.toast-desc { font-size: 0.78rem; opacity: 0.8; margin-top: 0.1rem; }
@keyframes toast-in {
  from { transform: translateY(0.5rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 760px) {
  .admin-stat-row { grid-template-columns: repeat(2, 1fr); }
  .admin-feat-grid { grid-template-columns: 1fr; }
  .ec-grid2, .ec-radio-grid.cols-3, .ec-radio-grid.cols-2, .ec-env-grid, .wiz-methods, .wiz-roles, .deleg-cols { grid-template-columns: 1fr; }
}

/* ================= TDP access level (view gating) ================= */

.viewas {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--dim);
}
.viewas > span {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.viewas select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--text);
  font-size: 0.76rem;
  font-family: inherit;
}
.viewas select:focus { outline: none; border-color: var(--accent); }

.drawing-restricted {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  min-height: 150px;
  text-align: center;
  color: var(--dim);
  background: repeating-linear-gradient(135deg, var(--plate), var(--plate) 10px, transparent 10px, transparent 20px);
  border-radius: var(--radius);
}
.drawing-restricted.thumb { height: 100%; }
.drawing-restricted .dr-lock { font-size: 1.4rem; opacity: 0.7; }
.drawing-restricted .dr-main { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.drawing-restricted .dr-sub { font-size: 0.72rem; color: var(--faint); }

.tdp-restrict-note {
  background: var(--conf-medium-tint);
  border: 1px solid var(--conf-medium-line);
  color: var(--body);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  margin: 0 0 1rem;
}

.src-btn.locked {
  color: var(--faint);
  border-color: var(--line);
  cursor: pointer;
}
.src-btn.locked:hover { color: var(--dim); }

.restricted-modal { max-width: 26rem; text-align: center; }
.restricted-body { padding: 1.6rem 1.4rem 1.4rem; }
.restricted-body .dr-lock { font-size: 2rem; display: block; margin-bottom: 0.6rem; opacity: 0.7; }
.restricted-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 0.6rem; }
.restricted-body p { font-size: 0.86rem; color: var(--body); line-height: 1.6; margin: 0 0 0.5rem; }

/* ================= WORK INSTRUCTIONS (traveler) ================= */

.instr-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.instr-intro {
  color: var(--dim);
  font-size: 0.88rem;
  max-width: 70ch;
  margin: 0.4rem 0 1.2rem;
}
.instr-resources {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.3rem;
}
.instr-res-col {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.9rem 1.1rem;
}
.instr-res-h {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 0.6rem;
}
.data-table.traveler .op-num {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.op-flag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.3rem;
  white-space: nowrap;
}
.op-flag.bridge { background: var(--status-gap-minor-tint); border: 1px solid var(--status-gap-minor-line); color: var(--status-gap-minor); }
.op-flag.blocker { background: var(--status-gap-major-tint); border: 1px solid var(--status-gap-major-line); color: var(--status-gap-major); }
.op-flag.watch { background: var(--muted); border: 1px solid var(--line); color: var(--dim); }

@media print {
  .shell-header, .tab-bar, .pane-toggle, .shell-footer, .theme-switcher, .pai-root, .footer-row .btn, #print-traveler {
    display: none !important;
  }
  .instr-head .btn { display: none !important; }
  body { background: #fff; }
}

/* ================= reality overrides (model memory management) ================= */

.adjust-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--dim);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 0.3rem;
}
.adjust-btn:hover { border-color: var(--accent); color: var(--accent); }
.cell-note.reality-note { color: var(--conf-medium); font-weight: 500; }

.ov-modal { max-width: 27rem; }
.ov-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  padding: 1.3rem 1.4rem 0.2rem;
}
.ov-entry { font-size: 1.05rem; font-weight: 700; color: var(--text); padding: 0 1.4rem; }
.ov-note-lbl { font-size: 0.82rem; color: var(--dim); padding: 0 1.4rem; margin: 0.8rem 0 0.5rem; }
.ov-opts { display: flex; flex-direction: column; gap: 0.5rem; padding: 0 1.4rem; }
.ov-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.ov-opt.on { border-color: var(--accent); background: var(--muted); }
.ov-opt input { margin-top: 0.2rem; }
.ov-opt-text { display: flex; flex-direction: column; gap: 0.1rem; }
.ov-opt-title { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.ov-opt-sub { font-size: 0.76rem; color: var(--dim); }
.ov-note-field { display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem 1.4rem 0; }
.ov-note-field > span { font-size: 0.74rem; font-weight: 600; color: var(--dim); }
.ov-note-field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}
.ov-note-field textarea:focus { outline: none; border-color: var(--accent); }
.ov-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 1.1rem 1.4rem 1.4rem;
}

/* ================= WORK INSTRUCTIONS: build manual ================= */

.manual { max-width: 60rem; }
.manual-cover {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1rem;
}
.mf-eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--faint); }
.mf-title { font-size: 1.6rem; margin: 0.2rem 0 0.1rem; }
.mf-sub { color: var(--dim); font-size: 0.85rem; margin: 0 0 1rem; }
.mf-facts { display: flex; gap: 2rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--line); margin-bottom: 1rem; }
.mf-fact-num { font-size: 1.3rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.mf-fact-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); }

.manual-alert {
  background: var(--conf-low-tint);
  border: 1px solid var(--conf-low-line);
  color: var(--conf-low);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.manual-before { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.mb-col { background: var(--card); border: var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 0.9rem 1rem; }
.mb-h { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--dim); margin-bottom: 0.5rem; }

.step-list { display: flex; flex-direction: column; }
.step { display: flex; gap: 1rem; position: relative; padding-bottom: 1.3rem; }
.step-rail { width: 3.2rem; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.step:not(:last-child) .step-rail::before {
  content: '';
  position: absolute;
  top: 3rem;
  bottom: -0.3rem;
  left: 1.6rem;
  width: 2px;
  background: var(--line);
}
.step-num {
  width: 2.4rem; height: 2.4rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.78rem;
  display: grid;
  place-items: center;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}
.step-fig {
  width: 3rem; height: 3rem;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  display: grid;
  place-items: center;
}
.op-fig-svg { width: 30px; height: 30px; }
.step-main {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}
.step-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.step-title { font-size: 1rem; font-weight: 600; margin: 0; }
.step-wc { font-size: 0.74rem; font-weight: 600; color: var(--accent); background: var(--muted); border: 1px solid var(--line); padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.step-detail { font-size: 0.88rem; color: var(--body); margin: 0.5rem 0 0.8rem; }
.step-grid { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.sb-h { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--faint); margin-bottom: 0.2rem; }
.sb-b { font-size: 0.8rem; color: var(--dim); }
.step-caution { margin-top: 0.8rem; font-size: 0.82rem; border-radius: 8px; padding: 0.5rem 0.75rem; }
.step-caution.blocker { background: var(--conf-low-tint); border: 1px solid var(--conf-low-line); color: var(--conf-low); }
.step-caution.bridge { background: var(--status-gap-minor-tint); border: 1px solid var(--status-gap-minor-line); color: var(--status-gap-minor); }
.step-caution.watch { background: var(--muted); border: 1px solid var(--line); color: var(--dim); }
.step-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.8rem; }
.step-derived { font-size: 0.74rem; color: var(--faint); }
.step.flag-blocker .step-num { background: var(--conf-low); }
.step.flag-blocker .step-fig { color: var(--conf-low); border-color: var(--conf-low-line); }

@media (max-width: 760px) {
  .step-grid { grid-template-columns: 1fr; }
  .manual-before { grid-template-columns: 1fr; }
}
@media print {
  .manual-cover .btn, .manual .footer-row .btn { display: none !important; }
}

/* ---------- bid desk: send -> award workflow (adds to the block above) ---------- */
.bid-head { padding-right: 2rem; }
.bid-head-k { display: flex; align-items: center; gap: 0.5rem; }
.bid-status {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  letter-spacing: 0.04em;
}
.bid-status.draft { background: var(--muted); }
.bid-status.sent { background: var(--tint); color: var(--accent-deep); border-color: transparent; }
.bid-status.go { background: var(--conf-high-tint); color: var(--conf-high); border-color: var(--conf-high-line); }
.bid-status.cond { background: var(--status-gap-minor-tint); color: var(--status-gap-minor); border-color: transparent; }
.bid-status.no { background: var(--conf-low-tint); color: var(--conf-low); border-color: var(--conf-low-line); }

.bid-engine {
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  background: var(--muted);
}
.bid-engine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.bid-engine-head .bid-split-title { margin-bottom: 0; }
.bid-engine-reason {
  font-size: 0.82rem;
  color: var(--body);
  line-height: 1.4;
  padding: 0.2rem 0;
}
.bid-engine-reason + .bid-engine-reason { border-top: 1px solid var(--line); }
.bid-engine-days {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.45rem;
}
.bid-engine-day {
  flex: 1;
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
  color: var(--dim);
  text-align: center;
}
.bid-engine-day strong { display: block; font-size: 1.2rem; color: var(--text); }
.bid-engine-day.ghost { background: var(--panel); }

.bid-sol {
  padding: 0.55rem 0.75rem;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}
.bid-sol-main { display: flex; align-items: baseline; gap: 0.5rem; }
.bid-sol-k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 700; }
.bid-sol-v { font-weight: 700; color: var(--text); }
.bid-sol-meta { font-size: 0.78rem; color: var(--dim); margin-top: 0.2rem; }

.bid-work, .bid-sent, .bid-outcome {
  padding: 0.85rem;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}
.bid-work-title, .bid-sent-head, .bid-trail-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 0.5rem;
}
.bid-work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.bid-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.72rem; color: var(--dim); }
.bid-field.full { grid-column: 1 / -1; margin-top: 0.6rem; }
.bid-field input, .bid-field textarea {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.5rem;
  border: var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
}
.bid-field textarea { resize: vertical; }
.bid-work-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--dim);
}
.bid-work-total strong { font-size: 1.15rem; color: var(--text); }
.bid-work-note { font-size: 0.74rem; color: var(--dim); margin-top: 0.5rem; line-height: 1.4; }
.bid-caution { margin-top: 0.6rem; font-size: 0.76rem; color: var(--conf-low); font-weight: 600; }

.bid-terms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.35rem 1rem; margin: 0.5rem 0; }
.bid-term { display: flex; justify-content: space-between; font-size: 0.84rem; border-bottom: 1px solid var(--line); padding-bottom: 0.2rem; }
.bid-term-k { color: var(--dim); }
.bid-term-v { font-weight: 600; color: var(--text); }

.bid-award { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.bid-award-q { font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 0.5rem; }

.bid-outcome.go { background: var(--conf-high-tint); border-color: var(--conf-high-line); }
.bid-outcome.no { background: var(--conf-low-tint); border-color: var(--conf-low-line); }
.bid-outcome-head { font-weight: 700; font-size: 1rem; color: var(--text); }
.bid-outcome.go .bid-outcome-head { color: var(--conf-high); }
.bid-outcome.no .bid-outcome-head { color: var(--conf-low); }
.bid-outcome-line { font-size: 0.84rem; color: var(--body); margin-top: 0.25rem; line-height: 1.4; }

.bid-trail { font-size: 0.8rem; }
.bid-trail-row { display: flex; justify-content: space-between; padding: 0.2rem 0; border-bottom: 1px dashed var(--line); }
.bid-trail-row:last-child { border-bottom: none; }
.bid-trail-k { color: var(--body); }
.bid-trail-t { color: var(--faint); font-variant-numeric: tabular-nums; }

.avail-note { margin-top: 0.2rem; font-size: 0.78rem; color: var(--status-gap-major); font-weight: 500; }

@media (max-width: 560px) {
  .bid-work-grid { grid-template-columns: 1fr; }
  .bid-terms { grid-template-columns: 1fr; }
}

/* ================= INTAKE UPLOAD (error + partial states) ================= */

/* The upload tile is now an active affordance, not a dead placeholder. */
.upload-tile {
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  transition: border-color var(--motion), background var(--motion), color var(--motion);
}
.upload-tile:hover,
.upload-tile:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--wash);
  color: var(--text);
}
.upload-tile-plus { font-size: 1.8rem; font-weight: 300; line-height: 1; color: var(--accent); }
.upload-tile-label { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.upload-tile-sub { font-size: 0.74rem; color: var(--dim); }

/* partial-read banner on the extract screen */
.partial-banner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--conf-low-tint);
  border: 1px solid var(--conf-low-line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.partial-banner-mark {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--conf-low);
  background: var(--card);
  border: 1px solid var(--conf-low-line);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  margin-top: 0.1rem;
}
.partial-banner-body { display: flex; flex-direction: column; gap: 0.7rem; }
.partial-banner-text { margin: 0; font-size: 0.86rem; color: var(--body); line-height: 1.5; }

/* upload modal */
.upload-modal { max-width: 560px; }
.up-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 0.3rem;
}
.up-sub { margin: 0 0 1rem; font-size: 0.86rem; color: var(--body); line-height: 1.5; padding-right: 1.5rem; }
.up-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: 1px dashed var(--hairline);
  border-radius: 12px;
  background: var(--muted);
  color: var(--dim);
  font-size: 0.84rem;
  padding: 1.1rem;
  margin-bottom: 1.1rem;
}
.up-drop-icon { font-size: 1.1rem; color: var(--accent); }
.up-samples { display: flex; flex-direction: column; gap: 0.6rem; }
.up-sample {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color var(--motion), background var(--motion);
}
.up-sample:hover,
.up-sample:focus-visible { outline: none; border-color: var(--accent); background: var(--wash); }
.up-sample-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--plate);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.up-sample-thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-sample-meta { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.up-sample-name { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.up-sample-kind { font-size: 0.74rem; color: var(--dim); }

.up-scanning {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 2.5rem 1rem;
  text-align: center;
}
.up-scanning-line { font-size: 0.9rem; color: var(--body); }
.up-scanning-file { font-size: 0.78rem; color: var(--dim); }

/* outcome panel: accent color keyed to the outcome */
.up-outcome { --oc: var(--conf-low); --oc-tint: var(--conf-low-tint); --oc-line: var(--conf-low-line); }
.up-outcome.up-partial { --oc: var(--status-gap-minor); --oc-tint: var(--status-gap-minor-tint); --oc-line: var(--status-gap-minor-line); }
.up-outcome-mark {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--oc);
  background: var(--oc-tint);
  border: 1px solid var(--oc-line);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  margin-bottom: 0.7rem;
}
.up-outcome-title { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.up-outcome-file { font-size: 0.76rem; color: var(--dim); margin: 0.2rem 0 0.8rem; }
.up-outcome-detail { margin: 0 0 0.9rem; font-size: 0.88rem; color: var(--body); line-height: 1.55; }
.up-marking {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: var(--conf-low);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.9rem;
  text-align: center;
}
.up-check { list-style: none; margin: 0 0 0.9rem; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.up-check li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--body);
}
.up-check-mark { width: 1.1rem; text-align: center; font-weight: 700; }
.up-check li.ok .up-check-mark { color: var(--conf-high); }
.up-check li.no .up-check-mark { color: var(--conf-low); }
.up-check-tag {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.up-outcome-advice {
  margin: 0 0 1.1rem;
  font-size: 0.84rem;
  color: var(--body);
  line-height: 1.55;
  background: var(--muted);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.7rem 0.9rem;
}
.up-outcome-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

/* ================= CAPABILITY INGEST (brochure / photo upload) ================= */

.cap-upload { margin-top: 1.3rem; max-width: 34rem; }
.cap-upload-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--faint);
  font-size: 0.76rem;
  margin-bottom: 0.7rem;
}
.cap-upload-divider::before,
.cap-upload-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.cap-upload-hint { font-size: 0.8rem; color: var(--dim); margin: 0 0 0.8rem; line-height: 1.5; }
.cap-drop {
  flex-wrap: wrap;
  cursor: pointer;
  margin-bottom: 1.2rem;
  transition: border-color var(--motion), background var(--motion);
}
.cap-drop:hover,
.cap-drop.is-drag { border-color: var(--accent); background: var(--wash); color: var(--body); }
.cap-drop.is-drag { border-style: solid; }
.cap-drop-text { color: var(--dim); }
.cap-drop [data-cap-browse] { pointer-events: auto; }
.cap-examples-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-bottom: 0.6rem;
}
.cap-brochures { display: flex; flex-direction: column; gap: 0.6rem; }
.cap-brochure {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color var(--motion), background var(--motion);
}
.cap-brochure:hover,
.cap-brochure:focus-visible { outline: none; border-color: var(--accent); background: var(--wash); }
.cap-brochure-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--plate);
  border: 1px solid var(--line);
}
.cap-brochure-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cap-brochure-meta { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.cap-brochure-name { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.cap-brochure-file { font-size: 0.74rem; color: var(--dim); }

/* ingest review modal */
.ig-modal { max-width: 580px; }
.ig-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 0.3rem;
}
.ig-source { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.7rem; }
.ig-source-name { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.ig-source-file { font-size: 0.76rem; color: var(--dim); }
.ig-intro { margin: 0 0 0.9rem; font-size: 0.84rem; color: var(--body); line-height: 1.5; padding-right: 1.5rem; }
.ig-flaw {
  font-size: 0.83rem;
  color: var(--body);
  line-height: 1.5;
  background: var(--status-gap-minor-tint);
  border: 1px solid var(--status-gap-minor-line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
}
.ig-flaw-mark {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--status-gap-minor);
  margin-right: 0.5rem;
}
.ig-entries { display: flex; flex-direction: column; gap: 0.7rem; }
.ig-entry {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--muted);
  padding: 0.7rem 0.85rem;
  transition: opacity var(--motion);
}
.ig-entry.off { opacity: 0.5; }
.ig-entry-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.ig-entry-head input[type="checkbox"] { flex-shrink: 0; }
.ig-type-badge {
  flex-shrink: 0;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 5px;
  padding: 0.2rem 0.45rem;
  color: var(--accent-deep);
  background: var(--tint);
}
.ig-type-labor, .ig-type-tool, .ig-type-process { color: var(--dim); background: var(--line); }
.ig-entry-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.ig-field { display: flex; flex-direction: column; gap: 0.2rem; }
.ig-field.wide { grid-column: 1 / -1; }
.ig-field-k { font-size: 0.7rem; font-weight: 600; color: var(--dim); }
.ig-input {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.4rem 0.55rem;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  width: 100%;
}
.ig-input:focus { outline: none; border-color: var(--accent); }
.ig-name { font-weight: 600; }
.ig-entry-head .ig-name { flex: 1; }
.ig-field.flagged .ig-input { border-color: var(--status-gap-minor); background: var(--status-gap-minor-tint); }
.ig-field.flagged .ig-field-k { color: var(--status-gap-minor); }
.ig-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.1rem; }

@media (max-width: 520px) {
  .ig-entry-body { grid-template-columns: 1fr; }
}

/* ========== PAI (Pioneer AI) floating assistant ==========
   Ported from Maestro's MAI copilot. Deliberately flat / bauhaus per the brief:
   a plain accent circle with the Sparkles mark, no gradient or decorative
   shadow. White mark on the accent fill clears WCAG contrast. Lives outside
   #app so re-renders never touch it; sits bottom-right, the theme switcher
   moved to bottom-left to make room. */
.pai-root {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 80;
}
.pai-fab {
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--motion);
}
.pai-fab svg { width: 24px; height: 24px; }
.pai-fab:hover { background: var(--accent-deep); }
.pai-fab:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 3px; }
.pai-root[data-open="true"] .pai-fab { display: none; }

.pai-panel {
  display: none;
  flex-direction: column;
  width: 360px;
  max-width: calc(100vw - 2rem);
  height: 520px;
  max-height: calc(100vh - 3rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.pai-root[data-open="true"] .pai-panel { display: flex; }

.pai-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.pai-head-mark {
  display: grid;
  place-items: center;
  color: var(--accent);
}
.pai-head-mark svg { width: 18px; height: 18px; }
.pai-head-name {
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
  color: var(--text);
}
.pai-head-sub {
  font-size: 0.68rem;
  color: var(--dim);
  letter-spacing: 0.03em;
}
.pai-close {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--dim);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.pai-close:hover { color: var(--text); }

.pai-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.pai-msg {
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-width: 90%;
}
.pai-msg-bot { color: var(--text); align-self: flex-start; }
.pai-msg-user {
  color: var(--accent-ink);
  background: var(--accent);
  align-self: flex-end;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
}

.pai-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
}
.pai-input input {
  flex: 1;
  min-width: 0;
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--text);
  background: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  outline: none;
}
.pai-input input:focus { border-color: var(--accent); }
.pai-send {
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.78rem;
  border-radius: 8px;
  padding: 0 0.9rem;
  cursor: pointer;
  transition: background var(--motion);
}
.pai-send:hover { background: var(--accent-deep); }
