:root {
  color-scheme: light;
  --navy: #17324a;
  --navy-soft: #29475b;
  --teal: #006c69;
  --teal-pale: #e5f3f1;
  --coral: #cc705d;
  --off-white: #f5f7f5;
  --white: #fff;
  --amber: #94600d;
  --amber-pale: #fff3d9;
  --red: #a8343f;
  --red-pale: #fcebee;
  --muted: #52646d;
  --line: #d7e0df;
  --shadow: 0 3px 15px rgb(23 50 74 / 6%);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--off-white);
  color: var(--navy);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select, input[type="file"] { cursor: pointer; }
button, input, select, textarea { min-height: 44px; }
button:disabled { cursor: not-allowed; opacity: .55; }
img { max-width: 100%; }
p, h1, h2, h3, h4 { margin-top: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h2 { font-size: clamp(1.35rem, 2vw, 1.7rem); }
h3 { font-size: 1.12rem; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { width: min(1200px, calc(100% - 48px)); margin: 0 auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 20px 0 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--navy); color: #a6ddd5; font-size: 1.6rem; line-height: 1; }
.brand-name { margin: 0; font-weight: 800; font-size: 1.06rem; letter-spacing: -.025em; }
.brand-subtitle { margin: 0; color: var(--muted); font-size: .87rem; }
.header-controls { display: flex; align-items: end; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.overview-link { align-self: center; color: var(--navy); font-size: .86rem; font-weight: 800; text-underline-offset: 3px; }
.demo-badge { align-self: center; border: 1px solid #c9e1dd; border-radius: 4px; padding: 5px 9px; background: var(--teal-pale); color: var(--teal); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.persona-control { display: grid; gap: 4px; }
.persona-control label, .field label { color: var(--navy); font-size: .86rem; font-weight: 700; }
.persona-control select { min-width: 190px; }
.mode-tabs { display: flex; gap: 6px; padding: 14px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.mode-tabs:empty { display: none; }
.mode-tabs button, .mode-tabs a, .mode-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 700; text-decoration: none; white-space: nowrap; }
.mode-tabs [aria-current="page"], .mode-tabs [aria-selected="true"], .mode-tabs .active, .mode-tabs .is-active { border-bottom-color: var(--teal); color: var(--navy); }
.workspace { min-height: 60vh; padding: 28px 0 48px; }
.workspace > * + * { margin-top: 24px; }
.loading-message { padding: 24px 0; color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 0 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

.eyebrow { display: block; color: var(--teal); font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.page-heading, .section-heading, .dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.page-heading p, .section-heading p, .dashboard-heading p, .lede { color: var(--muted); }
.page-heading h1, .section-heading h2, .dashboard-heading h1 { margin-bottom: 5px; }
.section-heading { margin-bottom: 15px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading p { margin-bottom: 0; }
.stack { display: grid; gap: 20px; }
.two-column, .evidence-grid, .dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.summary-card, .card, .bill-card, .panel, .evidence-card, .upload-preview, .report-preview { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); box-shadow: var(--shadow); }
.summary-card { border-top: 3px solid var(--teal); padding: 18px 20px; }
.summary-card[data-tone="coral"] { border-top-color: var(--coral); }
.summary-card[data-tone="amber"] { border-top-color: var(--amber); }
.summary-card[data-tone="navy"] { border-top-color: var(--navy); }
.summary-label, .metric-label { display: block; color: var(--muted); font-size: .83rem; font-weight: 700; }
.summary-value, .metric-value { display: block; margin-top: 5px; color: var(--navy); font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.2; }
.summary-note, .metric-note { display: block; margin-top: 5px; color: var(--muted); font-size: .82rem; }
.bill-card { border-left: 5px solid var(--teal); }
.bill-card h2, .panel h2, .evidence-card h2 { margin-bottom: 10px; }
.bill-amount { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.bill-meta, .detail-list, .key-values { display: grid; gap: 10px; margin: 16px 0; }
.bill-meta div, .detail-list div, .key-values div { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.bill-meta dt, .detail-list dt, .key-values dt { color: var(--muted); }
.bill-meta dd, .detail-list dd, .key-values dd { margin: 0; font-weight: 700; text-align: right; }
.actions, .button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 15px; border: 1px solid transparent; border-radius: 7px; font-weight: 800; line-height: 1.25; text-decoration: none; text-align: center; }
.button-primary { background: var(--teal); color: var(--white); }
.button-primary:hover:not(:disabled) { background: #005955; }
.button-secondary { border-color: var(--teal); background: var(--white); color: var(--teal); }
.button-secondary:hover:not(:disabled) { background: var(--teal-pale); }
.button-quiet { border-color: var(--line); background: var(--white); color: var(--navy); }
.button-quiet:hover:not(:disabled) { border-color: var(--teal); }
.button-danger { background: var(--red); color: var(--white); }
.button-danger:hover:not(:disabled) { background: #8b2630; }
.text-button { border: 0; background: transparent; color: var(--teal); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 5px; padding: 5px 9px; background: #ebeff2; color: var(--navy); font-size: .8rem; font-weight: 800; white-space: nowrap; }
.status-pill::before { content: "○"; font-weight: 900; }
.status-pill.status-pending, .status-pill[data-status="pending"] { background: var(--amber-pale); color: var(--amber); }
.status-pill.status-pending::before, .status-pill[data-status="pending"]::before { content: "◷"; }
.status-pill.status-verified, .status-pill[data-status="verified"] { background: var(--teal-pale); color: var(--teal); }
.status-pill.status-verified::before, .status-pill[data-status="verified"]::before { content: "✓"; }
.status-pill.status-rejected, .status-pill[data-status="rejected"] { background: var(--red-pale); color: var(--red); }
.status-pill.status-rejected::before, .status-pill[data-status="rejected"]::before { content: "×"; }
.status-pill.status-unpaid, .status-pill[data-status="unpaid"] { background: #ebeff2; color: var(--navy); }
.status-pill.status-unpaid::before, .status-pill[data-status="unpaid"]::before { content: "○"; }
.status-note, .notice, .callout { padding: 13px 16px; border-left: 4px solid var(--teal); border-radius: 4px; background: var(--teal-pale); color: var(--navy); }
.notice[data-tone="warning"], .callout-warning { border-left-color: var(--amber); background: var(--amber-pale); }
.notice[data-tone="error"], .callout-error { border-left-color: var(--red); background: var(--red-pale); }

.data-table { width: 100%; border-collapse: collapse; background: var(--white); }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { background: #edf2f1; color: var(--muted); font-size: .77rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td:last-child, .data-table th:last-child { text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.table-wrap .data-table th, .table-wrap .data-table td { border-left: 0; border-right: 0; }
.mobile-label { display: none; }
.timeline, .activity-timeline { list-style: none; margin: 0; padding: 0 0 0 12px; }
.timeline li, .activity-timeline li { position: relative; margin: 0 0 0 3px; padding: 0 0 18px 22px; border-left: 2px solid var(--line); }
.timeline li:last-child, .activity-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before, .activity-timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 10px; height: 10px; border: 2px solid var(--white); border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.activity-date, .timeline time { display: block; color: var(--muted); font-size: .82rem; }

.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field input:not([type="file"]), .field select, .field textarea, .persona-control select { width: 100%; padding: 9px 12px; border: 1px solid #a9b9bd; border-radius: 6px; background: var(--white); color: var(--navy); }
.field input[type="file"] { width: 100%; padding: 9px; border: 1px dashed #9db5b4; border-radius: 6px; background: var(--off-white); color: var(--muted); font-size: .85rem; }
.field input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 10px; border: 1px solid var(--teal); border-radius: 4px; background: var(--white); color: var(--teal); font-weight: 800; }
.field textarea { resize: vertical; }
.field-hint { margin: 0; color: var(--muted); font-size: .79rem; font-weight: 400; }
.input-prefix { display: flex; align-items: center; border: 1px solid #a9b9bd; border-radius: 6px; background: var(--white); }
.input-prefix span { padding-left: 12px; color: var(--muted); font-weight: 800; }
.input-prefix input { border: 0 !important; }
.form-error, .field-error { margin: 0; color: var(--red); font-size: .88rem; font-weight: 700; }
[hidden] { display: none !important; }

.evidence-grid { margin-top: 18px; }
.evidence-card { border-top: 3px solid var(--teal); }
.evidence-card:nth-child(2) { border-top-color: var(--coral); }
.comparison-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.comparison-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.comparison-list li:last-child { border-bottom: 0; }
.comparison-match { color: var(--teal); font-weight: 800; }
.comparison-mismatch { color: var(--red); font-weight: 800; }
.receipt-preview, .upload-preview { margin: 0; }
.receipt-image-frame { display: grid; place-items: center; min-height: 170px; overflow: hidden; border: 1px dashed #9db5b4; border-radius: 6px; background: var(--off-white); }
.receipt-image { display: block; max-height: 270px; object-fit: contain; }
.receipt-placeholder { color: var(--teal); font-size: 3rem; line-height: 1; }
.receipt-filename { margin-top: 8px; color: var(--muted); font-size: .83rem; overflow-wrap: anywhere; }
.upload-preview { border-style: dashed; box-shadow: none; }
.empty-state { display: grid; justify-items: center; gap: 7px; padding: 34px 16px; border: 1px dashed var(--line); border-radius: 9px; background: var(--white); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--teal-pale); color: var(--teal); font-size: 1.35rem; font-weight: 800; }
.empty-state h3, .empty-state p { margin: 0; }
.empty-description { color: var(--muted); }

dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--navy); box-shadow: 0 20px 60px rgb(13 37 53 / 20%); }
dialog::backdrop { background: rgb(10 29 43 / 55%); }
.dialog-content { padding: 28px; }
.dialog-content h2 { margin: 8px 0; }
.dialog-content p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header { align-items: flex-start; }
}

@media (max-width: 760px) {
  .app-shell { width: min(100% - 28px, 540px); }
  .site-header, .header-controls, .site-footer { display: grid; grid-template-columns: 1fr; justify-content: stretch; }
  .site-header { gap: 18px; padding-top: 16px; }
  .header-controls { gap: 10px; }
  .demo-badge { justify-self: start; }
  .persona-control select, .header-controls .button { width: 100%; }
  .mode-tabs { margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
  .workspace { padding-top: 22px; }
  .summary-grid { grid-template-columns: 1fr; }
  .two-column, .evidence-grid, .dashboard-grid, .form-grid { grid-template-columns: 1fr; }
  .card, .bill-card, .panel, .evidence-card, .upload-preview, .report-preview { padding: 18px; }
  .data-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td, .data-table td:last-child { display: flex; align-items: start; justify-content: space-between; gap: 15px; padding: 7px 0; border: 0; text-align: right; }
  .data-table .mobile-label { display: inline; color: var(--muted); font-size: .8rem; font-weight: 800; text-align: left; }
  .data-table .cell-value { min-width: 0; overflow-wrap: anywhere; }
  .data-table td:only-child { display: block; text-align: left; }
  .site-footer { gap: 4px; }
}

@media (max-width: 420px) {
  .dialog-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
