/*
 * Rhetor8 UI tokens — see docs/rhetor8-color-palette.html for full palette.
 * Steel Blue #366492 (structure), Kinetic Orange #F08D23 (highlights / primary CTA).
 */
:root {
  color-scheme: light dark;
  --r8-steel: #366492;
  --r8-steel-muted: #5c88b0;
  --r8-orange: #f08d23;
  --r8-orange-hover: #d97a1a;
  --r8-cyan: #00bcd4;
  --r8-gray: #9e9e9e;
  --bg: #f0f2f5;
  --fg: #333333;
  --muted: #9e9e9e;
  --border: #d0d5dd;
  --card: #ffffff;
  --accent: #366492;
  --accent-muted: #5c88b0;
  --forensics-bg: #e8eef4;
  --focus: #f08d23;
  accent-color: var(--r8-steel);
}

@media (prefers-color-scheme: dark) {
  :root {
    --r8-steel: #93c5fd;
    --r8-steel-muted: #7dd3fc;
    --r8-orange: #f5a84d;
    --r8-orange-hover: #ffb86b;
    --bg: #1e293b;
    --fg: #f8fafc;
    --muted: #94a3b8;
    --border: #334155;
    --card: #0f172a;
    --accent: #5b9bd4;
    --accent-muted: #7eb3e0;
    --forensics-bg: #1e293b;
    --focus: #f5a84d;
    accent-color: var(--r8-steel);
  }
}

::selection {
  background: rgba(54, 100, 146, 0.35);
  color: var(--fg);
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background: rgba(147, 197, 253, 0.35);
    color: var(--fg);
  }
}

a:any-link {
  color: var(--accent);
}

a:visited {
  color: var(--r8-steel-muted);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Serif 4", "Georgia", "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
}

.app-header,
.app-main,
.app-footer {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

.app-header {
  border-bottom: 1px solid var(--border);
  padding-top: 1.5rem;
}

.app-header-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.pre-approved-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding: 0.35rem 0.5rem 0.35rem 0.45rem;
  max-width: fit-content;
  border-radius: 6px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--r8-orange);
  background: linear-gradient(
    90deg,
    rgba(240, 141, 35, 0.12) 0%,
    var(--forensics-bg) 48%
  );
}

.pre-approved-badge-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  max-height: 28px;
}

.pre-approved-badge-text {
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--r8-steel);
  line-height: 1.3;
}

.brand-mark-icon {
  flex-shrink: 0;
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 3px solid var(--r8-orange);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4) inset,
    0 2px 8px rgba(240, 141, 35, 0.35),
    0 4px 14px rgba(15, 23, 42, 0.12);
  object-fit: cover;
}

.app-header-brand-text {
  flex: 1;
  min-width: 0;
}

.brand-wordmark {
  margin: 0 0 0.35rem;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand-rhetor {
  color: var(--r8-steel);
}

.brand-eight {
  color: var(--r8-orange);
}

.app-header h1 {
  margin: 0;
  padding: 0;
  border: none;
  font: inherit;
}

.app-header-brand-text .product-tagline {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  font-family: system-ui, sans-serif;
  color: var(--fg);
  line-height: 1.35;
}

.app-header > .tagline {
  margin: 0;
  padding-top: 0.15rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
}

.app-main {
  padding-bottom: 3rem;
}

.query-form label {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.query-form textarea {
  width: 100%;
  min-height: 5rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  resize: vertical;
}

.query-form textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.query-actions {
  margin-top: 0.65rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

button,
.query-form button[type="submit"] {
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent-muted);
  color: var(--accent);
}

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

button.primary {
  background: var(--r8-orange);
  color: #fff;
  border-color: var(--r8-orange-hover);
}

button.primary:hover {
  background: var(--r8-orange-hover);
  border-color: var(--r8-orange-hover);
  filter: none;
  color: #fff;
}

button.ghost {
  background: transparent;
}

.htmx-indicator {
  display: none;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

.htmx-request .htmx-indicator {
  display: inline;
}

#results {
  margin-top: 2rem;
}

.query-echo {
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--forensics-bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.query-echo strong {
  color: var(--fg);
}

.pipeline-note {
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1.25rem;
  padding: 0.65rem 0.85rem;
  border-left: 4px solid var(--r8-orange);
  background: var(--forensics-bg);
  border-radius: 0 6px 6px 0;
}

.pipeline-note strong {
  color: var(--fg);
}

.pipeline-note code {
  font-size: 0.88em;
  padding: 0.1em 0.25em;
  border-radius: 3px;
  background: var(--card);
  border: 1px solid var(--border);
}

.verbatim-label {
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--r8-orange);
  margin: 0 0 0.35rem;
}

.verbatim-block {
  margin-bottom: 0.5rem;
}

.verbatim-block blockquote {
  margin-top: 0;
}

.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;
}

.receipt-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

article.receipt {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  background: var(--card);
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.receipt-synthesis-scope {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.receipt-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 0.75rem;
  padding-right: 2.85rem;
  min-width: 0;
}

.receipt-head-row .receipt-head-main {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.receipt-head-row .synthesis-include {
  flex: 0 1 auto;
  align-self: center;
  max-width: 100%;
}

details.receipt.receipt-drawer {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
  max-width: 100%;
}

details.receipt.receipt-drawer > summary.receipt-summary {
  position: absolute;
  top: 1rem;
  right: 1.15rem;
  z-index: 2;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--forensics-bg);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

details.receipt.receipt-drawer > summary.receipt-summary::-webkit-details-marker {
  display: none;
}

details.receipt.receipt-drawer > summary.receipt-summary:hover {
  border-color: var(--r8-orange);
  box-shadow: 0 2px 8px rgba(240, 141, 35, 0.25);
}

details.receipt.receipt-drawer > summary.receipt-summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.receipt-expand-icon {
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.88;
  user-select: none;
}

details.receipt.receipt-drawer[open] > summary.receipt-summary {
  border-color: var(--r8-orange);
  background: rgba(240, 141, 35, 0.12);
}

@media (prefers-color-scheme: dark) {
  details.receipt.receipt-drawer[open] > summary.receipt-summary {
    background: rgba(245, 168, 77, 0.18);
  }

  .brand-mark-icon {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08) inset,
      0 2px 10px rgba(245, 168, 77, 0.35),
      0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

details.receipt.receipt-drawer > .receipt-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-top: 0.85rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.receipt-panel-section {
  margin: 0;
}

.receipt-panel-heading {
  margin: 0 0 0.65rem;
  padding: 0;
  border: none;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.receipt-pdf-line {
  margin: 0 0 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.65rem;
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--fg);
}

.receipt-pdf-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.82rem;
}

.receipt-pdf-name {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: var(--forensics-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  word-break: break-all;
}

.receipt-panel .forensics {
  font-size: 0.8125rem;
  line-height: 1.55;
  padding: 0.85rem 1rem;
  margin-bottom: 0;
  border-radius: 6px;
}

.receipt-panel .forensics dl {
  display: block;
  margin: 0;
}

.receipt-panel .forensics dt {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.65rem 0 0.2rem;
  padding: 0;
  line-height: 1.35;
}

.receipt-panel .forensics dt:first-child {
  margin-top: 0;
}

.receipt-panel .forensics dd {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0 0 0.35rem;
  padding: 0.35rem 0.5rem;
  background: rgba(54, 100, 146, 0.06);
  border-radius: 4px;
  border: 1px solid var(--border);
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--fg);
}

@media (prefers-color-scheme: dark) {
  .receipt-panel .forensics dd {
    background: rgba(91, 155, 212, 0.08);
  }
}

.pre-approved-inline {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  max-height: 28px;
}

.receipt-head-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.receipt-head-meta {
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.receipt-excerpt {
  margin-top: 0.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.receipt-links {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  border-left: 4px solid var(--r8-orange);
  min-width: 0;
  background: linear-gradient(
    90deg,
    rgba(240, 141, 35, 0.1) 0%,
    var(--card) 55%
  );
}

.receipt-links .receipt-pdf-line {
  margin-bottom: 0.65rem;
}

.receipt-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.receipt-links-list li {
  margin: 0;
}

.receipt-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.35rem 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--accent);
}

.receipt-link:visited {
  color: var(--r8-steel-muted);
}

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

.receipt-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.receipt-link-retail,
.receipt-link-download {
  color: var(--r8-orange);
  font-weight: 700;
}

.receipt-link-retail:hover,
.receipt-link-download:hover {
  color: var(--r8-orange-hover);
}

.receipt-link-retail:visited,
.receipt-link-download:visited {
  color: var(--r8-orange-hover);
}

.source-work {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--forensics-bg);
}

.source-work-label {
  margin: 0 0 0.35rem;
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.source-work-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  line-height: 1.3;
}

.source-work-meta {
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.receipt-synthesis-scope {
  transition: opacity 0.2s ease;
}

article.receipt:has(.synthesis-include input:not(:checked)) .receipt-synthesis-scope {
  opacity: 0.52;
}

.receipt blockquote {
  margin: 0 0 1rem;
  padding: 0.65rem 0 0 1rem;
  border-left: 4px solid var(--r8-orange);
  font-style: italic;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
}

.links a:any-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.links a:visited {
  color: var(--r8-steel-muted);
}

.links a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.forensics {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  padding: 0.65rem 0.75rem;
  background: var(--forensics-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
}

.forensics dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 1rem;
}

.forensics dt {
  color: var(--muted);
  font-weight: 600;
}

.forensics dd {
  margin: 0;
  word-break: break-all;
}

.receipt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
}

.receipt-toolbar button {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.synthesis-include {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.synthesis-include input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--r8-steel);
}

.context-snippet {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0.5rem 0;
  padding: 0.5rem 0.65rem;
  background: var(--forensics-bg);
  border-radius: 4px;
  font-style: normal;
}

.synthesis-actions {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.synthesis-actions h3 {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

#synthesis-panel {
  margin-top: 1rem;
}

.synthesis-output {
  padding: 1rem 1.1rem;
  border: 1px dashed var(--accent-muted);
  border-radius: 8px;
  background: var(--card);
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
}

.synthesis-output .warning {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.follow-up {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.follow-up h3 {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.follow-up textarea {
  width: 100%;
  min-height: 4rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  resize: vertical;
}

.follow-up textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.follow-up .query-actions {
  margin-top: 0.5rem;
}

.app-footer {
  border-top: 1px solid var(--border);
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
}

/* --- Watcher UI --- */
.watcher-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.watcher-header {
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.watcher-header-top {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.75rem;
}

.watcher-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.watcher-brand-icon {
  border-radius: 8px;
}

.watcher-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1.25rem;
  margin-bottom: 0.15rem;
}

.watcher-title {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.watcher-subtitle {
  margin: 0.2rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 42rem;
}

.watcher-subtitle-caveat {
  margin: 0.35rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  max-width: 42rem;
}

.watcher-product-tag {
  margin: 0.15rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.watcher-switcher-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  flex-shrink: 0;
}

.watcher-switcher-label {
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
  cursor: pointer;
}

.watcher-switcher-select {
  font: inherit;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  font-size: 0.88rem;
  min-width: 10rem;
  max-width: min(100%, 22rem);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
}

.watcher-switcher-select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.watcher-config-nick-form {
  margin: 0;
}

.watcher-config-nick-actions {
  margin: 0.5rem 0 0;
}

.watcher-nav {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1.25rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
}

.watcher-nav-link {
  color: var(--accent);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}

.watcher-nav-link:hover {
  background: var(--forensics-bg);
}

.watcher-nav-link-active {
  background: var(--forensics-bg);
  font-weight: 600;
  color: var(--fg);
}

.watcher-main {
  flex: 1;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
  width: 100%;
}

.watcher-footer {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
}

.watcher-footer p {
  margin: 0;
  line-height: 1.45;
  max-width: 48rem;
}

.watcher-footer p + p {
  margin-top: 0.5rem;
}

.watcher-page-header h2 {
  font-family: system-ui, sans-serif;
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
}

.watcher-lede {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.watcher-back {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.watcher-back a {
  color: var(--accent);
}

.watcher-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.watcher-card h3 {
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.watcher-card-muted {
  background: var(--forensics-bg);
}

.watcher-note {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.watcher-policy-blurb {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

.watcher-dl {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
  font-size: 0.92rem;
}

.watcher-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.watcher-dl dd {
  margin: 0;
}

.watcher-mono,
.watcher-mono-sm {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.watcher-mono-sm {
  font-size: 0.78rem;
}

.watcher-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-family: system-ui, sans-serif;
}

.watcher-table-wide {
  display: block;
  overflow-x: auto;
}

.watcher-table th,
.watcher-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.watcher-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.watcher-table tbody tr:last-child th,
.watcher-table tbody tr:last-child td {
  border-bottom: none;
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: system-ui, sans-serif;
  text-transform: capitalize;
  background: var(--forensics-bg);
  border: 1px solid var(--border);
}

.status-active {
  background: rgba(0, 188, 212, 0.15);
  border-color: var(--r8-cyan);
  color: var(--fg);
}

.status-confirmed {
  background: rgba(54, 100, 146, 0.12);
  border-color: var(--r8-steel);
}

.status-pending {
  background: rgba(240, 141, 35, 0.12);
  border-color: var(--r8-orange);
}

.status-corrupt {
  background: rgba(200, 60, 60, 0.12);
  border-color: #c62828;
  color: var(--fg);
}

.status-ok {
  background: rgba(46, 125, 50, 0.12);
  border-color: #2e7d32;
}

.status-fail {
  background: rgba(198, 40, 40, 0.12);
  border-color: #c62828;
}

.status-warn {
  background: rgba(240, 141, 35, 0.15);
  border-color: var(--r8-orange);
}

.watcher-verif-mode {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
  font-weight: 400;
  text-transform: none;
}

.watcher-btn-disabled {
  font: inherit;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: not-allowed;
}

/* Overview: glossary is intentionally distinct from “real” product cards */
.watcher-glossary-callout {
  background: linear-gradient(
    135deg,
    rgba(240, 141, 35, 0.14) 0%,
    rgba(54, 100, 146, 0.1) 100%
  );
  border: 2px dashed var(--r8-orange);
  border-radius: 12px;
  padding: 1rem 1.2rem 1.1rem;
  margin-bottom: 1rem;
}

.watcher-glossary-callout h3 {
  color: var(--fg);
  margin-top: 0.35rem;
}

.watcher-glossary-banner {
  margin: 0 0 0.25rem;
  padding: 0.35rem 0.5rem;
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg);
  background: rgba(240, 141, 35, 0.22);
  border-radius: 6px;
  display: inline-block;
}

.watcher-glossary-intro {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.watcher-console-map {
  margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
  .watcher-glossary-callout {
    background: linear-gradient(
      135deg,
      rgba(245, 168, 77, 0.12) 0%,
      rgba(91, 155, 212, 0.12) 100%
    );
    border-color: var(--r8-orange);
  }

  .watcher-glossary-banner {
    background: rgba(245, 168, 77, 0.18);
  }
}

.watcher-glossary-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--fg);
}

.watcher-glossary-list li {
  margin-bottom: 0.55rem;
}

.watcher-card-intro {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.watcher-help {
  font-size: 0.85rem;
  color: var(--muted);
}

.watcher-table th abbr {
  text-decoration: underline dotted;
  cursor: help;
}

.watcher-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.5rem;
}

.watcher-action-form {
  display: inline;
  margin: 0;
}

.watcher-action-form button {
  margin: 0;
}

.watcher-btn,
.watcher-btn-secondary,
.watcher-btn-danger {
  font: inherit;
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}

.watcher-btn-secondary {
  border-color: var(--r8-steel);
  background: var(--forensics-bg);
}

.watcher-btn-danger {
  border-color: #b71c1c;
  background: rgba(198, 40, 40, 0.08);
  color: var(--fg);
}

.watcher-btn:hover,
.watcher-btn-secondary:hover {
  border-color: var(--r8-orange);
}

.watcher-btn-danger:hover {
  border-color: #c62828;
  background: rgba(198, 40, 40, 0.14);
}

.watcher-btn:focus-visible,
.watcher-btn-secondary:focus-visible,
.watcher-btn-danger:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.watcher-btn:disabled,
.watcher-btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.watcher-action-wrap {
  display: inline-block;
}

.watcher-action-feedback {
  margin-top: 0.45rem;
  min-height: 0;
}

.watcher-action-feedback-block {
  margin-bottom: 0.65rem;
}

.watcher-action-stub {
  margin: 0;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  font-family: system-ui, sans-serif;
  color: var(--fg);
  background: var(--forensics-bg);
  border: 1px dashed var(--accent-muted);
  border-radius: 6px;
}

.watcher-metrics-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem 1.5rem;
}

.watcher-metrics-heading {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.watcher-metrics-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.watcher-metrics-list code {
  font-size: 0.78rem;
}

/* Files & health: full-width path + card rows */
.watcher-files-list-section {
  padding-bottom: 1.25rem;
}

.watcher-files-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.watcher-file-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
  background: var(--card);
}

.watcher-file-path {
  width: 100%;
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}

.watcher-file-path a {
  display: block;
  text-decoration: none;
}

.watcher-file-path a:hover code {
  color: var(--r8-orange);
}

.watcher-mono-path {
  display: block;
  width: 100%;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-all;
  white-space: pre-wrap;
  color: var(--fg);
}

.watcher-action-feedback-wide {
  width: 100%;
  margin-bottom: 0.35rem;
}

.watcher-file-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
}

.watcher-file-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.watcher-file-meta-label {
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.watcher-file-meta-value {
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
}

.watcher-file-actions-row {
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
}

.watcher-file-summary {
  border-left: 4px solid var(--r8-steel);
}

.watcher-file-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.watcher-file-summary-block {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.watcher-file-summary-label {
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.watcher-file-summary-value {
  font-size: 1.05rem;
  font-weight: 600;
  font-family: system-ui, sans-serif;
}

.watcher-file-summary-hash .watcher-file-summary-label {
  margin-bottom: 0.35rem;
  display: block;
}

.watcher-hash-full {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  word-break: break-all;
  white-space: pre-wrap;
  background: var(--forensics-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  max-height: 8rem;
  overflow: auto;
}

/* Configuration: policies, source rows, field agents */
.watcher-config-form {
  margin: 0;
  transition: opacity 0.15s ease;
}

.watcher-config-form.htmx-request {
  opacity: 0.88;
}

.watcher-policy-selects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.65rem;
}

.watcher-config-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.watcher-config-field-grow {
  flex: 1;
  min-width: 12rem;
}

.watcher-config-field-narrow {
  max-width: 10rem;
}

.watcher-config-label {
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.watcher-config-input,
.watcher-config-select {
  font: inherit;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  width: 100%;
  box-sizing: border-box;
}

.watcher-config-input:focus,
.watcher-config-select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.watcher-policy-blurb-live {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  min-height: 2.5rem;
}

.watcher-config-feedback {
  margin-top: 0.5rem;
  min-height: 0;
}

.watcher-config-save-stub {
  margin: 0;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.45;
  font-family: system-ui, sans-serif;
  color: var(--fg);
  background: var(--forensics-bg);
  border: 1px dashed var(--accent-muted);
  border-radius: 6px;
}

.watcher-sources-rows {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.watcher-source-edit-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--forensics-bg);
}

@media (min-width: 640px) {
  .watcher-source-edit-row {
    grid-template-columns: minmax(10rem, 1.2fr) minmax(6rem, 0.7fr) minmax(
        8rem,
        1fr
      ) 6.5rem;
    align-items: end;
  }
}

.watcher-config-add-row {
  margin: 0 0 0.75rem;
}

.watcher-config-subheading {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
}

.watcher-note {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 0.65rem;
}

.watcher-pending-agents-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.watcher-pending-agent-card {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.watcher-pending-agent-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.watcher-pending-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.watcher-pending-hint {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
  color: var(--fg);
  line-height: 1.4;
}

.watcher-pending-accept-form {
  margin: 0;
  display: inline;
}

.watcher-pending-accepted {
  padding: 0.65rem 0.85rem;
  border: 1px dashed var(--r8-steel);
  border-radius: 8px;
  background: rgba(91, 155, 212, 0.06);
}

.watcher-pending-accepted p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}
