:root {
  color-scheme: light;
  --ink: #17221d;
  --muted: #64736c;
  --line: #dfe7e2;
  --canvas: #f3f6f3;
  --panel: #ffffff;
  --forest: #145f45;
  --forest-dark: #0d4733;
  --mint: #e8f4ee;
  --amber: #a75c10;
  --amber-bg: #fff5e5;
  --red: #a33333;
  --red-bg: #fff0ef;
  --blue: #315e91;
  --shadow: 0 10px 28px rgba(26, 48, 38, .08);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; color: #fff; background: var(--forest-dark); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: #122c23; color: #eaf5ef; display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.brand-row { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 22px; }
.brand { display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #d8f1e4; color: var(--forest-dark); font-weight: 900; font-size: 20px; }
.brand strong, .brand small { display: block; }
.brand small { color: #9fc2b3; font-size: 12px; letter-spacing: .04em; }
.icon-button { border: 0; background: transparent; color: inherit; font-size: 22px; border-radius: 8px; padding: 6px 9px; }
.icon-button:hover, .icon-button:focus-visible { background: rgba(255,255,255,.1); outline: none; }
.sidebar-close { display: none; }
.business-switcher { padding: 14px; margin-bottom: 18px; border: 1px solid rgba(255,255,255,.11); border-radius: 14px; background: rgba(255,255,255,.045); }
.business-switcher label, .business-switcher p { color: #a9c4b8; font-size: 12px; }
.business-switcher p { margin: 6px 0 0; }
.business-switcher code { color: #fff; overflow-wrap: anywhere; user-select: all; }
.select-wrap select { width: 100%; margin: 6px 0 8px; border: 0; border-radius: 9px; padding: 9px 30px 9px 10px; background: #f5faf7; color: #173329; }
.integration-state { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.state-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #45ca8d; box-shadow: 0 0 0 3px rgba(69,202,141,.13); }
.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-label { margin: 16px 12px 5px; color: #799d8e; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 10px; color: #c4d8cf; background: transparent; text-align: left; }
.nav-item:hover, .nav-item:focus-visible { background: rgba(255,255,255,.065); color: #fff; outline: none; }
.nav-item.is-active { background: #e6f3ed; color: #153c2d; font-weight: 700; }
.nav-icon { width: 18px; text-align: center; opacity: .8; }
.nav-count { margin-left: auto; min-width: 21px; padding: 1px 6px; border-radius: 20px; color: #fff; background: var(--amber); text-align: center; font-size: 11px; }
.sidebar-footer { margin-top: auto; padding: 18px 8px 0; }
.scope-note { padding: 11px 12px; border-radius: 10px; background: rgba(255,255,255,.055); }
.scope-note strong, .scope-note span { display: block; }
.scope-note span { margin-top: 2px; color: #95b5a7; font-size: 11px; }
.sign-out { margin-top: 12px; width: 100%; padding: 8px; color: #bdd2c9; border: 0; background: transparent; text-align: left; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; padding: 12px 30px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); }
.menu-button { display: none; color: var(--ink); }
.page-identity p, .page-identity h1 { margin: 0; }
.page-identity p { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.page-identity h1 { font-size: 22px; }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.connection-pill { display: flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 30px; color: var(--muted); background: #fff; font-size: 12px; }
.user-chip { display: flex; gap: 8px; align-items: center; }
.user-avatar { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 50%; background: var(--mint); color: var(--forest); font-weight: 800; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.workspace-inner { max-width: 1500px; padding: 28px 30px 60px; margin: 0 auto; }
.page { animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: .4; transform: translateY(3px); } }

.review-banner { margin-bottom: 20px; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; border: 1px solid #eccb9c; border-radius: 13px; background: var(--amber-bg); }
.review-banner p { margin: 2px 0 0; color: #7b5b35; }
.banner-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e8a13e; color: #fff; font-weight: 900; }
.hero-panel { padding: 27px 30px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-radius: 20px; background: linear-gradient(120deg, #174d39, #146d4e); color: #fff; box-shadow: var(--shadow); }
.hero-panel h2 { margin: 2px 0 8px; font-size: clamp(25px, 3vw, 38px); }
.hero-panel p { margin: 0; max-width: 720px; color: #d6e8df; }
.hero-actions, .inline-actions, .form-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.metric-grid { margin: 20px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 3px 16px rgba(20,50,37,.035); }
.metric-card { min-height: 120px; padding: 18px; border-radius: 14px; }
.metric-card strong { display: block; margin: 8px 0 4px; font-size: 27px; }
.metric-label, .metric-card span:last-child, .panel-meta { color: var(--muted); font-size: 12px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .8fr); gap: 18px; }
.panel { border-radius: var(--radius); padding: 21px; }
.panel-heading, .section-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.panel-heading { margin-bottom: 17px; }
.section-heading { margin: 4px 0 20px; align-items: end; }
.section-heading h2, .panel h3, .empty-workspace h2 { margin: 2px 0 5px; }
.section-heading p, .panel-heading p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--forest); font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.guardrail-panel { background: #f8fbf9; }
.check-list { padding: 0; list-style: none; }
.check-list li { margin: 10px 0; display: flex; gap: 9px; }
.check-list span { color: var(--forest); font-weight: 900; }
.info-callout, .evidence-summary { margin-top: 17px; padding: 13px; border-radius: 11px; background: var(--mint); }
.info-callout p { margin: 3px 0 0; color: #456358; }
.status-badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 20px; font-size: 11px; font-weight: 750; background: #edf1ef; color: #53615b; }
.status-badge.review { color: #8a5315; background: var(--amber-bg); }
.status-badge.good { color: var(--forest); background: var(--mint); }
.status-badge.bad { color: var(--red); background: var(--red-bg); }

.button { min-height: 38px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; }
.button.primary { color: #fff; background: var(--forest); }
.button.primary:hover { background: var(--forest-dark); }
.hero-panel .button.primary { color: var(--forest-dark); background: #fff; }
.button.secondary { color: var(--forest); border-color: #b8d1c5; background: #f6fbf8; }
.button.quiet, .text-button { color: var(--forest); border: 0; background: transparent; }
.button.full { width: 100%; }
.button:disabled { opacity: .55; cursor: wait; }
.text-button { padding: 5px; font-weight: 700; }

label { display: grid; gap: 6px; color: #384a42; font-size: 12px; font-weight: 680; }
input, select, textarea { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #ccd8d1; border-radius: 8px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(32,126,89,.14); border-color: #438e6d; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.span-2 { grid-column: 1 / -1; }
.stack-form { display: grid; gap: 12px; }
.field-note { margin: 0; color: var(--muted); font-size: 11px; font-weight: 450; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .75fr); gap: 17px; align-items: start; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-heading { margin: 0; padding: 18px 20px 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 20px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: #fafcfb; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.empty-cell { padding: 34px; color: var(--muted); text-align: center; }
.record-list { display: grid; }
.record-row { width: 100%; padding: 14px 19px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; border: 0; border-top: 1px solid var(--line); color: inherit; background: #fff; text-align: left; }
.record-row:hover, .record-row.is-selected { background: #f3faf6; }
.record-row small, .record-meta { display: block; margin-top: 3px; color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 780; white-space: nowrap; }
.empty-state { padding: 38px 20px; display: grid; gap: 5px; place-items: center; color: var(--muted); text-align: center; }
.empty-state strong { color: #3e4d46; }
.segmented { padding: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 9px; background: #edf2ef; }
.segmented label { display: block; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px; border-radius: 7px; text-align: center; }
.segmented input:checked + span { background: #fff; color: var(--forest); box-shadow: 0 1px 5px rgba(0,0,0,.09); }
.tool-details { border-top: 1px solid var(--line); padding-top: 9px; }
.tool-details summary { color: var(--forest); font-weight: 750; }
.inset-form { margin-top: 11px; padding: 12px; border-radius: 10px; background: #f6f8f7; }

.upload-panel { margin-bottom: 17px; }
.upload-form { display: grid; grid-template-columns: minmax(260px,1.3fr) 1fr; gap: 18px; }
.drop-zone { min-height: 150px; padding: 22px; place-items: center; align-content: center; border: 2px dashed #a9c6b8; border-radius: 13px; color: var(--forest); background: #f5fbf8; text-align: center; cursor: pointer; }
.drop-zone input { max-width: 280px; margin-top: 10px; border: 0; background: transparent; }
.drop-zone span { color: var(--muted); font-weight: 450; }
.upload-icon { font-size: 26px; }
.upload-details { display: grid; gap: 10px; }
.import-form, .filter-row { display: flex; align-items: end; gap: 11px; flex-wrap: wrap; }
.import-form label, .filter-row label { min-width: 140px; flex: 1; }
.file-field { min-width: 230px !important; }
.import-layout { grid-template-columns: minmax(270px,.7fr) minmax(0,1.6fr); }
.import-rows { display: grid; gap: 9px; }
.import-row { padding: 12px; display: grid; grid-template-columns: auto minmax(130px,1fr) repeat(3,minmax(110px,.7fr)); gap: 9px; align-items: end; border: 1px solid var(--line); border-radius: 10px; }
.import-row.is-conflict { border-color: #e7bf86; background: var(--amber-bg); }
.sticky-actions { position: sticky; bottom: 0; margin: 18px -21px -21px; padding: 14px 21px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
.receipt-items-editor { display: grid; gap: 8px; }
.receipt-item { padding: 10px; display: grid; grid-template-columns: 1fr 110px 130px; gap: 8px; border: 1px solid var(--line); border-radius: 9px; }
.duplicate-card { margin-top: 8px; padding: 10px; border: 1px solid #e5c48f; border-radius: 9px; background: var(--amber-bg); }
.tax-review-split { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.tax-review-split legend { padding: 0 6px; color: var(--ink); font-weight: 780; }
.jurisdiction-review { margin-top: 9px; padding: 10px; border-radius: 9px; background: #f5f8f6; }
.close-grid, .close-lists { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; margin-bottom: 17px; }
.recon-picker { padding: 12px 18px; border-top: 1px solid var(--line); background: #fafcfb; }
.recon-picker label { display: flex; align-items: start; gap: 8px; padding: 5px 0; }
.recon-picker input { width: auto; min-height: 0; }
.report-tabs { display: inline-flex; gap: 3px; padding: 3px; margin-bottom: 12px; border-radius: 10px; background: #e5ebe7; }
.report-tabs button { padding: 8px 14px; border: 0; border-radius: 8px; background: transparent; }
.report-tabs button[aria-selected="true"] { background: #fff; color: var(--forest); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.report-output { margin-top: 18px; }
.report-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.report-number { padding: 13px; border-radius: 10px; background: #f5f8f6; }
.report-number span, .report-number strong { display: block; }
.report-number span { color: var(--muted); font-size: 11px; }
.report-number strong { margin-top: 4px; font-size: 20px; }

.toast-region { position: fixed; right: 22px; top: 84px; z-index: 80; display: grid; gap: 8px; }
.toast { max-width: 390px; padding: 12px 15px; border-radius: 11px; color: #fff; background: #243d33; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { background: #8d3434; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-7px); } }
.empty-workspace { max-width: 700px; margin: 10vh auto; padding: 40px; border: 1px solid var(--line); border-radius: 20px; background: #fff; text-align: center; }
.empty-illustration { margin: 0 auto 14px; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 16px; color: #fff; background: var(--forest); font-size: 30px; }
.inline-fields { display: flex; gap: 8px; }
.noscript-message { position: fixed; inset: auto 20px 20px; z-index: 100; padding: 12px; color: #fff; background: var(--red); }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #dff1e8, transparent 35%), #f3f6f3; }
.login-shell { width: min(940px, 100%); display: grid; grid-template-columns: 1.2fr .8fr; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.login-intro { padding: clamp(34px, 6vw, 68px); color: #fff; background: linear-gradient(140deg, #102f24, #146d4e); }
.login-intro .brand-mark { margin-bottom: 30px; }
.login-intro .eyebrow { color: #a8dac3; }
.login-intro h1 { margin: 7px 0 12px; font-size: clamp(31px, 5vw, 48px); line-height: 1.05; }
.login-intro > p:not(.eyebrow) { max-width: 540px; color: #d6e8df; }
.login-intro .check-list { margin-top: 28px; color: #e7f5ee; }
.login-intro .check-list span { color: #8ee0b9; }
.login-card { align-self: center; padding: clamp(30px, 5vw, 52px); }
.login-card h2 { margin: 5px 0; font-size: 28px; }
.login-card > p:not(.eyebrow):not(.field-note) { margin: 0 0 24px; color: var(--muted); }
.login-card .field-note { margin-top: 16px; text-align: center; }
.login-error { margin: 0; padding: 9px 11px; border-radius: 8px; color: var(--red); background: var(--red-bg); font-size: 12px; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .overview-grid, .split-layout, .import-layout { grid-template-columns: 1fr; }
  .form-panel { order: -1; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: min(86vw, 290px); transition: transform .2s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-close, .menu-button { display: inline-block; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(5,20,14,.45); }
  .topbar { padding: 10px 14px; }
  .page-identity { margin-right: auto; }
  .connection-pill, .user-name { display: none; }
  .workspace-inner { padding: 18px 13px 45px; }
  .hero-panel, .section-heading { align-items: stretch; flex-direction: column; }
  .metric-grid, .overview-grid, .close-grid, .close-lists, .form-grid, .form-grid.two, .upload-form, .report-summary { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .import-row { grid-template-columns: auto 1fr; }
  .import-row > *:nth-child(n+3) { grid-column: 2; }
  .sticky-actions, .inline-fields { align-items: stretch; flex-direction: column; }
  .receipt-item { grid-template-columns: 1fr; }
  .toast-region { left: 13px; right: 13px; top: 75px; }
  .login-body { padding: 12px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { padding: 28px; }
  .login-intro .check-list { display: none; }
  .login-card { padding: 28px; }
}
