/* The statement check (/check). Hand-written, like the app's other stylesheets. */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1f2430;
  --muted: #5b6475;
  --line: #dde1e7;
  --accent: #1f2937;
  --in: #15803d;
  --out: #b91c1c;
  --warn: #b45309;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }

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

/* ---- the bar across the top */
.sc-bar {
  display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.sc-brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.sc-brand span { font-weight: 400; color: var(--muted); margin-left: 4px; }
.sc-private { flex: 1; display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--in); }
.sc-private svg { width: 14px; height: 14px; fill: currentColor; flex: none; }

.sc-button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  font: inherit; font-size: 13px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.sc-button:hover { border-color: #b9c0cb; }
.sc-button:disabled { opacity: 0.5; cursor: default; }
.sc-button input[type="file"] { display: none; }
.sc-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.sc-primary:hover { background: #374151; }
.sc-link { padding: 0; font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; }

/* ---- opening a file: the start, password, busy and failure screens */
.sc-start { flex: 1; display: grid; place-items: center; padding: 24px; }
.sc-panel {
  max-width: 520px; padding: 32px; text-align: center; background: var(--panel);
  border-radius: 12px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.08), 0 8px 24px rgb(0 0 0 / 0.06);
}
.sc-panel h1 { margin: 0 0 8px; font-size: 22px; }
.sc-panel p { color: var(--muted); }
.sc-panel input[type="password"] {
  display: block; width: 100%; margin: 0 0 12px; padding: 8px 10px;
  font: inherit; border: 1px solid var(--line); border-radius: 6px;
}
.sc-hint { font-size: 12px; color: var(--muted); }
.sc-fineprint { margin-bottom: 0; font-size: 12px; }
body.sc-dragging .sc-panel { outline: 3px dashed #2563eb; outline-offset: 6px; }
.sc-spinner {
  width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: sc-spin 0.8s linear infinite;
}
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ---- the result: findings on the left, the document on the right */
.sc-result { flex: 1; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.sc-side {
  display: flex; flex-direction: column; gap: 22px; overflow: auto; padding: 16px;
  background: var(--panel); border-right: 1px solid var(--line);
}
.sc-side h3 { margin: 0 0 4px; font-size: 14px; }
.sc-side h4 { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; font-size: 13px; }
.sc-filename { margin: 0 0 10px; font-size: 15px; overflow-wrap: anywhere; }
/* The system that handed the statements over, and the application it named (CR 019). */
.sc-source {
  display: flex; flex-direction: column; gap: 2px; margin: 0 0 14px; padding: 8px 10px;
  font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.sc-source strong { overflow-wrap: anywhere; }
.sc-source span { color: var(--muted); }
.sc-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 12px; font-size: 13px; }
.sc-facts dt { color: var(--muted); }
.sc-facts dd { margin: 0; overflow-wrap: anywhere; }
.sc-note {
  margin: 0 0 12px; padding: 8px 10px; font-size: 13px;
  background: #fffbeb; border-left: 3px solid var(--warn); border-radius: 4px;
}
.sc-verdict {
  margin: 0 0 12px; padding: 10px 12px; font-size: 13px;
  background: #fef2f2; border: 1px solid #fecaca; border-left: 4px solid var(--out); border-radius: 6px;
}
.sc-verdict strong { display: block; color: var(--out); }
.sc-verdict p { margin: 4px 0 0; }
.sc-count { margin: 0; font-size: 13px; color: var(--muted); }
.sc-unbalanced-list { margin: 0 0 12px; }
.sc-unbalanced-list summary { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--out); cursor: pointer; }
.sc-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--c); }

.sc-list { margin: 0; padding: 0; list-style: none; }
.sc-item {
  margin-bottom: 6px; padding: 7px 10px; cursor: pointer;
  border: 1px solid var(--line); border-left: 3px solid var(--c, var(--muted)); border-radius: 6px;
}
.sc-item:hover { background: #f7f8fa; }
.sc-item.sc-active { box-shadow: 0 0 0 2px var(--c, var(--accent)); }
.sc-item-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.sc-desc { margin: 2px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.sc-desc mark {
  padding: 0 1px; color: inherit; border-radius: 2px;
  background: color-mix(in srgb, var(--c) 28%, white);
}
.sc-amount, .sc-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sc-out { color: var(--out); }
.sc-in { color: var(--in); }
.sc-tag {
  display: inline-block; margin: 1px 2px 1px 0; padding: 0 6px; font-size: 11px; border-radius: 9px;
  color: color-mix(in srgb, var(--c, var(--muted)) 75%, black);
  background: color-mix(in srgb, var(--c, var(--muted)) 14%, white);
}

/* ---- several statements: an account per card, its statements inside */
.sc-statements-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sc-names { margin: 4px 0; padding-left: 18px; }
.sc-names li { overflow-wrap: anywhere; }
.sc-note p { margin: 4px 0 0; }
.sc-note-ok { background: #f0fdf4; border-left-color: var(--in); }
.sc-account { margin-bottom: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.sc-account-head { margin-bottom: 8px; }
.sc-account-head h4 { margin: 0; font-size: 14px; }
.sc-account-head .sc-hint { margin: 2px 0 0; overflow-wrap: anywhere; }
.sc-account > .sc-note { margin-bottom: 8px; }
.sc-statement { margin-top: 8px; padding: 8px 10px 0; border: 1px solid #edf0f3; border-radius: 6px; }
.sc-statement.sc-current { border-color: var(--accent); }
.sc-statement .sc-facts { margin-bottom: 8px; }
.sc-statement-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sc-statement-name {
  padding: 0; font: inherit; font-size: 13px; font-weight: 600; text-align: left; color: var(--ink);
  background: none; border: 0; cursor: pointer; overflow-wrap: anywhere;
}
.sc-statement-name:hover { text-decoration: underline; }
.sc-statement .sc-chip-remove { padding: 0 2px; font-size: 15px; line-height: 1; background: none; border: 0; cursor: pointer; }
.sc-check-group { margin-bottom: 8px; }
.sc-check-group summary { margin-bottom: 6px; font-size: 13px; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }

/* ---- the keyword lists */
.sc-keywords-head { display: flex; align-items: baseline; justify-content: space-between; }
#sc-keywords > .sc-hint { margin: 0 0 10px; }
.sc-category { margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.sc-category-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.sc-category-title input { margin: 0; }
.sc-category-title .sc-hint { font-weight: 400; }
.sc-category.sc-off .sc-chips, .sc-category.sc-off .sc-category-name { opacity: 0.45; }
.sc-badge { margin-left: auto; padding: 0 7px; font-size: 11px; color: #fff; background: var(--c); border-radius: 9px; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.sc-chip {
  display: inline-flex; align-items: center; font-size: 11.5px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 40%, white);
  background: color-mix(in srgb, var(--c) 9%, white);
}
.sc-chip button { padding: 2px 4px; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sc-chip-name { padding-left: 8px !important; }
.sc-chip-remove { padding-right: 7px !important; color: var(--muted) !important; }
.sc-chip-remove:hover { color: var(--out) !important; }
.sc-chip.sc-off { background: transparent; border-style: dashed; }
.sc-chip.sc-off .sc-chip-name { color: var(--muted); text-decoration: line-through; }

/* ---- tags: the list in the side panel, the chips in the table, and the bar for the picked rows */
.sc-tag-item .sc-desc { color: var(--muted); }
.sc-tag-item .sc-chip-remove { padding: 0 2px; font-size: 14px; line-height: 1; background: none; border: 0; cursor: pointer; }
.sc-tag-name { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.sc-tag.sc-own { display: inline-flex; align-items: center; gap: 2px; padding-right: 2px; }
.sc-tag-remove { padding: 0 3px; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; opacity: 0.6; }
.sc-tag-remove:hover { opacity: 1; }
.sc-tagbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 16px;
  font-size: 13px; background: var(--panel); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 8px rgb(0 0 0 / 0.06);
}
.sc-tagbar .sc-add { flex: 0 1 260px; }
.sc-tag-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font: inherit; font-size: 12px;
  color: var(--ink); background: var(--panel); border: 1px solid color-mix(in srgb, var(--c) 45%, white);
  border-radius: 999px; cursor: pointer;
}
.sc-tag-toggle::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.sc-tag-toggle[aria-pressed="true"] { color: #fff; background: var(--c); border-color: var(--c); }
.sc-tag-toggle[aria-pressed="true"]::before { background: #fff; }
.sc-add { display: flex; gap: 6px; }
.sc-add input {
  flex: 1; min-width: 0; padding: 4px 8px; font: inherit; font-size: 12px;
  border: 1px solid var(--line); border-radius: 6px;
}
.sc-add .sc-button { padding: 3px 10px; font-size: 12px; }

/* ---- the document and the table */
.sc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sc-tabs { display: flex; gap: 4px; padding: 8px 16px 0; background: #eceef2; border-bottom: 1px solid var(--line); }
.sc-tabs button {
  margin-bottom: -1px; padding: 6px 14px; font: inherit; font-size: 13px; color: var(--muted);
  background: none; border: 1px solid transparent; border-radius: 6px 6px 0 0; cursor: pointer;
}
.sc-tabs button[aria-selected="true"] { color: var(--ink); background: var(--bg); border-color: var(--line); border-bottom-color: var(--bg); }
.sc-scroll { flex: 1; position: relative; overflow: auto; }
.sc-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sc-toolbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.sc-toolbar input {
  flex: 0 1 320px; min-width: 0; padding: 5px 9px; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 6px;
}

.sc-toolbar select, .sc-report-bar select {
  max-width: 100%; padding: 5px 8px; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}

#sc-pages { display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 24px 24px 40px; }
.sc-page { position: relative; flex: none; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); }
.sc-page canvas { display: block; width: 100%; height: 100%; }
.sc-page-number { position: absolute; right: 0; bottom: -20px; font-size: 11px; color: var(--muted); }

/* Marks are multiplied onto the page, so a highlight tints the print under it, as a marker would.
   Every transaction has an invisible area to click; a picked one is outlined. */
.sc-marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; mix-blend-mode: multiply; }
.sc-mark { pointer-events: visiblePainted; cursor: pointer; }
.sc-area { fill: transparent; pointer-events: all; }
.sc-row:hover .sc-area { fill: var(--accent); fill-opacity: 0.05; }
.sc-row.sc-picked .sc-area { fill: #2563eb; fill-opacity: 0.08; stroke: #2563eb; stroke-width: 1; stroke-dasharray: 4 2; }
.sc-band { fill-opacity: 0.1; }
.sc-word { fill-opacity: 0.38; stroke: none; }
.sc-loose .sc-word { fill-opacity: 0.22; stroke-width: 0.8; stroke-dasharray: 3 2; }
.sc-row.sc-active .sc-band { fill-opacity: 0.26; animation: sc-pulse 1.2s ease-out 2; }
@keyframes sc-pulse { 50% { fill-opacity: 0.45; } }
/* A row that doesn't add up against the running balance: outlined, so a flag's shading still shows. */
.sc-marks .sc-unbalanced { fill: var(--out); fill-opacity: 0.04; stroke: var(--out); stroke-width: 1.2; }
.sc-row.sc-active .sc-unbalanced { stroke-width: 2.4; animation: sc-pulse-line 1.2s ease-out 2; }
@keyframes sc-pulse-line { 50% { stroke-opacity: 0.35; } }

.sc-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); }
.sc-table th {
  position: sticky; top: 0; z-index: 1; padding: 8px 10px; text-align: left; font-weight: 600;
  background: #eceef2; border-bottom: 1px solid var(--line);
}
.sc-table td { padding: 6px 10px; vertical-align: top; border-bottom: 1px solid #edf0f3; }
.sc-table td.sc-date { white-space: nowrap; color: var(--muted); }
.sc-table .sc-num { text-align: right; }
.sc-table tbody tr { cursor: pointer; }
.sc-table tbody tr:hover { background: #f7f8fa; }
.sc-table tr.sc-flagged { background: #fffaf0; }
.sc-table tr.sc-picked { background: #eff6ff; }
.sc-table tr.sc-active { outline: 2px solid var(--accent); outline-offset: -2px; }
.sc-table tr.sc-unbalanced td:first-child { box-shadow: inset 3px 0 0 var(--out); }
.sc-table .sc-unbalanced-balance { color: var(--out); font-weight: 600; }
.sc-table .sc-unbalanced-balance::before { content: "≠ "; }
.sc-table .sc-check { width: 1%; padding-right: 0; cursor: default; }
.sc-table .sc-check input { margin: 2px 0 0; cursor: pointer; }
.sc-empty { padding: 24px; color: var(--muted); }

/* A row another statement of its account already holds: shown, left out of the totals. */
.sc-table tr.sc-covered td:not(.sc-check) { color: var(--muted); }
.sc-table tr.sc-covered .sc-num { text-decoration: line-through; }
.sc-row-note { display: block; margin-top: 2px; font-size: 11.5px; color: var(--warn); }
.sc-table .sc-account-cell { white-space: nowrap; color: var(--muted); }

/* A transfer between two of the accounts open: where the money went, and the reviewer's button. */
.sc-table tr.sc-paired { background: #f8fafc; }
.sc-table .sc-transfer-cell { min-width: 150px; }
.sc-pair {
  display: block; margin-bottom: 2px; padding: 1px 7px; font: inherit; font-size: 11.5px; text-align: left;
  color: #334155; background: #e2e8f0; border: 0; border-radius: 9px; cursor: pointer;
}
.sc-pair:hover { background: #cbd5e1; }
.sc-pair-possible { color: var(--warn); background: #fef3c7; }
.sc-pair-possible:hover { background: #fde68a; }
.sc-link-item .sc-link { margin-top: 4px; }
.sc-link-possible { border-left-color: var(--warn); }

/* ---- the Summary tab */
#sc-report { padding: 8px 24px 40px; }
.sc-report-bar { max-width: 1100px; margin-top: 16px; font-size: 13px; }
.sc-report-bar label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.sc-report-bar .sc-hint { margin: 6px 0 0; }
.sc-report { max-width: 1100px; margin-top: 20px; }
.sc-report h3 { margin: 0 0 2px; font-size: 15px; }
.sc-report > .sc-hint { margin: 0 0 10px; }
.sc-report-table { width: auto; min-width: 560px; border: 1px solid var(--line); }
.sc-report-table th { position: static; white-space: nowrap; }
.sc-report-table tbody tr { cursor: default; }
.sc-report-table tfoot th { background: #f7f8fa; border-top: 1px solid var(--line); border-bottom: 0; }
.sc-report-table .sc-link { font-size: 12px; }
.sc-group-name { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sc-nil { color: #b6bcc6; }

@media (max-width: 900px) {
  .sc-result { grid-template-columns: 1fr; grid-template-rows: minmax(0, 45vh) minmax(0, 1fr); }
  .sc-side { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---- the enterprise page's document checks (statement_check/enterprise) */
.sc-finding {
  display: flex; gap: 8px; margin-bottom: 6px; padding: 7px 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 6px;
}
.sc-finding-icon {
  flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--muted); border-radius: 50%;
}
.sc-finding-body { min-width: 0; }
.sc-finding-body strong { display: block; }
.sc-finding-ok .sc-finding-icon { background: var(--in); }
.sc-finding-fail { background: #fef2f2; border-color: #fecaca; }
.sc-finding-fail .sc-finding-icon { background: var(--out); }
.sc-finding-warn { background: #fffbeb; border-color: #fde68a; }
.sc-finding-warn .sc-finding-icon { background: var(--warn); }
