:root {
  /* surfaces */
  --bg: #f6f8fb;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --border: #d9e2ec;

  /* text */
  --text: #072b54;
  --text-dim: #6b7a8c;

  /* brand */
  --primary: #052f63;
  --primary-hover: #0a3d75;
  --accent: #052f63;
  --gold: #f3c84b;

  /* status */
  --warning: #d79b18;
  --warning-bg: #fff6d8;
  --critical: #d94a38;
  --critical-bg: #fdeaea;
  --ok: #237a55;
  --ok-bg: #e6f5ee;
  --info: #174e8c;
  --info-bg: #eaf2fb;

  /* radius */
  --radius-sm: .25rem;
  --radius-md: .375rem;
  --radius-lg: .5rem;
  --radius-xl: .75rem;
  --radius-2xl: 1rem;

  /* shadow */
  --shadow-xs: 0 1px 3px rgba(7, 43, 84, .07);
  --shadow-sm: 0 2px 10px rgba(7, 43, 84, .1);

  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "DM Serif Display", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow-xs);
}

.brand-block { display: flex; flex-direction: column; gap: 2px; }
.brand-eyebrow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.brand {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  color: var(--primary);
  letter-spacing: -.2px;
}
.brand a { color: inherit; text-decoration: none; }
.brand span { color: var(--gold); }

.header-nav { display: flex; align-items: center; gap: 18px; }
.header-nav a { font-size: 13px; color: var(--text-dim); font-weight: 500; }
.header-nav a:hover { color: var(--primary); text-decoration: none; }

.pill-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text) !important;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
}
.pill-link:hover { border-color: var(--primary); color: var(--primary) !important; text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.container-wide { max-width: 1370px; }

/* ---------- page heading ---------- */

.page-head { margin-bottom: 22px; }
.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -.3px;
}
.page-subtitle { font-size: 13px; color: var(--text-dim); margin: 0; }

/* ---------- card ---------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}
.card-body { padding: 16px 18px; }

/* ---------- table ---------- */

table { width: 100%; border-collapse: collapse; }
.card table { border: none; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); font-size: 13px; }
th:last-child, td:last-child { border-right: none; }
th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

.received-date { white-space: nowrap; }
.received-time { white-space: nowrap; color: var(--text-dim); font-size: 11px; margin-top: 2px; }

/* .doc-table's <colgroup> gives every column a fixed share of the table
   width; text-heavy columns wrap within that share instead of forcing the
   table wider than its container. .table-scroll's overflow-x is just a
   safety net for viewports too narrow to fit even the wrapped layout. */
.table-scroll { overflow-x: auto; }
.doc-table { table-layout: fixed; }
.doc-table th, .doc-table td { overflow-wrap: break-word; word-break: break-word; }
.doc-table th:nth-child(2), .doc-table td:nth-child(2),
.doc-table th:nth-child(7), .doc-table td:nth-child(7),
.doc-table th:nth-child(8), .doc-table td:nth-child(8),
.doc-table th:nth-child(10), .doc-table td:nth-child(10),
.doc-table th:nth-child(11), .doc-table td:nth-child(11) {
  white-space: nowrap;
}
.doc-table th:last-child, .doc-table td:last-child { text-align: center; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.badge-status-needs_review, .badge-status-processing, .badge-status-queued, .badge-status-received { color: var(--warning); background: var(--warning-bg); border-color: transparent; }
.badge-status-extracted { color: var(--info); background: var(--info-bg); border-color: transparent; }
.badge-status-approved, .badge-status-synced { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge-status-failed, .badge-status-rejected { color: var(--critical); background: var(--critical-bg); border-color: transparent; }

/* ---------- buttons ---------- */

.btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-danger { border-color: var(--critical); color: var(--critical); }
.btn-danger:hover:not(:disabled) { background: var(--critical-bg); border-color: var(--critical); color: var(--critical); }
.btn-ok { border-color: var(--ok); color: var(--ok); }
.btn-ok:hover:not(:disabled) { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

.btn-icon { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 0 2px; font-size: 12px; }
.btn-icon:hover { color: var(--primary); }

/* ---------- form fields ---------- */

input, select, textarea {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 13px;
  font-family: var(--font-sans);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 47, 99, .12);
}

/* ---------- auth (login / signup) split screen ---------- */

.auth-shell { display: flex; min-height: 100vh; background: var(--bg); }

.auth-brand-panel { display: none; }
@media (min-width: 1024px) {
  .auth-brand-panel {
    display: flex;
    width: 50%;
    flex-direction: column;
    justify-content: space-between;
    background: var(--primary);
    padding: 48px;
    position: relative;
    overflow: hidden;
  }
  .auth-brand-panel::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 6px;
    background: var(--gold);
  }
}

.auth-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .6);
  margin: 0 0 16px;
}
.auth-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 3px;
  background: var(--gold);
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--primary);
}
.auth-title {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -.5px;
  color: #fff;
}
.auth-rule { margin: 16px 0; width: 36px; border: none; border-top: 1px solid rgba(255, 255, 255, .2); }
.auth-tagline { font-size: 15px; color: rgba(255, 255, 255, .7); line-height: 1.6; max-width: 30ch; margin: 0; }
.auth-url { font-size: 13px; color: rgba(255, 255, 255, .4); margin: 0; }

.auth-form-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 32px; }
.auth-form-wrap { width: 100%; max-width: 380px; }
.auth-mobile-badge { display: block; text-align: center; margin-bottom: 32px; }
@media (min-width: 1024px) { .auth-mobile-badge { display: none; } }

.auth-heading-block { margin-bottom: 28px; }
.auth-heading { font-family: var(--font-display); font-size: 28px; font-weight: 400; letter-spacing: -.3px; color: var(--text); margin: 0; }
.auth-subtext { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); }
.auth-hint { margin: 6px 0 0; font-size: 11px; line-height: 1.45; color: var(--text-dim); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.auth-field input { width: 100%; padding: 10px 12px; }
.auth-error { color: var(--critical); font-size: 12px; min-height: 16px; }
.auth-footer-link { margin-top: 20px; font-size: 13px; color: var(--text-dim); text-align: center; }

/* ---------- review screen ---------- */

.review-shell { display: flex; height: calc(100vh - 118px); }
.pane-source { width: 45%; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: #fff; }
.pane-toolbar { padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 12px; font-weight: 500; background: var(--bg-panel); }
.pdf-pages { flex: 1; overflow-y: auto; padding: 16px; }
.pdf-page-wrap { max-width: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }
.pdf-highlight {
  background: rgba(255, 214, 0, 0.35);
  border: 1.5px solid #e0a800;
  border-radius: 2px;
  pointer-events: none;
}
.pane-form { width: 55%; overflow-y: auto; padding: 20px 24px; background: var(--bg); }

.locked-banner {
  background: var(--critical-bg);
  border: 1px solid var(--critical);
  color: var(--critical);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}

.tx-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: 18px;
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}
.tx-card-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.tx-card-body { padding: 14px 16px; }

.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; margin-bottom: 14px; }
.field-grid label { display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-dim); margin-bottom: 3px; }
.field-grid input, .field-grid select { width: 100%; }
.field-total { font-size: 21px; font-weight: 700; font-family: var(--font-display); color: var(--primary); }

.flag-card {
  border-left: 3px solid var(--warning);
  background: var(--warning-bg);
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
}
.flag-card.critical { border-left-color: var(--critical); background: var(--critical-bg); }
.flag-card.info { border-left-color: var(--info); background: var(--info-bg); }
.flag-card .flag-actions { margin-top: 8px; display: flex; gap: 8px; }

.li-table { width: 100%; font-size: 12px; margin-bottom: 12px; }
.li-table th, .li-table td { padding: 6px 8px; }
.li-table input, .li-table select { width: 100%; font-size: 12px; }
.li-flagged { background: var(--warning-bg); }
.li-table .li-conf { text-align: right; white-space: nowrap; }

/* Extraction-confidence pills (review.js confidencePill). Same green/amber/
   red tokens the status badges use, so "green" means the same thing
   everywhere on the page. */
.conf-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  cursor: help;
}
.li-table .conf-pill { margin-left: 0; }
.conf-high { color: var(--ok); background: var(--ok-bg); }
.conf-medium { color: var(--warning); background: var(--warning-bg); }
.conf-low { color: var(--critical); background: var(--critical-bg); }

.conf-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-dim);
}
.conf-legend .conf-pill { margin-left: 0; }

/* ---------- workspace switcher / practice view ---------- */

.ws-select {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  max-width: 220px;
}
.ws-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
}

.count-attention { color: var(--warning); font-weight: 700; }
.count-critical { color: var(--critical); font-weight: 700; }
.count-ok { color: var(--ok); font-weight: 700; }
.count-muted { color: var(--text-dim); font-weight: 600; }

/* ---------- per-line GL coding (review page) ---------- */

.li-coding-row td { padding-top: 0; padding-bottom: 8px; border-top: none; }
.coding-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
/* label + select travel together, so a narrow pane wraps whole fields
   rather than orphaning a label at the end of a line. */
.coding-field { display: inline-flex; align-items: center; gap: 6px; }
.coding-bar label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
}
.coding-select {
  font-size: 11px;
  max-width: 240px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.coding-source { margin-left: auto; font-size: 10.5px; color: var(--text-dim); font-style: italic; }
/* An offer, not a decision — visually distinct from the selects it would
   fill in, so an unaccepted suggestion never reads as a stored coding. */
.suggestion-chip {
  font-size: 10.5px;
  padding: 3px 8px;
  border-style: dashed;
  color: var(--info);
  border-color: var(--info);
  background: var(--info-bg);
  cursor: pointer;
}
.suggestion-chip:hover { background: #fff; }
.conf-legend span.legend-note { margin-right: 6px; }

.tx-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; margin: 4px 0 16px; }
.tx-summary-row { display: flex; justify-content: flex-end; gap: 20px; width: 240px; font-size: 13px; color: var(--text-dim); }
.tx-summary-row span:last-child { min-width: 90px; text-align: right; color: var(--text); }
.tx-summary-total { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 18px; font-weight: 700; font-family: var(--font-display); }
.tx-summary-total span { color: var(--primary); }

/* Subtotal + tax + shipping + discount doesn't reconcile to the extracted
   total by more than a cent — same tolerance/formula as worker.py's
   total_mismatch check, computed live client-side (see review.js's
   computeTotalMismatch) so an in-session line item edit updates this
   immediately. */
.tx-summary-row.mismatch { background: var(--critical-bg); border-radius: 4px; padding: 2px 6px; margin: -2px -6px 3px; }
.tx-summary-row.mismatch span,
.tx-summary-row.mismatch span:last-child { color: var(--critical); }

.footer-actions {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: 0 -2px 10px rgba(7, 43, 84, .06);
}

.upload-form { display: flex; gap: 10px; align-items: center; }

.vendor-suggestions { border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.vendor-suggestion:hover { background: var(--bg); }

/* ---------------------------------------------------------------------------
   Account lifecycle: the verification banner, and the Team page's controls
   (migration 036).
   --------------------------------------------------------------------------- */

/* Sits above the app header rather than inside the container, so it reads as
   a property of the account rather than of whichever page is open. Not
   dismissible by design — see js/accountBanner.js. */
.account-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 22px;
  font-size: 13px;
  background: var(--warning-bg);
  color: var(--text);
  border-bottom: 1px solid var(--warning);
}

.account-banner a {
  color: inherit;
  overflow-wrap: anywhere;
}

.account-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Workspace pickers on the Team page. Auto-fill rather than a fixed column
   count: a practice with 60 client files and one with 2 both have to be
   readable, and the list is the thing an admin scans before assigning. */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 16px;
  max-height: 240px;
  overflow-y: auto;
}

.checkbox-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  padding: 3px 0;
}

.checkbox-cell input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

/* The inline editor opened by "Edit" on a roster row — indented and tinted so
   it reads as belonging to the row above it rather than as a new section. */
.editor-row > td {
  background: var(--bg);
}

.member-editor {
  padding: 14px 4px;
  max-width: 640px;
}

.member-editor label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
}

.member-editor select {
  margin-top: 4px;
  width: 100%;
  max-width: 420px;
}
