@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  --ink: #242529;
  --muted: #5b5c5f;
  --sidebar: #fbfbfb;
  --primary: var(--accent);
  --primary-hover: #2262d8;
  --hairline: 0.5px;
  --divider: #eeeff1;
  --link: #2262d8;
  --success-text: #216547;
  --success-bg: #e7f4eb;
  --border: #e6e7ea;
  --border-interactive: #d7d9dd;
  --row-hover: #f8f9fa;
  --paper: #fff;

  --surface: #fbfbfb;
  --surface-strong: #f1f1f1;
  --elevated: #ffffff;
  --primary-ink: #ffffff;
  --accent: #266df0;
  --secondary-bg: #202124;
  --secondary-text: #fff;
  --secondary-hover: #35373b;
  --control-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3.5 5.5 3.5 3.5 3.5-3.5' fill='none' stroke='%235b5c5f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --control-icon-inset: 12px;
  --accent-ink: var(--ink);
  --selection: #f1f1f1;
  --focus: var(--accent);
  --warning-ink: #7b4414;
  --warning-surface: #faf0df;
  --error-ink: #a0312a;
  --info-ink: #3b536c;
  --info-surface: #eaf0f6;
  --overlay: #17181d55;
  --chart-balance: #a1a4ac;
  --chart-issue: #35373b;
  --shadow-menu: 0 6px 20px #17181d18;
  --shadow-dialog: 0 16px 54px #17181d32;
  --radius-control: 7px;
  --radius-section: 10px;
  --radius-dialog: 14px;
  --space-section: 24px;
  --sidebar-width: clamp(205px, 16.3vw, 248px);
  --ease: cubic-bezier(.2,.75,.25,1);
}


:root[data-theme="dark"] {
  color-scheme: dark;
  /* Application surfaces */
  --bg-app: #1b1d21;
  --bg-sidebar: #15181c;
  --bg-topbar: #1b1d21;
  --bg-surface: #202227;
  --bg-elevated: #242529;
  --bg-modal: #242529;
  --bg-dropdown: #242529;
  --bg-popover: #242529;
  --bg-table-header: #202227;
  --bg-table-row: #1b1d21;
  --bg-table-hover: #242529;
  --bg-hover: #242529;
  --bg-selected: #2d3036;
  --bg-input: #1b1d21;
  --bg-tooltip: #35373d;
  --bg-skeleton: #292b31;
  --bg-skeleton-highlight: #33353c;
  --bg-disabled: #26282e;
  --bg-overlay: rgba(0, 0, 0, 0.65);

  /* Typography */
  --text-heading: #f2f3f5;
  --text-primary: #eceef1;
  --text-secondary: #b7bac2;
  --text-table-header: #b7bac2;
  --text-muted: #a2a6af;
  --text-placeholder: #a2a6af;
  --text-disabled: #8c909a;
  --text-tooltip: #f2f3f5;

  /* Borders */
  --border-default: #383b43;
  --border-subtle: #33363d;
  --border-table: #33363d;
  --border-interactive: #575b66;
  --border-focus: #83aaff;
  --border-width: 0.5px;
  --divider: var(--border-subtle);
  --link: var(--brand-accent);
  --table-header: var(--bg-table-header);

  /* Primary actions */
  --primary-bg: #266df0;
  --primary-text: #fff;
  --primary-hover: #2262d8;
  --primary-pressed: #1d53b8;

  /* Secondary actions */
  --secondary-bg: #202124;
  --secondary-text: #eceef1;
  --secondary-hover: #292c32;

  /* Tertiary actions */
  --tertiary-bg: transparent;
  --tertiary-text: #b7bac2;
  --tertiary-hover: #242529;

  /* Sidebar */
  --nav-text: #eceef1;
  --nav-icon: #b7bac2;
  --nav-hover: #242529;
  --nav-active-bg: #2d3036;
  --nav-active-text: #f2f3f5;
  --nav-active-icon: #f2f3f5;

  /* Brand */
  --brand-accent: #83aaff;
  --brand-accent-text: #eceef1;

  /* Semantic states */
  --success-text: #85c9a7;
  --success-bg: #243831;
  --warning-text: #D6B477;
  --warning-bg: #30291E;
  --error-text: #E39595;
  --error-bg: #302123;
  --info-text: #91B3D9;
  --info-bg: #202A36;
  --neutral-status-text: #b7bac2;
  --neutral-status-bg: #2d3036;

  /* Financial charts */
  --chart-primary: #D4D4D8;
  --chart-secondary: #9ca2af;
  --chart-tertiary: #71717A;
  --chart-grid: #343438;
  --chart-axis: #A1A1AA;
  --chart-label: #DEDEE2;

  /* Scrollbars */
  --scrollbar-track: #1b1d21;
  --scrollbar-thumb: #3F3F46;
  --scrollbar-thumb-hover: #52525B;
  /* Existing component aliases. */
  --control-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3.5 5.5 3.5 3.5 3.5-3.5' fill='none' stroke='%23b7bac2' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --paper: var(--bg-app);
  --sidebar: var(--bg-sidebar);
  --elevated: var(--bg-elevated);
  --surface: var(--bg-surface);
  --surface-strong: var(--neutral-status-bg);
  --primary: var(--primary-bg);
  --primary-ink: var(--primary-text);
  --border: var(--border-default);
  --hairline: var(--border-width);
  --row-hover: var(--bg-hover);
  --selection: var(--bg-selected);
  --accent: var(--brand-accent);
  --accent-ink: var(--brand-accent-text);
  --focus: var(--border-focus);
  --warning-ink: var(--warning-text);
  --warning-surface: var(--warning-bg);
  --error-ink: var(--error-text);
  --info-ink: var(--info-text);
  --info-surface: var(--info-bg);
  --overlay: var(--bg-overlay);
  --chart-balance: var(--chart-tertiary);
  --chart-issue: var(--chart-primary);
  --shadow-menu: 0 8px 24px #0005;
  --shadow-dialog: 0 18px 54px #0008;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea, input::file-selector-button { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p, figure, dl, dd { margin: 0; }

.shell {
  --content-inset: clamp(21px, 2.3vw, 39px);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns 195ms var(--ease);
  height: 100dvh;
}
.sidebar { background: var(--sidebar); display: flex; flex-direction: column; min-height: 0; padding: 26px 15px 9px; border-inline-end: var(--hairline) solid var(--border); }
.brand { display: flex; align-items: center; gap: 11px; width: fit-content; margin: 0 0 40px 9px; }
.brand img { transition: transform 420ms var(--ease), filter 420ms var(--ease); }
.brand:hover img { transform: rotate(-9deg) scale(1.06); filter: drop-shadow(0 4px 7px #3e3e4036); }
.brand span { font-size: 23px; font-weight: 720; letter-spacing: -.95px; color: var(--ink); }
.sidebar-quick-actions { display:flex; gap:8px; margin:-25px 0 26px 9px; }
.sidebar-quick-actions button { display:grid; place-items:center; width:34px; height:34px; padding:7px; border:var(--hairline) solid var(--border); border-radius:9px; background:transparent; color:var(--muted); transition:background 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease), border-color 180ms var(--ease); }
.sidebar-quick-actions button:hover { background:var(--row-hover); border-color:var(--border-interactive); color:var(--ink); transform:translateY(-1px); }
.sidebar-quick-actions svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.navigation { display: grid; gap: 5px; }
.navigation a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 45px;
  padding: 0 11px;
  color: var(--muted);
  border: var(--hairline) solid transparent;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 510;
  transition: background 220ms var(--ease), border-color 220ms var(--ease), color 220ms var(--ease);
}
.navigation a svg { flex: none; color: var(--muted); transition: transform 240ms var(--ease); }
.navigation a:hover { background: var(--row-hover); color: var(--ink); }
.navigation a:hover svg { transform: translateY(-2px); }
.navigation a[aria-current] { background: var(--selection); border-color: var(--border); color: var(--ink); font-weight: 670; }
.profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 11px 8px;
  background: transparent;
  border: var(--hairline) solid transparent;
  border-top-color: var(--border);
  border-radius: 0 0 10px 10px;
  text-align: left;
  transition: background 240ms var(--ease);
}
.profile:hover { background: var(--row-hover); }
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 730;
}
.profile-copy { min-width: 0; display: grid; gap: 3px; }
.profile-copy strong, .profile-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { font-size: 13px; }
.profile-copy small { color: var(--muted); font-size: 12px; }
.profile-icon { margin-left: auto; color: var(--muted); display: grid; }

.panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
}
.topbar {
  display: flex;
  flex: 0 0 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-inline: var(--content-inset);
  border-bottom: var(--hairline) solid var(--border);
}
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 12px; }
.breadcrumb-icon { display: grid; flex: none; }
.breadcrumb-page { color: var(--ink); font-weight: 650; }
.topbar-actions { flex: none; }
.period {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 35px;
  border: var(--hairline) solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 220ms, background 220ms;
}
.period:hover, .period:focus-within { border-color: var(--border-interactive); background: var(--surface); }
.period svg { position: absolute; pointer-events: none; left: 10px; }
.period svg:last-child { left: auto; inset-inline-end: var(--control-icon-inset); }
.period select { appearance: none; width: 100%; border: 0; background: transparent; padding: 8px 34px; border-radius: inherit; cursor: pointer; font-size: 12px; font-weight: 610; }
.content {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border-interactive) transparent;
  padding: 28px var(--content-inset) 35px;
}
.content:focus-visible { outline-offset: -3px; }
.page-heading { margin-bottom: 28px; }
h1 {
  color: var(--ink);
  font-size: clamp(34px, 3.25vw, 58px);
  font-weight: 400;
  letter-spacing: -.052em;
  line-height: 1.05;
}
.page-heading p { margin-top: 11px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 25px; }
.metric {
  --metric-color: var(--muted);
  --metric-bg: var(--surface);
  min-width: 0;
  min-height: 230px;
  padding: 17px 17px 15px;
  border: var(--hairline) solid var(--border);
  border-radius: 15px;
  background: var(--paper);
  transition: border-color 300ms var(--ease), box-shadow 300ms var(--ease), transform 300ms var(--ease);
}
.metric:hover { border-color: var(--border-interactive); box-shadow: 0 8px 25px #3f3f410b; transform: translateY(-2px); }
.metric-matched { --metric-color: var(--muted); --metric-bg: var(--surface); }
.metric-exceptions { --metric-color: var(--warning-ink); --metric-bg: var(--warning-surface); }
.metric-value { --metric-color: var(--info-ink); --metric-bg: var(--info-surface); }
.metric-label { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.metric-label h2 { font-size: 13px; font-weight: 650; }
.metric-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--metric-bg, var(--surface)); color: var(--metric-color, var(--muted)); flex: none; }
.metric > strong { display: block; margin-top: 10px; font-size: clamp(26px, 2.4vw, 42px); font-weight: 670; line-height: 1.06; letter-spacing: -.056em; color: var(--ink); font-variant-numeric: tabular-nums; }
.metric > p { margin-top: 6px; color: var(--muted); font-size: 11px; }
.chart { margin-top: 16px; }
.chart-plot { position: relative; height: 62px; color: var(--metric-color); }
.chart-plot > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gridline { fill: none; stroke: var(--border); stroke-width: var(--hairline); vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; animation: trace 950ms var(--ease) calc(var(--delay) + 140ms) both; }
.chart-area { animation: fade 900ms var(--ease) calc(var(--delay) + 160ms) both; }
.chart-endpoint, .point-dot { position: absolute; top: var(--y); width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--paper); transform: translate(-50%, -50%); pointer-events: none; }
.chart-endpoint { left: 100%; animation: fade 450ms var(--ease) calc(var(--delay) + 650ms) both; }
.chart-point { position: absolute; z-index: 1; top: 0; left: var(--x); width: calc(var(--hit) * 2); height: 100%; transform: translateX(-50%); border: 0; padding: 0; background: transparent; color: inherit; }
.chart-point.first, .chart-point.last { width: var(--hit); }
.chart-point.first { transform: none; }
.chart-point.last { transform: translateX(-100%); }
.point-dot { left: 50%; opacity: 0; transition: opacity 180ms; }
.first .point-dot { left: 0; }
.last .point-dot { left: 100%; }
.chart-tip { position: absolute; bottom: calc(100% - var(--y) + 10px); left: 50%; opacity: 0; pointer-events: none; transform: translate(-50%, 5px); padding: 6px 8px; border: var(--hairline) solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px #3636381a; background: var(--paper); white-space: nowrap; color: var(--ink); font-size: 10px; transition: transform 180ms, opacity 180ms; }
.first .chart-tip { left: 0; transform: translate(0, 5px); }
.last .chart-tip { left: auto; right: 0; transform: translate(0, 5px); }
.chart-point:is(:hover, :focus-visible) { z-index: 2; }
.chart-point:is(:hover, :focus-visible) .point-dot, .chart-point:is(:hover, :focus-visible) .chart-tip { opacity: 1; }
.chart-point:is(:hover, :focus-visible) .chart-tip { translate: 0 -5px; }
.chart figcaption { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 10px; }

.list-card, .simple-list, .empty-state, .settings-card { border: var(--hairline) solid var(--border); border-radius: 15px; background: var(--paper); }
.list-card { overflow: hidden; }
.list-title { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 18px 20px; }
.list-title h2, .settings-card h2, .empty-state h2 { font-size: 17px; font-weight: 680; letter-spacing: -.025em; color: var(--ink); }
.list-title p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.view-all { display: inline-flex; flex: none; align-items: center; gap: 5px; padding: 7px 8px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 680; transition: background 200ms; }
.view-all svg, .record-open svg { transition: transform 250ms var(--ease); }
.view-all:hover { background: var(--surface); }
.view-all:hover svg, tr:hover .record-open svg { transform: translateX(3px); }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 685px; border-collapse: collapse; text-align: left; white-space: nowrap; }
thead { color: var(--muted); background: var(--surface); border-block: var(--hairline) solid var(--border); }
thead th { padding: 11px 12px; font-size: 11px; font-weight: 630; }
th:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 14px; }
tbody tr { border-bottom: var(--hairline) solid var(--border); transition: background 210ms var(--ease); cursor: pointer; }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover, tbody tr:focus-within { background: var(--row-hover); }
tbody th, tbody td { padding: 13px 12px; font-size: 12px; }
.record-name { display: flex; align-items: center; gap: 11px; }
.record-name > span:last-child { display: grid; gap: 4px; }
.record-name strong { font-size: 13px; font-weight: 640; color: var(--ink); }
.record-name small { color: var(--muted); font-weight: 480; font-size: 10px; letter-spacing: .035em; }
.source { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--surface); color: var(--muted); }
.source-stripe { background: var(--info-surface); color: var(--info-ink); }
.source-bank { background: var(--info-surface); color: var(--info-ink); }
.source-vendor { background: var(--warning-surface); color: var(--warning-ink); }
.muted { color: var(--muted); }
.amount { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 5px 8px; font-size: 10px; line-height: 1; font-weight: 650; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.success { color: var(--muted); background: var(--surface); }
.warning { color: var(--warning-ink); background: var(--warning-surface); }
.progress { color: var(--info-ink); background: var(--info-surface); }
.record-open, .close { display: grid; place-items: center; background: transparent; color: var(--muted); border: 0; border-radius: 6px; width: 28px; height: 28px; }
.record-open:hover, .close:hover { background: var(--surface); }

.simple-list { list-style: none; padding: 0; margin: 0; max-width: 700px; }
.simple-list li { display: flex; align-items: center; gap: 12px; padding: 13px 18px; }
.simple-list li:hover { background: var(--row-hover); }
.simple-list li + li { border-top: var(--hairline) solid var(--border); }
.simple-list li > span:last-child { margin-left: auto; color: var(--muted); }
.empty-state { display: grid; justify-items: center; gap: 12px; padding: 50px 20px; }
.empty-state .metric-icon { width: 43px; height: 43px; }
.settings-card { max-width: 620px; padding: 22px; }
.settings-card h2 { margin-bottom: 18px; }
dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 10px; align-items: center; }
dt { color: var(--muted); }
dd { font-weight: 610; text-align: right; overflow-wrap: anywhere; }
.loading { padding: 16px 0; color: var(--muted); }

.detail {
  width: min(430px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 25px;
  border: var(--hairline) solid var(--border);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
}
.detail[open] { animation: enter 350ms var(--ease) both; }
.detail::backdrop { background: var(--overlay); backdrop-filter: blur(3px); animation: fade 260ms both; }
.detail .close { position: absolute; top: 14px; right: 14px; }
.detail h2 { margin: 12px 0 4px; color: var(--ink); font-size: 29px; font-weight: 400; letter-spacing: -.035em; }
.detail p { color: var(--muted); }
.detail dl { border-top: var(--hairline) solid var(--border); margin-top: 18px; padding-top: 18px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.enter { animation: fade 300ms var(--ease) var(--delay, 0ms) both; }
@keyframes enter { from { opacity: 0; translate: 0 9px; } to { opacity: 1; translate: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes indicator { from { opacity: 0; scale: 1 .4; } to { opacity: 1; scale: 1; } }

@media (min-width: 1450px) {
  .metric { min-height: 250px; padding: 21px 22px 18px; }
  .chart-plot { height: 72px; }
  tbody th, tbody td { padding-block: 15px; }
}
@media (max-width: 1090px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { --content-inset: 14px; --sidebar-width: 54px; }
  .sidebar { padding: 13px 4px 4px; }
  .brand img { width: 32px; height: 35px; }
  .avatar { flex-basis: 32px; height: 32px; }
  .content { padding-block: 18px 22px; }
  .topbar { flex-basis: 42px; }
  .run-drawer { inset:50% 12px auto auto; width:calc(100vw - 24px); max-width:calc(100vw - 24px); height:min(88dvh,820px); border-radius:17px; }
  .run-drawer-header { padding:17px 17px 14px; }
  .run-drawer-body { padding:14px 17px 20px; }
  .page-heading { margin-bottom: 20px; }
  h1 { font-size: clamp(29px, 6vw, 39px); }
}
@media (max-width: 500px) {
  .topbar:has(.topbar-actions:not([hidden])) .breadcrumb > span { display: none; }
  .metrics { gap: 8px; }
  .metric { min-height: 166px; padding: 10px 9px; border-radius: 10px; }
  .metric-label { gap: 5px; }
  .metric-label h2 { font-size: 11px; }
  .metric-icon { width: 24px; height: 24px; }
  .metric-icon svg { width: 14px; height: 14px; }
  .metric > strong { font-size: clamp(18px, 5vw, 26px); }
  .metric > p { font-size: 10px; line-height: 1.25; }
  .chart { margin-top: 12px; }
  .chart-plot { height: 44px; }
  .chart figcaption { font-size: 9px; }
  .chart figcaption span:not(:first-child):not(:last-child) { display: none; }
  .list-title { padding: 13px 10px; }
  .list-title h2 { font-size: 14px; }
  .list-title p { display: none; }
  .view-all { padding: 5px 2px; }
}
@media (max-height: 430px) {
  .sidebar { padding-top: 5px; }
  .brand { margin-bottom: 8px; }
  .navigation { gap: 1px; }
  .navigation a { min-height: 30px; }
  .profile { padding-block: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}


/* Workspace page headers */
.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 35px;
}
.workspace-header h1 {
  color: var(--ink);
  font-size: clamp(32px, 3vw, 48px);
  font-weight: 730;
  letter-spacing: -.04em;
  line-height: 1.08;
}
.workspace-header p { margin-top: 8px; color: var(--muted); font-size: clamp(13px, 1.28vw, 18px); line-height: 1.45; }

/* Reconciliation workbench */
.recon .workspace-header { margin-bottom: 22px; }
.recon-actions { display: flex; flex: none; gap: 8px; }
.recon-button, .recon-toolbar :is(input, select) {
  min-height: 43px;
  padding: 9px 14px;
  border: var(--hairline) solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  transition: background 170ms var(--ease), border-color 170ms var(--ease);
}
.recon-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  font-weight: 550;
  white-space: nowrap;
}
.recon-button:not(:disabled):hover, .recon-button.is-active { border-color: var(--border-interactive); background: var(--surface); }
.recon-button:disabled { opacity: .55; cursor: default; }
.recon-primary { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.recon-primary:not(:disabled):hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.recon-actions .recon-button { min-height: 40px; padding-inline: 12px; color: var(--ink); }
.recon-actions .recon-primary { color: var(--primary-ink); }
.recon-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.recon-metrics > div { min-width: 0; min-height: 94px; padding: 13px 14px; background: var(--paper); border: var(--hairline) solid var(--border); border-radius: 10px; }
.recon-metrics dt { color: var(--muted); font-size: clamp(12px, 1.12vw, 15px); line-height: 1.35; }
.recon-metrics dd { margin-top: 6px; color: var(--ink); font-size: clamp(24px, 2.65vw, 36px); font-weight: 730; line-height: 1.08; letter-spacing: -.035em; text-align: left; font-variant-numeric: tabular-nums; }
.recon-tabs { display: flex; align-items: stretch; gap: clamp(16px, 3vw, 36px); margin-bottom: 14px; border-bottom: var(--hairline) solid var(--border); }
.recon-tabs button { position: relative; min-height: 38px; padding: 0 0 8px; border: 0; background: transparent; color: var(--muted); font-size: clamp(13px, 1.2vw, 16px); white-space: nowrap; }
.recon-tabs button:hover { color: var(--ink); }
.recon-tabs button[aria-pressed=true] { color: var(--ink); font-weight: 700; }
.recon-tabs button[aria-pressed=true]::after { content: ""; position: absolute; inset: auto 0 calc(-1 * var(--hairline)); height: var(--hairline); background: var(--border-interactive); animation: indicator 260ms var(--ease) both; }
.recon-toolbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.1fr) minmax(76px, .62fr) minmax(76px, .56fr); gap: 8px; margin-bottom: 14px; }
.recon-toolbar :is(input, select, button) { min-height: 38px; padding-block: 7px; }
.recon-toolbar :is(input, select) { width: 100%; min-width: 0; font: inherit; }
.recon-toolbar input::placeholder { color: var(--muted); opacity: 1; }
.recon-toolbar .recon-button { justify-content: flex-start; }
.recon-table-wrap { overflow-x: auto; scrollbar-width: thin; }
.recon-table { min-width: 605px; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: clamp(13px, 1.15vw, 16px); }
.recon-table col:nth-child(1) { width: 15%; }
.recon-table col:nth-child(2) { width: 19.3%; }
.recon-table col:nth-child(3) { width: 14.1%; }
.recon-table col:nth-child(4) { width: 13.7%; }
.recon-table col:nth-child(5) { width: 16%; }
.recon-table thead { background: var(--surface); color: var(--muted); }
.recon-table thead th:first-child { border-radius: 7px 0 0 7px; }
.recon-table thead th:last-child { border-radius: 0 7px 7px 0; }
.recon-table th, .recon-table td { padding: 9px clamp(10px, 1.3vw, 19px); font-size: inherit; font-weight: 500; text-overflow: ellipsis; overflow: hidden; }
.recon-table thead th { height: 42px; }
.recon-table tbody tr { border: 0; cursor: auto; color: var(--ink); }
.recon-table tbody :is(td, th) { height: 46px; border-bottom: var(--hairline) solid var(--border); }
.recon-table tbody td:nth-child(n+3) { font-variant-numeric: tabular-nums; }
.recon-table td.recon-empty { padding: 25px 14px; text-align: center; color: var(--muted); }
.recon-status.matched { color: var(--success-text); }
.recon-status.partial, .recon-status.unpaid, .recon-status.overpaid { color: var(--warning-ink); }
.recon-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 15px; color: var(--muted); font-size: 12px; }
.recon-pagination[hidden] { display: none; }
.recon-dialog h2 { margin: 0 24px 14px 0; font-size: 21px; font-weight: 700; line-height: 1.2; }
.recon-dialog > p { margin: 0 0 12px; line-height: 1.5; }
.recon-fields { display: grid; gap: 11px; }
.recon-fields label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
.recon-fields input, .recon-fields select { min-width: 0; min-height: 38px; padding: 8px; font: inherit; color: inherit; background: var(--paper); border: var(--hairline) solid var(--border); border-radius: 7px; }
.recon-fields input::file-selector-button { margin-right: 7px; padding: 4px 8px; color: var(--ink); background: var(--surface); border: var(--hairline) solid var(--border); border-radius: 5px; cursor: pointer; }
.recon-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.recon-dialog .recon-error { margin-top: 9px; color: var(--error-ink); overflow-wrap: anywhere; }
.recon-error:empty { display: none; }

/* Previously saved statement and ledger imports */
.import-page { max-width: 1250px; }
.import-back { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px 5px 1px; margin-bottom: 12px; color: var(--muted); font-size: 12px; font-weight: 650; }
.import-back svg { rotate: 180deg; }
.import-card, .import-list-card { min-width: 0; border: var(--hairline) solid var(--border); border-radius: 14px; background: var(--paper); }
.import-card { padding: 16px; }
.import-list-card { overflow: hidden; }
.import-list-card > :is(.loading, .import-alert) { margin: 15px; }
.import-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px; border-bottom: var(--hairline) solid var(--border); }
.import-list-heading h2, .import-section-title h2 { font-size: 16px; }
.import-list-heading p, .import-section-title p, .import-empty p { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.import-count { flex: none; color: var(--muted); font-size: 12px; }
.import-empty { display: flex; align-items: center; gap: 10px; padding: 15px; }
.import-icon { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--surface); color: var(--muted); }
.imported-runs { list-style: none; margin: 0; padding: 0; }
.imported-runs li + li { border-top: var(--hairline) solid var(--border); }
.imported-runs a { display: flex; align-items: center; gap: 10px; padding: 11px 20px 11px 16px; }
.imported-runs a:is(:hover, :focus-visible) { background: var(--row-hover); }
.import-run-name { display: grid; flex: 1; min-width: 0; gap: 4px; }
.import-run-name small, .import-run-counts, .preview-caption { color: var(--muted); font-size: 11px; }
.import-detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.import-detail-title h1 { overflow-wrap: anywhere; }
.import-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-source-title { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; }
.import-preview { overflow: auto; border: var(--hairline) solid var(--border); border-radius: 8px; }
.import-preview table { min-width: 290px; }
.import-preview th, .import-preview td { padding: 8px 9px; font-size: 11px; }
.import-preview tbody tr { cursor: auto; }
.import-reference { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.preview-caption { margin-top: 8px; }

@media (max-width: 1020px) {
  .workspace-header { flex-wrap: wrap; margin-bottom: 22px; }
  .recon-toolbar { grid-template-columns: minmax(130px, 2fr) minmax(90px, 1fr) minmax(90px, 1.1fr) auto auto; gap: 6px; }
  .recon-toolbar :is(input, select, button) { padding-inline: 9px; }
}
@media (max-width: 880px) {
  .import-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .workspace-header { gap: 12px; }
  .recon-actions .recon-button { min-height: 39px; padding-inline: 10px; }
  .recon-metrics > div { display: flex; flex-direction: column; min-height: 76px; padding: 9px; }
  .recon-metrics dd { margin-top: auto; padding-top: 6px; }
  .recon-table { min-width: 500px; }
  .recon-table th, .recon-table td { padding-inline: 6px; }
}
@media (max-width: 650px) {
  .recon-toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; }
  .recon-toolbar input { grid-column: 1 / -1; }
  .recon-toolbar :is(input, select, button) { min-height: 37px; font-size: 12px; }
}
@media (max-width: 560px) {
  .recon-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recon-tabs { gap: 14px; overflow-x: auto; }
  .recon-tabs button { font-size: 12px; }
  .import-run-counts { display: none; }
}
@media (max-width: 365px) {
  .recon-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Document import */
.document-modal {
  width: min(640px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: clamp(17px, 3vw, 27px);
  overflow: auto;
  background: var(--paper);
  border-color: var(--border);
  box-shadow: var(--shadow-dialog);
}
.document-modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.document-modal-header { position: relative; margin-bottom: 19px; }
.document-modal-header h2 { margin: 10px 34px 4px 0; color: var(--ink); font-size: 25px; font-weight: 720; letter-spacing: -.034em; }
.document-modal-header p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.document-modal-icon, .document-drop-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  border: var(--hairline) solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
}
.document-modal .document-close { top: 0; right: 0; }
.document-form { display: grid; gap: 15px; }
.document-client { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 650; }
.document-client select {
  width: 100%;
  min-height: 41px;
  padding: 8px 10px;
  border: var(--hairline) solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
}
.document-types { min-width: 0; padding: 0; margin: 0; border: 0; }
.document-types legend { padding: 0; margin-bottom: 7px; color: var(--ink); font-size: 13px; font-weight: 650; }
.document-type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.document-type {
  position: relative;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 5px;
  min-height: 94px;
  padding: 9px 10px;
  border: var(--hairline) solid var(--border);
  border-radius: 9px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}
.document-type:hover { background: var(--surface); }
.document-type:has(input:checked) { background: var(--surface); border-color: var(--border-interactive); }
.document-type:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.document-type input { position: absolute; top: 9px; right: 9px; margin: 0; accent-color: var(--accent); }
.document-type-icon { display: grid; place-items: center; width: 27px; height: 27px; color: var(--muted); }
.document-type strong { color: var(--ink); font-size: 12px; line-height: 1.2; }
.document-type small { color: var(--muted); font-size: 11px; }
.document-dropzone {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 87px;
  padding: 13px;
  border: var(--hairline) dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}
.document-dropzone:hover, .document-dropzone.is-dragging { border-color: var(--border-interactive); background: var(--surface); }
.document-dropzone strong { color: var(--ink); font-size: 13px; line-height: 1.3; }
.document-dropzone p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.document-dropzone .document-browse { margin-left: auto; min-height: 35px; flex: none; }
.document-file-error { color: var(--error-ink); font-size: 12px; overflow-wrap: anywhere; }
.document-selected { display: grid; gap: 5px; max-height: 125px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.document-file-error:empty, .document-selected:empty { display: none; }
.document-selected li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: var(--hairline) solid var(--border); border-radius: 7px; color: var(--muted); font-size: 12px; }
.document-selected li:is(:hover, :focus-within) { background: var(--row-hover); }
.document-selected li > svg { flex: none; }
.document-selected li span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.document-selected small { color: var(--muted); }
.document-remove { display: grid; place-items: center; flex: none; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.document-remove:hover { background: var(--surface); }
.document-modal .document-form-footer { margin: 0; padding-top: 12px; border-top: var(--hairline) solid var(--border); }
.document-form-footer .recon-button { min-height: 38px; }
.document-prototype { text-align: center; color: var(--muted); font-size: 11px; line-height: 1.4; }
.document-sample { border: 0; padding: 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.document-confirmation { margin-top: 12px; padding: 10px 12px; border: var(--hairline) solid var(--border); border-radius: 8px; color: var(--ink); background: var(--surface); font-size: 12px; }

@media (max-width: 460px) {
  .document-type-grid { grid-template-columns: 1fr; gap: 6px; }
  .document-type { grid-template-columns: 24px 1fr; align-items: center; column-gap: 7px; row-gap: 2px; min-height: 43px; padding: 6px 27px 6px 7px; }
  .document-type-icon { grid-row: span 2; width: 23px; height: 23px; }
  .document-dropzone { flex-wrap: wrap; }
  .document-dropzone .document-browse { margin-left: 0; }
}

/* Reconciliation setup */
.recon-setup { width:min(690px,calc(100% - 24px)); }
.recon-setup .document-modal-header h2 { margin-top:0; }
.recon-setup-form { display:grid; gap:15px; }
.recon-config-fields { grid-template-columns:minmax(0,1.1fr) minmax(0,1fr) minmax(0,1fr); align-items:start; }
.recon-config-fields input, .recon-config-fields select { width:100%; }
.recon-config-currency { display:grid; gap:5px; font-size:13px; font-weight:600; }
.recon-config-currency output {
  display:flex; align-items:center; min-height:38px; padding:7px 9px; border:var(--hairline) solid var(--border);
  border-radius:7px; background:var(--sidebar); font-weight:570;
}
.recon-config-currency small { color:var(--muted); font-size:11px; font-weight:460; }
.recon-source-slots { display:grid; gap:9px; }
.recon-source-slot { display:grid; gap:9px; min-width:0; padding:12px; border:var(--hairline) solid var(--border); border-radius:9px; }
.recon-source-slot header { display:flex; align-items:center; gap:9px; }
.recon-source-slot header h3 { margin:0 0 2px; font-size:14px; font-weight:690; }
.recon-source-slot header p { font-size:11px; color:var(--muted); }
.recon-source-icon {
  display:grid; place-items:center; width:34px; height:34px; flex:none; background:var(--row-hover);
  border:var(--hairline) solid var(--border); border-radius:8px;
}
.recon-source-required { margin-left:auto; font-size:11px; color:var(--muted); }
.recon-source-controls { display:grid; grid-template-columns:auto minmax(0,1fr); gap:7px; }
.recon-source-controls select {
  min-width:0; padding:7px 8px; color:var(--ink); background:var(--paper);
  border:var(--hairline) solid var(--border-interactive); border-radius:7px; font-size:12px;
}
.recon-source-controls select:disabled { color:var(--muted); background:var(--sidebar); }
.recon-source-controls button, .recon-source-result button, .recon-mapping button { min-height:34px; padding:6px 8px; font-size:12px; }
.recon-source-result:empty, .recon-source-slot [data-source-mapping]:empty, .recon-setup-form .recon-error:empty { display:none; }
.recon-source-file {
  display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:8px; padding:5px 7px;
  border-radius:7px; background:var(--row-hover); font-size:12px;
}
.recon-source-file strong { overflow-wrap:anywhere; }
.recon-source-result :is(p,ul) { margin:5px 0 0; font-size:12px; }
.recon-source-result ul { padding-left:16px; color:var(--muted); }
.recon-source-result > button { margin-top:6px; }
.recon-mapping { padding:7px 8px; border:var(--hairline) solid var(--border); border-radius:7px; font-size:12px; }
.recon-mapping summary { font-weight:650; cursor:pointer; }
.recon-mapping p { margin-top:5px; color:var(--muted); }
.recon-mapping-fields { grid-template-columns:repeat(3,minmax(0,1fr)); margin:9px 0; }
.recon-mapping-fields select { width:100%; }
.recon-coverage-review {
  padding:9px 10px; border:var(--hairline) solid var(--border-interactive); border-radius:7px;
  color:var(--ink); background:var(--sidebar); font-size:12px; line-height:1.45;
}
.recon-coverage-review label { display:flex; align-items:start; gap:6px; margin-top:6px; font-weight:620; }
.recon-coverage-review summary { font-weight:650; cursor:pointer; }
.recon-coverage-review p { margin-top:6px; }
.recon-coverage-review input { flex:none; margin:2px 0 0; accent-color:var(--accent); }
.recon-setup .recon-setup-footer { margin:0; padding-top:12px; border-top:var(--hairline) solid var(--border); }
@media (max-width:560px) {
  .recon-config-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .recon-config-fields label:first-child { grid-column:1 / -1; }
  .recon-mapping-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:385px) {
  .recon-source-file { grid-template-columns:minmax(0,1fr) auto; }
  .recon-source-file strong { grid-column:1 / -1; }
  .recon-source-file .badge { justify-self:start; }
}

/* Persisted reconciliation runs */
.run-list, .run-card {
  min-width: 0;
  margin: 0;
  border: var(--hairline) solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}
.run-list > h2, .run-card > h2 { font-size: 15px; font-weight: 700; }
.run-list > h2 { padding: 14px 16px; border-bottom: var(--hairline) solid var(--border); }
.run-list > p, .run-empty { padding: 16px; }
.run-empty p, .run-list-name small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.run-list-items { list-style: none; margin: 0; padding: 0; }
.run-list-items li + li { border-top: var(--hairline) solid var(--border); }
.run-list-items a { display: flex; align-items: center; gap: 10px; padding: 10px 20px 10px 15px; }
.run-list-items a:is(:hover, :focus-visible) { background: var(--row-hover); }
.run-list-name { display: grid; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.run-list-items .badge { text-transform: capitalize; }
.run-list-items svg { flex: none; }
.run-breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.run-breadcrumb a { color: var(--ink); }
.run-breadcrumb a:hover { text-decoration: underline; text-underline-offset: 2px; }
.run-title { margin-bottom: 19px; }
.run-title h1 { font-size: clamp(28px, 3vw, 43px); }
.run-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.run-metrics { margin-bottom: 7px; }
.run-metric-note { margin-bottom: 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.run-toolbar { grid-template-columns: minmax(100px, 2fr) minmax(100px, 1fr) minmax(112px, 1fr); }
.run-toolbar input { grid-column: auto; }
.run-result-table { min-width: 740px; }
.run-result-table tbody tr[data-result] { cursor: pointer; }
.run-row-link { max-width: 100%; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.run-reviewed { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.run-card { padding: 14px 15px; }
.run-progress { max-width: 700px; }
.run-progress ol, .run-card ul, .run-card ol { margin: 0; padding: 0; list-style: none; }
.run-progress ol li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 9px 0; font-size: 13px; }
.run-progress ol li + li { border-top: var(--hairline) solid var(--border); }
.run-stage-number { display: grid; place-items: center; width: 24px; height: 24px; border: var(--hairline) solid var(--border); border-radius: 50%; color: var(--muted); font-size: 11px; }
.run-stage-status { padding: 4px 7px; border-radius: 14px; color: var(--muted); background: var(--surface); font-size: 11px; }
.run-stage-status.processing { background: var(--primary); color: var(--primary-ink); }
.run-stage-status.failed, .run-error { color: var(--error-ink); }
.run-error { margin: 10px 0; font-size: 13px; overflow-wrap: anywhere; }
.run-muted { color: var(--muted); font-size: 12px; line-height: 1.5; }
.run-progress > .run-muted { margin-top: 9px; }
.run-progress > a { text-decoration: underline; text-underline-offset: 2px; }
.run-references { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 15px; }
.run-references :is(ol, ul) { margin-top: 7px; }
.run-references li { padding: 8px 0; overflow-wrap: anywhere; }
.run-references li + li { border-top: var(--hairline) solid var(--border); }
.run-references li:last-child { padding-bottom: 0; }
.run-references li > :is(small, time) { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.run-references ol li > span { font-size: 12px; line-height: 1.45; }
.run-source-link { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 12px; font-weight: 650; }
.run-source-link svg { flex: none; }
.run-source-link span { overflow-wrap: anywhere; }
.run-source-link:hover span { text-decoration: underline; text-underline-offset: 2px; }

.run-drawer {
  position: fixed;
  inset: 50% 24px auto auto;
  translate: 0 -50%;
  width: min(540px, calc(100vw - 48px));
  max-width: calc(100vw - 28px);
  max-height: min(88dvh, 900px);
  height: min(820px, 88dvh);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: var(--hairline) solid var(--border);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
}
.run-drawer[open] { display: flex; flex-direction: column; animation: drawer-enter 200ms var(--ease) both; }
.run-drawer::backdrop { background: var(--overlay); backdrop-filter:blur(1px); }
.run-drawer.is-closing { animation:drawer-exit 200ms cubic-bezier(.4,0,1,1) both; }
@keyframes drawer-enter { from { opacity:0; transform:translate3d(0,8px,0); } to { opacity:1; transform:translate3d(0,0,0) scale(1); } }
@keyframes drawer-exit { to { opacity:0; transform:translate3d(0,12px,0) scale(.98); } }
.run-drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 22px 23px 17px; border-bottom: var(--hairline) solid var(--border); }
.run-drawer-header h2 { font-size: 21px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.run-drawer-header p { margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.run-drawer-header button { flex: none; }
.run-drawer-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 23px 25px; }
.run-drawer-body .run-badges { margin: 0 0 8px; }
.run-balance, .run-source-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px 10px; }
.run-balance { padding: 11px; background: var(--surface); border-radius: 8px; font-size: 13px; }
.run-evidence-card { margin-top: 10px; padding: 11px; border: var(--hairline) solid var(--border); border-radius: 8px; }
.run-evidence-card h3 { margin: 0 0 6px; font-size: 13px; }
.run-evidence-card > p, .run-evidence-card > small { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.gatekeeper-summary { margin: 16px 0 20px; padding: 18px 20px; }
.gatekeeper-summary h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.025em; }
.gatekeeper-summary .recon-metrics { margin: 14px 0 10px; }
.gatekeeper-period-input { display: flex; align-items: center; gap: 10px; width: fit-content; margin-top: 12px; font-size: 13px; color: var(--muted); }
.gatekeeper-period-input input { width: 168px; min-height: 34px; border: var(--hairline) solid var(--border); border-radius: 7px; padding: 5px 8px; color: var(--ink); background: var(--paper); font: inherit; }
.gatekeeper-period-readiness { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.gatekeeper-findings { display: grid; gap: 8px; list-style: none; margin: 12px 0 0; padding: 0; }
.gatekeeper-finding { padding: 11px 12px; border: var(--hairline) solid var(--border); border-radius: 8px; background: var(--surface, var(--paper)); }
.gatekeeper-finding p { margin: 7px 0 4px; font-size: 13px; line-height: 1.4; }
.gatekeeper-finding small { display: block; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.run-evidence-source { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 3px 8px; margin-bottom: 6px; }
.run-evidence-source > small { color: var(--muted); white-space: nowrap; font-size: 10px; }
.run-source-fields, .run-match-reasons, .run-candidates { font-size: 12px; line-height: 1.45; }
.run-source-fields dt { overflow-wrap: anywhere; }
.run-source-fields dd { text-align: left; }
.run-payment-record + .run-payment-record { margin-top: 9px; padding-top: 8px; border-top: var(--hairline) solid var(--border); }
.run-match-reasons, .run-candidates { margin: 6px 0 0; padding-left: 16px; }
.run-review-form label { display: grid; gap: 5px; font-size: 12px; }
.run-review-form textarea { border: var(--hairline) solid var(--border-interactive); border-radius: 6px; padding: 7px; resize: vertical; }
.run-review-form button { min-height: 34px; margin-top: 7px; }
.run-review-error { color: var(--error-ink); font-size: 12px; }
.run-review-error:empty { display: none; }
@media (max-width: 660px) {
  .run-references { grid-template-columns: 1fr; }
  .run-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-toolbar input { grid-column: 1 / -1; }
  .run-result-table { min-width: 665px; }
}

/* Central exception review */
.exceptions-workspace .workspace-header { margin-bottom: 21px; }
.exception-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.exceptions-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  align-items: end;
  margin-bottom: 14px;
}
.exceptions-filters label { display: grid; gap: 4px; min-width: 0; font-size: 11px; font-weight: 640; color: var(--muted); }
.exceptions-filters :is(input, select) {
  min-width: 0; width: 100%; min-height: 36px; padding: 6px 9px; color: var(--ink);
  border: var(--hairline) solid var(--border); border-radius: 7px; background: var(--paper); font-size: 13px;
}
.exceptions-filters button { min-height: 36px; justify-self: start; }
.exceptions-table { min-width: 900px; font-size: 13px; }
.exceptions-table th:first-child { width: 11%; }
.exceptions-table th:nth-child(3), .exceptions-table th:last-child { width: 16%; }
.exceptions-table td time { font-size: 11px; }
.exceptions-table tr[data-exception-id] { cursor: pointer; }
.exception-invoice-picker[hidden] { display: none; }
.exception-run-link { text-decoration: underline; text-underline-offset: 2px; }
.exception-detail-list { list-style: none; padding: 0; margin: 0; }
.exception-detail-list li { padding: 6px 0; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.exception-detail-list li + li { border-top: var(--hairline) solid var(--border); }
.exception-detail-list li > small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.exception-detail-list p { margin-top: 5px; }
.exception-resolution-form :is(input,textarea), .run-finalize-dialog textarea, .exception-draft textarea {
  width: 100%; min-width: 0; padding: 7px 8px; color: var(--ink); background: var(--paper);
  border: var(--hairline) solid var(--border-interactive); border-radius: 7px; resize: vertical;
}
.exception-resolution-form .recon-error:empty { display: none; }
.exception-resolution-actions { display: flex; justify-content: flex-end; gap: 7px; }
.exception-resolution-actions .recon-button { min-height: 36px; }
.exception-audit summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.exception-changed-records { margin-top: 7px; }
.exception-changed-records summary { cursor: pointer; color: var(--muted); }
.exception-audit ol { max-height: 210px; overflow: auto; }
.exception-verification { padding:10px 12px; border:var(--hairline) solid var(--border); border-radius:8px; background:var(--sidebar); }
.exception-verification[hidden], .exception-verification button[hidden] { display:none; }
.exception-verification p { color:var(--muted); font-size:12px; line-height:1.5; }
.exception-verification .exception-resolution-actions { margin-top:8px; }
.exception-decision-state { margin-top: 7px; gap: 3px 9px; }
.exception-draft { display: grid; margin-top: 8px; gap: 4px; font-weight: 650; }
.exception-draft textarea { font-weight: 400; font-size: 12px; }
.run-title .run-finalized-by { color: var(--muted); font-size: 12px; }
.run-finalize-dialog > p { font-size: 13px; }
@media (max-width: 760px) {
  .exceptions-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exceptions-filters .exceptions-search { grid-column: 1 / -1; }
}

.shell[hidden], .auth-screen[hidden], .profile-actions[hidden] { display: none; }
.auth-screen { min-height: 100dvh; max-height: 100dvh; overflow: auto; display: grid; place-items: center; padding: 20px; background: var(--sidebar); }
.auth-card { width: min(100%, 414px); padding: clamp(20px, 5vw, 31px); border: var(--hairline) solid var(--border); border-radius: 14px; background: var(--paper); }
.auth-brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 700; margin-bottom: 22px; }
.auth-card h1 { font-size: 27px; font-weight: 730; letter-spacing: -.03em; }
.auth-card > p { margin: 6px 0 16px; color: var(--muted); font-size: 13px; }
.auth-fields button { min-height: 39px; }
.auth-links { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 13px; }
.auth-links button { background: none; border: 0; padding: 2px 0; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.auth-message { color: var(--muted); font-size: 12px; }
.auth-message:empty, .profile-error:empty { display: none; }
.profile-menu { position: relative; margin-top: auto; }
.profile-actions { position: absolute; inset-inline-start: 0; bottom: calc(100% + 5px); z-index: 5; width: max(100%, 157px); padding: 5px; background: var(--paper); border: var(--hairline) solid var(--border); border-radius: 8px; box-shadow: var(--shadow-menu); }
.profile-actions :is(a, button) { display: block; width: 100%; padding: 7px; text-align: left; border: 0; background: none; border-radius: 5px; font-size: 13px; }
.profile-actions :is(a, button):hover { background: var(--row-hover); }
.profile-error { padding: 5px; font-size: 11px; color: var(--error-ink); }
.clients-toolbar { grid-template-columns: minmax(0, 2fr) minmax(105px, 1fr); }
.clients-toolbar input { grid-column: auto; }
.clients-table { min-width: 790px; font-size: 13px; }
.client-more { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.client-tabs { overflow: auto; }
.client-tabs a { flex: none; padding: 6px 0 10px; color: var(--muted); border-bottom: var(--hairline) solid transparent; }
.client-tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--primary); font-weight: 700; }
.client-dialog h2 { font-size: 21px; margin-bottom: 14px; }
.client-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.client-dialog textarea { width: 100%; padding: 8px; border: var(--hairline) solid var(--border); border-radius: 7px; resize: vertical; }
.client-dialog .recon-error:empty { display: none; }
.clients-page .settings-card p { white-space: pre-wrap; }

.documents-workspace .workspace-header { margin-bottom: 21px; }
.document-filters { grid-template-columns: minmax(145px, 1.4fr) repeat(4, minmax(110px, 1fr)); }
.document-tabs { overflow-x: auto; }
.documents-table { min-width: 1080px; font-size: 13px; }
.documents-table th:first-child { width: 18%; }
.documents-table th:nth-child(8) { width: 16%; }
.documents-table tbody tr { cursor: pointer; }
.documents-table th small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.documents-table time { font-size: 11px; }
.document-import-fields, .document-map-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.document-client input { width: 100%; min-width: 0; padding: 7px; background: var(--paper); border: var(--hairline) solid var(--border); border-radius: 7px; }
.document-client .muted { font-size: 11px; font-weight: 400; }
.document-detail-actions { display: flex; margin-top: 10px; gap: 6px; flex-wrap: wrap; }
.document-detail-actions .recon-button { min-height: 33px; padding: 5px 8px; font-size: 12px; }
.document-detail-error:not(:empty) { margin-top: 8px; color: var(--error-ink); font-size: 12px; }
.document-mapping summary { font-weight: 680; cursor: pointer; }
.document-mapping form { margin-top: 8px; }
.document-preview { min-width: 435px; font-size: 11px; }
.document-preview th, .document-preview td { padding: 5px 7px; }
.document-preview thead th, .document-preview tbody td { height: 34px; }
.document-original-preview { display:block; width:100%; max-height:360px; min-height:180px; object-fit:contain;
  background:var(--surface); border:var(--hairline) solid var(--border); border-radius:8px; }
.extraction-fields { margin:12px 0; border-top:var(--hairline) solid var(--border); }
.extraction-fields > div { display:grid; grid-template-columns:minmax(100px,35%) 1fr; gap:12px;
  padding:9px 0; border-bottom:var(--hairline) solid var(--border); font-size:12px; }
.extraction-fields dt { color:var(--muted); }
.extraction-fields dd { margin:0; min-width:0; overflow-wrap:anywhere; }
.extraction-fields dd strong { display:block; font-weight:600; }
.extraction-fields dd span,.extraction-fields dd small { display:block; margin-top:3px; color:var(--muted); }
.extraction-fields dd em { display:inline-block; margin-top:4px; color:var(--warning-ink); font-style:normal; }
.extraction-notes { font-size:12px; margin:9px 0; }
.extraction-notes ul { padding-left:18px; margin:5px 0; }
.extraction-reprocess { margin-top:12px; }
@media (max-width: 900px) {
  .document-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .document-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .document-filters label:first-child { grid-column: 1/-1; }
  .document-tabs { gap: 12px; }
}

.inbox-filters { grid-template-columns: minmax(160px,1.65fr) repeat(4,minmax(110px,1fr)); }
.inbox-filters [data-history-status][hidden] { display: none; }
.inbox-workspace [data-inbox-scope] { margin-block: 0 12px; }
.inbox-tabs small { margin-left: 3px; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); }
.inbox-table { min-width: 710px; font-size: 13px; }
.inbox-table tbody tr[data-message] { cursor: pointer; }
.inbox-table th[scope="row"] { width: 47%; }
.inbox-table th[scope="row"] span, .inbox-table th[scope="row"] small {
  display: block; max-width: min(36vw,490px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 400; color: var(--muted);
}
.inbox-message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.inbox-draft, .email-collection form { margin-top: 12px; }
.inbox-draft textarea, .email-collection textarea {
  width: 100%; padding: 8px; border: var(--hairline) solid var(--border-interactive); border-radius: 7px; resize: vertical;
}
.inbox-draft-actions, .inbox-inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inbox-inline-actions input { flex: 1 1 230px; }
.inbox-check { display: flex !important; gap: 8px; align-items: center; }
.inbox-check input[type="checkbox"] { width: 16px; height: 16px; padding: 0; min-height: 0; }
.inbox-detail-feedback:not(:empty) { margin-top: 10px; }
.email-collection { margin-bottom: 15px; }
.email-collection .recon-fields { max-width: 620px; }
.email-collection > .recon-fields { margin-top: 10px; }
.email-collection p + p { margin-top: 6px; }
@media (max-width: 1050px) { .inbox-filters { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 620px) {
  .inbox-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .inbox-filters label:first-child { grid-column: 1/-1; }
}

.schedule-card { margin-block: 14px; }
.schedule-form { margin-top: 14px; }
.schedule-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.schedule-card p[role="status"]:not(:empty) { margin-top: 8px; }
@media (max-width: 720px) { .schedule-fields { grid-template-columns: repeat(2,minmax(0,1fr)); } }

.overview-header { gap: 18px; margin-bottom:20px; }
.overview-range, .overview-custom { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.overview-custom:where([hidden]) { display:none; }
.overview-custom label { font-size:12px; display:flex; align-items:center; gap:5px; }
.overview-custom input { color:var(--ink); border:var(--hairline) solid var(--border); border-radius:7px; padding:6px 7px; min-height:36px; background:var(--paper); }
.overview-period-note { color:var(--muted); min-height:17px; margin:0 0 14px; font-size:12px; }
.overview-metrics { gap:10px; margin:0 0 16px; }
.overview-metrics > div { display:flex; flex-direction:column; gap:3px; min-height:100px; }
.overview-metrics dd { font-size:30px; font-variant-numeric:tabular-nums; }
.overview-metrics p { color:var(--muted); font-size:11px; margin-top:auto; }
.overview-priority, .overview-secondary { display:grid; grid-template-columns:minmax(260px,1fr) minmax(0,2.15fr); gap:12px; margin-bottom:12px; align-items:start; }
.overview-secondary { grid-template-columns:minmax(0,1fr) minmax(0,1.4fr); }
.overview-card { margin:0; min-width:0; }
.overview-card h2 { font-size:15px; }
.overview-card > header, .overview-empty { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.overview-card > header a, .overview-wait-link { font-size:12px; text-decoration:underline; text-underline-offset:3px; }
.overview-card > header a { flex:none; }
.overview-empty { margin-bottom:12px; }
.overview-empty p { color:var(--muted); font-size:13px; }
.overview-placeholder {
  display:grid; justify-items:center; align-content:center; gap:10px; min-height:148px; margin-top:12px; padding:18px 14px;
  border:var(--hairline) solid var(--border); border-radius:9px; background:var(--sidebar); text-align:center;
}
.overview-placeholder-icon {
  flex:none; display:grid; place-items:center; width:43px; height:43px; border-radius:10px;
  background:var(--paper); border:var(--hairline) solid var(--border-interactive); color:var(--ink);
  box-shadow:0 2px 5px #1a1a1809;
}
.overview-placeholder h3 { font-size:13px; font-weight:695; margin:0; }
.overview-placeholder p { margin-top:4px; color:var(--muted); font-size:12px; line-height:1.45; }
.overview-placeholder-link { font-size:12px; font-weight:670; text-decoration:underline; text-underline-offset:3px; }
.overview-card:has(>.overview-placeholder):not(.overview-attention-card) { align-self:stretch; display:flex; flex-direction:column; }
.overview-card>.overview-placeholder { flex:1; }
.overview-attention-card .overview-placeholder { grid-template-columns:auto minmax(0,1fr); align-items:center; justify-items:start; min-height:0; padding:9px; text-align:left; }
.overview-attention-card .overview-placeholder-icon { width:35px; height:35px; border-radius:8px; }
.overview-attention-card .overview-placeholder-icon svg { width:19px; height:19px; }
.overview-prompt-copy { display:flex; align-items:center; gap:11px; }
.overview-prompt-copy .overview-placeholder-icon { background:var(--row-hover); }
.overview-prompt-copy h2 { margin-bottom:3px; }
.overview-attention, .overview-upcoming, .overview-feed { list-style:none; margin:8px 0 0; padding:0; }
.overview-attention li + li, .overview-upcoming li + li, .overview-feed li + li { border-top:var(--hairline) solid var(--border); }
.overview-attention a { display:grid; grid-template-columns:20px minmax(0,1fr) 27px 14px; align-items:center; gap:6px; padding:8px var(--control-icon-inset) 8px 5px; border-radius:4px; min-height:42px; font-size:12px; }
.overview-attention a:hover { background:var(--surface); }
.overview-attention strong { justify-self:end; min-width:21px; text-align:center; font-variant-numeric:tabular-nums; }
.overview-open-count { background:var(--surface); padding:3px 4px; border-radius:5px; }
.overview-queue-icon { display:flex; align-items:center; color:var(--muted); }
.overview-table { width:100%; min-width:650px; table-layout:fixed; font-size:12px; }
.overview-table td, .overview-table th { padding:8px 7px; white-space:normal; overflow-wrap:anywhere; text-overflow:clip; line-height:1.35; }
.overview-table th:nth-child(1) { width:15%; }
.overview-table th:nth-child(2) { width:14%; }
.overview-table th:nth-child(3), .overview-table th:nth-child(5) { width:10%; }
.overview-table th:nth-child(4), .overview-table th:nth-child(6) { width:8%; }
.overview-table th:nth-child(7) { width:16%; }
.overview-table th:nth-child(8) { width:19%; }
.overview-table .badge { white-space:nowrap; }
.overview-table tbody tr { cursor:pointer; }
.overview-table tbody tr:hover { background:var(--surface); }
.overview-number { font-variant-numeric:tabular-nums; }
.overview-upcoming li, .overview-feed li { padding:10px 0; font-size:13px; }
.overview-upcoming p, .overview-upcoming small, .overview-feed small, .overview-feed time { display:block; color:var(--muted); font-size:11px; }
.overview-upcoming p { margin:3px 0 6px; }
.overview-upcoming small { margin-top:4px; }
.overview-wait-link { display:block; margin-top:5px; }
.overview-feed li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
.overview-event-meta { text-align:right; }
.overview-feed time { margin-top:3px; }
@media (max-width:1120px) { .overview-priority { grid-template-columns:minmax(0,1fr); } }
@media (max-width:760px) {
  .overview-header { flex-wrap:wrap; }
  .overview-secondary { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:480px) {
  .overview-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .overview-empty { flex-wrap:wrap; }
  .overview-card > header { flex-wrap:wrap; }
}

.billing-workspace { display: grid; gap: 18px; }
.billing-workspace [data-billing-body] { display: grid; gap: 20px; min-width: 0; }
.billing-notice { margin: 0; color: var(--muted); }
.billing-notice:empty { display: none; }
.billing-card { padding: 20px; min-width: 0; }
.billing-card h2, .billing-plans h2 { margin: 0 0 10px; font-size: 17px; }
.billing-section-head, .billing-checkout { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.billing-details, .billing-meters, .billing-plan-grid { display: grid; gap: 12px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.billing-meters { grid-template-columns: repeat(2,minmax(0,1fr)); }
.billing-details dt, .billing-meter dt { color: var(--muted); font-size: 13px; margin-bottom: 5px; }
.billing-details dd, .billing-meter dd { margin: 0; }
.billing-checkout { border-top: var(--hairline) solid var(--border); padding-top: 12px; align-items: center; justify-content: start; }
.billing-checkout p { margin: 0 12px 0 0; }
.billing-meter { min-width: 0; }
.billing-meter dd, .billing-price { font-size: 24px; font-weight: 650; margin: 0; }
.billing-meter small, .billing-price small { font-size: 13px; color: var(--muted); font-weight: 400; }
.billing-meter progress { width: min(100%,280px); height: 9px; accent-color: var(--accent); }
.billing-meter p, .billing-adjustment { display: block; font-size: 12px; color: var(--muted); margin: 4px 0; }
.billing-plan { padding: 18px; display: grid; align-content: start; justify-items: start; gap: 9px; }
.billing-plan h3 { margin: 0; font-size: 16px; }
.billing-plan ul { list-style: none; margin: 5px 0 10px; padding: 0; display: grid; gap: 5px; font-size: 13px; }
.billing-dialog { width: min(440px, calc(100% - 24px)); padding: 20px; border: var(--hairline) solid var(--border); border-radius: 12px; color: inherit; font: inherit; }
.billing-dialog::backdrop { background: var(--overlay); }
.billing-dialog h2 { margin: 0; font-size: 19px; }
.billing-dialog .recon-actions { justify-content: flex-end; }
@media (max-width: 700px) {
  .billing-details, .billing-plan-grid { grid-template-columns: 1fr; }
}

/* Batch upload grows with the file list and keeps controls in view. */
.detail.batch-dialog {
  box-sizing: border-box;
  width: min(580px, calc(100vw - 28px));
  max-height: min(680px, calc(100dvh - 28px));
  padding: 0;
  overflow: hidden;
}
.detail.batch-dialog[open] { animation: batch-dialog-in 300ms cubic-bezier(.2,.8,.22,1) both; }
.detail.batch-dialog.is-upload-closing::backdrop { animation: batch-backdrop-out 235ms ease both; }
.batch-upload.recon-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(678px, calc(100dvh - 30px));
}
.batch-header { flex: none; display: flex; justify-content: space-between; gap: 12px; padding: 17px 20px 13px; }
.batch-header h2 { margin: 0; font-size: 21px; font-weight: 690; }
.batch-header p { margin: 4px 0 0; font-size: 13px; }
.batch-header .close { position: static; flex: none; }
.batch-body { display: grid; gap: 12px; padding: 0 20px 14px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.batch-context { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 10px; }
.batch-context label { gap: 5px; }
.batch-context :is(input,select) { box-sizing: border-box; min-width: 0; height: 40px; width: 100%; }
.batch-drop {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px dashed var(--border-interactive);
  border-radius: 10px;
  background: var(--sidebar);
  transition: background-color 180ms, border-color 180ms;
}
.batch-drop.is-over { background: var(--selection); border-color: var(--accent); }
.batch-drop-icon, .batch-file-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--surface); }
.batch-drop strong { display: block; font-size: 14px; }
.batch-drop small, .batch-file small { display: block; color: var(--muted); font-size: 12px; }
.batch-files {
  margin: 0;
  padding: 0 3px;
  list-style: none;
  max-height: min(270px, 39dvh);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.batch-files:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.batch-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: var(--hairline) solid var(--border); }
.batch-file[data-entering] { animation: batch-row-in 330ms cubic-bezier(.2,.8,.22,1) both; }
.batch-file-icon { flex: none; }
.batch-file-icon[data-invoice="true"] { color: #bd472f; background: #f9e7df; }
[data-theme="dark"] .batch-file-icon[data-invoice="true"] { color: #ff9578; background: #452b27; }
.batch-file-name { flex: 1 1 145px; min-width: 0; overflow-wrap: anywhere; }
.batch-file-name strong { display: block; font-size: 13px; }
.batch-file-name .recon-error { color: var(--error-ink); }
.batch-file select { width: auto; max-width: 100%; }
.batch-file [data-remove] { padding: 0; min-width: 30px; min-height: 30px; }
.batch-feedback { flex: none; padding: 0 20px 10px; overflow-wrap: anywhere; }
.batch-feedback p { margin: 0; font-size: 12px; }
.batch-feedback [data-error]:not(:empty) { margin-top: 5px; color: var(--error-ink); }
.batch-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 0; padding: 11px 20px; border-top: var(--hairline) solid var(--border); }
.batch-actions button { min-height: 38px; }
.batch-meter { display: grid; gap: 7px; padding: 10px 12px; border: var(--hairline) solid var(--border); border-radius: 9px; background: var(--sidebar); }
.batch-meter > div { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.batch-meter [data-file-count] { margin-inline-start: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.batch-meter-light { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: batch-meter-pulse 1.8s ease-out infinite; }
.batch-meter progress { display: block; appearance: none; width: 100%; height: 4px; overflow: hidden; border: 0; border-radius: 10px; background: var(--surface-strong); }
.batch-meter progress::-webkit-progress-bar { background: var(--surface-strong); }
.batch-meter progress::-webkit-progress-value { border-radius: 10px; background: var(--accent); transition: width 230ms cubic-bezier(.2,.8,.22,1); }
.batch-meter progress::-moz-progress-bar { border-radius: 10px; background: var(--accent); }
.batch-upload [hidden] { display: none; }
@keyframes batch-dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes batch-backdrop-out { to { opacity: 0; } }
@keyframes batch-row-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes batch-meter-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 45% { box-shadow: 0 0 0 4px var(--selection); } }
@media (max-width: 430px) {
  .batch-header, .batch-body, .batch-feedback, .batch-actions { padding-inline: 13px; }
  .batch-drop { grid-template-columns: auto minmax(0,1fr); }
  .batch-drop [data-browse] { grid-column: 2; justify-self: start; }
  .batch-actions button { max-width:100%; white-space: normal; }
}
@media (max-width: 340px) {
  .batch-context { grid-template-columns: 1fr; }
  .batch-actions button { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .detail.batch-dialog[open], .detail.batch-dialog.is-upload-closing::backdrop, .batch-file[data-entering], .batch-meter-light { animation: none; }
  .batch-drop, .batch-meter progress::-webkit-progress-value { transition: none; }
}

[data-review-workspace][hidden], .documents-workspace > [hidden] { display: none; }
.financial-review-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-block: .75rem; }
.financial-review-table { min-width: 1120px; font-variant-numeric: tabular-nums; }
.financial-review-table th button { font: inherit; color: inherit; border: 0; background: transparent; padding: 0; cursor: pointer; }
.financial-review-table th[aria-sort="ascending"] button::after { content: " ↑"; }
.financial-review-table th[aria-sort="descending"] button::after { content: " ↓"; }
.financial-review-issue { background: var(--warning-surface); }
.financial-review-detail.run-drawer { width: min(1150px, 96vw); max-width: 96vw; }
.financial-review-detail > nav, .financial-review-error { padding-inline: 1.25rem; }
.financial-review-split { display: grid; grid-template-columns: minmax(0,var(--source-share, 1fr)) minmax(0,var(--fields-share, 1fr)); gap: .75rem; align-items: stretch; }
.financial-review-original { min-width: 0; }
.financial-review-preview { min-width: 0; overflow: auto; }
.financial-review-preview iframe { width: 100%; height: min(60vh, 640px); border: 0; }
.financial-review-preview img { display: block; width: 100%; max-width: none; }
.financial-review-field, .financial-review-finding { padding: .65rem; border-bottom: var(--hairline) solid var(--border); }
.financial-review-field small { display: block; }
.financial-review-inputs { display: grid; grid-template-columns: minmax(7rem, .55fr) minmax(0,1fr); gap: .5rem; margin-top: .3rem; }
.financial-review-detail input:not([type=checkbox],[type=range]), .financial-review-detail select,
.financial-review-detail textarea { width: 100%; font: inherit; }
.financial-review-detail form > label { display: block; margin-block: .65rem; }
.financial-review-confirm { width: min(580px, 94vw); max-height: 85vh; overflow: auto; padding: 1.25rem; }
.financial-review-confirm li { margin-bottom: .3rem; }
.financial-review-checkbox { display: flex; align-items: baseline; gap: .5rem; }
@media (max-width: 780px) {
  .financial-review-split { grid-template-columns: 1fr; }
  .financial-review-original { position: static; }
  .financial-review-preview { max-height: 42vh; }
}
.financial-review-pdf-scroll { max-height: 54vh; overflow: auto; }
.financial-review-pdf-scroll canvas:not([hidden]) { display: block; margin-inline: auto; background: #fff; }
.financial-review-preview [data-pdf-page] { width: 4rem; }
.financial-review-inputs :is(input,select,textarea), .financial-review-detail form > label :is(select,textarea) {
  border: var(--hairline) solid var(--border-interactive);
  border-radius: 7px;
  background: var(--var(--paper), var(--paper));
  color: inherit;
  padding: .45rem .6rem;
}
.financial-review-toolbar [hidden], .verified-export-dialog [hidden] { display: none; }
.verified-export-dialog form { gap: .7rem; }
.verified-export-dialog h2 { margin-top: 0; }
.verified-export-dates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.verified-export-dialog [data-export-preview]:not(:empty) {
  background: var(--surface); border-radius: 8px; padding: .75rem;
}
.verified-export-dialog [data-export-preview] p { margin: .25rem 0; }
.recon-table.financial-review-table { table-layout: auto; min-width: 1320px; }
.financial-review-table :is(th,td) { white-space: nowrap; }
.financial-review-table :is(th,td):last-child { white-space: normal; min-width: 12rem; }
.run-drawer.workbook-append-dialog { width: min(960px, 96vw); max-width: 96vw; }
.append-body { display: block; }
.append-body :is(p,details) { margin-block: .65rem; }
.append-mapping { display: grid; grid-template-columns: repeat(auto-fit,minmax(205px,1fr)); gap: .65rem; }
.append-mapping select { width: 100%; }
.append-preview-table { min-width: 56rem; }
.recon-table.append-preview-table { table-layout: auto; }
.append-selection { display: flex; flex-wrap: wrap; gap: .5rem 1rem; max-height: 16rem; overflow: auto; padding: .5rem; }
.append-drop { border: 1px dashed var(--border-interactive); padding: .75rem; border-radius: 8px; }
.append-drop small { display: block; margin-top: .35rem; }
.document-analysis { margin-block: 1rem; }
.document-analysis .financial-review-toolbar { flex-wrap: wrap; margin-block: .625rem; }
.analysis-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .625rem; margin-block: .875rem; }
.analysis-counts > div { border: 1px solid var(--border); border-radius: .5rem; padding: .625rem .75rem; }
.analysis-counts dt { font-size: .82rem; }
.analysis-counts dd { margin: .125rem 0 0; font-weight: 650; }
.analysis-job-list { max-height: 16rem; overflow: auto; padding-inline-start: 1.25rem; }
.analysis-job { display: flex; flex-wrap: wrap; align-items: baseline; gap: .625rem; padding-block: .35rem; }
.analysis-job small { flex-basis: 100%; }
.documents-table [data-analysis-select] { margin-inline-end: .5rem; }
.register-layout { border-block: 1px solid var(--border); padding-block: .75rem; }
.register-columns { max-height: 19rem; overflow: auto; margin-block: .75rem; padding-inline-start: 1.5rem; }
.register-columns li { padding: .45rem .25rem; }
.register-columns input { width: 100%; }
.register-column-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .4rem; margin-block-start: .45rem; }
.register-layout [data-layout-message]:empty { display: none; }

/* Document-to-Excel working surfaces */
.workflow-start { display:grid; grid-template-columns:minmax(0,1fr) minmax(185px,.38fr); padding:clamp(18px,2.4vw,30px); gap:20px; align-items:center; margin-block-end:16px; }
.workflow-start h2 { font-size:clamp(21px,2vw,29px); letter-spacing:-.045em; margin-bottom:5px; }
.workflow-start p,.excel-capabilities p { color:var(--muted); }
.workflow-start .recon-actions { justify-content:flex-start; flex-wrap:wrap; margin-top:16px; }
.workflow-start-excel { border-inline-start:1px solid var(--border); padding-inline-start:16px; }
.workflow-start-excel a { display:flex; gap:.6rem; align-items:center; justify-content:space-between; min-height:43px; padding:.45rem var(--control-icon-inset) .45rem .55rem; border-radius:8px; font-weight:640; }
.workflow-start-excel a:hover { background:var(--row-hover); }
.workflow-start-excel a span { display:flex; gap:.65rem; align-items:center; }
.workflow-start-excel svg { flex:none; color:var(--muted); }
.recon-metrics.workflow-metrics { grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); }
.workflow-metrics a:hover { text-decoration:underline; text-underline-offset:.2em; }
.excel-capabilities,.excel-history-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-block:16px; }
.excel-capabilities section { display:flex; align-items:flex-start; padding:16px; gap:12px; }
.excel-capabilities h2,.excel-history-card h2 { font-size:16px; margin-bottom:6px; }
.workspace-operation-icon { display:grid; place-items:center; color:var(--muted); background:var(--row-hover); border-radius:9px; min-width:36px; height:36px; }
.excel-history-card { padding:15px; }
.excel-history-card ul { padding:0; margin:0; list-style:none; max-height:23rem; overflow:auto; }
.excel-history-card li { display:flex; align-items:baseline; justify-content:space-between; gap:.75rem; padding:.6rem 0; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
.excel-history-card li:last-child { border:0; }
.excel-history-card small { display:block; color:var(--muted); margin-block-start:2px; }
.excel-history-card li>span { color:var(--muted); flex:none; font-size:.82rem; }
.excel-history-note { grid-column:1/-1; }
.excel-workspace [data-excel-records] .workspace-header { margin-top:20px; }
.excel-workspace .financial-review-table { min-width:1100px; }
.client-workflow-links { display:flex; flex-wrap:wrap; gap:.55rem; margin-block:1rem; }
.gatekeeper-summary details { color:var(--muted); margin-top:.6rem; }
.gatekeeper-summary details summary { cursor:pointer; width:fit-content; font-weight:620; }
@media (max-width:760px) {
  .workflow-start,.excel-capabilities,.excel-history-grid { grid-template-columns:minmax(0,1fr); }
  .workflow-start-excel { border-inline:0; padding-inline:0; border-top:1px solid var(--border); }
  .recon-metrics.workflow-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .excel-history-card li { flex-wrap:wrap; }
}

.verified-inputs { padding: 14px; display: grid; gap: 8px; }
.verified-inputs[hidden] { display: none; }
.verified-inputs .recon-table-wrap { max-height: 280px; overflow: auto; }
.verified-inputs .recon-table { table-layout: auto; min-width: 520px; }
.verified-inputs .recon-table th:last-child,
.verified-inputs .recon-table td:last-child { white-space: nowrap; text-align: right; }
.recon-setup .recon-source-slot[hidden] { display: none; }
.verified-inputs small { display: block; color: var(--muted); }
.recon-setup [data-extra-banks] { display: grid; gap: 5px; }
.recon-setup [data-extra-banks][hidden] { display: none; }

.exceptions-table td small { display: block; margin-top: 3px; color: var(--muted); }

[data-audit-body] { margin-top: 8px; overflow-wrap: anywhere; }
[data-audit-body] pre { white-space: pre-wrap; }
[data-audit-body] .run-balance dd { min-width: 0; }

.reports-page { display: grid; gap: 1.3rem; }
.reports-page .page-heading { margin-bottom: 0; }
.reports-filters { display: flex; align-items: end; flex-wrap: wrap; gap: .65rem 1rem; }
.reports-filters label { display: grid; gap: .3rem; color: var(--muted); font-size: .85rem; font-weight: 650; }
.reports-filters label[hidden] { display: none; }
.reports-filters :is(select,input) {
  border: var(--hairline) solid var(--border-interactive);
  border-radius: 7px;
  padding: .48rem .65rem;
  min-height: 2.35rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  max-width: 15rem;
}
.reports-scope, .reports-section p { margin: 0; color: var(--muted); font-size: .88rem; }
.reports-notice, .reports-empty { padding: .8rem 1rem; margin: 0; background: var(--sidebar); border: var(--hairline) solid var(--border); border-radius: 8px; }
.reports-notice { border-inline-start: 3px solid var(--accent); }
.reports-metrics {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  align-items: start;
  margin: 0;
  border-block: var(--hairline) solid var(--border);
}
.reports-metrics > div { min-width: 0; padding: .9rem 1rem .9rem 0; }
.reports-metrics dt, .reports-metrics small { color: var(--muted); font-size: .84rem; }
.reports-metrics dd { text-align: left; margin: .26rem 0; font-size: clamp(1.1rem,2vw,1.7rem); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.reports-section { display: grid; gap: .65rem; align-content: start; min-width: 0; }
.reports-section h2 { margin: 0; font-size: 1.1rem; }
.reports-breakdowns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.3rem; }
.reports-table-wrap, .reports-chart-scroll { overflow-x: auto; border: var(--hairline) solid var(--border); border-radius: 8px; }
.reports-table-wrap table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.reports-table-wrap :is(td,th) { text-align: left; padding: .55rem .65rem; border-bottom: var(--hairline) solid var(--border); white-space: nowrap; }
.reports-breakdowns table, .reports-chart-values table { min-width: 0; }
.reports-breakdowns th { white-space: normal; }
.reports-breakdowns td:last-child, .reports-breakdowns th:last-child { text-align: right; }
.reports-table-wrap thead th { background: var(--sidebar); color: var(--muted); }
.reports-table-wrap tbody tr:last-child :is(td,th) { border-bottom: 0; }
.reports-table-wrap a, .reports-empty a { text-underline-offset: .2em; }
.reports-legend, .reports-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; font-size: .82rem; }
.reports-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.reports-legend i { width: .65rem; height: .65rem; border-radius: 2px; }
.reports-series-invoices { background: var(--primary); }
.reports-series-payments { background: var(--chart-balance); }
.reports-series-outstanding { background: var(--chart-balance); }
.reports-chart { display: flex; justify-content: space-around; gap: .35rem; padding: .85rem; }
.reports-chart-month { flex: 1 0 4.2rem; display: grid; gap: .4rem; text-align: center; font-size: .75rem; color: var(--muted); }
.reports-bars { height: 112px; display: flex; align-items: end; justify-content: center; gap: 3px; border-bottom: var(--hairline) solid var(--border); }
.reports-chart:not(:has(.reports-chart-month:nth-child(2))) .reports-bars > div { width: 9%; max-width: 52px; }
.reports-bars > div { width: 12%; min-width: 5px; max-width: 16px; border-radius: 2px 2px 0 0; }
.reports-chart-values summary { cursor: pointer; font-size: .84rem; }
.reports-chart-values[open] summary { margin-bottom: .5rem; }
@media (max-width: 850px) {
  .reports-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .reports-breakdowns { grid-template-columns: minmax(0,1fr); }
}

/* Workspace chrome and shared controls. */
.topbar-context { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar { background: var(--sidebar); }
.breadcrumb-workspace { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-toggle { display: grid; place-items: center; flex: none; width: 34px; height: 34px;
  background: transparent; border: var(--hairline) solid var(--border); border-radius: var(--radius-control); color: var(--muted); }
.sidebar-toggle:hover { color: var(--ink); background: var(--row-hover); border-color: var(--border-interactive); }
.sidebar-toggle[aria-expanded="false"] svg { transform: scaleX(-1); }
.sidebar { position: relative; z-index: 3; padding-top: 21px; }
.brand { margin-bottom: 28px; }
.sidebar-quick-actions { margin-top: -12px; margin-bottom: 18px; }
.navigation { gap: 3px; }
.navigation a { min-height: 40px; border-radius: var(--radius-control); font-size: 14px; }
.navigation a svg { width: 18px; height: 18px; }
.navigation a:hover svg { transform: none; }
.navigation a[aria-current] { background: var(--selection); color: var(--accent-ink); border-color: var(--border); }
.navigation a[aria-current] svg { color: var(--accent-ink); }
[data-theme="dark"] :is(.brand,.market-brand,.market-product-brand,.auth-home,.journey-brand) img[src="/mark.svg"] { filter: brightness(0) invert(.93); }
[data-sidebar="compact"] .shell { --sidebar-width: 64px; }
[data-sidebar="compact"] .brand { margin: 0 auto 22px; }
[data-sidebar="compact"] .brand img { width: 31px; height: 34px; }
[data-sidebar="compact"] .sidebar { padding-inline: 8px; }
[data-sidebar="compact"] :is(.brand span,.navigation a span,.profile-copy,.profile-icon) { display: none; }
[data-sidebar="compact"] .navigation a { justify-content: center; padding-inline: 0; }
[data-sidebar="compact"] .sidebar-quick-actions { flex-direction: column; align-items: center; margin-inline: 0; margin-bottom: 12px; }
[data-sidebar="compact"] .profile { justify-content: center; padding-inline: 0; }
.navigation a::after { content: attr(data-tooltip); display: none; position: absolute; inset-inline-start: calc(100% + 8px);
  z-index: 8; padding: 6px 9px; background: var(--elevated); color: var(--ink); border: var(--hairline) solid var(--border-interactive);
  border-radius: 5px; box-shadow: var(--shadow-menu); font-size: 12px; pointer-events: none; }
[data-sidebar="compact"] .navigation a:is(:hover,:focus-visible)::after { display: block; }
.profile-actions { background: var(--elevated); }
.profile-menu { z-index: 4; }
.settings-card { border-radius: var(--radius-section); }
.settings-appearance { margin-top: 15px; }
.settings-appearance h2 { margin-bottom: 5px; }
.settings-appearance p { color: var(--muted); }
.appearance-options { border: 0; padding: 0; margin: 15px 0 0; display: flex; flex-wrap: wrap; gap: 7px; }
.appearance-options label { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; cursor: pointer;
  border: var(--hairline) solid var(--border-interactive); border-radius: var(--radius-control); }
.appearance-options label:has(:checked) { color: var(--ink); background: var(--selection); border-color: var(--border-interactive); font-weight: 660; }

:where(input[type="checkbox"],input[type="radio"],input[type="range"],progress) { accent-color: var(--accent); }
:where(input,textarea,select)::placeholder { color: var(--muted); }
:where(.recon-button,.sidebar-toggle,.close,.appearance-options label) { transition: color 145ms, background-color 145ms, border-color 145ms; }
.recon-button:active:not(:disabled), .sidebar-toggle:active { transform: translateY(1px); }

.recon-tabs button[aria-pressed="true"]::after, .client-tabs a[aria-current] { background-color: transparent; border-color: var(--ink); }
.recon-tabs button[aria-pressed="true"]::after { height: 2px; background: var(--ink); }
:where(.recon-button,.sidebar-toggle,.close):focus-visible { outline-color: var(--focus); }
:is(.run-drawer, .detail, .billing-dialog, .financial-review-confirm, .verified-export-dialog, .document-modal) { background: var(--elevated); color: var(--ink); border-radius: var(--radius-dialog); }
:where(.billing-dialog,.financial-review-confirm,.verified-export-dialog)::backdrop { background: var(--overlay); }
.run-drawer-header { background: var(--elevated); }
.run-drawer-header .close { width: 34px; height: 34px; border: var(--hairline) solid var(--border); font-size: 19px; }
.recon-fields :where(input:not([type="checkbox"],[type="radio"]), select, textarea) { background: var(--paper); }
.financial-review-pdf-scroll canvas:not([hidden]), .financial-review-preview img { background: #fff; }
.recon-button:disabled { cursor: not-allowed; }
.badge.success { color: var(--ink); background: var(--selection); }
.badge.verified { color: var(--success-text); background: var(--success-bg); }
.financial-review-error:not(:empty) { color: var(--error-ink); padding-block: .4rem; }
.financial-review-error:empty { display: none; }

.content :is(.workspace-header,.page-heading) h1 { font-size: clamp(29px,3.1vw,44px); font-weight: 710; line-height: 1.1; }
.content :is(.workspace-header,.page-heading) p { font-size: clamp(13px,1.25vw,16px); line-height: 1.55; }
.content .workspace-header { margin-bottom: var(--space-section); }
.content :is(.run-card,.recon-metrics > div,.excel-history-card,.overview-card) { border-radius: var(--radius-section); }
.recon-metrics > div { min-height: 80px; }
.workflow-start { background: var(--sidebar); }
.excel-capabilities section { background: var(--sidebar); }
.excel-capabilities .workspace-operation-icon { background: var(--selection); color: var(--accent-ink); }
.excel-history-card { background: var(--sidebar); }
.reports-series-invoices { background: var(--chart-issue); }
.reports-metrics small { display: block; }
.reports-table-wrap, .recon-table-wrap { scrollbar-width: thin; scrollbar-color: var(--border-interactive) transparent; }
.recon-table, .reports-table-wrap table { font-variant-numeric: tabular-nums; }
.recon-table thead, .reports-table-wrap thead th { background: var(--surface); }
.recon-table thead th, .reports-table-wrap thead th { font-size: 12px; font-weight: 660; }
.recon-table tbody :is(th,td) { padding-block: 10px; }
.recon-table tbody tr:has(input[data-check]:checked) { background: var(--selection); }
:is(.financial-review-table) :is(th,td):nth-child(n+8):nth-child(-n+10),
.run-result-table :is(th,td):nth-child(n+4):nth-child(-n+6),
.exceptions-table :is(th,td):nth-child(5),
.reports-table-wrap :is(th,td).amount { text-align: right; }
.recon-table.run-result-table,.recon-table.exceptions-table { table-layout: auto; }
:is(.run-result-table,.exceptions-table) .run-row-link { max-width: 24ch; }
.verified-inputs .recon-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.recon-table-wrap:focus-visible,.reports-table-wrap:focus-visible { outline-offset: -2px; }
.entry-banner, .auth-message:not(:empty) { color: var(--muted); }
.auth-card { border-radius: var(--radius-section); }
.auth-card > form { gap: 11px; }

@media (max-width: 760px) {
  :root .shell { --sidebar-width: 54px; }
  :root:not([data-rail-open="true"]) .brand { margin: 0 auto 17px; }
  :root:not([data-rail-open="true"]) :is(.brand span,.navigation a span,.profile-copy,.profile-icon) { display: none; }
  :root:not([data-rail-open="true"]) .navigation a { justify-content: center; padding-inline: 0; min-height: 35px; }
  :root:not([data-rail-open="true"]) .sidebar-quick-actions { flex-direction: column; align-items: center; margin: 0 0 9px; gap: 4px; }
  :root:not([data-rail-open="true"]) .sidebar-quick-actions button { width: 32px; height: 32px; }
  :root:not([data-rail-open="true"]) .profile { justify-content: center; padding-inline: 0; }
  :root:not([data-rail-open="true"]) .navigation a:is(:hover,:focus-visible)::after { display: block; }
  :root[data-rail-open="true"] .sidebar { position: fixed; z-index: 6; inset: 0 auto 0 0; width: 208px; padding-inline: 12px; box-shadow: var(--shadow-menu); }
  :root[data-rail-open="true"] .panel { grid-column: 2; }
  :root[data-rail-open="true"] .sidebar-toggle { position: relative; z-index: 7; transform: translateX(155px); background: var(--elevated); }
  :root[data-rail-open="true"] .brand { margin: 0 0 25px 5px; }
  :root[data-rail-open="true"] :is(.brand span,.navigation a span) { display: inline; }
  :root[data-rail-open="true"] :is(.profile-copy,.profile-icon) { display: grid; }
  :root[data-rail-open="true"] .breadcrumb { visibility: hidden; }
  :root[data-rail-open="true"] .navigation a { justify-content: flex-start; padding-inline: 10px; }
  :root[data-rail-open="true"] .navigation a::after { display:none; }
  :root[data-rail-open="true"] .sidebar-quick-actions { flex-direction: row; align-items: flex-start; }
  :root[data-rail-open="true"] .profile { justify-content: flex-start; }
  .topbar-context { gap: 7px; }
  .topbar { flex-basis: 47px; }
}
@media (max-height: 590px) {
  .sidebar { padding-top: 10px; }
  .sidebar .brand { margin-bottom: 14px; }
  .sidebar .sidebar-quick-actions { flex-direction: row; margin: 0 0 8px; }
  .sidebar .navigation { min-height: 0; overflow-y: auto; }
  .sidebar .navigation a { min-height: 32px; }
}

.financial-review-detail > .financial-review-toolbar { margin-block: .5rem; border-bottom: var(--hairline) solid var(--border); padding-bottom: .6rem; }
.financial-review-detail .financial-review-split { overflow: hidden; }
.financial-review-split > .run-evidence-card { min-width: 0; min-height: 0; margin-top: 0; padding: 12px; overflow: auto; scrollbar-width: thin; }
.financial-review-split .financial-review-preview > div > .financial-review-toolbar {
  font-size: 12px; margin-block: .5rem; padding: .45rem; background: var(--surface); border-radius: var(--radius-control);
}
.financial-review-preview .financial-review-toolbar label { display: inline-flex; gap: .4rem; align-items: center; }
.financial-review-preview input[type="range"], .review-proportion input { inline-size: 88px; }
.financial-review-pdf-scroll { max-height: none; padding-inline: 5px; background: var(--surface); }
.financial-review-split .financial-review-original { background: var(--sidebar); }
.financial-review-original > .financial-review-toolbar a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: .18em; }
.financial-review-original > .financial-review-toolbar { font-size: 12px; }
.financial-review-original button { min-height: 31px; }
.review-proportion { display: inline-flex; gap: .45rem; align-items: center; color: var(--muted); }
.financial-review-split.source-expanded { grid-template-columns: minmax(0,1fr); }
.financial-review-split [hidden] { display: none; }
.financial-review-inputs { grid-template-columns: minmax(0, .55fr) minmax(0, 1fr); }
.financial-review-inputs :is(input,select,textarea) { min-height: 35px; }
.financial-review-field :is(summary,small) { color: var(--muted); }
.financial-review-field summary { cursor: pointer; }
.financial-review-toolbar :is([data-export],[data-export-now],[data-approve]) {
  color: var(--primary-ink); border-color: var(--primary); background: var(--primary);
}
.financial-review-toolbar :is([data-export],[data-export-now],[data-approve]):not(:disabled):hover { background: var(--primary-hover); color: var(--primary-ink); }

.excel-subtle-action { border-color: transparent; }
.excel-workspace [data-excel-records] > p[role="status"]:not(:empty),
.excel-workspace [data-excel-records][aria-busy="true"] > p { padding: 15px; min-height: 70px; background: var(--surface); border-radius: var(--radius-section); }
.overview-metrics { gap: 0; margin-block: 10px 18px; border-block: var(--hairline) solid var(--border); }
.overview-metrics > div { background: transparent; min-height: 86px; border: 0; border-radius: 0; }
.overview-metrics > div + div { border-inline-start: var(--hairline) solid var(--border); }
.inbox-table time { color: var(--muted); font-variant-numeric: tabular-nums; }
.financial-review-table .document-name { max-width: 26ch; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .financial-review-detail .financial-review-split { grid-template-columns: minmax(0,1fr); overflow: auto; }
  .financial-review-split > .run-evidence-card { overflow: visible; }
  .review-proportion { display: none; }
  .financial-review-pdf-scroll { max-height: 43vh; }
}
@media (max-width: 760px) {
  .overview-metrics > div:nth-child(3) { border-inline-start: 0; }
  .overview-metrics > div:nth-child(n+3) { border-top: var(--hairline) solid var(--border); }
}

.recon-table-wrap:has(.financial-review-table, .run-result-table, .exceptions-table),
.reports-table-wrap:has(+ .reports-pagination) { max-block-size: min(53dvh, 34rem); overflow: auto; }
:is(.financial-review-table, .run-result-table, .exceptions-table) thead th,
.reports-table-wrap:has(+ .reports-pagination) thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  box-shadow: 0 var(--hairline) var(--border);
}

/* Component roles that have distinct graphite tokens. */
[data-theme="dark"] .topbar { background: var(--bg-topbar); }
[data-theme="dark"] :is(h1,h2,h3,.breadcrumb-page) { color: var(--text-heading); }
[data-theme="dark"] :is(.sidebar,.profile) { border-color: var(--border-subtle); }
[data-theme="dark"] .navigation a { color: var(--nav-text); }
[data-theme="dark"] .navigation a svg { color: var(--nav-icon); }
[data-theme="dark"] .navigation a:hover { background: var(--nav-hover); }
[data-theme="dark"] :is(.navigation a[aria-current],.market-product-tabs button[aria-selected="true"]) { background: var(--nav-active-bg); color: var(--nav-active-text); }
[data-theme="dark"] .navigation a[aria-current] svg { color: var(--nav-active-icon); }
[data-theme="dark"] .profile-actions { background: var(--bg-dropdown); }
[data-theme="dark"] .navigation a::after, [data-theme="dark"] .chart-tip { background: var(--bg-tooltip); color: var(--text-tooltip); }
[data-theme="dark"] dialog { background: var(--bg-modal); color: var(--text-primary); }
[data-theme="dark"] dialog::backdrop { background: var(--bg-overlay); }
[data-theme="dark"] :is(input:not([type="checkbox"],[type="radio"],[type="range"]),textarea,select,option) {
  background-color: var(--bg-input); color: var(--text-primary); border-color: var(--border-interactive);
}
[data-theme="dark"] :is(input,textarea)::placeholder { color: var(--text-placeholder); }
[data-theme="dark"] :is(.recon-table,.reports-table-wrap table) thead th, [data-theme="dark"] table thead { background: var(--bg-table-header); color: var(--text-table-header); }
[data-theme="dark"] tbody tr { background: var(--bg-table-row); border-color: var(--border-table); }
[data-theme="dark"] tbody tr:is(:hover,:focus-within) { background: var(--bg-table-hover); }
[data-theme="dark"] tbody tr:has(input:checked) { background: var(--bg-selected); }
[data-theme="dark"] :is(.reports-table-wrap td,.reports-table-wrap th,.recon-table td,.recon-table th) { border-color: var(--border-table); }
[data-theme="dark"] :is(.recon-primary,.market-dark,.market-accent,.financial-review-toolbar :is([data-export],[data-export-now],[data-approve])):active:not(:disabled) {
  background: var(--primary-pressed);
}
[data-theme="dark"] .excel-subtle-action { background: var(--tertiary-bg); color: var(--tertiary-text); }
[data-theme="dark"] .excel-subtle-action:hover { background: var(--tertiary-hover); }
[data-theme="dark"] :is(.recon-button,input,select,textarea):disabled { background: var(--bg-disabled); color: var(--text-disabled); opacity: 1; }
[data-theme="dark"] .profile-error:not(:empty), [data-theme="dark"] .financial-review-error:not(:empty) { background: var(--error-bg); }
[data-theme="dark"] .run-stage-status:not(.processing,.failed) { color: var(--neutral-status-text); background: var(--neutral-status-bg); }
[data-theme="dark"] .reports-series-payments { background: var(--chart-secondary); }
[data-theme="dark"] .reports-bars { border-color: var(--chart-grid); }
[data-theme="dark"] .reports-chart-month { color: var(--chart-axis); }
[data-theme="dark"] .reports-legend { color: var(--chart-label); }
[data-theme="dark"] .gridline { stroke: var(--chart-grid); }
[data-theme="dark"] :is(.content,.recon-table-wrap,.reports-table-wrap,.run-drawer-body,.financial-review-split > section) { scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
[data-theme="dark"] :where(.content,.run-drawer-body)::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
[data-theme="dark"] .excel-workspace [data-excel-records][aria-busy="true"] > p { background: var(--bg-skeleton); }
[data-theme="dark"] .financial-review-pdf-scroll canvas:not([hidden]), [data-theme="dark"] .financial-review-preview img { background: #fff; }
[data-theme="dark"] .profile-actions :is(a,button) { color: var(--text-primary); }
[data-theme="dark"] .excel-workspace [data-excel-records][aria-busy="true"] > p { border: var(--hairline) solid var(--bg-skeleton-highlight); }
[data-theme="dark"] .run-muted { color: var(--text-muted); }
[data-theme="dark"] .chart-tip { border-color: var(--border-default); }

/* Keep trailing controls inset while leaving room for long selected labels. */
:is(.shell,.auth-screen) select:not([multiple],[size]:not([size="1"]),.period select) {
  appearance: none;
  background-image: var(--control-chevron);
  background-repeat: no-repeat;
  background-position: right var(--control-icon-inset) center;
  background-size: 14px;
  padding-inline-end: calc(var(--control-icon-inset) + 22px);
}
:is(.shell,.auth-screen) select:not([multiple],[size]:not([size="1"]),.period select):dir(rtl) {
  background-position: left var(--control-icon-inset) center;
}
.recon-button:is(.recon-secondary, [data-append], [data-append-now], [data-expand-source]):not(:disabled) {
  color: var(--secondary-text);
  border-color: var(--border-interactive);
  background-color: var(--secondary-bg);
}
.recon-button:is(.recon-secondary, [data-append], [data-append-now], [data-expand-source]):not(:disabled):hover {
  color: var(--secondary-text);
  border-color: var(--border-interactive);
  background-color: var(--secondary-hover);
}
@media (forced-colors: active) {
  :is(.shell,.auth-screen) select:not([multiple],[size]:not([size="1"]),.period select) {
    appearance: auto;
    background-image: none;
    padding-inline-end: var(--control-icon-inset);
  }
}
.excel-offline-options{position:relative;align-self:center}
.excel-offline-options>summary{cursor:pointer;color:var(--muted,#5b5c5f);list-style:none;padding:10px 12px;border:1px solid var(--border,#e6e7ea);border-radius:8px}
.excel-offline-options>summary::-webkit-details-marker{display:none}
.excel-offline-options[open]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
@media(max-width:700px){.excel-offline-options[open]{width:100%}}

.excel-invoices { display: grid; gap: 16px; min-width: 0; }
.excel-invoices > .workspace-header { margin: 0; }
.excel-connection-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 10px 12px; border: var(--hairline) solid var(--border); }
.excel-connection-brand, .excel-connection-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.excel-application-mark { position: relative; display: inline-grid; place-items: center; width: 27px; height: 24px; }
.excel-application-mark b { position: absolute; inset-inline-start: 0; z-index: 1; display: grid; place-items: center; width: 17px; height: 17px; color: var(--secondary-text); background: var(--secondary-bg); border-radius: 2px; font-size: 12px; }
.excel-application-mark i { position: absolute; inset-inline-end: 0; width: 17px; height: 21px; background: var(--selection); border: var(--hairline) solid var(--border-interactive); border-radius: 2px; }
.excel-application-mark i::after { content: ""; position: absolute; inset: 6px 0; border-block: var(--hairline) solid var(--border-interactive); }
.excel-connection-strip strong, .excel-sync-history strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.excel-connection-strip small, .excel-sync-history small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.excel-destination { border-inline-start: var(--hairline) solid var(--border); padding-inline-start: 17px; min-width: 0; }
.excel-connection-actions { margin-inline-start: auto; }
.excel-feedback:empty, .excel-selection-message:empty { display: none; }
.excel-feedback p, .excel-selection-message { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.excel-feedback p + p { margin-top: 8px; }
.excel-feedback .excel-attention, .excel-difference { color: var(--warning-ink); }
.excel-feedback .excel-success { color: var(--ink); }
.excel-feedback .recon-button { margin-inline-start: 8px; }
.excel-invoice-workspace { min-width: 0; }
.excel-section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.excel-section-heading h2 { font-size: 17px; margin: 0; }
.excel-invoice-filters { display: grid; grid-template-columns: minmax(165px, 1.4fr) repeat(4, minmax(112px, 1fr)); gap: 8px; margin: 10px 0; }
.excel-invoice-filters label { display: grid; gap: 5px; color: var(--ink); font-size: 12px; font-weight: 600; min-width: 0; }
.excel-invoice-filters :is(input, select) { min-width: 0; width: 100%; min-height: 36px; border: var(--hairline) solid var(--border); background-color: var(--paper); color: var(--ink); font: inherit; padding: 7px 9px; }
.excel-bulk, .excel-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 6px; font-size: 12px; }
.excel-bulk [data-record-count] { margin-inline-start: auto; }
.excel-invoice-scroll { border-block: var(--hairline) solid var(--border); }
.excel-invoice-table { table-layout: auto; width: 100%; min-width: 780px; font-size: 13px; }
.excel-invoice-table :is(th, td) { padding: 7px 10px; height: auto; text-overflow: initial; overflow: visible; overflow-wrap: anywhere; text-align: left; }
.excel-invoice-table tbody td { height: 38px; }
.excel-invoice-table th:first-child, .excel-invoice-table td:first-child { width: 34px; text-align: center; }
.excel-invoice-table [type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); vertical-align: middle; }
.excel-invoice-table th button { border: 0; background: transparent; color: inherit; font: inherit; padding: 0; text-align: inherit; }
.excel-invoice-table :is([data-column="totalAmount"], .excel-amount) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.excel-invoice-table :is(:nth-child(5), :nth-child(6), :nth-child(7)) { white-space: nowrap; }
.excel-sync-status { color: var(--muted); font-size: 12px; }
.excel-sync-status[data-state="synchronized"] { color: var(--success-text); }
.excel-sync-status:is([data-state="conflict"], [data-state="uncertain"], [data-state="writing"]) { color: var(--warning-ink); }
.excel-pagination { justify-content: flex-end; color: var(--muted); }
.excel-selection-bar:not([hidden]) { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; background: var(--paper); border: var(--hairline) solid var(--border); }
.excel-selection-bar > div { flex: 1 1 160px; }
.excel-selection-bar strong { margin-inline-end: 8px; }
.excel-selection-bar span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.excel-selection-bar small { display: block; color: var(--muted); }
.excel-sync-history { border-top: var(--hairline) solid var(--border); padding-top: 9px; }
.excel-invoices summary { cursor: pointer; color: var(--muted); }
.excel-sync-history ul { padding: 0; margin: 8px 0; list-style: none; }
.excel-sync-history li { display: flex; flex-wrap: wrap; gap: 4px 15px; justify-content: space-between; padding: 7px 0; border-top: var(--hairline) solid var(--border); }
.excel-sync-history code { overflow-wrap: anywhere; }
/* The native dialog border otherwise applies to both preview and recovery. */
.excel-sync-dialog {
  width: min(660px,calc(100vw - 24px)); height: min(598px,calc(100dvh - 28px));
  max-width: none; max-height: none; padding: 0; overflow: hidden;
  border: var(--hairline) solid var(--border); border-radius: var(--radius-dialog);
  background: var(--elevated); color: var(--ink); box-shadow: var(--shadow-dialog);
}
.excel-sync-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; animation: drawer-enter 220ms var(--ease) both; }
.excel-sync-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.excel-dialog-heading, .excel-sync-dialog > footer {
  display: flex; align-items: center; gap: 8px; padding: 13px 21px;
}
.excel-dialog-heading { justify-content: space-between; border-bottom: var(--hairline) solid var(--border); }
.excel-dialog-heading h2 { margin: 0; font-size: clamp(19px,4.5vw,23px); letter-spacing: -.025em; }
.excel-dialog-heading h2:focus { outline: none; }
.excel-dialog-close {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: var(--radius-control); background: transparent; color: var(--muted);
}
.excel-dialog-close:hover { background: var(--row-hover); color: var(--ink); }
.excel-dialog-body { min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 15px 21px 18px; }
.excel-dialog-body :is(p,dl) { margin: 0; overflow-wrap: anywhere; }
.excel-sync-dialog > footer { justify-content: flex-end; margin: 0; flex-wrap: wrap; border-top: var(--hairline) solid var(--border); }
.excel-review-destination { display: flex; align-items: center; gap: 9px 11px; min-width: 0; }
.excel-review-destination .excel-application-mark { flex: none; }
.excel-review-destination div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.excel-review-destination div span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.excel-review-destination > a { color: var(--muted); white-space: nowrap; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.excel-review-insertion { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 9px 22px;
  margin-block-start: 14px; padding-block: 10px; border-block: var(--hairline) solid var(--border); }
.excel-review-insertion strong { display: block; margin-block: 2px; font-size: clamp(19px,4vw,27px); font-weight: 690; line-height: 1.12; letter-spacing: -.024em; }
.excel-review-label, .excel-review-insertion small { display: block; color: var(--muted); font-size: 12px; }
.excel-review-insertion > :last-child:not(:only-child) .excel-amount { text-align: start; }
.excel-dialog-body .excel-review-breakdown {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px 8px; margin-block: 9px;
}
.excel-review-breakdown > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 6px; padding: 3px 5px; font-size: 12px; }
.excel-review-breakdown :is(dt,dd), .excel-review-record-counts dd { color: inherit; margin: 0; }
.excel-review-breakdown [data-level="zero"] { color: var(--muted); }
.excel-review-breakdown [data-level="attention"] { background: var(--warning-surface); color: var(--warning-ink); border-radius: 4px; }
.excel-review-breakdown dd, .excel-review-record-counts dd, .excel-dialog-body .excel-amount { font-variant-numeric: tabular-nums; }
.excel-dialog-body .excel-review-warning { padding: 8px 10px; margin-block: 8px; background: var(--warning-surface); color: var(--warning-ink); border-radius: 6px; }
.excel-dialog-body .excel-review-warning + .recon-button { margin-block-start: 5px; }
.excel-review-warning p { margin-top: 3px; }
.excel-review-note { color: var(--muted); }
.excel-dialog-body .excel-review-record-counts { display: flex; flex-wrap: wrap; gap: 6px 22px;
  padding-block: 8px; margin-block: 6px; border-block: var(--hairline) solid var(--border); }
.excel-review-record-counts > div { display: flex; gap: 6px; align-items: baseline; }
.excel-review-record-counts dt { font-size: 12px; }
.excel-review-integrity { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.excel-review-integrity strong { color: var(--ink); }
.excel-review-details { margin-block: 10px 0; border-top: var(--hairline) solid var(--border); padding-block: 5px; }
.excel-review-details > summary { color: var(--ink); font-weight: 650; padding: 4px 0; }
.excel-review-details > summary span { color: var(--muted); margin-inline-start: 4px; font-size: 12px; font-weight: 500; }
.excel-review-table-scroll, .excel-comparison { overflow-x: auto; }
.excel-dialog-body :is(.excel-review-table,.excel-comparison table) { width: 100%; min-width: 0; table-layout: auto; border-collapse: collapse; font-size: 12px; }
.excel-dialog-body :is(th,td) { padding: 6px; text-align: start; vertical-align: top; overflow-wrap: anywhere; border-bottom: var(--hairline) solid var(--border); }
.excel-dialog-body .excel-amount { text-align: end; white-space: nowrap; overflow-wrap: normal; }
.excel-review-outcome { color: var(--muted); }
.excel-review-outcome:is([data-outcome="conflict"],[data-outcome="uncertain"],[data-outcome="excluded"]) { color: var(--warning-ink); font-weight: 650; }
.excel-evidence-toggle { border: 0; background: transparent; display: block; padding: 2px 0; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.excel-evidence-row > td { background: var(--surface); }
.excel-evidence-row p, .excel-evidence-row a { margin-block: 4px; }
.excel-evidence-row a { display: inline-block; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.excel-comparison table { margin-block: 5px; }
.excel-difference { font-size: 11px; font-weight: 550; }
.excel-review-details > .recon-button { margin-top: 8px; }
.excel-dialog-body [data-review-status]:not(:empty) { color: var(--error-ink); margin-top: 8px; }
@media(max-width: 520px) {
  .excel-dialog-heading,.excel-dialog-body,.excel-sync-dialog > footer { padding-inline: 13px; }
  .excel-dialog-body .excel-review-breakdown { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .excel-review-destination { flex-wrap: wrap; }
}
@media(prefers-reduced-motion:reduce) { .excel-sync-dialog[open] { animation: none; } }
.excel-invoices :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 900px) { .excel-invoice-filters { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 560px) {
  .excel-invoices { gap: 12px; }
  .excel-invoice-filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .excel-invoice-filters label:first-child { grid-column: 1/-1; }
  .excel-destination { border-inline-start: 0; padding-inline-start: 0; }
  .excel-connection-actions { margin-inline-start: 0; }
}

.overview-command { display:grid; gap:12px; }
.overview-command-primary, .overview-command-secondary { display:grid; gap:12px; grid-template-columns:minmax(0,1.65fr) minmax(0,1fr); align-items:start; }
.overview-command-primary > :only-child { grid-column:1/-1; }
.overview-module { margin:0; min-width:0; padding:clamp(12px,1.4vw,20px); }
.overview-module > header { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; justify-content:space-between; }
.overview-module h2 { display:flex; gap:7px; align-items:center; font-size:16px; line-height:1.25; margin:0; }
.overview-module p { margin:0; color:var(--muted); font-size:12px; }
.overview-module > header > a:not(.recon-button), .overview-actions a { color:var(--ink); font-size:12px; text-decoration:underline; text-underline-offset:3px; }
.overview-stages { display:grid; align-items:stretch; grid-template-columns:repeat(4,minmax(0,1fr)); margin:14px 0 0; }
.overview-stages-pair { grid-template-columns:repeat(2,minmax(0,1fr)); }
.overview-stages > div { padding:7px 9px 8px; border-block:var(--hairline) solid var(--border); }
.overview-stages > div + div { border-inline-start:var(--hairline) solid var(--border); }
.overview-stages dt, .overview-recon dt { font-size:12px; color:var(--ink); overflow-wrap:anywhere; }
.overview-stages dt a:hover { text-decoration:underline; text-underline-offset:3px; }
.overview-stages dd { margin:3px 0; text-align:left; font-size:clamp(22px,2.3vw,29px); font-variant-numeric:tabular-nums; }
.overview-stages p { font-size:11px; }
.overview-module .overview-last, .overview-module .overview-empty-line { margin-top:10px; overflow-wrap:anywhere; }
.overview-connection { margin-top:10px; font-size:13px; }
.overview-connection strong { display:block; margin-bottom:2px; }
.overview-actions { display:flex; flex-wrap:wrap; gap:5px 15px; margin-top:10px; }
.overview-issues a { color:var(--warning-ink); }
.overview-onboarding progress { display:block; width:100%; height:6px; margin:10px 0; accent-color:var(--accent); }
.overview-onboarding header strong { font-size:12px; }
.overview-onboarding ol { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px 10px; padding:0; margin:0; list-style:none; }
.overview-onboarding li { display:flex; align-items:baseline; gap:6px; padding:4px 0; font-size:12px; }
.overview-step { display:inline-grid; place-items:center; flex:none; width:15px; height:15px; border-radius:50%; border:var(--hairline) solid var(--border-interactive); }
.overview-step.is-complete { color:var(--ink); border-color:var(--border-interactive); }
.overview-activity-list { max-height:20rem; overflow:auto; }
.overview-activity-list li { padding:7px 0; }
.overview-activity-list li > div { min-width:0; overflow-wrap:anywhere; }
.overview-recon { display:grid; grid-template-columns:minmax(0,1fr); gap:5px; margin:12px 0; }
.overview-recon > div { display:flex; justify-content:space-between; gap:8px; padding-block:3px; border-bottom:var(--hairline) solid var(--border); }
.overview-recon dd { font-size:14px; font-variant-numeric:tabular-nums; }
.overview-command a:focus-visible { outline:2px solid var(--focus); outline-offset:3px; }
@media(max-width:1100px) {
  .overview-command-primary, .overview-command-secondary { grid-template-columns:minmax(0,1fr); }
}
@media(max-width:600px) {
  .overview-header { gap:10px; margin-bottom:9px; }
  .overview-stages:not(.overview-stages-pair) { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .overview-stages:not(.overview-stages-pair) > div:nth-child(3) { border-inline-start:0; }
  .overview-onboarding ol, .overview-activity-list li { grid-template-columns:minmax(0,1fr); }
  .overview-activity-list li { gap:1px; }
  .overview-attention a { grid-template-columns:18px minmax(0,1fr) auto 12px; }
}

.documents-workspace > .documents-header { margin-bottom: 13px; }
.documents-summary { grid-template-columns: repeat(5,minmax(0,1fr)); align-items: stretch; gap: 0; margin: 0 0 12px; border-block: var(--hairline) solid var(--border); }
.documents-summary > div { min-width: 0; padding: 8px 12px; }
.documents-summary > div + div { border-inline-start: var(--hairline) solid var(--border); }
.documents-summary dt { font-size: 12px; line-height: 1.3; }
.documents-summary dd { margin: 3px 0 0; text-align: start; color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; }
.documents-navigation { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.documents-navigation .document-tabs { gap: 20px; margin: 0; min-width: 0; }
.documents-navigation .document-tabs button { min-height: 32px; padding-bottom: 4px; }
.documents-navigation > button { min-height: 34px; }
.documents-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 0 0 11px; }
.documents-filters > label { display: grid; gap: 4px; flex: 1 1 145px; min-width: 0; font-size: 12px; color: var(--muted); }
.documents-filters > label:first-child { flex-grow: 1.6; }
.documents-filters :is(input,select) { box-sizing: border-box; width: 100%; min-width: 0; height: 36px; padding: 6px 9px; border: var(--hairline) solid var(--border); border-radius: var(--radius-control); background-color: var(--paper); color: var(--ink); font: inherit; }
.documents-more-filters { align-self: end; }
.documents-more-filters > summary { min-height: 36px; cursor: pointer; }
.documents-more-filters > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.documents-more-filters[open] { flex-basis: 100%; }
.documents-more-filters label { display: grid; gap: 4px; flex: 1 1 130px; max-width: 260px; font-size: 12px; color: var(--muted); }
.documents-more-filters > summary::-webkit-details-marker { display:none; }
.documents-more-filters > summary::after { content:'+'; font-weight:650; }
.documents-more-filters[open] > summary::after { content:'−'; }
.documents-scroll { border-block: var(--hairline) solid var(--border); }
.documents-library-table { width: 100%; min-width: 720px; table-layout: auto; font-size: 13px; }
.documents-library-table :is(th,td) { text-align: start; white-space: normal; overflow-wrap: anywhere; padding: 7px 10px; text-overflow: initial; }
.documents-library-table th:first-child, .documents-library-table td:first-child { text-align: center; width: 34px; }
.documents-library-table input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }
.documents-library-table :is(time,small) { color: var(--muted); }
.documents-library-table th[scope=row] button { display: block; max-width: 100%; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.documents-library-table th[scope=row] small { display: block; }
.documents-library-table .badge { white-space: normal; }
.documents-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; }
.documents-row-actions .recon-button { min-height: 31px; padding: 4px 8px; font-size: 12px; white-space: normal; }
.documents-row-link { text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.documents-selection:not([hidden]), .documents-progress:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; margin-block: 8px; padding: 8px 10px; border: var(--hairline) solid var(--border); font-size: 13px; }
.documents-selection strong, .documents-progress > div { flex: 1 1 110px; }
.documents-progress small { display: block; color: var(--muted); }
.documents-progress progress { display: block; width: min(220px,100%); height: 4px; margin: 5px 0 0; accent-color: var(--accent); }
.documents-selection .recon-button, .documents-progress .recon-button { min-height: 33px; }
.documents-analysis-drawer [data-analysis-list] label { display: grid; gap: 5px; }
.documents-analysis-drawer [data-analysis-list] select { width: 100%; min-height: 39px; }
.documents-workspace :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media(max-width: 550px) {
  .documents-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .documents-summary > div { border-bottom: var(--hairline) solid var(--border); }
  .documents-summary > div:nth-child(odd) { border-inline-start: 0; }
  .documents-navigation { flex-wrap: wrap; }
  .documents-navigation .document-tabs { gap: 10px; }
  .documents-summary > div { padding: 5px 7px; }
  .documents-summary dd { font-size: 17px; }
  .documents-filters > label:not(:first-child) { flex-basis: calc(50% - 4px); }
  .documents-filters > label:first-child { flex-basis: 100%; }
}

.workbook-destination {
  width: min(620px, calc(100vw - 28px));
  height: min(610px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: var(--hairline) solid var(--border);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
  transform-origin: center 44%;
}
.workbook-destination[open] {
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto auto;
  animation: destination-open 340ms cubic-bezier(.18,.82,.24,1) both;
}
.workbook-destination::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(5px);
  animation: destination-fade 270ms ease both;
}
.workbook-destination[data-closing] { animation: destination-close 185ms cubic-bezier(.4,0,1,1) both; }
.workbook-destination[data-closing]::backdrop { animation: destination-fade 185ms ease reverse both; }
.destination-header { position: relative; padding: 24px 58px 16px 24px; border-bottom: var(--hairline) solid var(--border); }
.destination-header h2 { margin: 11px 0 0; font-size: clamp(22px,4vw,28px); letter-spacing: -.035em; line-height: 1.15; }
.destination-header h2:focus { outline: none; }
.destination-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 11px; font-weight: 650; }
.destination-steps li { display: flex; align-items: center; gap: 5px; }
.destination-steps li + li::before { content: ''; width: 16px; height: 1px; margin-right: 3px; background: var(--border); }
.destination-steps li[aria-current] { color: var(--ink); }
.destination-steps li span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); }
.destination-steps li[aria-current] span { color: var(--accent-ink); background: var(--selection); }
.destination-close, .destination-text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 5px 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600;
  transition: background 170ms ease, color 170ms ease, transform 170ms var(--ease);
}
.destination-close { position: absolute; top: 17px; right: 17px; width: 34px; height: 34px; }
.destination-close:hover, .destination-text-button:hover { color: var(--ink); background: var(--row-hover); }
.destination-close:active, .destination-text-button:active { transform: scale(.96); }
.destination-body { overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 18px 24px; }
.destination-scene { display: grid; gap: 12px; min-width: 0; animation: destination-scene 260ms var(--ease) both; }
.destination-scene :is(p,ul,dl) { margin-block: 0; }
.destination-scene :is(strong,small,p,li,summary,span) { overflow-wrap: anywhere; }
.destination-client { color: var(--muted); }
.destination-client strong { color: var(--ink); }
.destination-scene label { display: grid; gap: 5px; color: var(--ink); font-size: 12px; font-weight: 600; }
.destination-scene :is(input:not([type=radio]),select) {
  width: 100%; min-width: 0; min-height: 40px; padding: 7px 11px;
  border: var(--hairline) solid var(--border); border-radius: 9px; background: var(--paper); color: var(--ink);
}
.destination-search { position: relative; }
.destination-search svg { position: absolute; top: 12px; left: 11px; color: var(--muted); pointer-events: none; }
.destination-search input[type=search] { padding-inline-start: 35px; }
.destination-books { list-style: none; padding: 0; border-block: var(--hairline) solid var(--border); }
.destination-books li + li { border-top: var(--hairline) solid var(--border); }
.destination-books button {
  display: flex; width: 100%; min-height: 50px; gap: 9px; align-items: center; padding: 7px 9px;
  border: 0; background: transparent; text-align: left; color: var(--ink); transition: background 180ms ease;
}
.destination-books button:hover { background: var(--row-hover); }
.destination-books button:focus-visible { outline-offset: -2px; }
.destination-books button > svg { margin-inline-start: auto; color: var(--muted); flex: none; }
.destination-books strong, .destination-file strong { display: block; font-weight: 650; }
.destination-books small, .destination-file small { display: block; margin-top: 2px; color: var(--muted); }
.destination-file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.destination-file-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; flex: none; color: var(--accent-ink); background: var(--selection); }
.destination-books .destination-current { margin-inline-start: auto; }
.destination-books .destination-current + svg { margin-inline-start: 0; }
.destination-empty, .destination-loading { padding: 10px 0; color: var(--muted); }
.destination-loading { display: flex; align-items: center; gap: 8px; }
.destination-loading > span { width: 13px; height: 13px; border: 1.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: destination-spin 700ms linear infinite; }
.destination-issue, .destination-issues { color: var(--warning-ink); }
.destination-issues { padding-inline-start: 18px; }
.destination-register { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; border-block: var(--hairline) solid var(--border); padding-block: 9px; }
.destination-register span, .destination-register strong { display: block; }
.destination-register span { color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.destination-register strong { font-weight: 650; }
.destination-mapping { display: grid; gap: 10px; }
.destination-mapping h3 { margin: 0; font-size: 15px; }
.destination-tally { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; align-items: stretch; }
.destination-tally > div { padding: 7px 9px; border-radius: 8px; background: var(--surface); }
.destination-tally dt { font-size: 11px; }
.destination-tally dd { margin: 3px 0 0; text-align: left; font-size: 19px; }
.destination-formulas { color: var(--muted); }
.destination-formulas strong { color: var(--accent-ink); }
.destination-scene details > summary { padding: 7px 0; cursor: pointer; font-weight: 650; }
.destination-scene details[open] > :is(form,ul,fieldset) { animation: destination-scene 230ms var(--ease) both; }
.destination-fallback form { display: grid; align-items: end; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.destination-field { border-top: var(--hairline) solid var(--border); }
.destination-field > summary { padding-inline-start: 3px; }
.destination-field > summary span { margin-inline-start: 8px; color: var(--muted); font-weight: 500; }
.destination-field fieldset { min-width: 0; margin: 0 0 6px; padding: 3px 6px; border: 0; max-height: 220px; overflow: auto; }
.destination-field fieldset label { display: flex; align-items: flex-start; gap: 7px; padding: 6px 4px; cursor: pointer; font-weight: 500; }
.destination-field fieldset label:hover { background: var(--row-hover); }
.destination-field input[type=radio] { accent-color: var(--accent); margin: 2px 0 0; }
.destination-field fieldset small { display: block; color: var(--muted); }
.destination-field input:disabled + span { color: var(--muted); }
.destination-mapping:has([data-destination-editor][open]) .destination-unresolved { display: none; }
.destination-notice { margin: 0; padding: 7px 24px; color: var(--muted); overflow-wrap: anywhere; }
.destination-notice:empty { display: none; }
.destination-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 24px; border-top: var(--hairline) solid var(--border); }
.destination-actions[hidden] { display: none; }
@keyframes destination-open { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes destination-close { to { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes destination-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes destination-scene { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes destination-spin { to { transform: rotate(1turn); } }
@media(max-width: 470px) {
  .destination-header, .destination-body, .destination-notice, .destination-actions { padding-inline-start: 15px; padding-inline-end: 15px; }
  .destination-header { padding-inline-end: 49px; }
  .destination-close { right: 9px; }
  .destination-fallback form { grid-template-columns: minmax(0,1fr); justify-items: start; }
  .destination-fallback form label { width: 100%; }
}
@media(prefers-reduced-motion: reduce) {
  .workbook-destination[open], .workbook-destination::backdrop, .workbook-destination[data-closing], .workbook-destination[data-closing]::backdrop,
  .destination-scene, .destination-scene details[open] > :is(form,ul,fieldset), .destination-loading > span { animation: none; }
  .destination-close, .destination-text-button, .destination-books button { transition: none; }
}

.document-drawer.run-drawer {
  inset: max(12px, 3dvh) 16px max(12px, 3dvh) auto;
  translate: none;
  width: min(610px, calc(100vw - 32px));
  max-width: none;
  max-height: none;
  height: auto;
  border-radius: 15px;
  box-shadow: 0 12px 36px color-mix(in srgb, #000 15%, transparent);
}
.document-drawer[open] { animation: inspection-enter 240ms cubic-bezier(.2,.75,.22,1) both; }
.document-drawer[data-expanded] { width: min(1050px, calc(100vw - 32px)); }
@keyframes inspection-enter { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.inspection-header {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: start;
  padding: 17px 18px 12px; gap: 11px; border-bottom: 0;
}
.inspection-header h2 { margin: 0; text-wrap: pretty; font-size: clamp(16px,3vw,20px); line-height: 1.23; }
.inspection-header h2:focus { outline: none; }
.inspection-header p { margin: 5px 0 6px; }
.inspection-header .badge { width: fit-content; }
.inspection-file-mark {
  width: 37px; height: 37px; display: grid; place-items: center; border-radius: 8px;
  background: var(--selection); color: var(--accent-ink);
}
.inspection-tabs {
  display: flex; gap: clamp(14px,4vw,24px); padding-inline: 18px;
  border-bottom: var(--hairline) solid var(--border);
}
.inspection-tabs button {
  padding: 8px 2px 9px; min-height: 38px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
}
.inspection-tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); }
.document-drawer .inspection-body { padding: 15px 18px 18px; overscroll-behavior: contain; }
.inspection-body [role=tabpanel] { min-width: 0; }
.inspection-body :is(p,summary,dd,li,strong,small) { overflow-wrap: anywhere; }
.inspection-body :is(p,dl,ol,ul) { margin-block: 0; }
.inspection-body :is(section h3, details h3) { margin: 0 0 6px; font-size: 14px; }
.inspection-invoice { min-width: 0; }
.inspection-total { padding-block: 1px 10px; }
.inspection-total h3 { color: var(--muted); font-weight: 600; }
.inspection-total > div { display: flex; flex-wrap: wrap; column-gap: 8px; align-items: baseline; }
.inspection-total-amount { font-size: clamp(24px, 5vw, 34px); font-weight: 680; line-height: 1.06; letter-spacing: -.033em; }
.inspection-currency { font-size: 13px; font-weight: 650; }
.inspection-total small { display: block; margin-top: 5px; color: var(--muted); }
.inspection-values { display: block; border-top: var(--hairline) solid var(--border); }
.inspection-values > div, .inspection-body .extraction-fields > div {
  display: grid; grid-template-columns: minmax(105px, 34%) minmax(0,1fr); align-items: baseline;
  gap: 6px 12px; min-width: 0; border-bottom: var(--hairline) solid var(--border); padding-block: 6px;
}
.inspection-values dt { font-size: 12px; }
.inspection-values dd { margin: 0; text-align: start; font-size: 13px; font-weight: 550; min-width: 0; }
.inspection-body :is(.inspection-money,.inspection-total-amount) { white-space: nowrap; overflow-wrap: normal; font-variant-numeric: tabular-nums; }
.inspection-body .extraction-fields { display: block; }
.inspection-body .extraction-fields dd { text-align: start; }
.inspection-section, .inspection-disclosure { margin-top: 12px; border-top: var(--hairline) solid var(--border); padding-block-start: 10px; }
.inspection-invoice + .inspection-section { border-top: 0; padding-block-start: 0; }
.inspection-check-result { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--muted); font-size: 12px; }
.inspection-findings { display: grid; gap: 6px; padding-inline-start: 18px; }
.inspection-check-result + .inspection-findings { margin-top: 7px; }
.inspection-findings p, .inspection-body .recon-fields, .inspection-body section > .recon-button { margin-top: 5px; }
.inspection-body summary { cursor: pointer; padding-block: 5px; font-weight: 600; color: var(--ink); }
.inspection-body details :is(ol,ul) { padding-inline-start: 18px; }
.inspection-body .document-mapping { margin-block: 5px; padding: 0; border: 0; background: none; }
.inspection-body .document-mapping label { min-width: 0; }
.inspection-body .document-mapping :is(input,select) { width: 100%; }
.inspection-view-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.document-drawer .financial-review-pdf-scroll { max-height: none; overflow: visible; padding-inline: 5px; }
.document-drawer .financial-review-pdf-scroll canvas { max-width: none; }
.document-drawer [data-inspection-original] [role=status] { font-size: 12px; color: var(--muted); }
.document-drawer [data-inspection-original] .financial-review-toolbar { gap: 6px 9px; }
.inspection-original-image { width: 100%; max-width: none; height: auto; display: block; }
.inspection-original-image[hidden] { display: none; }
.inspection-source-rows { list-style: none; padding: 0; }
.inspection-source-rows li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px;
  padding-block: 6px; border-bottom: var(--hairline) solid var(--border); }
.inspection-source-rows li > div { flex: 1 1 140px; min-width: 0; }
.inspection-source-rows li > :last-child { flex: 0 1 auto; }
.inspection-source-rows :is(small,time) { display: block; font-size: 12px; color: var(--muted); }
.inspection-timeline { list-style: none; padding: 0 0 0 11px; border-inline-start: var(--hairline) solid var(--border); }
.inspection-timeline li { position: relative; padding: 0 0 12px 4px; }
.inspection-timeline li::before {
  content: ''; position: absolute; inset: 5px auto auto -15px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent);
}
.inspection-timeline li > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; justify-content: space-between; }
.inspection-timeline :is(time,small,summary) { font-size: 12px; color: var(--muted); }
.inspection-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  padding: 10px 18px; gap: 7px; border-top: var(--hairline) solid var(--border); background: var(--elevated); }
.inspection-more { position: relative; }
.inspection-more summary { cursor: pointer; list-style: none; }
.inspection-more summary::-webkit-details-marker { display: none; }
.inspection-more summary::after { content: '⋯'; font-size: 16px; line-height: 1; }
.inspection-more > div { position: absolute; inset: auto auto calc(100% + 5px) 0; z-index: 2;
  min-width: 195px; width: max-content; max-width: calc(100vw - 54px); padding: 4px;
  background: var(--elevated); border: var(--hairline) solid var(--border); border-radius: 8px; box-shadow: var(--shadow-menu); }
.inspection-more > div :is(a,button) {
  width: 100%; min-height: 34px; display: flex; align-items: center; gap: 6px; padding: 4px 7px;
  border: 0; background: transparent; color: var(--ink); border-radius: 5px; text-align: start;
}
.inspection-more > div :is(a,button):hover { background: var(--row-hover); }
.document-drawer .document-detail-error { margin: 0; padding-inline: 18px; overflow-wrap: anywhere; }
.document-drawer .document-detail-error:not(:empty) { padding-block: 6px; }
.inspection-confirm { width: min(440px,calc(100vw - 26px)); }
.inspection-confirm textarea { width: 100%; resize: vertical; padding: 8px; background: var(--paper); border: var(--hairline) solid var(--border); }
.inspection-confirm p { margin: 0; }
.inspection-confirm [data-inspection-question-error]:empty { display: none; }
@media(max-width:560px) {
  .document-drawer.run-drawer { inset: 0 0 0 auto; width: 100%; border-radius: 0; }
  .inspection-header,.inspection-tabs,.document-drawer .inspection-body,.inspection-footer { padding-inline: 13px; }
  .inspection-header { padding-top: 12px; }
  .inspection-total-amount { font-size: clamp(19px,5.7vw,27px); }
}
@media(max-width:350px) {
  .inspection-values > div,.inspection-body .extraction-fields > div {
    grid-template-columns: minmax(0,1fr); gap: 3px;
  }
}
@media(prefers-reduced-motion:reduce) { .document-drawer[open] { animation: none; } }

.fr-workspace { min-width: 0; }
.fr-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fr-link { border: 0; background: transparent; padding: 0; text-align: start; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.fr-reference { display: block; max-width: 100%; overflow-wrap: anywhere; font-weight: 650; }
.fr-header { margin-bottom: 10px; gap: 8px 12px; }
.fr-header > a { align-self: flex-start; }
.fr-tabs { gap: clamp(8px,3vw,22px); margin-bottom: 10px; flex-wrap: wrap; }
.fr-tabs button { font-size: 13px; min-height: 31px; padding-bottom: 5px; }
.fr-tabs button span { margin-inline-start: 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fr-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 9px; }
.fr-filters label { display: grid; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); }
.fr-filters > label:first-child { flex: 1 1 165px; }
.fr-filters > label:nth-child(2) { flex: 1 1 130px; }
.fr-filters :is(input,select) { min-width: 0; width: 100%; min-height: 36px; padding: 6px 8px; border: var(--hairline) solid var(--border); border-radius: var(--radius-control); color: var(--ink); background: var(--paper); }
.fr-more[open] { flex-basis: 100%; }
.fr-more > div { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.fr-more label { flex: 0 1 184px; }
.fr-more summary, .fr-options summary, .fr-invoice-more summary, .fr-source-actions summary { cursor: pointer; }
.fr-more summary { min-height: 36px; list-style: none; }
.fr-more summary::after, .fr-invoice-more summary::after { content: '+'; }
.fr-more[open] summary::after, .fr-invoice-more[open] summary::after { content: '−'; }
.fr-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding-block: 3px 6px; font-size: 12px; color: var(--muted); }
.fr-options { margin-inline-start: auto; }
.fr-options > div { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding-top: 5px; }
.fr-workspace .recon-button[hidden],.fr-workspace input[hidden],.fr-workspace [data-selection][hidden],.fr-workspace [data-pages][hidden] { display: none; }
.fr-workspace [data-report] { color: var(--muted); margin-block: 4px; }
.fr-workspace [data-report]:empty { display: none; }
.fr-table-scroll { border-block: var(--hairline) solid var(--border); }
.fr-workspace .recon-table.fr-table { min-width: 760px; }
.fr-workspace .fr-table :is(th,td) { padding: 6px 8px; height: auto; white-space: normal; min-width: 0; overflow-wrap: anywhere; text-align: start; }
.fr-workspace .fr-table tbody td { height: 37px; }
.fr-workspace .fr-table :is(th,td):first-child { width: 32px; text-align: center; }
.fr-workspace .fr-table :is(th,td):nth-child(6) { text-align: end; white-space: nowrap; }
.fr-workspace .fr-table :is(th,td):nth-child(5) { white-space: nowrap; }
.fr-workspace .fr-table :is(th,td):last-child { min-width: 90px; }
.fr-table input { vertical-align: middle; }
.fr-row-action { min-height: 29px; padding: 4px 7px; font-size: 12px; }
.fr-selection { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  margin-top: 8px; padding: 8px; background: var(--elevated); border: var(--hairline) solid var(--border); border-radius: var(--radius-control); }
.fr-selection strong { flex: 1 1 80px; }

.fr-invoice.run-drawer { width: min(1200px,calc(100vw - 34px)); max-width: none; height: min(850px,calc(100dvh - 30px)); max-height: none; inset-inline-end: 17px; }
.fr-invoice-header { padding: 13px 17px 11px; }
.fr-invoice-header h2 { line-height: 1.2; margin: 0; }
.fr-invoice-header h2:focus { outline: none; }
.fr-invoice-header .badge { display: inline-block; margin-top: 5px; }
.fr-invoice-header .fr-close { display: grid; place-items: center; padding: 0; }
.fr-draft:not(:empty) { color: var(--warning-ink); margin-inline-start: 7px; font-size: 12px; }
.fr-invoice .fr-split { padding: 0; gap: 0; grid-template-columns: minmax(0,1.08fr) minmax(0,1fr); }
.fr-invoice .fr-split.source-expanded { grid-template-columns: minmax(0,1fr); }
.fr-source, .fr-fields { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.fr-source { padding: 10px 12px 14px; border-inline-end: var(--hairline) solid var(--border); }
.fr-source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; font-size: 12px; }
.fr-source-actions strong { margin-inline-end: auto; }
.fr-source-actions details > div { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.fr-source-actions a { color: var(--accent-ink); text-decoration: underline; }
.fr-invoice .fr-preview { overflow: visible; max-height: none; }
.fr-invoice .fr-preview :is(img,canvas) { max-width: none; }
.fr-invoice .financial-review-pdf-scroll { max-height: none; overflow: visible; }
.pdf-page-controls:not([hidden]) { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.fr-invoice .financial-review-toolbar { margin-block: 7px; gap: 6px; }
.fr-invoice .financial-review-toolbar button, .fr-source-actions button { min-height: 30px; padding: 4px 7px; font-size: 12px; }
.fr-invoice .financial-review-toolbar [role=status] { font-size: 11px; color: var(--muted); }
.fr-fields { padding: 12px 16px 16px; overflow-wrap: anywhere; }
.fr-fields:focus-visible { outline-offset: -2px; }
.fr-fields h3 { font-size: 13px; margin: 0 0 5px; }
.fr-fields p { margin-block: 3px; }
.fr-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fr-invoice-value > strong { display: block; font-size: clamp(21px,3.2vw,32px); letter-spacing: -.028em; line-height: 1.14; }
.fr-invoice-value > p, .fr-check-status { font-size: 12px; color: var(--muted); }
.fr-check-status .badge { margin-inline-end: 5px; }
.fr-checks, .fr-diagnostics { border-top: var(--hairline) solid var(--border); margin-block: 8px 5px; padding-top: 7px; }
.fr-findings { margin: 5px 0 0; padding: 0; list-style: none; }
.fr-findings li { margin: 4px 0; padding: 5px 7px; border-inline-start: 2px solid var(--warning-ink); background: var(--warning-surface); }
.fr-findings strong, .fr-field-warning { color: var(--warning-ink); font-size: 12px; }
.fr-values { display: block; margin: 7px 0; border-top: var(--hairline) solid var(--border); }
.fr-values > div { display: grid; grid-template-columns: minmax(94px,34%) minmax(0,1fr); gap: 5px 10px; align-items: baseline; border-bottom: var(--hairline) solid var(--border); padding-block: 5px; }
.fr-values dt { font-size: 12px; }
.fr-values dd { text-align: start; margin: 0; min-width: 0; }
.fr-values dd strong { font-size: 13px; font-weight: 650; }
.fr-field-warning { display: block; }
.fr-fields summary { cursor: pointer; color: var(--muted); padding-block: 3px; }
.fr-evidence { font-size: 11px; }
.fr-evidence[open] { padding-bottom: 4px; }
.fr-diagnostics details { border-bottom: var(--hairline) solid var(--border); padding-block: 4px; font-size: 12px; }
.fr-corrections { margin-top: 9px; }
.fr-correction-field { border-bottom: var(--hairline) solid var(--border); padding-block: 4px; }
.fr-correction-field summary { color: var(--ink); font-weight: 600; }
.fr-correction-field small { margin-inline-start: 6px; color: var(--muted); font-weight: 500; }
.fr-invoice .fr-corrections :is(label,select,input,textarea) { min-width: 0; }
.fr-invoice .fr-corrections :is(select,input:not([type=checkbox]),textarea) { padding: 6px; border: var(--hairline) solid var(--border); border-radius: var(--radius-control); background: var(--paper); }
.fr-correction-decision textarea { resize: vertical; }
.fr-invoice-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 9px 16px; gap: 7px; border-top: var(--hairline) solid var(--border); }
.fr-invoice-footer > :is(nav,div) { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.fr-invoice-footer > div { margin-inline-start: auto; }
.fr-invoice-footer .recon-button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.fr-invoice-more { position: relative; }
.fr-invoice-more summary { list-style: none; }
.fr-invoice-more > div { position: absolute; inset: auto 0 calc(100% + 4px) auto; z-index: 2; width: max-content; max-width: calc(100vw - 35px);
  display: grid; gap: 3px; padding: 5px; border: var(--hairline) solid var(--border); border-radius: 8px; background: var(--elevated); box-shadow: var(--shadow-menu); }
.fr-invoice .financial-review-error { margin: 0; padding-inline: 16px; overflow-wrap: anywhere; }
.fr-confirm { border: var(--hairline) solid var(--border); box-shadow: var(--shadow-dialog); color: var(--ink); }
.fr-confirm::backdrop { backdrop-filter: blur(2px); }
@media(max-width: 860px) {
  .fr-invoice .fr-split { grid-template-columns: minmax(0,1fr); overflow: auto; }
  .fr-source,.fr-fields { overflow: visible; }
  .fr-source { border-inline-end: 0; border-bottom: var(--hairline) solid var(--border); }
}
@media(max-width: 540px) {
  .fr-invoice.run-drawer { inset-inline: 0; width: 100%; max-width: 100%; height: 100dvh; border-radius: 0; }
  .fr-invoice-header,.fr-invoice-footer,.fr-fields { padding-inline: 11px; }
  .fr-invoice-value > strong { font-size: clamp(18px,5vw,24px); }
}
