/*
 * Morandi palette: low-saturation, grey-leaning hues on a warm neutral ground,
 * after Giorgio Morandi's still lifes. Every colour carries some of the same
 * grey, which is what keeps the page quiet enough to read a diff or a findings
 * table in. The muting is deliberate but the contrast is not: every text and
 * badge colour below clears WCAG AA (4.5:1) against both the page and the card
 * background it can sit on, in both themes.
 *
 * :root is the dark theme; [data-theme="light"] overrides it. js/app.js sets
 * data-theme on <body> from localStorage, falling back to prefers-color-scheme.
 */
:root {
  /* Warm charcoal rather than black: a neutral grey ground reads as a hole in
     the screen next to these hues. */
  --bg-primary: #22201e;
  --bg-secondary: #2a2725;
  --bg-card: rgba(48, 45, 42, 0.88);
  --bg-card-hover: rgba(60, 56, 52, 0.75);
  --border-color: rgba(233, 228, 220, 0.10);
  --border-focus: rgba(157, 181, 177, 0.55);
  --text-primary: #e9e4dc;
  --text-secondary: #aba49b;
  --text-muted: #8a827a;
  --accent: #9db5b1;          /* dusty eucalyptus */
  --accent-hover: #b2c6c2;
  --accent-light: rgba(157, 181, 177, 0.16);
  --accent-ring: rgba(157, 181, 177, 0.22);
  --accent-edge: rgba(157, 181, 177, 0.28);
  --accent-glow: rgba(157, 181, 177, 0.18);
  --on-accent: #22201e;       /* dark ink on a light accent */
  --success: #a3bc96;         /* sage */
  --success-bg: rgba(163, 188, 150, 0.14);
  --success-edge: rgba(163, 188, 150, 0.28);
  --warning: #d6b27c;         /* ochre */
  --warning-bg: rgba(214, 178, 124, 0.14);
  --warning-edge: rgba(214, 178, 124, 0.30);
  --danger: #d79a92;          /* faded terracotta */
  --danger-bg: rgba(215, 154, 146, 0.14);
  --danger-edge: rgba(215, 154, 146, 0.32);
  --brand-from: #7d8f8b;      /* the brand tile is the one place with a wash */
  --brand-to: #9a8e88;
  --on-brand: #f4f1ec;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.38);
  --shadow-accent: 0 4px 12px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] {
  /* Unbleached linen, not white. The hues are the same family as the dark
     theme, taken deeper so they still clear AA on a pale ground. */
  --bg-primary: #ebe7e0;
  --bg-secondary: #f6f3ee;
  --bg-card: rgba(251, 249, 246, 0.96);
  --bg-card-hover: rgba(243, 239, 233, 0.92);
  --border-color: rgba(51, 48, 44, 0.12);
  --border-focus: rgba(76, 103, 100, 0.55);
  --text-primary: #33302c;
  --text-secondary: #635c55;
  --text-muted: #7a7269;
  --accent: #4c6764;
  --accent-hover: #3d5451;
  --accent-light: rgba(76, 103, 100, 0.10);
  --accent-ring: rgba(76, 103, 100, 0.18);
  --accent-edge: rgba(76, 103, 100, 0.26);
  --accent-glow: rgba(76, 103, 100, 0.22);
  --on-accent: #fbf9f6;
  --success: #4e6746;
  --success-bg: rgba(78, 103, 70, 0.10);
  --success-edge: rgba(78, 103, 70, 0.24);
  --warning: #7c5c2c;
  --warning-bg: rgba(124, 92, 44, 0.10);
  --warning-edge: rgba(124, 92, 44, 0.26);
  --danger: #8b4f49;
  --danger-bg: rgba(139, 79, 73, 0.10);
  --danger-edge: rgba(139, 79, 73, 0.28);
  --brand-from: #6f827e;
  --brand-to: #8d817b;
  --on-brand: #fbf9f6;
  --shadow-sm: 0 2px 8px rgba(51, 48, 44, 0.06);
  --shadow-md: 0 8px 24px rgba(51, 48, 44, 0.08);
  --shadow-lg: 0 16px 40px rgba(51, 48, 44, 0.10);
  --shadow-accent: 0 4px 12px rgba(51, 48, 44, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  width: 100%;
  flex: 1;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-brand);
  font-weight: 700;
  font-size: 20px;
  box-shadow: var(--shadow-accent);
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

/* Language picker — same chrome as .btn-icon, but sized to its content and kept a
   native <select> so it stays keyboard- and screen-reader-friendly. */
.lang-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  height: 38px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.lang-select:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}
.lang-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Privacy Banner */
/* Intro: what this tool is, what it is not. It sits below the tool rather than
   above it, because someone who came here to clean a file should reach the
   textarea without scrolling; the rule and the heading are what stop it from
   reading as a stray paragraph down there. The caveat card keeps the same
   weight as the other two rather than being tucked into a footnote, because
   "the metadata is gone" and "the watermark is gone" are not the same claim
   and that difference is the whole point of the Inspector tab. */
.intro {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.intro-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.intro-lead {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 76ch;
  margin-bottom: 18px;
}

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

.intro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent-edge);
  border-radius: var(--radius-sm);
  padding: 14px 16px 16px;
}

.intro-card-caveat {
  border-top-color: var(--warning);
}

.intro-card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.intro-card p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .intro-cards { grid-template-columns: 1fr; }
  .intro-lead { font-size: 14px; }
}

.privacy-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--success);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.privacy-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.privacy-text strong {
  color: var(--text-primary);
}

.engine-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-edge);
}
.engine-status-badge.server-mode {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-edge);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Navigation Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  width: fit-content;
}

.tab-btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}
.tab-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* Tab Content Cards */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.main-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  margin-bottom: 32px;
}

/* Text Mode Layout */
.text-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .text-grid { grid-template-columns: 1fr; }
}

/* The tagline is a second line for the title, not a thing to read on a phone:
   at this width it wraps to five lines and pushes the controls off the row. */
@media (max-width: 560px) {
  .brand-sub { display: none; }
}

.text-box-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.textarea-wrapper {
  position: relative;
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

textarea {
  width: 100%;
  height: 100%;
  min-height: 280px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.output-preview {
  width: 100%;
  height: 100%;
  min-height: 280px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Options Panel */
.options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.options-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.checkbox-label:hover {
  color: var(--text-primary);
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Inspection Report Badge */
.report-box {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: none;
}
.report-box.show {
  display: block;
  animation: fadeIn 0.2s ease;
}
.report-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-edge);
}
.tag-badge.clean {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-edge);
}

/* Actions */
.actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  border-color: var(--border-focus);
}

/* File Dropzone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
  margin-bottom: 20px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  color: var(--accent);
}
.dropzone-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}
.dropzone-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* File Items List */
.file-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.file-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.file-name {
  font-size: 14px;
  font-weight: 600;
}
.file-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Footer */
footer {
  text-align: center;
  padding: 32px 20px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}
footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
footer a:hover {
  text-decoration: underline;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Accessibility & focus */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone:focus-visible { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Settings panel */
.settings-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
@media (max-width: 720px) { .settings-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.field input[type="text"], .field input[type="password"], .field input[type="url"] {
  font: inherit; font-size: 13px; padding: 8px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--bg-secondary); color: var(--text-primary);
}
.field input:focus { border-color: var(--border-focus); outline: none; }
.settings-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.settings-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }
.settings-note code { font-family: var(--font-mono); font-size: 11.5px; }
.engine-select { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.engine-select label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.file-card.error { border-color: var(--danger); }
.file-card.error .file-icon { background: var(--danger-bg); color: var(--danger); }
.file-card .file-meta.error { color: var(--danger); }
.file-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file-findings { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }
.tag-badge.warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.mode-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---- optional AI rewrite panel ---- */
.rewrite-box { display: block; }          /* not gated on .show; JS toggles [hidden] */
.output-preview.compact { min-height: 160px; }
/* The rewrite output sits under the two-column grid, so it must not inherit the
   280px min-height those side-by-side boxes need — that left a dead gap between
   the output and the copy button. */
.rewrite-box .textarea-wrapper { min-height: 0; flex: none; }
.rewrite-box .output-preview.compact { height: auto; }
.rewrite-prompt summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.rewrite-prompt textarea {
  min-height: 96px;
  height: auto;
  margin-top: 8px;
  font-size: 12.5px;
}
.rewrite-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rewrite-controls label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.rewrite-controls input {
  flex: 1 1 180px;
  min-width: 140px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.rewrite-hint { color: var(--text-secondary); }

.mt-20 { margin-top: 20px; }
.mt-14 { margin-top: 14px; }
.engine-select { margin-top: 12px; }
.footnote { margin-top: 8px; font-size: 11.5px; }


/* [hidden] has to beat the display rules on .btn / .checkbox-label / .rewrite-box:
   the UA sheet's display:none loses to any class that sets display, which left
   JS-hidden controls (Cancel, the detection-key selector) visible while idle. */
[hidden] { display: none !important; }

/* ---- Watermark Inspector ---- */
.inspect-intro { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 14px; }
.inspect-input { min-height: 0; }
.inspect-input .textarea-wrapper { min-height: 0; }
.inspect-input textarea { min-height: 160px; height: auto; }
.inspect-key select, .rewrite-controls select, .rewrite-controls input[type="number"] {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.rewrite-controls input[type="number"] { flex: 0 0 90px; min-width: 70px; }
.rewrite-controls input[type="text"] { flex: 1 1 260px; }
.inspect-results { margin-top: 18px; }
.inspect-layer + .inspect-layer { margin-top: 18px; }
.inspect-layer h3 { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.inspect-table-wrap { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-secondary); }
.inspect-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.inspect-table th, .inspect-table td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-color); }
.inspect-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.inspect-table tbody tr:last-child td { border-bottom: 0; }
.inspect-table tr.row-detected td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.inspect-table tr.row-uncertain td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.inspect-table tr.row-clean td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.inspect-name { min-width: 180px; font-weight: 600; }
.inspect-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.flag { font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border-color); color: var(--text-muted); font-family: var(--font-mono); }
.flag-heuristic { color: var(--warning); border-color: var(--warning-edge); }
.inspect-score { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); white-space: nowrap; margin-top: 4px; }
td.inspect-score { margin-top: 0; }
.tag-badge.status-clean { background: var(--success-bg); color: var(--success); border-color: var(--success-edge); }
.tag-badge.status-detected { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-edge); }
.tag-badge.status-uncertain { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-edge); }
.tag-badge.status-unavailable, .tag-badge.status-not_tested, .tag-badge.status-not_applicable {
  background: transparent; color: var(--text-muted); border-color: var(--border-color);
}
.tag-badge.status-error { background: var(--danger-bg); color: var(--danger); border-style: dashed; }
.inspect-evidence { color: var(--text-secondary); max-width: 520px; }
.inspect-evidence details summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.inspect-evidence ul { margin: 6px 0 0 16px; padding: 0; font-size: 12px; line-height: 1.5; }
.inspect-evidence code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-primary); }
.inspect-offsets { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.inspect-note { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.inspect-delta { font-weight: 600; white-space: nowrap; }
.inspect-delta.same { color: var(--text-muted); }
.inspect-delta.changed { color: var(--warning); }
.inspect-overall-lines p { font-size: 13px; line-height: 1.55; margin: 0; }
.inspect-overall-lines p + p { margin-top: 4px; }
#inspect-overall { margin-top: 16px; }
#stat-demo-box { margin-top: 18px; }

/* Keyed-Gumbel key entry. A <details> because the key is an advanced control
   that most visitors never have, but it stays available on the hosted page:
   unlike the sidecar detectors, this one needs no local service. */
.gumbel-panel {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  padding: 10px 14px;
}
.gumbel-panel summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.gumbel-panel .footnote { margin-bottom: 0; }
.gumbel-panel input[type="password"] { flex: 1 1 220px; }
.gumbel-panel input[type="text"] { flex: 0 0 110px; min-width: 90px; }
