:root {
  --bg: #f0f0f0;
  --text: #333;
  --sidebar: #333;
  --tab: #4c6ef5;
  --tab-active: #2f55e7;
  --card: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 30px;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.startup-loading {
  overflow: hidden;
}

body.startup-loading .tab,
body.startup-loading button,
body.startup-loading input,
body.startup-loading select,
body.startup-loading textarea,
body.startup-loading a {
  pointer-events: none;
}

body.startup-loading .tab,
body.startup-loading button {
  background: #8a8f99 !important;
  color: #ececec !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

body.startup-loading .content,
body.startup-loading .sidebar {
  filter: grayscale(0.25);
}

.startup-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 22, 29, 0.6);
  backdrop-filter: blur(2px);
  z-index: 9999;
}

.startup-overlay.hidden {
  display: none;
}

.startup-panel {
  width: min(88vw, 400px);
  padding: 18px 20px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, #243244 0%, #182230 100%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.startup-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f4f7fb;
}

.startup-status {
  margin-top: 8px;
  color: #c8d4e5;
  font-size: 0.96rem;
}

.startup-progress-shell {
  width: 100%;
  max-width: none;
  height: 0.442in;
  margin: 14px auto 12px;
  padding: 0.05in;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 16, 24, 0.8);
  overflow: hidden;
}

.startup-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: #f4b400;
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.28);
  transition: width 220ms ease;
}

.startup-overlay.startup-complete .startup-progress-bar {
  background: #2f9d3a;
}

.startup-console {
  height: 292px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #3b4654;
  background: #000;
  color: #ffe761;
  font:
    13px / 1.45 Consolas,
    Menlo,
    monospace;
  white-space: pre-wrap;
}

.startup-final-line.startup-blink {
  animation: startup-blink 0.8s steps(1, end) infinite;
}

@keyframes startup-blink {
  50% {
    opacity: 0.12;
  }
}

/* Scanner dialog — reuses the startup-panel look, but lives inline in the main
   SPA area (no full-screen overlay/darkening) and gains Start Scan / Show Image
   actions plus a dismissable scanned-image preview. */
.scanner-dialog {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
  padding: 8px 0;
}

.scanner-panel {
  margin: 0;
}

.scanner-state {
  margin-top: 6px;
  color: #ffe761;
  font-size: 0.95rem;
}

.scanner-panel.scan-complete .scanner-bar {
  background: #2f9d3a;
}

.scanner-panel.scan-error .scanner-bar {
  background: #d9534f;
}

/* Freezer "WIA device is busy" — red bar + blinking red "Restart the Scanner
   Please" while the 5s status poll keeps reporting busy/offline. */
.scanner-panel.scan-busy .scanner-bar {
  background: #d9534f;
}

.scanner-state.scanner-blink {
  color: #ff4d4d;
  font-weight: 700;
  animation: startup-blink 0.8s steps(1, end) infinite;
}

.scanner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.scanner-actions .am-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scanner-workflow health LEDs — one row per failure point (WSL bridge,
   imaging service, driver, online, stuck scans, printer device). Reuses the
   Server Management traffic-light palette so green/yellow/red read the same. */
.scanner-diagnostics {
  margin-top: 14px;
  max-width: min(92vw, 560px);
  border: 1px solid #d9d9e3;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafd;
}
.scanner-diag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.scanner-diag-title {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.scanner-diag-refresh {
  padding: 3px 12px;
  font-size: 0.82rem;
}
.scanner-diagnostics.scanner-diag-busy .scanner-diag-refresh {
  opacity: 0.5;
  pointer-events: none;
}
.scanner-diag-leds {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scanner-diag-busy .scanner-diag-leds {
  opacity: 0.55;
}
.scanner-diag-empty {
  font-size: 0.85rem;
  color: #777;
  padding: 2px 0;
}
.scanner-diag-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #ececf1;
}
.scanner-diag-led {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #999;
}
.scanner-diag-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.scanner-diag-label {
  font-weight: 600;
  font-size: 0.86rem;
}
.scanner-diag-detail {
  font-size: 0.8rem;
  color: #555;
  line-height: 1.35;
}
.scanner-diag-row.diag-ok .scanner-diag-led {
  background: #43a047;
  box-shadow: 0 0 6px #43a047;
}
.scanner-diag-row.diag-warn .scanner-diag-led {
  background: #f9a825;
  box-shadow: 0 0 6px #f9a825;
}
.scanner-diag-row.diag-bad .scanner-diag-led {
  background: #e53935;
  box-shadow: 0 0 6px #e53935;
}
.scanner-diag-row.diag-bad {
  background: #fdecea;
  border-color: #f5c6c2;
}
.scanner-diag-row.diag-warn {
  background: #fff8e1;
  border-color: #f3e2b3;
}
.scanner-diag-row.diag-unknown .scanner-diag-led {
  background: #9aa0a6;
}

/* Inline "Process Document" pipeline result (classify → parse → investigate →
   categorize → store). The deterministic front half is filled in within
   seconds; the agentic back half is dispatched to Mazda and shown as delegated. */
.pdf-process-panel {
  max-width: min(88vw, 520px);
}

.pdf-path-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}

.pdf-path-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #94afc8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pdf-path-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 16, 24, 0.7);
  color: #e8f0fa;
  font: 13px / 1.4 Consolas, Menlo, monospace;
  box-sizing: border-box;
}

.pdf-path-input:focus {
  outline: none;
  border-color: rgba(100, 160, 255, 0.55);
  background: rgba(10, 16, 24, 0.9);
}

.scanner-result {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(10, 16, 24, 0.6);
  font-size: 0.9rem;
}

.scanner-result.hidden {
  display: none;
}

.pipeline-title {
  font-weight: 700;
  color: #cfe3ff;
  margin-bottom: 8px;
}

.pipeline-busy {
  color: #ffe761;
}

.pipeline-error {
  color: #ff6b6b;
  margin-bottom: 6px;
}

.printer-repair-success {
  color: #4cc35a;
  font-weight: 600;
}

.pipeline-stages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pipeline-stage {
  display: grid;
  grid-template-columns: 96px 84px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pipeline-stage:last-child {
  border-bottom: none;
}

.pipeline-stage-name {
  font-weight: 600;
  color: #e8eefc;
  text-transform: capitalize;
}

.pipeline-stage-status {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pipeline-stage.stage-done .pipeline-stage-status {
  color: #4cc35a;
}

.pipeline-stage.stage-error .pipeline-stage-status {
  color: #ff6b6b;
}

.pipeline-stage.stage-delegated .pipeline-stage-status {
  color: #6fb6ff;
}

.pipeline-stage.stage-pending .pipeline-stage-status,
.pipeline-stage.stage-skipped .pipeline-stage-status {
  color: #9aa6b8;
}

.pipeline-stage-summary {
  color: #c4cedd;
}

.pipeline-note {
  margin-top: 8px;
  color: #9aa6b8;
  font-size: 0.82rem;
  font-style: italic;
}

.statement-metadata-form label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  font-weight: 700;
}

.statement-metadata-modal .statement-metadata-form input {
  padding: 9px 10px;
  border: 1px solid #777;
  border-radius: 4px;
  font: inherit;
}

.statement-metadata-error {
  min-height: 1.3em;
  color: #d9534f;
  font-weight: 700;
}

/* Full-screen modal overlay — the scanned image pops open large and centered
   over a dark backdrop (click backdrop, ×, or Esc to close). Was previously an
   inline flex sibling of the panel, which could collapse to an empty short box
   "behind" the dialog. */
.scanner-image-box {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(6, 10, 16, 0.82);
  backdrop-filter: blur(2px);
}

.scanner-image-box.hidden {
  display: none;
}

.scanner-image-box.scanner-image-scrollable {
  align-items: flex-start;
  justify-content: flex-start;
}

.scanner-image {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 90vh;
  width: auto;
  height: auto;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #fff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

.scanner-image-box.scanner-image-ready .scanner-image {
  max-width: none;
  max-height: none;
}

.scanner-image-box.scanner-image-scrollable .scanner-image {
  cursor: grab;
}

.scanner-image-box.scanner-image-dragging,
.scanner-image-box.scanner-image-dragging .scanner-image {
  cursor: grabbing;
}

/* While loading or on error, give the frame a visible size so the modal never
   appears as a blank/zero-height box. */
.scanner-image-box.scanner-image-loading .scanner-image,
.scanner-image-box.scanner-image-error .scanner-image {
  min-width: min(60vw, 480px);
  min-height: 320px;
}

.scanner-image-box.scanner-image-error::after {
  content: "Scanned image failed to load. Close and try Show Image again.";
  position: absolute;
  color: #ffb4b4;
  font-size: 1rem;
  text-align: center;
  max-width: 360px;
  pointer-events: none;
}

.scanner-image-close {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #d9534f;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 1001;
}

.scanner-image-close:hover {
  background: #c9302c;
}

.sidebar {
  position: fixed;
  top: 30px;
  left: 0;
  width: 136px; /* 170px * 0.8 -- freed width goes to .content, see its comment */
  height: calc(100vh - 60px);
  background: var(--sidebar);
  padding: 12px;
  overflow-y: auto;
}

.sidebar h1 {
  margin: 0 0 16px;
  font-size: 1.2rem;
  color: #fff;
  text-align: center;
}

.sidebar nav {
  display: grid;
  gap: 10px;
}

.sidebar nav.hidden {
  display: none;
}

.tab {
  border: 0;
  width: 100%;
  background: var(--tab);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.15;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

/* Excel-style corner marker: this Agent Blocks tab opens another flat nav
   level instead of a document page. */
.tab.has-children {
  position: relative;
}

.tab.has-children::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-top: 10px solid #e03131;
  border-right: 10px solid transparent;
  border-top-left-radius: 4px;
}

.tab:hover,
.tab:focus-visible {
  outline: none;
  background: #3a5de3;
}

.sidebar .tab.active:not(.tab-alert):not(.tab-alert-red) {
  background: #fff !important;
  color: var(--tab) !important;
  font-weight: 700;
}

.tab.hidden {
  display: none;
}

.tab.back-tab {
  background: #555;
}

.tab.back-tab:hover,
.tab.back-tab:focus-visible {
  background: #444;
}

.tab.agent-active {
  background: #a07800 !important;
}
.tab.agent-error {
  background: #c0392b !important;
}
.tab.agent-health-error {
  background: #c0392b !important;
}

.content {
  /* left margin butts straight up against .sidebar's fixed 136px width --
     .sidebar ignores body's 30px margin (it's position:fixed to the
     viewport), so 136px here lands .content's border-box exactly at the
     sidebar's right edge with zero extra gap at this layer. The remaining
     ~1/3in of breathing room comes from .content's own 22px padding plus
     the report page's own body padding (see intake_report.css). max-width
     grows by the same amount the margin shrank, so the panel keeps the same
     right-hand edge it always had. */
  max-width: 1214px;
  margin: 20px auto 20px 106px;
  background: var(--card);
  border-radius: 4px;
  padding: 22px;
}

.content.fullbleed {
  max-width: none;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

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

h2,
h3,
p {
  margin-top: 0;
}

a {
  color: #1d4ed8;
  text-decoration: none;
  word-break: break-word;
}

a:hover {
  text-decoration: underline;
}

#scissari-frame,
.plan-frame {
  width: 100%;
  height: calc(100vh - 60px);
  border: none;
  display: block;
}

/* Recent Report / scanner report dialog only -- both views' ids start with
   "rol-finance-report-" (see rol-finance-reports-controller.js), so this
   leaves the many other unrelated .plan-frame iframes (project plans, Mazda
   objects, etc.) untouched. 20% taller overall: top moves up ~3vh (negative
   margin) and, since height grows by 20vh from that raised top, the bottom
   edge lands ~17vh lower than before -- net +20vh top-to-bottom. */
.view[id^="rol-finance-report-"] .plan-frame {
  height: calc(100vh - 60px + 20vh);
  margin-top: -3vh;
}

.reprocess-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: #1a1a2e;
  border-bottom: 1px solid #333;
}

.reprocess-btn {
  padding: 4px 14px;
  background: #2a4a7f;
  color: #e0e8ff;
  border: 1px solid #3a6abf;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  white-space: nowrap;
}

.reprocess-btn:hover:not(:disabled) {
  background: #3a5a9f;
}

.reprocess-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.reprocess-status {
  font-size: 0.8em;
  color: #aaa;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Attention-reason card shown above a red or yellow report's iframe */
.doc-failure-reason {
  padding: 10px 14px;
  background: #2a1518;
  border-bottom: 1px solid #7f1d1d;
  border-left: 4px solid #dc2626;
  color: #f3d6d6;
  font-size: 0.85em;
}

.doc-failure-reason h3 {
  margin: 0 0 6px;
  color: #fca5a5;
  font-size: 1em;
}

.doc-failure-reason .dfr-badge {
  margin: 0 0 6px;
  font-weight: 700;
  color: #fecaca;
}

.doc-failure-reason .dfr-summary {
  margin: 0 0 6px;
}

.doc-failure-reason .dfr-todo {
  margin: 6px 0 4px;
  font-weight: 700;
  color: #fca5a5;
}

.doc-failure-reason ul {
  margin: 0;
  padding-left: 20px;
}

.doc-failure-reason li {
  margin: 3px 0;
}

.doc-failure-reason .dfr-action {
  margin: 8px 0 0;
}

.doc-failure-reason.doc-review-reason {
  background: #2a2415;
  border-bottom-color: #854d0e;
  border-left-color: #eab308;
  color: #fef3c7;
}

.doc-failure-reason.doc-review-reason h3,
.doc-failure-reason.doc-review-reason .dfr-badge,
.doc-failure-reason.doc-review-reason .dfr-todo {
  color: #fde047;
}

pre {
  background: #1e1e1e;
  color: #e6e6e6;
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.45;
}
code {
  font-family: Consolas, Menlo, monospace;
}
p code,
li code,
td code {
  background: #e8e8e8;
  color: #b3306b;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}
table.kv {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
}
table.kv th,
table.kv td {
  border: 1px solid #ccc;
  padding: 6px 10px;
  text-align: left;
  font-size: 0.9rem;
  vertical-align: top;
}
table.kv th {
  background: #f0f0f0;
}
.note {
  background: #fff8e1;
  border-left: 4px solid #f5a623;
  padding: 10px 14px;
  border-radius: 4px;
  margin: 12px 0;
}
.ok {
  background: #e8f5e9;
  border-left: 4px solid #43a047;
  padding: 10px 14px;
  border-radius: 4px;
  margin: 12px 0;
}
details {
  margin: 10px 0;
}
summary {
  cursor: pointer;
  font-weight: 700;
}

/* ---- Agent manager ---- */
.am-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.am-toolbar input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.am-btn {
  border: 0;
  background: var(--tab);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}
.am-btn:hover {
  background: #3a5de3;
}
#agent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}
.agent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.agent-row:last-child {
  border-bottom: 0;
}
.agent-row:hover {
  background: #eef2ff;
}
.agent-name {
  font-weight: 600;
}
.agent-model {
  font-family: Consolas, Menlo, monospace;
  font-size: 0.78rem;
  color: #666;
  background: #f0f0f0;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.am-dim {
  padding: 12px;
  color: #888;
}
.am-warn {
  padding: 12px;
  color: #8a4b00;
  background: #fff8e1;
}
.am-back {
  background: #555;
  color: #fff;
  border: 0;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 12px;
}
.am-back:hover {
  background: #444;
}
.am-submenu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 16px;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
}
.am-sub {
  border: 0;
  background: #e8e8e8;
  color: #333;
  padding: 7px 16px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 0.92rem;
}
.am-sub:hover {
  background: #dcdcff;
}
.am-sub.active {
  background: var(--tab-active);
  color: #fff;
  font-weight: 700;
}

/* ---- MSI-installer-style scrolling console ---- */
.msi-console {
  background: #000;
  color: #fff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  height: 60vh;
  min-height: 320px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 2px inset #888;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  scroll-behavior: smooth;
}
.msi-entry {
  padding: 2px 0;
  border-bottom: 1px dotted #1e1e1e;
  animation: msi-in 0.18s ease-out;
}
.msi-stamp {
  color: #00d000;
}
.msi-entry .hdr {
  color: #6cf;
  font-weight: 700;
}
.msi-line.dim,
.msi-entry.dim {
  color: #888;
}
.msi-line.err {
  color: #ff6b6b;
}
@keyframes msi-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.msi-cursor {
  display: inline-block;
  color: #fff;
  animation: msi-blink 1s step-end infinite;
}
@keyframes msi-blink {
  50% {
    opacity: 0;
  }
}
.am-test-input {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid #111;
  border-radius: 6px;
  font-family: inherit;
}
.am-test-out {
  margin-top: 12px;
}
.agent-system-message {
  background: #111;
  color: #d0d0d0;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  font-size: 0.85em;
  max-height: 480px;
}

/* ---- Voice input controls ---- */
.am-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.am-controls .am-btn {
  padding: 11px 12px;
  line-height: 1.15;
}
.am-copy {
  background: #6c757d;
}
.am-copy:hover {
  background: #5a6268;
}
.voice-btn {
  background: #2e9e3f;
  color: #000;
  font-weight: 700;
}
.voice-btn:hover {
  background: #28902f;
}
.voice-btn.recording {
  background: #c62828;
  color: #fff;
}
.voice-btn.recording:hover {
  background: #b71c1c;
}
.am-mode {
  background: #555;
}
.am-mode:hover {
  background: #444;
}
.am-speak {
  background: #555;
}
.am-speak:hover {
  background: #444;
}
.am-speak.on {
  background: #1565c0;
  color: #fff;
  font-weight: 700;
}
.am-speak.on:hover {
  background: #0d47a1;
}
.rec-indicator {
  display: none;
  align-items: center;
  gap: 8px;
}
.rec-indicator.on {
  display: inline-flex;
}
.rec-led {
  width: 20px;
  height: 20px;
  background: #fff;
  border: 1px solid #888;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rec-led::after {
  content: "";
  width: 10px;
  height: 10px;
  background: #e53935;
  border-radius: 50%;
  animation: rec-blink 1s step-end infinite;
}
@keyframes rec-blink {
  50% {
    opacity: 0;
  }
}
.rec-text {
  font-size: 0.85rem;
  color: #c62828;
  font-weight: 600;
  min-width: 84px;
  font-variant-numeric: tabular-nums;
}

/* ---- Server status coloring ---- */
.tab.server-up {
  background: #43a047;
  color: #fff;
  font-weight: 700;
}
.tab.server-up:hover,
.tab.server-up:focus-visible {
  background: #388e3c;
}
.tab.server-down {
  background: #e53935;
  color: #fff;
  font-weight: 700;
}
.tab.server-down:hover,
.tab.server-down:focus-visible {
  background: #c62828;
}
.tab.server-starting {
  background: #f9a825;
  color: #000;
  font-weight: 700;
}
.tab.server-starting:hover,
.tab.server-starting:focus-visible {
  background: #f57f17;
  color: #000;
}
/* Yellow "concern" — reachable-but-degraded, dependency-down, down-but-
   restartable-here, or recently-restarted. A heads-up the user can act on,
   distinct from a hard red "down". Same amber family as "starting". */
.tab.server-concern {
  background: #f9a825;
  color: #000;
  font-weight: 700;
}
.tab.server-concern:hover,
.tab.server-concern:focus-visible {
  background: #f57f17;
  color: #000;
}
/* Muted — warning disabled (e.g., unused model deliberately silenced). */
.tab.muted {
  background: #6b7280;
  color: #fff;
  font-weight: 700;
}
.tab.muted:hover,
.tab.muted:focus-visible {
  background: #4b5563;
}
/* ---- Model Stats ---- */
.ms-card {
  max-width: 560px;
}
.ms-card h3 {
  margin: 0 0 8px;
}
.ms-mute-btn {
  margin: 0 0 10px;
}
.ms-window {
  margin: 12px 0;
}
.ms-window-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.ms-bar {
  height: 16px;
  background: #e6e6e6;
  border-radius: 8px;
  overflow: hidden;
}
.ms-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 300ms ease;
}
/* Rate-of-change warning: the fill is already yellow (inline style) when the
   burn multiple crosses the server's warn threshold; this makes it BLINK so
   it can't be missed at a glance. */
.ms-bar-fill.ms-blink-warn {
  animation: ms-warn-blink 1s steps(1, end) infinite;
}
@keyframes ms-warn-blink {
  50% {
    opacity: 0.25;
  }
}
/* Provider 429 banner: red, bold, with the live reset countdown inline —
   loud enough that nobody has to rediscover a rate limit from a terminal. */
.ms-rate-limited {
  color: #e53935;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 8px 0;
}
.ms-rate-limited [data-countdown-until] {
  font-variant-numeric: tabular-nums;
}
/* Slow-leak badge under the bars ("Slow token drain — +X% over last 2h"). */
.ms-leak {
  color: #f9a825;
  font-weight: 600;
  margin: 8px 0 0;
}
/* ---- Codex moms-token sync panel (always visible on Model Stats) ---- */
.cs-panel {
  max-width: 560px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #333;
}
.cs-panel h4 {
  margin: 0;
}
.cs-panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cs-toggle-btn {
  font-size: 0.82rem;
  padding: 3px 10px;
  cursor: pointer;
}
/* Greyed out while the automatic timer is disabled — a glance confirms the
   4h pull isn't running, without hiding the manual override buttons. */
.cs-panel-body-disabled {
  opacity: 0.5;
  filter: grayscale(1);
  background: rgba(128, 128, 128, 0.12);
  border-radius: 6px;
  padding: 8px;
  margin: -8px;
}
.cs-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.cs-panel-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.cs-swap-btn {
  font-size: 0.82rem;
  padding: 3px 10px;
  cursor: pointer;
}
.cs-swap-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
/* The W11-copy action deliberately collapses the dual-account fallback onto
   one account — mark it visually distinct from the safe R46 default. */
.cs-swap-btn-danger {
  border-color: #e53935;
  color: #e53935;
}
.cs-rows {
  margin-top: 10px;
  font-size: 0.86rem;
}
.cs-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px dashed #333;
}
.cs-row:last-child {
  border-bottom: none;
}
.cs-row-email {
  font-family: monospace;
}

/* ---- PC Monitor ---- */
/* The metric bars reuse the Model Stats .ms-* pieces and the sidebar tab
   reuses .tab-alert (yellow blink) for warn; crit gets a red blink. */
.pcm-alert-flag {
  color: #f9a825;
  font-size: 0.8rem;
  font-weight: 600;
}
.pcm-crit-flag {
  color: #e53935;
  font-size: 0.8rem;
  font-weight: 600;
}
@keyframes tab-alert-blink-red {
  0%,
  49% {
    background: #e53935;
    color: #fff;
  }
  50%,
  100% {
    background: var(--tab);
    color: #fff;
  }
}
.tab.tab-alert-red {
  animation: tab-alert-blink-red 1s step-end infinite;
}

/* Stale outage (down past the threshold) blinks to escalate — passive red went
   unnoticed for 54 min today. */
.tab.server-stale {
  animation: server-stale-blink 1.1s steps(1, end) infinite;
}
@keyframes server-stale-blink {
  50% {
    opacity: 0.45;
  }
}

/* Month/year grouping tabs above the ROL Finance report list. Distinct
   teal so the month-selector row reads as a different level than the
   document tabs below it; .active still bolds the chosen month. */
.tab.month-tab {
  background: #00695c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
}
.tab.month-tab:hover,
.tab.month-tab:focus-visible {
  background: #00897b;
}
.tab.month-tab.active {
  background: #009688;
  font-weight: 700;
}
/* Completion status for a month tab, from /api/rol-finance-month-status.
   Green = every scanned expense in the month is categorized; yellow = the
   most-recently-scanned expense still needs a category (work to do). Placed
   after .active so the status color wins; the active month keeps a dark ring so
   it stays identifiable regardless of green/yellow. */
.tab.month-tab.status-green {
  background: #43a047;
  color: #fff;
  font-weight: 700;
}
.tab.month-tab.status-green:hover,
.tab.month-tab.status-green:focus-visible {
  background: #388e3c;
}
.tab.month-tab.status-yellow {
  background: #f9a825;
  color: #000;
  font-weight: 700;
}
.tab.month-tab.status-yellow:hover,
.tab.month-tab.status-yellow:focus-visible {
  background: #f57f17;
}
.tab.month-tab.active.status-green,
.tab.month-tab.active.status-yellow {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.55);
}
/* Red = at least one report.html card in the month is missing or failed
   verification. Takes priority over the yellow/green expense-based classes
   above (JS clears them before adding this one), mirroring the document-tab
   report-missing color below. */
.tab.month-tab.report-missing {
  background: #e53935;
  color: #fff;
  font-weight: 700;
}
.tab.month-tab.report-missing:hover,
.tab.month-tab.report-missing:focus-visible {
  background: #c62828;
}
.tab.month-tab.active.report-missing {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.55);
}

/* Document-level completion states mirror the month colors so individual report
   tabs read consistently with the month summary row. Receipt-only progress stays
   green unless the report file itself is missing, in which case the missing red
   wins. */
.tab.status-green,
.tab.receipt-progress {
  background: #43a047;
  color: #fff;
  font-weight: 700;
}
.tab.status-green:hover,
.tab.status-green:focus-visible,
.tab.receipt-progress:hover,
.tab.receipt-progress:focus-visible {
  background: #388e3c;
}
.tab.status-yellow {
  background: #f9a825;
  color: #000;
  font-weight: 700;
}
.tab.status-yellow:hover,
.tab.status-yellow:focus-visible {
  background: #f57f17;
}
.tab.report-missing.status-green,
.tab.report-missing.status-yellow {
  background: #e53935;
  color: #fff;
}
.tab.report-missing.status-green:hover,
.tab.report-missing.status-green:focus-visible,
.tab.report-missing.status-yellow:hover,
.tab.report-missing.status-yellow:focus-visible {
  background: #c62828;
}

/* Recently-scanned viewing area — up to N still-uncategorized expenses (newest
   first) shown above the report views. As each is categorized it drops out and
   the next backfills on the next poll. */
.rol-recent-scans {
  margin: 0 0 14px;
}
/* Category row colors for New Records table — mirrors the report.html inline palette */
.cat-church-facility { background: #b8cce4; color: #000; }
.cat-church-utilities { background: #95b3d7; color: #000; }
.cat-ministry-and-worship { background: #dce6f1; color: #000; }
.cat-office-and-administration { background: #4f81bd; color: #fff; }
.cat-food-and-hospitality { background: #f4f199; color: #000; }
.cat-gifts-and-love-offerings { background: #a9d18e; color: #000; }
.cat-robert-benefits-and-medical { background: #ccc0da; color: #000; }
.cat-rosemary-benefits-and-medical { background: #f4b6c2; color: #000; }
.cat-staff-benefits-and-medical { background: #ccc0da; color: #000; }
.cat-travel-and-vehicle { background: #f4b683; color: #000; }
.cat-insurance-taxes-and-fees { background: #fcd5b4; color: #000; }
.cat-housing { background: #ddd9c4; color: #000; }
.cat-personal { background: #948a54; color: #fff; }
.cat-uncategorized { background: #bfbfbf; color: #000; }
.rol-recent-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.rol-recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rol-recent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 0.85rem;
}
.rol-recent-card .rol-recent-vendor {
  font-weight: 600;
}
.rol-recent-card .rol-recent-amount {
  font-variant-numeric: tabular-nums;
}
.rol-recent-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
}
.rol-recent-empty {
  margin: 0;
  color: #6b7280;
  font-size: 0.85rem;
}
.rol-recent-card {
  cursor: pointer;
}
.rol-recent-card:hover,
.rol-recent-card:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

/* New Records "Set Category" dialog — a native-dashboard copy of the Verified
   Transactions row picker, plus a .cp-reason block between the target line and
   the category grid. Reuses /api/recategorize-expense. */
#rol-newrec-picker,
#rol-newrec-mazda {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
}
#rol-newrec-picker {
  z-index: 9999;
}
#rol-newrec-mazda {
  z-index: 10000;
}
#rol-newrec-picker.open,
#rol-newrec-mazda.open {
  display: flex;
}
#rol-newrec-picker .cp-panel {
  background: #fff;
  border-radius: 14px;
  width: min(420px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
#rol-newrec-picker .cp-head {
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}
#rol-newrec-picker .cp-head h3 {
  margin: 0 0 4px;
  font: 700 1.05rem Arial, sans-serif;
  color: #0f172a;
}
#rol-newrec-picker .cp-target {
  margin: 0;
  font: 0.82rem Arial, sans-serif;
  color: #6b7280;
  word-break: break-word;
}
#rol-newrec-picker .cp-reason {
  padding: 10px 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff7ed;
  color: #9a3412;
  font: 0.85rem Arial, sans-serif;
}
#rol-newrec-picker .cp-list {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#rol-newrec-picker .cp-square {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  font: 700 0.95rem Arial, sans-serif;
  cursor: pointer;
  text-align: center;
}
#rol-newrec-picker .cp-square.current {
  border-color: #111;
}
#rol-newrec-picker .cp-square:hover {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
#rol-newrec-picker .cp-foot {
  padding: 10px 18px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
}
#rol-newrec-picker .cp-msg {
  flex: 1;
  font: 0.82rem Arial, sans-serif;
}
#rol-newrec-picker .cp-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}
#rol-newrec-picker .cp-actions button {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font: 700 0.9rem Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
#rol-newrec-picker .cp-ask-mazda {
  background: #2563eb;
  color: #fff;
}
#rol-newrec-picker .cp-view-receipt,
#rol-newrec-picker .cp-close {
  background: #e5e7eb;
  color: #111827;
}
#rol-newrec-mazda .mz-panel {
  background: #fff;
  border-radius: 14px;
  width: min(720px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
#rol-newrec-mazda .mz-head {
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}
#rol-newrec-mazda .mz-head h3 {
  margin: 0;
  font: 700 1.05rem Arial, sans-serif;
  color: #0f172a;
}
#rol-newrec-mazda .mz-body {
  overflow-y: auto;
  padding: 14px 18px;
}
#rol-newrec-mazda .mz-foot {
  padding: 10px 18px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
#rol-newrec-mazda .mz-back {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font: 700 0.9rem Arial, sans-serif;
  cursor: pointer;
  background: #e5e7eb;
  color: #111827;
}

/* Report tab whose report.html is missing on disk (also used for every
   document under an unavailable month, e.g. February 2025). */
.tab.report-missing {
  background: #e53935;
  color: #fff;
  font-weight: 700;
}
.tab.report-missing:hover,
.tab.report-missing:focus-visible {
  background: #c62828;
}

/* Receipt Only is real completed intake work, even before statement PDFs are
   processed. Show its resolved receipt count as green progress. */
.tab.receipt-progress {
  background: #43a047;
  color: #fff;
  font-weight: 700;
}
.tab.receipt-progress:hover,
.tab.receipt-progress:focus-visible {
  background: #388e3c;
}

/* Month overview landing page (Project Plans → ROL Finance → Reports →
   <month>) — one color-coded row per document instead of jumping straight
   into the first document's report. */
.rol-overview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.rol-overview-table th,
.rol-overview-table td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.rol-overview-table tbody tr {
  cursor: pointer;
}
.rol-overview-table tr.rol-status-pass {
  background: rgba(46, 125, 50, 0.35);
}
.rol-overview-table tr.rol-status-pass:hover {
  background: rgba(46, 125, 50, 0.5);
}
.rol-overview-table tr.rol-status-review {
  background: rgba(245, 178, 8, 0.3);
}
.rol-overview-table tr.rol-status-review:hover {
  background: rgba(245, 178, 8, 0.45);
}
.rol-overview-table tr.rol-status-fail {
  background: rgba(198, 40, 40, 0.35);
}
.rol-overview-table tr.rol-status-fail:hover {
  background: rgba(198, 40, 40, 0.5);
}
.rol-attention-tab-link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.rol-attention-tab-link:hover {
  color: #0d6efd;
}

/* New Records (Project Plans → ROL Finance → Reports → <month>, above
   Document Status) — same clickable color-coded-row pattern as the
   Verified Transactions table inside each report.html, including its
   red top-left corner marker, so a human scans both the same way. */
.rol-recent-reports h3 {
  margin: 0 0 6px;
}
.rol-recent-table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 0;
  margin-bottom: 18px;
}
.rol-recent-table th,
.rol-recent-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}
.rol-recent-table th {
  background-color: #f2f2f2;
}
.rol-recent-table tbody tr td:first-child {
  position: relative;
}
.rol-recent-table tbody tr.rol-recent-needs-attention td:first-child::before,
.rol-recent-table tbody tr.has-receipt td:first-child::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 9px 0 0;
  border-color: #dc2626 transparent transparent transparent;
  pointer-events: none;
}
.rol-recent-table tbody tr {
  cursor: pointer;
}
.rol-recent-table tbody tr:hover {
  filter: brightness(0.93);
}
.rol-recent-empty {
  opacity: 0.7;
  margin: 0 0 18px;
}

.srv-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 12px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #f0f0f0;
}
.srv-led {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #999;
  animation: none;
}
.srv-status.up {
  background: #e8f5e9;
}
.srv-status.up .srv-led {
  background: #43a047;
  box-shadow: 0 0 6px #43a047;
}
.srv-status.down {
  background: #fdecea;
}
.srv-status.down .srv-led {
  background: #e53935;
  box-shadow: 0 0 6px #e53935;
}
.srv-status.starting {
  background: #fff8e1;
}
.srv-status.starting .srv-led {
  background: #f9a825;
  box-shadow: 0 0 6px #f9a825;
  animation: pulse-yellow 1s ease-in-out infinite;
}
/* Detail-panel "concern" pill — yellow, matching the sidebar tab. */
.srv-status.concern {
  background: #fff8e1;
}
.srv-status.concern .srv-led {
  background: #f9a825;
  box-shadow: 0 0 6px #f9a825;
}
@keyframes pulse-yellow {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.srv-start-btn {
  background: #43a047;
  color: #fff;
  border: 0;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 10px;
}
.srv-start-btn:hover {
  background: #388e3c;
}
.srv-start-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}
.srv-note {
  color: #666;
  font-size: 0.82rem;
  margin: 0 0 10px;
}
.srv-filter {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  margin-bottom: 10px;
}
.msi-console {
  background: #000;
  color: #fff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  height: 60vh;
  min-height: 320px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 2px inset #888;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  scroll-behavior: smooth;
}

/* ---- Status > Servers summary table ---- */
.srv-summary-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.srv-summary-stamp {
  font-size: 0.82rem;
  color: #888;
}
.srv-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}
.srv-table th,
.srv-table td {
  border: 1px solid #ddd;
  padding: 8px 12px;
  text-align: left;
  font-size: 0.88rem;
  vertical-align: top;
}
.srv-table th {
  background: #f5f5f5;
  font-weight: 700;
}
.srv-table tr:hover td {
  background: #f9f9ff;
}
.srv-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.srv-badge.up {
  background: #e8f5e9;
  color: #2e7d32;
}
.srv-badge.down {
  background: #ffebee;
  color: #c62828;
}
.srv-badge.starting {
  background: #fff8e1;
  color: #8a5a00;
}
.srv-badge.unknown {
  background: #eceff1;
  color: #455a64;
}
.srv-skills {
  font-size: 0.76rem;
  color: #555;
  margin: 0;
  padding: 0;
  list-style: none;
}
.srv-skills li {
  display: inline-block;
  background: #eef2ff;
  color: #3949ab;
  padding: 1px 7px;
  border-radius: 8px;
  margin: 2px 2px 0 0;
}

/* Stack the nav on top with the content below it when the viewport is
       narrow OR the device has a coarse (touch) pointer. Android tablets/phones
       report a coarse pointer even at widths above 900px, where the desktop
       two-column layout would otherwise leave the report squeezed into a skinny
       column beside the fixed sidebar. */
@media (max-width: 900px), (pointer: coarse) {
  body {
    margin: 0;
  }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    top: 0;
    padding: 10px;
  }
  .sidebar h1 {
    font-size: 1rem;
    margin-bottom: 10px;
  }
  .sidebar nav {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .content {
    margin: 0;
    border-radius: 0;
    padding: 14px;
  }
  .tab {
    font-size: 0.82rem;
    padding: 6px;
    text-align: center;
  }
}
@media (max-width: 560px) {
  .sidebar nav {
    grid-template-columns: 1fr;
  }
}

/* ---- Code-change alert ---- */
@keyframes tab-alert-blink {
  0%,
  49% {
    background: #ffd43b;
    color: #333;
  }
  50%,
  100% {
    background: var(--tab);
    color: #fff;
  }
}
.tab.tab-alert {
  animation: tab-alert-blink 1s step-end infinite;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.hidden {
  display: none;
}

/* The provider-token decision can arrive while the startup checks are still
   running. Keep that confirmation above the startup curtain and interactive;
   startup-loading intentionally disables every other dashboard control. */
#provider-token-sync-modal {
  z-index: 10000;
}
body.startup-loading #provider-token-sync-modal button {
  pointer-events: auto;
  background: revert !important;
  color: revert !important;
  cursor: pointer !important;
  box-shadow: revert !important;
}
.modal-box {
  background: #fff;
  color: #333;
  padding: 20px 24px;
  border-radius: 8px;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.win98-confirm-box {
  padding: 3px;
  border: 2px outset #fff;
  border-radius: 0;
  background: #c0c0c0;
  box-shadow: 2px 2px 0 #000;
  font-family: "MS Sans Serif", Tahoma, sans-serif;
}
.win98-confirm-title {
  padding: 3px 5px;
  background: #000080;
  color: #fff;
  font-weight: 700;
}
.win98-confirm-box p { padding: 10px 14px 0; }
.win98-confirm-box .modal-actions { padding: 0 10px 10px; }
.win98-confirm-box button { min-width: 72px; }
.win98-progress-shell {
  height: 20px;
  padding: 2px;
  border: 2px inset #808080;
  background: #c0c0c0;
}
.win98-progress-fill {
  height: 100%;
  width: 0%;
  background-image: repeating-linear-gradient(
    90deg, #000080 0, #000080 6px, #c0c0c0 6px, #c0c0c0 8px
  );
  transition: width 220ms ease;
}
.win98-progress-fill.warn {
  background-image: repeating-linear-gradient(
    90deg, #b8860b 0, #b8860b 6px, #c0c0c0 6px, #c0c0c0 8px
  );
}
.win98-progress-fill.danger {
  background-image: repeating-linear-gradient(
    90deg, #800000 0, #800000 6px, #c0c0c0 6px, #c0c0c0 8px
  );
}
.vendor-review-panel {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(10, 16, 24, 0.6);
}

.vendor-review-panel.hidden {
  display: none;
}

.vendor-review-title {
  font-weight: 700;
  color: #cfe3ff;
  margin-bottom: 8px;
}

.vendor-review-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}

.vendor-review-row:last-child {
  border-bottom: none;
}

.vendor-review-row-summary {
  color: #e8eefc;
}

.vendor-review-row-image {
  color: #6fb6ff;
}

#vendor-picker-modal .modal-box {
  max-width: 460px;
  width: 90%;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.vendor-picker-filter {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}

.vendor-picker-list {
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}

.vendor-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid #eee;
  background: none;
  cursor: pointer;
  font-size: 0.88rem;
}

.vendor-picker-item:hover {
  background: #f0f4fa;
}

.vendor-picker-msg {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #b00;
}

#vision-halted-modal .modal-box {
  max-width: 480px;
}
.vision-halted-detail {
  font-size: 0.85em;
  color: #666;
  margin-top: 8px;
  white-space: pre-line;
}

/* ── Statement review dialog (Scanner screen) ──────────────────────────────
   Pops when a scanned statement could not be stored: either its card is
   missing from Known_Credit_Cards_and_Banks.xlsx, or a transaction amount was
   unreadable. Styled to match the ROL category picker. */
.statement-review-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}
.statement-review-overlay .srd-panel {
  background: #fff;
  border-radius: 14px;
  width: min(560px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.statement-review-overlay .srd-head {
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}
.statement-review-overlay .srd-head h3 {
  margin: 0 0 4px;
  font: 700 1.05rem Arial, sans-serif;
  color: #0f172a;
}
.statement-review-overlay .srd-head p {
  margin: 0;
  font: 0.82rem Arial, sans-serif;
  color: #6b7280;
}
.statement-review-overlay .srd-body {
  overflow-y: auto;
  padding: 14px 18px;
}
.statement-review-overlay .srd-message {
  margin: 0 0 12px;
  font: 0.95rem/1.5 Arial, sans-serif;
  color: #0f172a;
}
.statement-review-overlay .srd-document {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
}
.statement-review-overlay .srd-document span {
  display: block;
  margin-bottom: 4px;
  font: 700 0.78rem Arial, sans-serif;
  color: #475569;
}
.statement-review-overlay .srd-document code {
  display: block;
  overflow-wrap: anywhere;
  font: 0.8rem/1.4 monospace;
  color: #0f172a;
}
.statement-review-overlay .srd-row {
  display: block;
  padding: 10px 0;
  border-top: 1px solid #f1f5f9;
}
.statement-review-overlay .srd-row-label {
  display: block;
  font: 700 0.9rem Arial, sans-serif;
  color: #0f172a;
  margin-bottom: 6px;
}
.statement-review-overlay .srd-row-label em {
  font: 0.8rem Arial, sans-serif;
  color: #6b7280;
  font-style: normal;
  margin-left: 8px;
}
.statement-review-overlay .srd-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.statement-review-overlay .srd-currency {
  font: 700 1rem Arial, sans-serif;
  color: #6b7280;
}
.statement-review-overlay .srd-amount {
  font: 1rem Arial, sans-serif;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  width: 140px;
}
.statement-review-overlay .srd-amount:focus {
  outline: 2px solid #2563eb;
  outline-offset: -1px;
}
.statement-review-overlay .srd-error {
  display: block;
  margin-top: 6px;
  font: 0.8rem Arial, sans-serif;
  color: #b91c1c;
}
.statement-review-overlay .srd-banner {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef3c7;
  color: #92400e;
  font: 0.85rem/1.4 Arial, sans-serif;
}
.statement-review-overlay .srd-foot {
  padding: 12px 18px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.statement-review-overlay .srd-later,
.statement-review-overlay .srd-ask-mazda,
.statement-review-overlay .srd-show-document,
.statement-review-overlay .srd-ok {
  border: 0;
  border-radius: 8px;
  padding: 9px 18px;
  font: 700 0.9rem Arial, sans-serif;
  cursor: pointer;
}
.statement-review-overlay .srd-later {
  background: #e5e7eb;
  color: #111827;
}
.statement-review-overlay .srd-ask-mazda {
  background: #7c3aed;
  color: #fff;
}
.statement-review-overlay .srd-show-document {
  background: #475569;
  color: #fff;
}
.statement-review-overlay .srd-ok {
  background: #2563eb;
  color: #fff;
}
.statement-review-overlay .srd-ok[disabled] {
  background: #93c5fd;
  cursor: not-allowed;
}

/* Start/Stop Listening pulse. The button carries an inline background (set by
   InputOptionsRenderer), which a plain class rule could not override — an
   animation can, so the red pulse is expressed as keyframes. */
@keyframes listen-blink {
  0%,
  49% {
    background: #c62828;
  }
  50%,
  100% {
    background: #7f1d1d;
  }
}

/* ---- System Status: Mazda tool reconciliation ---- */
/* The left border carries the verdict: green agreed, amber stale, red
   missing. Colours match the .ms-bar-fill palette already used for PC
   Monitor thresholds, so one glance means the same thing on both pages. */
.mtr-card {
  max-width: 720px;
  padding: 12px 16px;
  border-left: 4px solid #43a047;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}
.mtr-card.mtr-warn {
  border-left-color: #f9a825;
}
.mtr-card.mtr-bad {
  border-left-color: #e53935;
}
.mtr-card h3 {
  margin: 0 0 8px;
}
.mtr-tools {
  margin: 6px 0 12px;
  padding-left: 20px;
  columns: 2;
}
.mtr-tools li {
  break-inside: avoid;
}
.mtr-missing code {
  color: #e53935;
}
.mtr-stale code {
  color: #f9a825;
}
.mtr-fix-label {
  margin: 10px 0 4px;
  font-weight: 700;
}
/* The command is meant to be selected and pasted, so it wraps rather than
   scrolling off the right edge where half of it would be invisible. */
.mtr-fix {
  margin: 0 0 8px;
  padding: 8px 10px;
  background: #111827;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.82rem;
  user-select: all;
}
.mtr-detail {
  margin: 10px 0;
}
.mtr-detail summary {
  cursor: pointer;
}
