/* Hallucination Hunter — Handcrafted UI stylesheet
   Plain CSS, light & dark themes, zero framework overhead. */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: light;

  --bg: #f7f6f2;
  --bg-subtle: #efede7;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --border: #e4e1d8;
  --border-strong: #cfcac0;

  --ink: #171614;
  --ink-2: #4a4842;
  --ink-3: #78746b;
  --placeholder: #989388;

  --btn-bg: #171614;
  --btn-fg: #f7f6f2;
  --btn-hover: #2c2a26;
  --brand-mark: #d94e28;

  --green: #1d7548;
  --green-soft: rgba(29, 117, 72, 0.08);
  --green-line: rgba(29, 117, 72, 0.36);

  --amber: #966200;
  --amber-soft: rgba(150, 98, 0, 0.09);
  --amber-line: rgba(150, 98, 0, 0.38);

  --red: #be3820;
  --red-soft: rgba(190, 56, 32, 0.08);
  --red-line: rgba(190, 56, 32, 0.38);

  --tip-bg: #181715;
  --tip-fg: #f3f1ec;
  --tip-muted: #a9a49b;
  --tip-green: #69cb95;
  --tip-amber: #ebb64e;
  --tip-red: #f0836e;

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 22, 20, 0.04);
  --shadow-md: 0 12px 32px -12px rgba(23, 22, 20, 0.16);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #111110;
  --bg-subtle: #1b1b19;
  --surface: #171715;
  --surface-2: #1d1d1b;
  --border: #292926;
  --border-strong: #3b3a36;

  --ink: #ededec;
  --ink-2: #b5b3ac;
  --ink-3: #807d75;
  --placeholder: #67655e;

  --btn-bg: #ededec;
  --btn-fg: #141413;
  --btn-hover: #d8d6cf;
  --brand-mark: #e5643f;

  --green: #53bc83;
  --green-soft: rgba(83, 188, 131, 0.12);
  --green-line: rgba(83, 188, 131, 0.4);

  --amber: #e2ac42;
  --amber-soft: rgba(226, 172, 66, 0.12);
  --amber-line: rgba(226, 172, 66, 0.4);

  --red: #ee7460;
  --red-soft: rgba(238, 116, 96, 0.12);
  --red-line: rgba(238, 116, 96, 0.4);

  --tip-bg: #22221f;
  --tip-fg: #f2f1ed;
  --tip-muted: #9f9c94;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 14.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.hidden, [hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

code, kbd {
  font-family: var(--mono);
  font-feature-settings: "zero" 0;
}

:focus-visible {
  outline: 2px solid var(--brand-mark);
  outline-offset: 2px;
}

/* Boot crest sequence */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 72% 62% at 50% 45%, #ffffff 0%, #f7f6f2 58%, #ebe8df 100%);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.56s cubic-bezier(0.65, 0, 0.35, 1),
    visibility 0.56s cubic-bezier(0.65, 0, 0.35, 1);
  user-select: none;
  cursor: pointer;
}

html:not(.hh-boot) .boot-screen {
  display: none;
}

html.hh-boot:not(.hh-boot-out) {
  scrollbar-color: transparent transparent;
}
html.hh-boot:not(.hh-boot-out)::-webkit-scrollbar-thumb,
html.hh-boot:not(.hh-boot-out) body::-webkit-scrollbar-thumb {
  background: transparent;
  border-color: transparent;
}
html.hh-boot:not(.hh-boot-out)::-webkit-scrollbar-track,
html.hh-boot:not(.hh-boot-out) body::-webkit-scrollbar-track {
  background: transparent;
}

html.hh-boot:not(.hh-boot-out) .masthead,
html.hh-boot:not(.hh-boot-out) .main-wrapper {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
}

html.hh-boot .masthead,
html.hh-boot .main-wrapper {
  transition:
    opacity 0.58s cubic-bezier(0.16, 1, 0.3, 1) 0.06s,
    transform 0.62s cubic-bezier(0.16, 1, 0.3, 1) 0.06s;
}

html.hh-boot-out .boot-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(138, 115, 74, 0.34);
  border-style: solid;
  border-width: 0;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.boot-corner-tl { top: 24px; left: 24px; border-top-width: 1px; border-left-width: 1px; transform: translate3d(-6px, -6px, 0); }
.boot-corner-tr { top: 24px; right: 24px; border-top-width: 1px; border-right-width: 1px; transform: translate3d(6px, -6px, 0); }
.boot-corner-bl { bottom: 24px; left: 24px; border-bottom-width: 1px; border-left-width: 1px; transform: translate3d(-6px, 6px, 0); }
.boot-corner-br { bottom: 24px; right: 24px; border-bottom-width: 1px; border-right-width: 1px; transform: translate3d(6px, 6px, 0); }

.boot-screen.is-ready .boot-corner {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.boot-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-bottom: 2.5vh;
  transition:
    transform 0.52s cubic-bezier(0.55, 0, 0.25, 1),
    opacity 0.44s cubic-bezier(0.55, 0, 0.25, 1);
}

html.hh-boot-out .boot-stage {
  transform: translate3d(0, -8px, 0) scale(1.035);
  opacity: 0;
}

.boot-aura {
  position: absolute;
  top: 42%;
  left: 50%;
  width: min(560px, 90vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(0.84);
  background: radial-gradient(
    circle,
    rgba(184, 152, 92, 0.14) 0%,
    rgba(138, 115, 74, 0.05) 38%,
    transparent 68%
  );
  opacity: 0;
  pointer-events: none;
}

.boot-screen.is-ready .boot-aura {
  animation: bootAuraIn 1.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.boot-crest {
  position: relative;
  width: min(440px, 78vw);
  aspect-ratio: 1200 / 696;
}

.boot-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  will-change: transform, opacity, clip-path;
  pointer-events: none;
}

.boot-eagle {
  transform-origin: 50% 36%;
  transform: translate3d(0, 18px, 0) scale(0.92);
}

.boot-star-center {
  transform-origin: 50% 11.7%;
  transform: translate3d(0, 9px, 0) scale(0.52);
}

.boot-star-left {
  transform-origin: 40.9% 11.7%;
  transform: translate3d(6px, 9px, 0) scale(0.56);
}

.boot-star-right {
  transform-origin: 59.1% 11.7%;
  transform: translate3d(-6px, 9px, 0) scale(0.56);
}

.boot-word-main {
  transform-origin: 50% 74%;
  clip-path: inset(0 0 100% 0);
  transform: translate3d(0, 12px, 0);
}

.boot-word-sub {
  transform-origin: 50% 93%;
  transform: translate3d(0, 10px, 0) scale(0.97);
}

.boot-screen.is-ready .boot-eagle {
  animation: bootEagleRise 0.72s cubic-bezier(0.16, 1, 0.3, 1) 0.02s forwards;
}

.boot-screen.is-ready .boot-star-center {
  animation: bootStarLock 0.56s cubic-bezier(0.22, 1, 0.36, 1) 0.20s forwards;
}

.boot-screen.is-ready .boot-star-left,
.boot-screen.is-ready .boot-star-right {
  animation: bootStarLock 0.56s cubic-bezier(0.22, 1, 0.36, 1) 0.30s forwards;
}

.boot-screen.is-ready .boot-word-main {
  animation: bootWordMask 0.62s cubic-bezier(0.16, 1, 0.3, 1) 0.36s forwards;
}

.boot-screen.is-ready .boot-word-sub {
  animation: bootSubSettle 0.58s cubic-bezier(0.16, 1, 0.3, 1) 0.50s forwards;
}

.boot-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-image: url("assets/brand/boot-lockup.png");
  mask-image: url("assets/brand/boot-lockup.png");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.boot-sheen::after {
  content: "";
  position: absolute;
  inset: -25% -40%;
  background: linear-gradient(
    108deg,
    transparent 38%,
    rgba(255, 247, 226, 0) 43%,
    rgba(255, 245, 214, 0.58) 50%,
    rgba(196, 164, 100, 0.32) 54%,
    transparent 60%
  );
  transform: translate3d(-72%, 0, 0);
  will-change: transform;
}

.boot-screen.is-ready .boot-sheen::after {
  animation: bootFoilSweep 0.92s cubic-bezier(0.25, 1, 0.4, 1) 0.62s forwards;
}

.boot-meter {
  width: min(132px, 36vw);
  height: 1.5px;
  background: rgba(29, 28, 70, 0.10);
  border-radius: 99px;
  overflow: hidden;
  opacity: 0;
}

.boot-screen.is-ready .boot-meter {
  animation: bootMeterShow 0.35s ease 0.24s forwards;
}

.boot-meter-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d1c46 0%, #8a734a 62%, #b59a66 100%);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

.boot-screen.is-ready .boot-meter-fill {
  animation: bootMeterFill 1.36s cubic-bezier(0.22, 1, 0.36, 1) 0.24s forwards;
}

@keyframes bootAuraIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.84); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
}

@keyframes bootEagleRise {
  0% { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.92); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes bootStarLock {
  0% { opacity: 0; transform: translate3d(0, 9px, 0) scale(0.52); }
  70% { opacity: 1; transform: translate3d(0, -1px, 0) scale(1.04); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes bootWordMask {
  0% { opacity: 0; clip-path: inset(0 0 100% 0); transform: translate3d(0, 12px, 0); }
  100% { opacity: 1; clip-path: inset(0 0 0% 0); transform: translate3d(0, 0, 0); }
}

@keyframes bootSubSettle {
  0% { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.97); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes bootFoilSweep {
  0% { transform: translate3d(-72%, 0, 0); }
  100% { transform: translate3d(72%, 0, 0); }
}

@keyframes bootMeterShow {
  to { opacity: 1; }
}

@keyframes bootMeterFill {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .boot-screen.is-ready .boot-layer {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
  .boot-sheen,
  .boot-meter {
    display: none;
  }
  html.hh-boot .masthead,
  html.hh-boot .main-wrapper {
    transform: none !important;
  }
}

@media (max-width: 560px) {
  .boot-corner {
    width: 14px;
    height: 14px;
  }
  .boot-corner-tl, .boot-corner-tr { top: 16px; }
  .boot-corner-bl, .boot-corner-br { bottom: 16px; }
  .boot-corner-tl, .boot-corner-bl { left: 16px; }
  .boot-corner-tr, .boot-corner-br { right: 16px; }
  .boot-stage {
    gap: 22px;
  }
}

/* Accessibility & offline */
.skip-link {
  position: fixed;
  top: -48px;
  left: 16px;
  z-index: 1000;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 10px;
}

.offline-bar {
  display: none;
  padding: 8px 16px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--amber-soft);
  color: var(--amber);
  border-bottom: 1px solid var(--amber-line);
}
.offline-bar.show {
  display: block;
}

/* Top navigation bar */
.masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 54px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.masthead-inner {
  max-width: 980px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}
[data-theme="dark"] .brand-plate {
  fill: #262522;
}

.brand-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.mast-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}

.sidebar-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color 0.15s ease;
}
.sidebar-link:hover {
  color: var(--ink);
}
.sidebar-link.active {
  color: var(--ink);
}

.nav-ink {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--ink);
  pointer-events: none;
  opacity: 0;
}
.nav-ink.ready {
  opacity: 1;
  transition: transform 0.22s var(--ease), width 0.22s var(--ease);
}

.mast-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.sync-indicator:hover {
  color: var(--ink);
  background: var(--bg-subtle);
}
.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex-shrink: 0;
}
.sync-indicator.connected .sync-dot {
  background: var(--green);
}
.sync-indicator.disconnected .sync-dot {
  background: var(--amber);
}

.search-box {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px 0 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.search-box:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.search-placeholder-text {
  padding-right: 4px;
}
.search-kbd, .hint-kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 5px;
  font-size: 10.5px;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .i-sun {
  display: none;
}
[data-theme="dark"] .theme-toggle .i-moon {
  display: none;
}
[data-theme="dark"] .theme-toggle .i-sun {
  display: block;
}

.mast-gh {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.mast-gh:hover {
  color: var(--ink);
  background: var(--bg-subtle);
}

/* Main container & views */
.main-wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.view {
  display: none;
}
.view.active {
  display: block;
}

/* Hero + inline stats */
.intro-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 22px;
}

.hero {
  max-width: 580px;
}

.page-title {
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 33px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: var(--ink);
}

.page-subtitle {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}

.stats-inline {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 2px;
  flex-shrink: 0;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-left: 20px;
  border-left: 1px solid var(--border);
}
.stat-cell:first-child {
  padding-left: 0;
  border-left: 0;
}
.stat-cell dt {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.stat-cell dd {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 1px;
}

/* Composer card */
.input-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.input-card:focus-within {
  border-color: var(--ink-2);
}

.input-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.input-head-left {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.input-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.word-meta {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.specimen-bar {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.specimen-caption {
  font-size: 12px;
  color: var(--ink-3);
  margin-right: 2px;
}

.specimen-chip {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.specimen-chip:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.specimen-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.input-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.mic-btn.recording {
  color: var(--red);
  background: var(--red-soft);
}

.textarea-wrap {
  position: relative;
}

#llm-input {
  display: block;
  width: 100%;
  min-height: 158px;
  max-height: 400px;
  padding: 15px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 15px/1.62 var(--sans);
  resize: vertical;
}
#llm-input:focus {
  outline: none;
}
#llm-input::placeholder {
  color: var(--placeholder);
}
#llm-input[readonly] {
  color: var(--ink-2);
}

.input-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.input-meta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.char-indicator.over {
  color: var(--red);
  font-weight: 600;
}

.batch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  color: var(--ink-2);
  white-space: nowrap;
}
.batch-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.batch-box {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.batch-toggle input:checked + .batch-box {
  background: var(--ink);
  border-color: var(--ink);
}
.batch-toggle input:checked + .batch-box::after {
  content: '';
  width: 7px;
  height: 4px;
  border-left: 1.6px solid var(--bg);
  border-bottom: 1.6px solid var(--bg);
  transform: rotate(-45deg) translate(0.5px, -0.5px);
}
.batch-toggle input:focus-visible + .batch-box {
  outline: 2px solid var(--brand-mark);
  outline-offset: 2px;
}

.input-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-text {
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-text:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--ink);
}
.btn-text:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-danger {
  color: var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-soft);
  color: var(--red);
}

.btn-solid {
  position: relative;
  display: inline-grid;
  place-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.btn-solid > * {
  grid-area: 1 / 1;
}
.btn-solid:hover:not(:disabled) {
  background: var(--btn-hover);
}
.btn-solid:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-solid.is-busy {
  opacity: 1;
  cursor: progress;
}
.btn-solid-danger {
  background: var(--red);
  color: #fff;
}
.btn-solid-danger:hover:not(:disabled) {
  background: #a52e19;
}

.btn-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s ease;
}
.btn-kbd {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  opacity: 0.85;
}
[data-theme="dark"] .btn-kbd {
  background: rgba(0, 0, 0, 0.16);
}

.btn-spinner {
  width: 15px;
  height: 15px;
  border: 1.8px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0;
}
.btn-solid.is-busy .btn-label {
  opacity: 0;
}
.btn-solid.is-busy .btn-spinner {
  opacity: 1;
  animation: spin 0.7s linear infinite;
}

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

/* Processing steps */
.processing {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.process-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.process-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  opacity: 0.55;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.process-step.active,
.process-step.done {
  opacity: 1;
}
.process-step.active {
  border-color: var(--border-strong);
  background: var(--surface);
}

.ps-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.process-step.done .ps-dot {
  background: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
}

.ps-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.ps-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.ps-desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3);
}

.ps-status {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--green);
}
.loader {
  width: 13px;
  height: 13px;
  border: 1.7px solid var(--border-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.progress-strip {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-track {
  flex: 1;
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 2px;
  overflow: hidden;
}
.progress-thumb {
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform-origin: left center;
  transform: scaleX(0);
}
.progress-pct {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
}

/* Results view */
.results {
  margin-top: 22px;
}
.results.is-in {
  animation: fadeUp 0.24s var(--ease) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.results-dossier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.score-block {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.score-readout {
  display: inline-flex;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.score-number {
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}
.score-readout.is-text .score-number {
  font-size: 20px;
  letter-spacing: -0.015em;
}
.score-pct {
  font-size: 18px;
  font-weight: 500;
  margin-left: 1px;
  opacity: 0.8;
}
.score-readout[data-band="good"] { color: var(--green); }
.score-readout[data-band="mid"] { color: var(--amber); }
.score-readout[data-band="bad"] { color: var(--red); }

.score-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.score-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.score-note {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.score-note strong {
  font-weight: 600;
  color: var(--ink-2);
}

.summary-meter-col {
  flex: 1;
  min-width: 230px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pill-verified .pill-dot { background: var(--green); }
.pill-unverifiable .pill-dot { background: var(--amber); }
.pill-false .pill-dot { background: var(--red); }
.pill-num {
  font-weight: 600;
  color: var(--ink);
}

.breakdown-bar {
  display: flex;
  gap: 2px;
  height: 5px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
}
.bd-seg {
  height: 100%;
  transition: width 0.45s var(--ease);
}
.bd-verified { background: var(--green); }
.bd-unverifiable { background: var(--amber); }
.bd-false { background: var(--red); }

.results-actions,
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.action-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
}
.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Content sections */
.content-section {
  margin-top: 26px;
}
.content-section.first-section {
  margin-top: 0;
}

.section-label {
  margin-bottom: 10px;
}
.section-label h2,
.section-label h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.section-label p {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.section-label-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

/* Annotated passage */
.annotated-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  font: 400 15px/1.8 var(--sans);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.claim-hl {
  background: transparent;
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
  border-bottom: 1.75px solid var(--border-strong);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.claim-hl.verified {
  background: var(--green-soft);
  border-bottom-color: var(--green);
}
.claim-hl.unverifiable {
  background: var(--amber-soft);
  border-bottom-color: var(--amber);
  border-bottom-style: dashed;
}
.claim-hl.false {
  background: var(--red-soft);
  border-bottom-color: var(--red);
}
.claim-hl:hover {
  filter: brightness(0.97);
}

.claim-sup {
  margin-left: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Filter tabs */
.filter-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ftab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ftab:hover {
  color: var(--ink);
}
.ftab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.ftab-n {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.ftab.active .ftab-n {
  color: var(--ink-2);
}

/* Stacked claims list */
.claims-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.claim-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.18s ease, opacity 0.18s ease;
}
.claim-card:last-child {
  border-bottom: 0;
}
.claim-card.below-threshold {
  opacity: 0.68;
}
.claim-card.flash {
  animation: rowFlash 1.1s ease;
}
@keyframes rowFlash {
  0%, 20% { background: var(--amber-soft); }
  100% { background: transparent; }
}

.claim-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.claim-idx {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 20px;
}

.verdict-stamp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
}
.verdict-stamp.verified { color: var(--green); }
.verdict-stamp.unverifiable { color: var(--amber); }
.verdict-stamp.false { color: var(--red); }

.verdict-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

.claim-tag {
  font-size: 12px;
  color: var(--ink-3);
}
.claim-tag::before {
  content: '\00b7';
  margin-right: 7px;
}

.claim-meta-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.threshold-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--amber);
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--amber-soft);
}

.claim-conf {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.claim-copy {
  width: 26px;
  height: 26px;
  opacity: 0.65;
}
.claim-copy:hover,
.claim-copy.done {
  opacity: 1;
}
.claim-copy.done {
  color: var(--green);
}

.claim-desc {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.52;
  color: var(--ink);
}

.claim-correction {
  margin-top: 9px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-left: 2px solid var(--green);
  border-radius: 0 4px 4px 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}
.claim-correction strong {
  font-weight: 600;
  color: var(--green);
  margin-right: 6px;
}

.claim-explain {
  margin-top: 7px;
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--ink-2);
}

.claim-foot-row {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.claim-source-direct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.claim-source-direct svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--ink-3);
}
.claim-source-direct a {
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}
.claim-source-direct a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.src-domain {
  font-family: var(--mono);
  font-feature-settings: "zero" 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

.claims-empty {
  margin-top: 10px;
  padding: 22px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Recent checks & History rows — clean table rows, zero pill boxes */
.wire-section {
  margin-top: 28px;
}

.wire-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.wire-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.wire-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color 0.15s ease;
}
.wire-all-btn:hover {
  color: var(--ink);
}

.wire-list,
.history-list,
.sources-list,
.settings-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.wire-row {
  width: 100%;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto 74px;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.14s ease;
}
.wire-row:last-child {
  border-bottom: 0;
}
.wire-row:hover {
  background: var(--surface-2);
}

.row-verdict {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.row-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-3);
}
.row-verdict.good .row-dot { background: var(--green); }
.row-verdict.mid .row-dot { background: var(--amber); }
.row-verdict.bad .row-dot { background: var(--red); }
.row-verdict.unverified {
  font-weight: 500;
  color: var(--ink-2);
}
.row-verdict.unverified .row-dot {
  background: var(--amber);
}

.wire-excerpt {
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wire-summary {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wire-time {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* Idle how-it-works strip */
.how-strip {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.how-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.how-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  flex-shrink: 0;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.how-item h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.how-item p {
  font-size: 12.5px;
  line-height: 1.52;
  color: var(--ink-3);
}

/* Page headers for secondary views */
.page-header {
  margin-bottom: 20px;
}
.page-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.history-count {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-3);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.history-tools {
  margin-bottom: 12px;
}

.filter-input {
  width: 100%;
  max-width: 340px;
  height: 34px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.filter-input:focus {
  outline: none;
  border-color: var(--ink-2);
}
.filter-input::placeholder {
  color: var(--placeholder);
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 0;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.14s ease, height 0.25s ease, opacity 0.2s ease;
}
.history-row:last-child {
  border-bottom: 0;
}
.history-row:hover {
  background: var(--surface-2);
}
.history-row.removing {
  opacity: 0;
  overflow: hidden;
}

.history-open {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 4px 13px 16px;
  text-align: left;
}

.history-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-preview {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.history-summary-text {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history-delete {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  opacity: 0.65;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.history-delete:hover {
  opacity: 1;
  color: var(--red);
  background: var(--red-soft);
}
.history-delete svg {
  width: 15px;
  height: 15px;
}

.history-row.skeleton {
  padding: 14px 16px;
}
.sk {
  background: var(--bg-subtle);
  border-radius: 4px;
  animation: pulse 1.4s ease-in-out infinite;
}
.sk-score { width: 64px; height: 18px; }
.sk-line { width: 72%; height: 13px; margin-bottom: 6px; }
.sk-line.short { width: 36%; height: 11px; margin-bottom: 0; }
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding-left: 6px;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty-state.small-empty {
  padding: 26px 18px;
}
.empty-state h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.empty-state p {
  font-size: 13px;
  color: var(--ink-3);
}
.empty-state .action-btn {
  margin-top: 14px;
}

/* Sources view */
.source-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 120px 92px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.source-row:last-child {
  border-bottom: 0;
}

.source-rank {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.source-name-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.source-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.source-name a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.source-meta {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.source-bar {
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 2px;
  overflow: hidden;
}
.source-bar span {
  display: block;
  height: 100%;
  width: calc(var(--w, 0) * 100%);
  background: var(--ink-2);
}

.source-count {
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.directory {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.dir-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.dir-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.dir-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.dir-list li a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  transition: color 0.14s ease;
}
.dir-list li:last-child a {
  border-bottom: 0;
  padding-bottom: 0;
}
.dir-list li a:hover .dir-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dir-name {
  color: var(--ink);
  font-weight: 500;
}
.dir-domain {
  font-family: var(--mono);
  font-feature-settings: "zero" 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* Settings view */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child {
  border-bottom: 0;
}

.setting-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.setting-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.setting-hint {
  font-size: 12.5px;
  color: var(--ink-3);
}

.select-input {
  height: 32px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink);
}

.range-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.range-input {
  width: 140px;
  accent-color: var(--ink);
}
.range-val {
  font-size: 13px;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.segmented button {
  height: 26px;
  padding: 0 11px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.segmented button[aria-pressed="true"],
.segmented button[aria-selected="true"],
.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.db-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.db-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}
.db-status.connected { color: var(--green); }
.db-status.connected::before { background: var(--green); }
.db-status.disconnected { color: var(--amber); }
.db-status.disconnected::before { background: var(--amber); }

.db-count {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Skill & LLM Integrations view */
.skill-dl-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.endpoint-ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.endpoint-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.endpoint-row:last-child {
  border-bottom: 0;
}

.endpoint-kind {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}

.endpoint-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
}

.skill-platform-tabs {
  flex-wrap: wrap;
}

.skill-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.skill-panel[hidden] {
  display: none;
}

.skill-step-card,
.copilot-sandbox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.skill-step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.skill-step-head h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.skill-step-head p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}

.skill-step-head code,
.wire-note code,
.copilot-out-title code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 5px;
  background: var(--bg-subtle);
  border-radius: 3px;
  color: var(--ink);
}

.inline-text-link {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.code-sheet {
  margin: 0;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
  tab-size: 2;
}
.code-sheet code {
  font-family: inherit;
  white-space: pre;
}

.copilot-textarea {
  width: 100%;
  min-height: 76px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
}
.copilot-textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--surface);
}

.copilot-bar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.copilot-bar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.copilot-client-label {
  font-size: 12.5px;
  color: var(--ink-3);
}

.select-compact {
  height: 30px;
  padding: 0 26px 0 9px;
  font-size: 12.5px;
}

.copilot-output {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.copilot-out-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.copilot-out-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.copilot-out-meta {
  font-size: 12px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.copilot-pre code {
  white-space: pre-wrap;
  word-break: break-word;
}

.origin-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  padding: 1px 5px;
  background: var(--bg-subtle);
  border-radius: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* About view */
.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr);
  gap: 20px;
  align-items: start;
}

.about-card,
.spec-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.about-card .lede {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 18px;
}

.about-card h3,
.spec-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}
.about-card h3 {
  margin-top: 18px;
}

.about-card ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.about-card ol strong {
  color: var(--ink);
  font-weight: 600;
}
.about-card p {
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--ink-2);
}

.spec-dl {
  display: flex;
  flex-direction: column;
}
.spec-dl > div {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.spec-dl > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.spec-dl dt {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.spec-dl dd {
  font-size: 13px;
  color: var(--ink);
}
.spec-dl code {
  font-size: 12px;
  padding: 1px 5px;
  background: var(--bg-subtle);
  border-radius: 3px;
}

/* Footer */
.colophon {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-3);
}
.colophon-brand {
  font-weight: 600;
  color: var(--ink-2);
}
.colophon a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Search modal */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 15, 14, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 24px;
  transition: opacity 0.16s ease;
}
.search-overlay.closing {
  opacity: 0;
}

.search-modal {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.search-modal-icon {
  color: var(--ink-3);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 14.5px;
  color: var(--ink);
}
.search-input:focus {
  outline: none;
}
.search-close-btn kbd {
  padding: 2px 6px;
  font-size: 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--ink-3);
}

.search-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
}
.search-empty-state,
.search-no-results {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

.search-section-label {
  padding: 8px 10px 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.search-result-item.selected {
  background: var(--bg-subtle);
}

.search-result-icon {
  width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  color: var(--ink-2);
}
.search-result-icon svg {
  width: 13px;
  height: 13px;
}
.search-result-icon.band-good { color: var(--green); }
.search-result-icon.band-mid { color: var(--amber); }
.search-result-icon.band-bad { color: var(--red); }

.search-result-info {
  min-width: 0;
  flex: 1;
}
.search-result-title {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-title mark {
  background: var(--amber-soft);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}
.search-result-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.search-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--ink-3);
}
.search-foot kbd {
  padding: 1px 5px;
  font-size: 10.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-right: 3px;
}

/* Native dialogs */
.dialog {
  margin: auto;
  width: min(420px, calc(100vw - 32px));
  padding: 20px 22px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.dialog::backdrop {
  background: rgba(15, 15, 14, 0.45);
}
.dialog-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.dialog-body {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
}
.dialog-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.shortcut-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
}
.shortcut-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.shortcut-list > div:last-child {
  border-bottom: 0;
}
.shortcut-list kbd {
  padding: 2px 6px;
  font-size: 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.shortcut-list dd {
  color: var(--ink-2);
}

/* Hover tooltip */
.tip {
  position: fixed;
  z-index: 250;
  max-width: 330px;
  padding: 10px 12px;
  background: var(--tip-bg);
  color: var(--tip-fg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  line-height: 1.48;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.tip.visible {
  opacity: 1;
}
.tip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 11.5px;
  font-weight: 600;
}
.tip-conf {
  color: var(--tip-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.tip-source {
  margin-top: 5px;
  font-size: 11px;
  color: var(--tip-muted);
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 380px;
  padding: 10px 13px;
  background: var(--tip-bg);
  color: var(--tip-fg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  animation: fadeUp 0.2s var(--ease) both;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.leaving {
  opacity: 0;
  transform: translateY(4px);
}
.toast-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.toast-action {
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

/* Mobile bottom navigation */
.mobile-nav {
  display: none;
}

/* Responsive */
@media (max-width: 860px) {
  .intro-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .stats-inline {
    width: 100%;
    justify-content: flex-start;
  }
  .stat-cell {
    align-items: flex-start;
  }
  .process-card,
  .how-strip,
  .directory,
  .about-layout {
    grid-template-columns: 1fr;
  }
  .wire-row {
    grid-template-columns: 92px minmax(0, 1fr) 68px;
  }
  .wire-summary,
  .search-kbd {
    display: none;
  }
}

@media (max-width: 680px) {
  .mast-nav,
  .mast-gh,
  .search-kbd,
  .sync-label,
  .btn-kbd {
    display: none;
  }
  .masthead-inner {
    padding: 0 16px;
    gap: 10px;
  }
  .main-wrapper {
    padding: 20px 16px 88px;
  }
  .specimen-bar {
    width: 100%;
    margin-left: 0;
    order: 3;
  }
  .input-tools {
    margin-left: auto;
  }
  .results-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .summary-meter-col {
    width: 100%;
    max-width: none;
  }
  .history-open {
    grid-template-columns: 88px minmax(0, 1fr);
  }
  .history-summary-text,
  .source-bar {
    display: none;
  }
  .source-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }
  .endpoint-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
  }
  .endpoint-kind {
    grid-column: 1 / -1;
  }
  .skill-step-head {
    flex-direction: column;
    gap: 10px;
  }
  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 72px;
  }
  .toast {
    max-width: none;
  }
  .mobile-nav {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav-inner {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    height: 56px;
  }
  .mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--ink-3);
    font-size: 10.5px;
    font-weight: 500;
  }
  .mobile-nav-link svg {
    width: 18px;
    height: 18px;
  }
  .mobile-nav-link.active {
    color: var(--ink);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .masthead,
  .input-card,
  .processing,
  .results-actions,
  .filter-tabs,
  .wire-section,
  .how-strip,
  .mobile-nav,
  .colophon,
  .claim-copy {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .main-wrapper {
    max-width: none;
    padding: 0;
  }
  .results-dossier,
  .annotated-card,
  .claims-list {
    border-color: #ccc;
    box-shadow: none;
  }
}
