:root {
  /* Bob 50 design-system tokens */
  --bordeaux: #500716;
  --bordeaux-mid: #6E1F2A;
  --bordeaux-dark: #2E0009;
  --brass: #B07A4A;
  --brass-deep: #8B5E36;
  --cream: #F7F2EC;
  --cream-deep: #EFE7DC;
  --paper: #FFFFFF;
  --ink: #241916;
  --ink-soft: #3A2E2A;
  --ink-muted: #6B5E59;
  --linen: #E5DDD2;
  --sage: #7A8F60;
  --terracotta: #B0432F;
  --amber: #C68A3E;
  --paper-grain: 1;

  /* Color tokens */
  --surface: var(--cream);
  --surface-elevated: var(--paper);
  --surface-muted: var(--cream-deep);
  --border-subtle: var(--linen);
  --border-muted: #EEE6DA;
  --text-primary: var(--ink);
  --text-muted: var(--ink-muted);
  --text-soft: #94877F;
  --accent: var(--bordeaux);
  --color-primary: var(--accent);
  --accent-strong: var(--bordeaux-mid);
  --accent-soft: #FBF1F2;
  --nav-bg: var(--paper);
  --nav-text: var(--ink-soft);
  --nav-text-active: #FBF6EE;
  --status-success: #1d8348;
  --status-success-bg: #d4edda;
  --status-success-fg: #155724;
  --status-warning: #b7791f;
  --status-warning-bg: #fff3cd;
  --status-warning-fg: #856404;
  --status-danger: #c0392b;
  --status-danger-bg: #f8d7da;
  --status-danger-fg: #721c24;
  --status-info: #1e3a8a;
  --status-info-bg: #eef6ff;
  --status-info-fg: #1e3a8a;

  /* Typography scale */
  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.25rem;   /* 20px */
  --font-size-xl: 1.5rem;    /* 24px */
  --font-size-2xl: 2rem;     /* 32px */
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Elevation system */
  --shadow-xs: 0 1px 2px rgba(23, 32, 51, 0.04);
  --shadow-sm: 0 4px 12px rgba(23, 32, 51, 0.08);
  --shadow-md: 0 10px 24px rgba(23, 32, 51, 0.12);
  --shadow-lg: 0 18px 42px rgba(23, 32, 51, 0.14);
  --shadow-focus: 0 0 0 3px rgba(31, 111, 235, 0.18);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 120ms var(--ease-out);
  --transition-base: 180ms var(--ease-out);

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

[data-theme="dark"] {
  --surface: #0f172a;
  --surface-elevated: #1e293b;
  --surface-muted: #334155;
  --border-subtle: #334155;
  --border-muted: #1e293b;
  --text-primary: #f1f5f9;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --accent: #60a5fa;
  --color-primary: var(--accent);
  --accent-strong: #93c5fd;
  --accent-soft: #1e3a8a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-feature-settings: "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.serif { font-family: "Source Serif 4", Georgia, serif; font-optical-sizing: auto; }
.num,
.figs {
  font-variant-numeric: tabular-nums oldstyle-nums;
  font-feature-settings: "tnum", "onum";
}
.ms {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--cream);
  overflow: hidden;
}
.top-edge {
  height: 3px;
  flex: 0 0 3px;
  background: linear-gradient(90deg, var(--bordeaux) 0%, var(--bordeaux-mid) 50%, var(--bordeaux) 100%);
}
.sidebar {
  display: flex;
  flex-direction: column;
  width: 244px;
  min-height: 100vh;
  flex-shrink: 0;
  background: var(--paper);
  border-right: 0.5px solid var(--linen);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.35rem 1.35rem 1rem;
}
.brand-lockup {
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--bordeaux);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.brand-lockup span {
  font-style: italic;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.85rem;
  box-shadow: none;
  background: transparent;
  color: var(--ink-soft);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 3px;
  color: var(--ink-soft);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition-base), color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-fast);
  position: relative;
}
.nav-item:hover {
  background: var(--cream-deep);
  color: var(--bordeaux);
}
.nav-item .ms {
  font-size: 18px;
  color: var(--ink-muted);
  font-variation-settings: "FILL" 0, "wght" 350, "GRAD" 0, "opsz" 20;
}
.nav-item.active {
  color: #FBF6EE;
  background: var(--bordeaux);
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 22px;
  background: var(--brass);
  transform: translateY(-50%);
}
.nav-item.active .ms {
  color: #FBF6EE;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20;
}
.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.35rem 1.35rem;
  border-top: 0.5px solid var(--linen);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 68px;
  padding: 0 32px;
  background: var(--paper);
  border-bottom: 0.5px solid var(--linen);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}
.topbar-title strong {
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--bordeaux);
  font-size: 1.1rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.page-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.grain {
  position: relative;
}
.grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScyNDAnIGhlaWdodD0nMjQwJz48ZmlsdGVyIGlkPSduJz48ZmVUdXJidWxlbmNlIHR5cGU9J2ZyYWN0YWxOb2lzZScgYmFzZUZyZXF1ZW5jeT0nMC45JyBudW1PY3RhdmVzPScyJyBzdGl0Y2hUaWxlcz0nc3RpdGNoJy8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPScwIDAgMCAwIDAuMTUgMCAwIDAgMCAwLjEwIDAgMCAwIDAgMC4wNyAwIDAgMCAwLjA2IDAnLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0nMTAwJScgaGVpZ2h0PScxMDAlJyBmaWx0ZXI9J3VybCgjbiknLz48L3N2Zz4=");
  mix-blend-mode: multiply;
  opacity: 0.38;
  z-index: 0;
}
.grain > * {
  position: relative;
  z-index: 1;
}
.monogram {
  width: 40px;
  height: 40px;
  border: 0.5px solid var(--bordeaux);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 500;
  font-size: 16px;
  color: #FBF6EE;
  background: var(--bordeaux);
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.eyebrow-italic {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-muted);
}
.eyebrow-mono {
  font-family: Inter, ui-sans-serif, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
}
.h-page {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.05;
  color: var(--bordeaux);
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 48;
}
.h-page-sub {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 46rem;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.dropmark {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  color: var(--brass);
  font-size: 1em;
  margin-right: 0.15em;
}
.par-rule {
  position: relative;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0 1.5rem;
}
.par-rule::before,
.par-rule::after {
  content: "";
  flex: 1;
  border-top: 0.5px solid var(--brass);
}
.par-rule::before { margin-right: 12px; }
.par-rule::after { margin-left: 12px; }
.par-rule .diamond {
  width: 5px;
  height: 5px;
  background: var(--brass);
  transform: rotate(45deg);
}

nav {
  background: var(--nav-bg);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: var(--shadow-sm);
}
nav a {
  color: var(--nav-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
nav a:hover { color: var(--nav-text-active); }
nav a.active {
  color: var(--nav-text-active);
  border-bottom-color: var(--nav-text-active);
}
nav .brand {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
  color: white;
  margin-right: 0.5rem;
  letter-spacing: -0.01em;
}
.client-switcher { position: relative; min-width: 220px; }
.client-switcher input {
  background: #243858;
  color: white;
  border-color: #48617f;
  padding: 0.35rem 0.6rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.client-switcher input::placeholder { color: #c7d2df; }
.client-switcher-results {
  display: none;
  position: absolute;
  top: 2.2rem;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow: auto;
}
.client-switcher-results button {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  background: var(--surface-elevated);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.client-switcher-results button:hover { background: var(--accent-soft); }

main { max-width: 1280px; margin: 1.5rem auto; padding: 0 1rem; }
h1 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: 1.25rem;
  letter-spacing: -0.015em;
}
h2 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.25rem;
  transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}
.table-card {
  overflow: hidden;
  padding: 0;
}
.table-card table { margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); }
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border-muted); vertical-align: middle; }
th {
  background: #f8fafc;
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody tr { transition: background var(--transition-fast); }
tr:hover td { background: #f8fafc; }
td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  min-height: 1.45rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1.05rem;
  white-space: nowrap;
}
.badge-pending { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.badge-needs_review { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.badge-needs_split { background: #e2e3ff; color: #25276f; }
.badge-auto_approved { background: var(--status-success-bg); color: var(--status-success-fg); }
.badge-approved { background: #cce5ff; color: #004085; }
.badge-exported { background: #e2e3e5; color: #383d41; }
.badge-failed { background: #f5c6cb; color: var(--status-danger-fg); }
.badge-extracting { background: #fef9e7; color: #7d6608; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  line-height: 1.2;
  min-height: 2.25rem;
  white-space: nowrap;
  user-select: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}
.btn:hover { box-shadow: var(--shadow-sm); transform: scale(1.015); }
.btn:active { transform: translateY(0) scale(0.985); box-shadow: var(--shadow-xs); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}
.btn.is-loading {
  cursor: wait;
  opacity: 0.78;
  pointer-events: none;
}
.btn-spinner {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  flex: 0 0 auto;
}
.btn.is-loading:has(.btn-spinner)::before {
  display: none;
}
.btn.is-loading::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: button-spin 720ms linear infinite;
}
.btn-primary { background: var(--accent); color: white; box-shadow: 0 6px 16px rgba(31, 111, 235, 0.18); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-success { background: #238636; color: white; font-size: var(--font-size-base); padding: 0.75rem 2rem; box-shadow: 0 6px 16px rgba(35, 134, 54, 0.18); }
.btn-success:hover { background: #1f7a31; }
.btn-sm { padding: 0.25rem 0.7rem; font-size: var(--font-size-xs); }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-secondary { background: #687380; color: white; }
.btn-secondary:hover { background: #59636f; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-muted); }

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #cfd7e3;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  background: var(--surface-elevated);
  color: var(--text-primary);
  font-feature-settings: "tnum";
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-color: var(--accent);
}
input.flagged { border-color: #dc3545; background: #fff5f5; }
label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group { margin-bottom: 1rem; }
.drop-zone {
  border: 1.5px dashed #aeb8c6;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  transition: border-color var(--transition-base), background var(--transition-base), color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}
.drop-zone:hover,
.drop-zone.hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); transform: scale(1.01); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-file-count {
  margin-top: 0.5rem;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.review-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.82fr); gap: 1.35rem; align-items: start; }
.pdf-review-pane { position: relative; }
.review-action-bar {
  position: static;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.review-actions { display: flex; align-items: center; gap: 0.5rem; }
.review-actions form { margin: 0; }
.queue-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 13rem;
}
.queue-actions form {
  display: inline-flex;
  margin: 0;
}
.queue-actions .btn {
  white-space: nowrap;
}
.queue-action-cell {
  min-width: 14rem;
  width: 14rem;
}
.queue-table-status {
  min-width: 8.5rem;
}
.queue-ledger-shell {
  overflow: hidden;
}
.queue-document-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-width: 14rem;
}
.queue-type-icon {
  color: var(--bordeaux);
  font-size: 1.15rem;
}
.queue-filename {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.98rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}
.queue-meta {
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.queue-analysis {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}
.status-filter-bar {
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
}
.status-filter-bar .btn:not(.btn-primary) {
  background: var(--surface-elevated);
  color: var(--text-muted);
  border-color: var(--border-subtle);
}
.status-filter-bar .btn:not(.btn-primary):hover {
  color: var(--text-primary);
  border-color: #cbd5e1;
}
.htmx-request {
  opacity: 0.72;
  transition: opacity var(--transition-base);
}
.pdf-frame {
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 760px;
  border: 1px solid #cfd7e3;
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
}
.pdf-highlight {
  position: absolute;
  left: 1rem;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 230, 90, 0.92);
  border: 1px solid #c99a00;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-size: var(--font-size-sm);
  pointer-events: none;
}
.pdf-region-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.pdf-region-button, .annex-thumb {
  border: 1px solid #cfd7e3;
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  font-size: var(--font-size-xs);
}
.annex-strip {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-muted);
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.provenance-focused { outline: 3px solid #ffc107; }
#review-form [data-field-path] {
  background: var(--row-bg, var(--paper));
}

.bundle-progress-panel {
  margin-bottom: 1rem;
}
.bundle-progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.bundle-progress-header h2 {
  margin: 0 0 0.25rem;
  font-size: var(--font-size-lg);
}
.bundle-progress-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.bundle-progress-list {
  display: grid;
  gap: 0.65rem;
}
.bundle-progress-row {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(10rem, 18rem) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
}
.bundle-progress-row strong,
.bundle-progress-row span {
  display: block;
}
.bundle-progress-row span {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.progress-meter {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}
.progress-meter span {
  display: block;
  height: 100%;
  background: var(--color-primary);
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-card .number {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.stat-card .label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--font-weight-semibold);
}
.stat-card .sparkline {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 0.5rem;
  color: var(--accent);
}
.sparkline-path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sparkline-fill { fill: currentColor; opacity: 0.12; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.kpi-strip .kpi-item {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}
.kpi-strip .kpi-item .kpi-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--font-weight-semibold);
}
.kpi-strip .kpi-item .kpi-value {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.error { color: #dc3545; font-size: var(--font-size-sm); margin-top: 0.5rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; align-items: end; }
.line-table input { padding: 0.4rem 0.5rem; font-size: var(--font-size-sm); min-width: 86px; }
.line-table input[type=number]::-webkit-inner-spin-button,
.line-table input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.line-table input[type=number] { appearance: textfield; }
.line-table th, .line-table td { padding: 0.4rem 0.5rem; }
.invoice-line-table td input[type="number"] { font-size: 0.95rem; padding: 0.5rem 0.6rem; min-width: 7ch; text-align: right; }
.invoice-line-table th:nth-child(n+2), .invoice-line-table td:nth-child(n+2) { text-align: right; }
.invoice-line-table th:first-child, .invoice-line-table td:first-child { text-align: left; }
.invoice-line-table.vat-breakdown-table th, .invoice-line-table.vat-breakdown-table td { min-width: 9rem; }
.invoice-line-table.vat-breakdown-table tbody tr:nth-child(odd) td { background: #f8fafc; }
.invoice-line-table.vat-breakdown-table tbody tr:nth-child(even) td { background: var(--surface-elevated); }

.pdf-zoom-controls { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.pdf-zoom-controls .pdf-fullscreen-toggle { margin-left: auto; }
.pdf-zoom-controls .pdf-fullscreen-toggle summary {
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  padding: 0.3rem 0.6rem;
  border: 1px solid #cfd7e3;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  list-style: none;
}
.pdf-wrap { width: 100%; overflow: auto; }
.review-layout.review-fullscreen-pdf { grid-template-columns: 1fr; }
.review-layout.review-fullscreen-pdf > div:last-child { display: none; }
.review-layout.review-fullscreen-pdf .pdf-wrap { width: 100%; }

.muted { color: var(--text-soft); font-style: italic; font-size: var(--font-size-sm); }

.empty-state {
  border: 1px dashed var(--border-subtle);
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 1.75rem 1.25rem;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.empty-state .empty-state-icon {
  width: 40px;
  height: 40px;
  color: var(--text-soft);
  opacity: 0.8;
}
.empty-state .empty-state-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}
.empty-state .empty-state-help { max-width: 38ch; line-height: 1.45; }
.empty-state .empty-state-cta { margin-top: 0.4rem; }

.hint-box {
  margin-top: 0.75rem;
  border-left: 3px solid #48617f;
  background: #f8fafc;
  padding: 0.65rem 0.75rem;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.inline-create-client { margin: -0.25rem 0 1rem; padding: 0.75rem; background: #f8fafc; border: 1px solid var(--border-muted); border-radius: var(--radius-sm); }
.inline-row { display: flex; gap: 0.5rem; align-items: center; }
.inline-row input { flex: 1; }
.spacer-block { height: 1.5rem; }
.bulk-action-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.bulk-action-bar form { display: flex; gap: 0.5rem; align-items: center; margin: 0; }
.indicator {
  display: inline-block;
  margin: 0.1rem;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
}
.flag-indicator { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.snooze-indicator { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.lock-indicator { background: #e2e3ff; color: #25276f; }
.comment-indicator { background: var(--status-success-bg); color: var(--status-success-fg); }
.age-indicator { background: var(--status-info-bg); color: var(--status-info-fg); }
.split-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 0.75rem; align-items: end; padding: 0.75rem; border: 1px solid var(--border-muted); border-radius: var(--radius-sm); margin-bottom: 0.75rem; }
.page-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.page-card {
  min-height: 92px;
  border: 1px solid #cfd7e3;
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}
.page-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: scale(1.01); }
.page-card span, .annex-page-card span { display: block; color: var(--text-muted); font-size: var(--font-size-xs); }
.page-card small { display: block; color: var(--text-soft); margin-top: 0.35rem; }
.annex-page-card { display: inline-flex; flex-direction: column; gap: 0.15rem; min-width: 120px; }
.fraud-banner { background: #fff5f5; border: 1px solid #f5c6cb; color: var(--status-danger-fg); border-radius: var(--radius-sm); padding: 0.75rem; margin-bottom: 0.75rem; }
.recent-filter-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.confidence-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.conf-high { background: var(--status-success-bg); color: var(--status-success-fg); }
.conf-medium { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.conf-low { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.conf-na { background: #e2e3e5; color: #6c757d; }
.comment-list { padding-left: 1.1rem; font-size: var(--font-size-sm); color: var(--text-muted); }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.35); align-items: center; justify-content: center; padding: 1rem; }
.modal {
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  max-width: 760px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  animation: modal-enter var(--transition-base);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1rem; }
.notice { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 0.85rem 1rem; margin-bottom: 1rem; background: var(--surface-elevated); }
.notice-info { background: var(--status-info-bg); border-color: #bfdbfe; color: var(--status-info-fg); }
.notice-danger { background: #fff5f5; border-color: #fecaca; color: #7f1d1d; }
.reverse-charge-banner { background: var(--status-info-bg); border: 1px solid #93c5fd; color: var(--status-info-fg); border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 1rem; }
.reverse-charge-banner p { margin-top: 0.35rem; font-size: var(--font-size-sm); }
.review-alert-card { background:#fff5f5; border:1px solid #f5c6cb; }
.review-alert-list { margin-top:0.5rem; padding-left:1.25rem; font-size:0.85rem; }
.review-decision-card {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}
.review-decision-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; align-items: center; }
.review-error-box { display: none; }
.inline-checkbox { display:flex; align-items:center; gap:0.5rem; }
.inline-checkbox input { width:auto; }
.inline-checkbox label { margin:0; }
.form-action-row { display:flex; align-items:end; gap:0.75rem; }
.form-action-row > * { flex:1; }
.form-action-row .btn { flex:0 0 auto; }
.export-presets { display:flex; gap:0.5rem; flex-wrap:wrap; margin-bottom:0.75rem; }
.export-summary-copy { font-size:0.9rem; color:var(--text-muted); }
.export-vat-table { font-size:0.85rem; margin:0.5rem 0; border-collapse:collapse; min-width:360px; }
.export-vat-table th, .export-vat-table td { padding:0.25rem 0.5rem; }
.export-vat-table th:nth-child(n+2), .export-vat-table td:nth-child(n+2) { text-align:right; }
.split-preview-layout { display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(280px, 0.9fr); gap: 1rem; align-items: start; }
.split-pdf-frame { width: 100%; height: 620px; border: 1px solid #cfd7e3; border-radius: var(--radius-lg); background: var(--surface-elevated); }
.client-select-search { margin-bottom: 0.4rem; }
.capability-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.capability-grid .card { margin-bottom: 0; min-height: 140px; }
.logout-form { margin-left:auto; }
.logout-button {
  background:none;
  color:#9ab;
  border:none;
  cursor:pointer;
  font-size:0.9rem;
  min-height:auto;
  padding:0.25rem 0.4rem;
}
.login-shell {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  padding:1rem;
}
.login-card {
  width:360px;
  box-shadow: var(--shadow-md);
}
.login-title { margin-bottom:1.5rem; }
.full-width { width:100%; }
.top-space-sm { margin-top:0.5rem; }
.new-client-inline {
  margin-top:0.5rem;
  padding:0.55rem;
  border:1px solid var(--border-muted);
  border-radius:var(--radius-md);
  background:#f8fafc;
}
.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;
}

/* Bob50 design-system component layer */
.card {
  background: var(--paper);
  border: 0.5px solid var(--linen);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(80, 7, 22, 0.035);
}
.card.bordeaux-rail { border-left: 2.5px solid var(--bordeaux); }
.card.brass-rail { border-left: 2px solid var(--brass); }
.card.amber-rail { border-left: 2px solid var(--amber); }
.card.terracotta-rail { border-left: 2px solid var(--terracotta); }
.card.sage-rail { border-left: 2px solid var(--sage); }
.card.tinted,
.queue-filter-card,
.status-filter-bar,
.bulk-action-bar {
  background: rgba(255, 255, 255, 0.82);
}
.hl { border: 0.5px solid var(--linen); }
.hl-b { border-bottom: 0.5px solid var(--linen); }
.hl-t { border-top: 0.5px solid var(--linen); }
.hl-r { border-right: 0.5px solid var(--linen); }
.hl-l { border-left: 0.5px solid var(--linen); }
.text-bordeaux { color: var(--bordeaux); }
.text-brass { color: var(--brass); }
.text-brass-deep { color: var(--brass-deep); }
.text-ink { color: var(--ink); }
.text-ink-soft { color: var(--ink-soft); }
.text-ink-muted { color: var(--ink-muted); }
.bg-cream { background: var(--cream); }
.bg-cream-deep { background: var(--cream-deep); }
.bg-paper { background: var(--paper); }
.ms-fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.ms-thin { font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24; }
.monogram.sm {
  width: 34px;
  height: 34px;
  font-size: 13px;
}
.monogram.outlined {
  background: transparent;
  color: var(--bordeaux);
  border-color: var(--brass);
  box-shadow: none;
}
.side-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  padding: 0.5rem 0.85rem;
  background: transparent;
  box-shadow: none;
}
.side-nav a {
  border-bottom: 0;
  padding: 8px 12px;
}
.side-nav a.active {
  border-bottom-color: transparent;
}
.btn {
  border-radius: 3px;
  font-weight: 600;
}
.btn-primary {
  background: var(--bordeaux);
  color: #FBF6EE;
  border: 0.5px solid var(--bordeaux-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 1px 0 rgba(176,122,74,0.18);
}
.btn-primary:hover {
  background: var(--bordeaux-mid);
}
.btn-secondary,
.btn-outline {
  background: var(--paper);
  color: var(--bordeaux);
  border: 0.5px solid var(--brass);
}
.btn-secondary:hover,
.btn-outline:hover {
  background: #FBF6EE;
  color: var(--bordeaux);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--cream-deep);
  color: var(--bordeaux);
}
.btn-danger,
.btn-reject {
  color: #933218;
  background: transparent;
  border: 0.5px solid #D6B3A8;
}
.btn-danger:hover,
.btn-reject:hover {
  background: #FBEAE4;
  color: #933218;
  border-color: #933218;
}
.btn-success,
.btn-approve {
  background: var(--sage);
  color: #fff;
  border: 0.5px solid #4D5E36;
  box-shadow: 0 6px 16px rgba(77, 94, 54, 0.14);
}
.btn-success:hover,
.btn-approve:hover {
  background: #657A4A;
}
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}
.toolbar-btn:hover {
  background: var(--cream-deep);
  color: var(--bordeaux);
}
.toolbar-btn:active {
  transform: scale(0.96);
}
.field,
input,
select,
textarea {
  border: 0.5px solid var(--linen);
  border-radius: 3px;
  background: var(--paper);
}
.field:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(176, 122, 74, 0.14);
}
label,
.field-label {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--ink-muted);
}
.client-switcher {
  min-width: 260px;
}
.client-switcher .field {
  padding-left: 2.25rem;
  background: var(--cream);
}
.client-switcher input {
  color: var(--ink);
  background: var(--cream);
  border-color: var(--linen);
}
.client-switcher input::placeholder {
  color: var(--ink-muted);
}
.client-switcher-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--ink-muted);
  z-index: 2;
}
.client-switcher-results {
  top: calc(100% + 0.35rem);
  border: 0.5px solid var(--linen);
  border-radius: 3px;
}
.topbar .logout-form {
  margin-left: 0;
}
.logout-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.7rem;
  color: var(--ink-muted);
  border: 0.5px solid transparent;
  border-radius: 3px;
  background: transparent;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.logout-button:hover {
  background: var(--cream-deep);
  color: var(--bordeaux);
}
.ledger-table {
  width: 100%;
  border-collapse: collapse;
}
.ledger-table thead th {
  text-align: left;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bordeaux);
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--brass);
  background: #FBF1F2;
}
.ledger-table tbody td {
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--linen);
  color: var(--ink);
}
.ledger-table tbody tr:nth-child(even) td {
  background: rgba(176,122,74,0.025);
}
.ledger-table tbody tr:hover td {
  background: rgba(80,7,22,0.035);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 12px;
}
.h-section {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--bordeaux);
  letter-spacing: -0.005em;
}
.crumb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: var(--bordeaux);
  color: #FBF6EE;
  border: 0.5px solid var(--bordeaux);
  border-radius: 2px;
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 12.5px;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.crumb-chip .figs {
  font-style: normal;
  font-weight: 600;
}
.crumb-chip.ghost,
.crumb-chip:not(.active) {
  background: transparent;
  color: var(--bordeaux);
  border-color: var(--brass);
}
.crumb-chip:hover {
  background: #FBF6EE;
}
.tva-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--bordeaux);
  border: 0.5px solid var(--bordeaux-dark);
  color: #FBF6EE;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  border-radius: 2px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #FBF6EE;
  border: 0.5px solid var(--linen);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 11px;
  border-radius: 2px;
  letter-spacing: 0.02em;
}
.amt {
  display: inline-grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
}
.amt .whole {
  text-align: right;
  font-feature-settings: "tnum", "onum";
}
.amt .sep {
  padding: 0 1px;
  color: var(--ink-muted);
}
.amt .frac {
  text-align: left;
  font-feature-settings: "tnum", "onum";
}
.banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  background: linear-gradient(180deg, #FBF1F2 0%, #F8E8E9 100%);
  border: 0.5px solid #E8C8CB;
  border-left: 2.5px solid var(--bordeaux);
  padding: 18px 22px;
  border-radius: 3px;
}
.banner-numeral {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 48px;
  line-height: 1;
  color: var(--bordeaux);
  font-variation-settings: "opsz" 60;
}
.kpi-figure {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 500;
  font-size: 56px;
  line-height: 1;
  color: var(--bordeaux);
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 60;
  font-feature-settings: "tnum", "onum";
}
.kpi-figure-sm { font-size: 36px; }
.kpi-delta {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 13px;
}
.kpi-delta.up { color: #4D5E36; }
.kpi-delta.down { color: #933218; }
.barograph {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
.barograph i {
  display: inline-block;
  width: 3px;
  background: var(--linen);
}
.barograph i:nth-child(1) { height: 5px; }
.barograph i:nth-child(2) { height: 7px; }
.barograph i:nth-child(3) { height: 9px; }
.barograph i:nth-child(4) { height: 11px; }
.barograph i:nth-child(5) { height: 13px; }
.barograph i:nth-child(6) { height: 16px; }
.barograph.active i.on { background: var(--sage); }
.barograph.warn i.on { background: var(--amber); }
.barograph.error i.on { background: var(--terracotta); }
.barograph.bordeaux i.on { background: var(--bordeaux); }
.date-stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  border: 0.5px solid var(--brass);
  width: 52px;
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--bordeaux);
  overflow: hidden;
}
.date-stamp .month {
  background: var(--bordeaux);
  color: #FBF6EE;
  width: 100%;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.date-stamp .day {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
  padding: 4px 0 2px;
  font-feature-settings: "tnum", "onum";
}
.date-stamp .year {
  font-size: 9px;
  color: var(--ink-muted);
  font-style: italic;
  padding-bottom: 3px;
  font-feature-settings: "tnum", "onum";
}
.file-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 0.5px solid var(--linen);
  transition: background var(--transition-fast);
}
.file-row:last-child {
  border-bottom: 0;
}
.file-row:hover {
  background: rgba(176,122,74,0.035);
}
.file-icon {
  width: 44px;
  height: 52px;
  border: 0.5px solid var(--brass);
  background: linear-gradient(180deg, #FBF6EE 0%, #F1ECE3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bordeaux);
  position: relative;
}
.file-icon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: var(--cream);
  border-left: 0.5px solid var(--brass);
  border-bottom: 0.5px solid var(--brass);
}
.donut {
  --p: 75;
  --c: var(--bordeaux);
  width: 80px;
  height: 80px;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--cream-deep) 0);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 9px;
  background: var(--paper);
  border-radius: 50%;
  border: 0.5px solid var(--linen);
}
.donut span {
  position: relative;
  z-index: 1;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--bordeaux);
  font-feature-settings: "tnum", "onum";
}
.search-bar {
  position: relative;
}
.search-bar input {
  width: 280px;
  padding: 8px 12px 8px 36px;
  background: var(--cream);
  border: 0.5px solid var(--linen);
  border-radius: 3px;
  font-size: 13px;
  color: var(--ink);
}
.search-bar .ms {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--ink-muted);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 2px;
  font-weight: 600;
  font-size: 12px;
  border: 0.5px solid transparent;
  white-space: nowrap;
}
.pill-late,
.pill-error {
  background: #FBE4DE;
  color: #933218;
  border-color: #E8B3A6;
}
.pill-due {
  background: var(--bordeaux);
  color: #FBF6EE;
}
.pill-soon {
  background: #FBF1E2;
  color: #7A5318;
  border-color: #E7C68A;
}
.pill-ok {
  background: #EFF1E6;
  color: #4D5E36;
  border-color: #C9D4B0;
}
.pill-pending,
.pill-info {
  background: #FBF6EE;
  color: var(--ink-muted);
  border-color: var(--linen);
}
.badge {
  border-radius: 2px;
}
.indicator {
  border-radius: 2px;
  background: #FBF6EE;
  border: 0.5px solid var(--linen);
  color: var(--ink-muted);
}
.flag-indicator {
  background: #FBE4DE;
  border-color: #E8B3A6;
  color: #933218;
}
.drop-zone {
  border-color: var(--brass);
  background: linear-gradient(180deg, #FFFFFF 0%, #FBF6EE 100%);
}
.drop-zone:hover,
.drop-zone.hover {
  color: var(--bordeaux);
  border-color: var(--bordeaux);
  background: #FBF1F2;
}
.review-elevated-shell {
  margin-top: 1rem;
  margin-bottom: 8rem;
}
body:has(#review-layout-root) {
  --pdf-zoom: 1.08;
}
body:has(#review-layout-root) .page-body {
  max-width: none;
  padding: 32px 36px 48px;
}
.review-ledger-panel .card {
  border-left: 2px solid rgba(176,122,74,0.7);
}
.review-action-bar {
  background: rgba(255,255,255,0.92);
  border: 0.5px solid var(--linen);
  border-radius: 4px;
}
.review-pdf-stage .pdf-frame {
  border: 0.5px solid var(--linen);
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(80,7,22,0.08);
}
.review-document-panel .pdf-frame {
  height: calc(100vh - 118px);
  min-height: 820px;
  border: 0;
  border-radius: 0;
  background: #262626;
}
.review-document-panel .pdf-zoom-controls {
  position: sticky;
  top: 0;
  z-index: 3;
}
.review-total-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding: 0.75rem 0.9rem;
  background: #FBF6EE;
  border: 0.5px solid var(--linen);
  border-left: 2px solid var(--brass);
  border-radius: 3px;
}
.dashboard-attention-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}
.display-supplier {
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--bordeaux);
  line-height: 1;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 500;
  font-variation-settings: "opsz" 48;
}
.display-supplier .secondary {
  color: var(--brass-deep);
}
.pdf-page {
  min-height: 22rem;
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 28px, rgba(176,122,74,0.10) 28px, rgba(176,122,74,0.10) 28.5px),
    linear-gradient(180deg, #FBF6EE 0%, var(--cream) 100%);
  box-shadow: 0 1px 0 rgba(176,122,74,0.1), 0 24px 60px -28px rgba(36,25,22,0.25);
  border: 0.5px solid var(--linen);
  border-top: 3px solid var(--bordeaux);
  border-radius: 3px;
}
.review-document-panel {
  background: var(--cream-deep);
  border: 0.5px solid var(--linen);
  border-radius: 4px;
  overflow: hidden;
}
.review-document-panel .pdf-zoom-controls {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--paper);
  border-bottom: 0.5px solid var(--linen);
}
.review-document-stage {
  padding: 0.75rem;
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 28px, rgba(176,122,74,0.08) 28px, rgba(176,122,74,0.08) 28.5px),
    linear-gradient(180deg, #FBF6EE 0%, var(--cream) 100%);
}
.bob50-pdf-viewer {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.75rem;
  min-height: calc(100vh - 118px);
}
.bob50-pdf-thumbs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 132px);
  padding: 0.25rem;
}
.bob50-pdf-thumb {
  border: 0.5px solid var(--linen);
  border-radius: 3px;
  background: rgba(255,255,255,0.72);
  padding: 0.35rem;
  color: var(--ink-muted);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.bob50-pdf-thumb.active,
.bob50-pdf-thumb:hover {
  border-color: var(--bordeaux);
  background: #FBF1F2;
  color: var(--bordeaux);
}
.bob50-pdf-thumb canvas {
  width: 100%;
  height: auto;
  display: block;
  background: var(--paper);
  border: 0.5px solid var(--linen);
}
.bob50-pdf-thumb span {
  display: block;
  margin-top: 0.25rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.78rem;
  font-style: italic;
}
.bob50-pdf-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
}
.bob50-pdf-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.25rem;
}
.bob50-pdf-canvas-wrap {
  min-height: 760px;
  max-height: calc(100vh - 164px);
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  background: #292725;
  border: 0.5px solid var(--linen);
  border-radius: 3px;
}
.bob50-pdf-canvas {
  display: block;
  max-width: none;
  background: var(--paper);
  box-shadow: 0 18px 42px rgba(0,0,0,0.28);
}
.bob50-pdf-error {
  padding: 0.75rem 1rem;
  background: #FBE4DE;
  border: 0.5px solid #E8B3A6;
  color: #933218;
  border-radius: 3px;
}
.bob50-pdf-viewer.is-loading .bob50-pdf-canvas-wrap::before {
  content: "Chargement du PDF...";
  color: #FBF6EE;
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  align-self: center;
}
.review-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.review-editor-panel .card h2 {
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--bordeaux);
  font-size: 1.1rem;
  font-weight: 500;
}
.review-action-dock {
  position: static;
  margin-top: 0;
  padding: 0;
  background: transparent;
  border-top: 0;
  box-shadow: none;
  display: flex;
  justify-content: stretch;
}
.review-action-dock .review-decision-card {
  width: 100%;
  margin: 0;
  padding: 1rem 1.25rem;
  border-left: 2px solid var(--bordeaux);
}
.review-action-dock .review-decision-card h2 {
  margin-bottom: 0.7rem;
}
.review-action-dock .review-decision-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.export-workflow {
  display: grid;
  gap: 2rem;
}
.export-step {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.export-config-grid {
  display: block;
}
.export-filter-form {
  grid-template-columns: minmax(320px, 2fr) repeat(4, minmax(150px, 1fr)) auto;
  align-items: end;
}
.export-client-field select,
.export-client-field input {
  min-height: 2.55rem;
}
.export-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.export-client-card {
  margin-bottom: 0;
}
.export-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 0.5px solid var(--linen);
}
.export-card-header .serif {
  font-size: 1.2rem;
}
.export-card-count {
  text-align: right;
}
.export-card-count .figs {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.65rem;
  color: var(--ink);
}
.export-total-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.export-total-grid .serif {
  font-size: 1.08rem;
  color: var(--ink);
}
.audit-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.audit-kpi-strip > div {
  padding: 1.25rem;
  border-right: 0.5px solid var(--linen);
}
.audit-kpi-strip > div:last-child {
  border-right: 0;
}
.audit-exception-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.audit-timeline {
  display: grid;
  gap: 0;
  margin-bottom: 1rem;
}
.saved-filter-strip {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.split-composer {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1rem;
}
.split-page-sidebar {
  background: var(--paper);
  border: 0.5px solid var(--linen);
  border-radius: 4px;
  overflow: hidden;
}
.dashboard-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.dashboard-command-list {
  display: grid;
  gap: 0;
}
.reverse-charge-banner {
  background: #FBF1E2;
  border: 0.5px solid #E7C68A;
  border-left: 2px solid var(--amber);
  color: #7A5318;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
    overflow: visible;
  }
  .sidebar {
    width: 100%;
    min-height: auto;
    border-right: 0;
    border-bottom: 0.5px solid var(--linen);
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.8rem;
  }
  .nav-item {
    flex: 0 0 auto;
  }
  .page-main {
    height: auto;
    min-height: 100vh;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding: 1rem;
  }
  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .client-switcher {
    min-width: min(100%, 320px);
  }
  .page-body {
    padding: 24px 16px;
  }
  .page-header {
    display: block;
  }
  .export-config-grid,
  .export-preview-grid,
  .audit-kpi-strip,
  .audit-exception-grid,
  .split-composer,
  .dashboard-command-grid {
    grid-template-columns: 1fr;
  }
  .audit-kpi-strip > div {
    border-right: 0;
    border-bottom: 0.5px solid var(--linen);
  }
  .audit-kpi-strip > div:last-child {
    border-bottom: 0;
  }
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}
@keyframes modal-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
  .btn:hover,
  .drop-zone:hover,
  .drop-zone.hover,
  .page-card:hover {
    transform: none;
  }
}

@media (max-width: 980px) {
  .review-layout, .split-preview-layout, .capability-grid { grid-template-columns: 1fr; }
  .bob50-pdf-viewer {
    grid-template-columns: 1fr;
  }
  .bob50-pdf-thumbs {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
  }
  .bob50-pdf-thumb {
    flex: 0 0 82px;
  }
  .review-action-dock {
    left: 0;
    padding: 0;
  }
  body:has(#review-layout-root) .page-body {
    padding: 24px 16px 48px;
  }
  .pdf-frame { min-height: 520px; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  nav { flex-wrap: wrap; }
  .field-row, .filter-grid, .recent-filter-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}
