:root {
  --ink: #231f20;
  --muted: #716c6d;
  --line: #e5e1df;
  --surface: #ffffff;
  --canvas: #f3f2ef;
  --soft: #ebe9e5;
  --brand: #b60f22;
  --brand-dark: #8e0d1b;
  --brand-soft: #f5e9e9;
  --stripe: #635bff;
  --success: #16734a;
  --success-soft: #e7f3ed;
  --warning: #8a5a13;
  --warning-soft: #f7f0df;
  --shadow: 0 18px 50px rgba(42, 35, 35, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: none; grid-template-columns: 238px minmax(0, 1fr); }
body.authenticated .app-shell { display: grid; }
.auth-screen { min-height: 100vh; padding: 32px 18px; display: grid; place-items: center; background: #262223; }
body.authenticated .auth-screen { display: none; }
.auth-card { width: min(420px, 100%); padding: 36px; border-radius: 18px; background: white; box-shadow: 0 26px 80px rgba(0,0,0,.28); }
.auth-card > img { width: 112px; height: 112px; margin: 0 auto 20px; display: block; object-fit: contain; }
.auth-card h1 { margin-bottom: 9px; font-size: 28px; }
.auth-intro { margin-bottom: 24px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-form { display: grid; gap: 15px; }
.auth-form > small { margin-top: -8px; color: var(--muted); font-size: 10px; }
.auth-error { margin: 18px 0 0; padding: 11px 13px; color: var(--brand-dark); background: var(--brand-soft); border-radius: 8px; font-size: 12px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 26px 18px;
  display: flex; flex-direction: column; background: #262223; color: white;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 27px; color: white; text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; }
.brand span { font-family: Manrope, sans-serif; font-size: 14px; line-height: 1.15; }
.sidebar nav { display: grid; gap: 13px; overflow-y: auto; }
.nav-group { display: grid; gap: 5px; }
.nav-section-label { margin: 0 13px 2px; color: #aaa4a5; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-link {
  width: 100%; border: 0; border-radius: 10px; padding: 12px 13px;
  display: flex; align-items: center; gap: 11px; color: #cbc6c7; background: transparent; text-align: left;
}
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.10); }
.nav-link span { width: 20px; font-size: 18px; text-align: center; }
.issuer-note { margin-top: auto; padding: 17px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; display: grid; gap: 5px; }
.issuer-note span, .issuer-note small { color: #aaa4a5; font-size: 11px; }
.issuer-note strong { font-size: 12px; line-height: 1.4; }
.drawer-account { display: none; }
.drawer-overlay, .mobile-header-controls, .mobile-user-indicator, .mobile-dock { display: none; }
main { min-width: 0; padding: 28px 38px 50px; }
.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-heading { min-width: 0; margin-right: auto; }
.app-shell > main { width: 100%; max-width: 1540px; margin-inline: auto; }
.user-chip { min-width: 120px; display: grid; text-align: right; }
.user-chip span { font-size: 12px; font-weight: 700; }
.user-chip small { color: var(--muted); font-size: 9px; }
.logout-button { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: white; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-weight: 700; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Manrope, sans-serif; }
h1 { margin-bottom: 0; font-size: 29px; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -.025em; }
h3 { margin-bottom: 0; font-size: 15px; }
.button { border: 0; border-radius: 9px; padding: 11px 17px; font-weight: 700; font-size: 13px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--brand); box-shadow: 0 8px 18px rgba(182,15,34,.18); }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { color: var(--ink); background: white; border: 1px solid var(--line); }
.button.compact { padding: 8px 11px; font-size: 10px; }
.button.danger { color: var(--brand-dark); background: var(--brand-soft); border: 1px solid #ead1d4; }
.button.wide { width: 100%; margin-top: 10px; }
.text-button { padding: 0; border: 0; color: var(--brand); background: none; font-weight: 700; font-size: 12px; }
.notice { margin: -10px 0 22px; padding: 12px 15px; border-radius: 9px; color: var(--success); background: var(--success-soft); font-size: 13px; }
.notice.error { color: var(--brand-dark); background: var(--brand-soft); }
.status.pending_verification, .status.unapplied, .status.draft, .status.paused_attention { color: var(--warning); background: var(--warning-soft); }
.status.confirmed_unallocated, .status.allocated_receipt_pending, .status.accepted, .status.issued { color: #315b7a; background: #e7eff5; }
.status.paid_receipt_pending { color: #315b7a; background: #e7eff5; }
.status.receipted, .status.approved { color: var(--success); background: var(--success-soft); }
.status.converted, .status.cancelled, .status.paused { color: var(--muted); background: var(--soft); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 7px; }
.danger-text { color: var(--brand-dark) !important; }
.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.type-picker input { position: absolute; opacity: 0; }
.type-picker label > span { min-height: 70px; padding: 14px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 10px; font-weight: 700; cursor: pointer; }
.type-picker label small { color: var(--muted); font-weight: 400; }
.type-picker input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #faf6f5; }
.multi-line-items { display: grid; gap: 10px; margin-bottom: 18px; }
.multi-line-row { display: grid; grid-template-columns: minmax(220px, 2fr) 120px 86px 120px 30px; gap: 9px; align-items: end; }
.line-remove { width: 30px; height: 36px; margin-bottom: 1px; border: 0; border-radius: 8px; color: var(--brand-dark); background: var(--brand-soft); }
.toggle-field { width: fit-content; min-height: 44px; margin: 10px 0 2px; display: inline-flex; align-items: center; gap: 10px; color: #4f494a; font-size: 12px; font-weight: 600; cursor: pointer; }
.toggle-field input[type="checkbox"] { width: 18px; min-width: 18px; height: 18px; margin: 0; padding: 0; flex: 0 0 18px; accent-color: var(--brand); }
.toggle-field span { line-height: 1.35; }
.document-warning { margin: 24px 0; padding: 13px 15px; border-radius: 9px; color: var(--warning); background: var(--warning-soft); font-size: 11px; }
.document-warning.strong { border-left: 4px solid var(--warning); font-weight: 600; }
.approval-record { margin-top: 28px; padding: 15px; display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; }
.approval-record span, .approval-record small { color: var(--muted); }
.conversion-actions { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.source-links { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 7px; }
.source-chip { padding: 6px 9px; border-radius: 999px; color: var(--muted); background: var(--soft); font-size: 9px; }
.doc-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.schedule-row, .schedule-card { padding: 14px 0; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.schedule-row > div, .schedule-card > div { min-width: 0; display: grid; gap: 4px; flex: 1; }
.schedule-row small, .schedule-card small { color: var(--muted); font-size: 10px; }
.schedule-card { flex-wrap: wrap; }
.schedule-card p { flex-basis: 100%; margin: 0; color: var(--warning); font-size: 10px; }
.schedules-layout { grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); }
.draft-review { margin-bottom: 18px; padding: 14px; display: grid; grid-template-columns: minmax(110px, 1fr) minmax(130px, 1.3fr); gap: 7px 14px; border-radius: 9px; background: var(--soft); font-size: 10px; }
.draft-review span { color: var(--muted); }
.draft-review strong { text-align: right; }
.workflow-note { margin: -4px 0 22px; padding: 13px 14px; display: grid; gap: 4px; border-left: 3px solid var(--warning); border-radius: 8px; background: var(--warning-soft); font-size: 11px; }
.workflow-note span { color: var(--muted); }
.view { display: none; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 17px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.metric-card { min-height: 140px; padding: 22px; display: flex; flex-direction: column; }
.metric-card > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-card > strong { margin: 14px 0 auto; font-family: Manrope, sans-serif; font-size: 25px; letter-spacing: -.04em; }
.metric-card > small { color: var(--muted); }
.dashboard-heading-panel { margin-bottom: 16px; display: flex; align-items: end; justify-content: space-between; gap: 24px; background: #fbfaf8; box-shadow: none; }
.dashboard-heading-panel .section-intro { margin: 7px 0 0; }
.dashboard-period-controls { display: flex; align-items: end; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
#dashboard-period-form { display: flex; align-items: end; gap: 7px; }
#dashboard-period-form .field { width: 130px; }
#dashboard-period-form input { padding-block: 8px; font-size: 10px; }
.quick-actions-panel { margin-bottom: 16px; box-shadow: none; }
.quick-actions-panel .section-intro { margin-bottom: 14px; }
.home-quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.home-quick-action { min-width: 0; min-height: 86px; padding: 14px; display: grid; grid-template-columns: 35px minmax(0, 1fr) 12px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fbfaf8; text-align: left; }
.home-quick-action:hover { border-color: #cbc5c2; background: white; transform: translateY(-1px); }
.home-quick-action.primary-shortcut { border-color: #e6c6c9; background: #fcf7f6; }
.home-quick-action > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.home-quick-action strong { font-size: 12px; }
.home-quick-action small { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.quick-action-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: var(--brand); background: #f3ecea; font-family: Manrope, sans-serif; font-size: 17px; font-weight: 800; }
.quick-action-arrow { color: #aaa3a1; font-size: 18px; }
.dashboard-kpis { margin-bottom: 16px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.dashboard-kpis .metric-card { min-height: 132px; padding: 18px; box-shadow: none; }
.dashboard-kpis .metric-card > strong { margin-top: 12px; font-size: clamp(19px, 2vw, 25px); }
.dashboard-kpis .metric-card > small { margin-top: 8px; font-size: 9px; line-height: 1.35; }
.dashboard-analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-analytics-grid > .panel { min-width: 0; box-shadow: none; }
.dashboard-trend-panel, .dashboard-recent-panel { grid-column: 1 / -1; }
.trend-legend { margin: -6px 0 15px; display: flex; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: 9px; }
.trend-legend span { display: flex; align-items: center; gap: 5px; }
.trend-legend i { width: 8px; height: 8px; border-radius: 2px; }
.trend-legend .sales, .trend-month .sales { background: #292526; }
.trend-legend .cash, .trend-month .cash { background: #a7b8aa; }
.trend-legend .expense, .trend-month .expense { background: #c7b3aa; }
.trend-bars { height: 170px; display: grid; grid-template-columns: repeat(12, minmax(20px, 1fr)); align-items: stretch; gap: 7px; border-bottom: 1px solid var(--line); }
.trend-month { min-width: 0; display: grid; grid-template-rows: 1fr 20px; gap: 5px; text-align: center; }
.trend-month > div { min-height: 0; display: flex; align-items: end; justify-content: center; gap: 2px; }
.trend-month i { width: min(7px, 28%); min-height: 2px; border-radius: 3px 3px 0 0; }
.trend-month small { color: var(--muted); font-size: 8px; }
.dashboard-ranked-list { display: grid; }
.dashboard-ranked-list article { min-width: 0; padding: 10px 0; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 9px; border-top: 1px solid var(--line); }
.dashboard-ranked-list article:first-child { border-top: 0; padding-top: 0; }
.rank-number { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); background: var(--soft); font-size: 9px; font-weight: 800; }
.dashboard-ranked-list article > div { min-width: 0; display: grid; gap: 3px; }
.dashboard-ranked-list strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-ranked-list small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-ranked-list b { font-size: 10px; }
.rank-bar { height: 3px; overflow: hidden; border-radius: 2px; background: var(--soft); }
.rank-bar i { height: 100%; display: block; border-radius: inherit; background: #8f8a87; }
.dashboard-funnel { display: grid; gap: 10px; }
.dashboard-funnel article { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px 12px; }
.dashboard-funnel span { color: var(--muted); font-size: 10px; }
.dashboard-funnel strong { font-size: 12px; }
.dashboard-funnel i { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: #9f9895; }
.dashboard-queue-list { display: grid; }
.dashboard-queue-list button { min-height: 43px; padding: 8px 0; display: grid; grid-template-columns: minmax(0,1fr) auto 15px; align-items: center; gap: 10px; border: 0; border-top: 1px solid var(--line); color: var(--ink); background: transparent; text-align: left; }
.dashboard-queue-list button:first-child { border-top: 0; padding-top: 0; }
.dashboard-queue-list span { font-size: 11px; }
.dashboard-queue-list strong { min-width: 26px; padding: 4px 7px; border-radius: 999px; color: var(--brand-dark); background: var(--brand-soft); font-size: 9px; text-align: center; }
.dashboard-queue-list i { color: var(--muted); font-style: normal; }
.restricted-kpi { margin-top: 14px; padding: 12px; display: grid; gap: 3px; border-left: 3px solid #605a58; border-radius: 8px; background: #f1efec; }
.restricted-kpi span, .restricted-kpi small { color: var(--muted); font-size: 8px; }
.restricted-kpi strong { font-size: 15px; }
.quick-action-selected { margin: 20px 0; display: grid; gap: 8px; }
.quick-action-choice { min-height: 57px; padding: 9px 10px; display: grid; grid-template-columns: 25px 35px minmax(0,1fr) auto; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; }
.quick-action-order { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: white; background: #3a3536; font-size: 9px; font-weight: 800; }
.quick-action-choice > span:nth-child(3) { display: grid; gap: 3px; }
.quick-action-choice strong { font-size: 11px; }
.quick-action-choice small { color: var(--muted); font-size: 8px; }
.quick-action-controls { display: flex; gap: 4px; }
.quick-action-controls button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; }
.quick-action-controls button:disabled { opacity: .32; }
.field-label { margin: 0 0 8px; color: #4f494a; font-size: 10px; font-weight: 700; }
.quick-action-options { display: flex; flex-wrap: wrap; gap: 7px; }
.quick-action-option { min-height: 38px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: white; font-size: 10px; font-weight: 700; }
.quick-action-option span { color: var(--brand); font-size: 13px; }
.quick-claim-person { margin: 14px 0; padding: 12px; display: grid; gap: 3px; border-radius: 9px; background: var(--soft); }
.quick-claim-person span, .quick-claim-person small { color: var(--muted); font-size: 9px; }
.quick-claim-person strong { font-size: 12px; }
.quick-expense-more { margin-top: 15px; }
.quick-expense-more summary { min-height: 36px; cursor: pointer; color: var(--brand); font-size: 10px; font-weight: 700; }
.status-card > strong { font-size: 19px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 17px; }
.panel { padding: 23px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.method-summary { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.method-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; }
.method-icon.bank { color: var(--brand); background: var(--brand-soft); }
.method-icon.stripe { color: white; background: var(--stripe); }
.method-summary div { display: grid; gap: 4px; }
.method-summary strong { font-size: 13px; }
.method-summary small, .fine-print { color: var(--muted); font-size: 11px; line-height: 1.5; }
.fine-print { margin: 18px 0 0; }
.section-intro { margin: -6px 0 22px; color: var(--muted); font-size: 12px; }
.empty-state { padding: 34px 14px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 11px; }
.record-list { display: grid; }
.record-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(100px, .7fr) 110px 90px auto; align-items: center; gap: 12px; min-height: 67px; border-top: 1px solid var(--line); cursor: pointer; }
.record-row:first-child { border-top: 0; }
.record-row:hover .record-title { color: var(--brand); }
.record-title { display: grid; gap: 4px; font-weight: 700; font-size: 13px; }
.record-title small, .record-cell small { color: var(--muted); font-weight: 400; }
.record-cell { display: grid; gap: 4px; font-size: 12px; }
.record-amount { font-weight: 700; font-size: 13px; text-align: right; }
.chevron { color: #a9a3a2; font-size: 19px; }
.status { width: fit-content; border-radius: 99px; padding: 5px 9px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.status.unpaid { color: var(--warning); background: var(--warning-soft); }
.status.unapplied { color: var(--warning); background: var(--warning-soft); }
.status.paid { color: var(--success); background: var(--success-soft); }
.payment-register { display: grid; }
.payment-row { display: grid; grid-template-columns: minmax(170px, 1.2fr) minmax(120px, .65fr) 130px 90px minmax(190px, auto); align-items: center; gap: 14px; min-height: 76px; border-top: 1px solid var(--line); }
.payment-row:first-child { border-top: 0; }
.payment-row .card-action { text-align: right; }
.filter-chips { display: flex; gap: 7px; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 6px 11px; color: var(--muted); background: white; font-size: 11px; font-weight: 700; }
.chip.active { color: white; border-color: #383334; background: #383334; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 17px; align-items: start; }
.form-panel { padding: 28px; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two-columns { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { color: #4f494a; font-size: 11px; font-weight: 700; }
.field small { color: var(--muted); font-weight: 400; }
input, textarea, select { width: 100%; border: 1px solid #d9d4d2; border-radius: 8px; padding: 10px 11px; color: var(--ink); background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(182,15,34,.09); }
textarea { resize: vertical; }
.line-item-heading { margin: 27px 0 12px; display: flex; justify-content: space-between; align-items: end; }
.line-item-heading small { color: var(--muted); font-size: 10px; }
.line-item-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 130px; gap: 12px; margin-bottom: 19px; }
.form-summary { position: sticky; top: 28px; }
.catalogue-picker { margin-top: 23px; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.product-picker-chip { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--ink); background: white; font-size: 11px; font-weight: 700; }
.product-picker-chip:hover { color: var(--brand); border-color: var(--brand); }
.product-picker-chip.selected { color: white; border-color: var(--brand); background: var(--brand); }
.summary-row { display: flex; justify-content: space-between; margin-top: 19px; font-size: 13px; }
.summary-row.total { margin: 16px 0 22px; padding-top: 17px; border-top: 1px solid var(--line); font-size: 17px; }
.legal-box { margin: 0 0 18px; padding: 14px; display: grid; gap: 6px; border-radius: 10px; background: var(--soft); }
.legal-box span, .legal-box small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.legal-box strong { font-size: 11px; line-height: 1.45; }
.document-toolbar { max-width: 860px; margin: 0 auto 14px; display: flex; justify-content: space-between; }
.document-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.document-sheet { width: 100%; max-width: 860px; min-height: 1000px; margin: 0 auto; padding: 58px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
.doc-header { padding-bottom: 24px; display: flex; justify-content: space-between; gap: 30px; border-bottom: 3px solid var(--brand); }
.doc-brand { display: flex; align-items: center; gap: 15px; }
.doc-brand img { width: 76px; height: 76px; object-fit: contain; }
.doc-brand strong { display: block; font-family: Manrope, sans-serif; font-size: 17px; white-space: nowrap; }
.doc-brand small { color: var(--muted); font-size: 10px; }
.doc-title { text-align: right; }
.doc-title h2 { font-size: 28px; text-transform: uppercase; }
.doc-title strong { color: var(--brand); font-size: 12px; }
.doc-parties { margin: 32px 0; display: grid; grid-template-columns: 1fr; max-width: 560px; }
.doc-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.doc-parties strong { font-size: 13px; }
.doc-parties p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.doc-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 11px; }
.doc-meta span { color: var(--muted); }
.doc-meta strong { text-align: right; }
.doc-table { width: 100%; border-collapse: collapse; margin: 30px 0; font-size: 11px; }
.doc-table th { padding: 10px; color: var(--muted); background: var(--soft); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; text-align: left; }
.doc-table td { padding: 15px 10px; border-bottom: 1px solid var(--line); }
.doc-table th:nth-child(n+2), .doc-table td:nth-child(n+2) { text-align: right; }
.doc-total { width: min(300px, 100%); margin-left: auto; display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px 10px 0; border-top: 2px solid var(--ink); font-size: 16px; }
.payment-section { margin-top: 46px; padding-top: 25px; border-top: 1px solid var(--line); }
.payment-section > h3 { margin-bottom: 16px; }
.payment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.payment-card { min-height: 150px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.payment-card h4 { margin: 0 0 8px; font-size: 13px; }
.payment-card p { margin: 0 0 15px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.bank-details { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 10px; }
.bank-details span { color: var(--muted); }
.stripe-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 164px; border: 0; border-radius: 999px; padding: 10px 18px; color: white; background: var(--stripe); font-size: 11px; font-weight: 700; box-shadow: 0 6px 16px rgba(99,91,255,.23); }
.stripe-button:hover { background: #5149e8; }
.stripe-mark { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; color: var(--stripe); background: white; font-weight: 800; }
.bank-paid-button { margin-top: 14px; border: 0; padding: 0; color: var(--brand); background: none; font-size: 10px; font-weight: 700; }
.paid-banner { margin-top: 43px; padding: 18px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-radius: 12px; color: var(--success); background: var(--success-soft); }
.paid-banner strong { font-size: 14px; }
.paid-banner span { font-size: 10px; }
.doc-notes { margin-top: 35px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.doc-footer { margin-top: 65px; padding-top: 15px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
dialog { width: min(460px, calc(100% - 30px)); border: 0; border-radius: 15px; padding: 0; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
dialog::backdrop { background: rgba(35,31,32,.55); }
dialog form { position: relative; padding: 28px; }
dialog h2 { margin-bottom: 11px; }
dialog p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.55; }
.dialog-close { position: absolute; top: 13px; right: 15px; border: 0; background: none; color: var(--muted); font-size: 23px; }
.dialog-actions { margin-top: 23px; display: flex; justify-content: flex-end; gap: 9px; }
.subheading { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.audit-list, .policy-grid { display: grid; gap: 10px; }
.audit-filters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.audit-filters select, .audit-filters input { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.audit-row, .workspace-card, .policy-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.audit-row { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(90px,auto); align-items: center; gap: 12px; }
.audit-row div, .workspace-card > div:first-child { display: grid; gap: 3px; }
.audit-row small, .workspace-card small, .policy-card small { color: var(--muted); }
.workspace-layout { align-items: start; }
.workspace-card { display: grid; gap: 12px; margin-top: 10px; }
.workspace-card .row-actions, .policy-card .row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.assistant-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.assistant-toolbar .button { min-height: 44px; }
.assistant-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.assistant-layout.history-collapsed { grid-template-columns: minmax(0, 1fr); }
.assistant-layout > * { min-width: 0; }
.assistant-project-panel { position: sticky; top: 20px; max-height: calc(100dvh - 40px); overflow-y: auto; padding: 20px; box-shadow: none; }
.assistant-project-panel h2 { font-size: 15px; letter-spacing: 0; }
.assistant-mode-banner { margin-bottom: 8px; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; border: 1px solid #dddeda; border-radius: 10px; color: #555b56; background: #eeefeb; font-size: 13px; line-height: 1.5; }
.assistant-mode-banner.live { color: var(--success); background: var(--success-soft); }
.assistant-mode-banner strong { font-size: 13px; }
.assistant-limitations { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.assistant-limitations summary { cursor: pointer; width: fit-content; padding: 6px 0; min-height: 32px; }
.assistant-limitations p { max-width: 76ch; margin: 6px 0; }
.assistant-project-list { display: grid; gap: 8px; }
.assistant-project { width: 100%; min-width: 0; padding: 12px; display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; text-align: left; overflow-wrap: anywhere; }
.assistant-project:hover, .assistant-project.active { border-color: #c8c1be; background: #f8f6f3; box-shadow: inset 3px 0 0 var(--brand); }
.assistant-project strong { font-size: 13px; }
.assistant-project small { color: var(--muted); font-size: 12px; }
.assistant-project-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.assistant-document-queue { margin-top: 19px; padding-top: 16px; border-top: 1px solid var(--line); }
.assistant-document-queue > summary, .assistant-details > summary { cursor: pointer; font-weight: 700; font-size: 12px; }
.assistant-document-queue > p { margin: 8px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.assistant-chat-panel { min-height: 540px; padding: 0; overflow: hidden; container-type: inline-size; box-shadow: 0 10px 30px rgba(42,35,35,.04); }
.assistant-empty-state { min-height: 540px; padding: 36px 28px; display: grid; place-content: center; justify-items: center; text-align: center; }
.assistant-empty-state h2 { font-size: clamp(22px, 2vw, 30px); margin-bottom: 12px; }
.assistant-empty-state p { max-width: 56ch; color: var(--muted); font-size: 14px; line-height: 1.65; }
.assistant-spark { width: 48px; height: 48px; margin-bottom: 17px; display: grid; place-items: center; border-radius: 15px; color: var(--brand); background: var(--soft); font-size: 23px; }
.assistant-starter-chips { max-width: 590px; margin: 16px 0 13px; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.assistant-starter-form { width: min(100%, 720px); padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: end; border: 1px solid #ccc9c3; border-radius: 18px; background: white; box-shadow: 0 8px 22px rgba(43,36,36,.05); }
.assistant-starter-form button { justify-self: end; }
.assistant-starter-form textarea { min-height: 56px; padding: 11px 12px; border: 0; box-shadow: none; resize: vertical; }
.assistant-starter-form textarea:focus { box-shadow: none; }
.assistant-starter-form button { min-height: 44px; }
.assistant-empty-state > .assistant-safety-note { max-width: 65ch; margin-top: 14px; padding: 0; font-size: 12px; }
.assistant-chat-header { padding: 20px 23px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); background: #fbfaf8; }
.assistant-chat-header h2 { font-size: 18px; }
.assistant-chat-header span:not(.status) { color: var(--muted); font-size: 13px; }
.assistant-messages { min-height: 210px; max-height: 370px; padding: 24px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; scroll-behavior: smooth; }
.assistant-intro { max-width: 600px; padding: 13px 15px; border-radius: 13px; color: #4d494a; background: var(--soft); font-size: 14px; line-height: 1.6; }
.assistant-message { max-width: min(85%, 680px); padding: 11px 14px; border-radius: 14px 14px 14px 4px; background: var(--soft); font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-message.user { margin-left: auto; border-radius: 14px 14px 4px 14px; color: white; background: #383334; }
.assistant-message small { display: block; margin-top: 7px; opacity: .8; font-size: 12px; }
.assistant-chips { padding: 0 24px 14px; display: flex; flex-wrap: wrap; gap: 7px; }
.assistant-chip { min-height: 44px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px; color: #4d4848; background: white; font-size: 13px; font-weight: 700; }
.assistant-chip:hover { color: var(--brand); border-color: var(--brand); }
.assistant-details { margin: 0 24px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf8; }
.assistant-details > summary { padding: 13px 15px; display: flex; justify-content: space-between; list-style: none; }
.assistant-details > summary::-webkit-details-marker { display: none; }
.assistant-details > summary span { color: var(--muted); font-weight: 500; font-size: 9px; }
.assistant-details form { padding: 4px 15px 17px; display: grid; gap: 15px; }
.assistant-document-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.assistant-document-picker button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: 10px; font-weight: 700; }
.assistant-document-picker button.active { color: white; border-color: #383334; background: #383334; }
.assistant-line-items { display: grid; gap: 8px; }
.assistant-line-item { display: grid; grid-template-columns: minmax(150px, 1.5fr) 95px 76px 105px 30px; gap: 7px; align-items: end; }
.assistant-line-remove { width: 44px; height: 44px; border: 0; border-radius: 8px; color: var(--brand-dark); background: var(--brand-soft); }
.assistant-review-card { margin: 0 24px 18px; padding: 17px; border: 1px solid #d9d2cf; border-radius: 12px; background: white; }
.assistant-review-card header { display: flex; justify-content: space-between; gap: 12px; }
.assistant-review-card h3 { font-size: 14px; }
.assistant-review-grid { margin: 15px 0; display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 10px; }
.assistant-review-grid span { color: var(--muted); }
.assistant-review-card ul { margin: 10px 0; padding-left: 18px; color: var(--warning); font-size: 10px; }
.assistant-composer { margin-top: 4px; padding: 14px 24px 7px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; border-top: 1px solid var(--line); }
.assistant-composer textarea { min-height: 42px; max-height: 130px; resize: vertical; }
.assistant-composer button { min-height: 42px; }
.assistant-safety-note { margin: 0; padding: 0 24px 18px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.assistant-chat-panel input, .assistant-chat-panel textarea { min-width: 0; font-size: 16px; }
.assistant-chat-panel .field > span, .assistant-details > summary span { font-size: 12px; }
.assistant-review-grid, .assistant-review-card ul { font-size: 13px; }
.assistant-document-picker button { min-height: 44px; font-size: 12px; }
.assistant-project .status { font-size: 10px; }
.assistant-details .form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.assistant-details .field, .assistant-details form, .assistant-line-items, .assistant-chat-header > div { min-width: 0; }
.assistant-chat-header { overflow-wrap: anywhere; }
.assistant-line-item { grid-template-columns: minmax(0, 1.5fr) 95px 76px 105px 44px; }
.assistant-date-spacer { display: none; }
.receipt-queue-list { display: grid; gap: 12px; margin-block: 20px; }
.payment-capture-actions, .payment-source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; }
.payment-capture-actions .assistant-chip { min-height: 44px; }
.payment-capture-actions [aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.payment-source-actions { justify-content: space-between; font-size: 13px; }
.payment-source-actions strong { overflow-wrap: anywhere; min-width: 0; }
.payment-source-actions .text-button { min-height: 44px; }
.payment-capture-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.payment-extra-details summary { min-height: 44px; cursor: pointer; align-content: center; color: var(--muted); font-size: 12px; }
.payment-extra-details > .form-grid { padding-top: 12px; }
#payment-dialog .payment-review-summary { color: var(--ink); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.payment-capture-fields:disabled input, .payment-capture-fields:disabled select, .payment-capture-fields:disabled textarea { color: var(--ink); opacity: 1; background: #f4f3f1; }
#payment-receipt-options { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
#payment-dialog { width: min(580px, calc(100% - 24px)); max-height: calc(100dvh - 32px); }
#payment-dialog .dialog-actions { flex-wrap: wrap; }
#payment-dialog .dialog-actions .button { white-space: normal; min-height: 44px; }
.status.receipted_unallocated { color: #286044; background: #eef5f0; }
.receipt-meta { table-layout: fixed; }
.receipt-meta td { overflow-wrap: anywhere; }
.receipt-meta td:first-child { width: 35%; }
.receipt-queue-item { padding: 16px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; }
.receipt-queue-item > div { display: grid; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.receipt-queue-item small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.receipt-queue-item .button { min-height: 44px; }
.receipt-issue-summary { margin: 20px 0; padding: 16px; border-radius: 12px; background: var(--soft); }
.receipt-issue-summary dl { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 12px; margin: 0; font-size: 14px; }
.receipt-issue-summary dt { color: var(--muted); }
.receipt-issue-summary dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
button:focus-visible, summary:focus-visible { outline: 3px solid #406d84; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.policy-grid { grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); }
.policy-card h3 { margin: 12px 0 7px; }
.policy-card p { min-height: 56px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.doc-footer a { color: var(--brand); font-weight: 700; }
.governance-form { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
@media (max-width: 768px) { .audit-filters, .audit-row { grid-template-columns: 1fr; } }
.allocation-picker { margin: 20px 0 0; padding: 0; border: 0; }
.allocation-picker legend { margin-bottom: 9px; color: #4f494a; font-size: 11px; font-weight: 700; }
#allocation-options { display: grid; gap: 8px; }
.allocation-option { cursor: pointer; }
.allocation-option input { position: absolute; opacity: 0; pointer-events: none; }
.allocation-option span { padding: 13px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 10px; }
.allocation-option small { color: var(--muted); font-size: 10px; }
.allocation-option input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(182,15,34,.08); }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.copy-field input { border-radius: 8px 0 0 8px; }
.copy-field button { border: 0; border-radius: 0 8px 8px 0; padding: 0 15px; color: white; background: #383334; font-weight: 700; }
.share-warning { margin-top: 15px; padding: 13px; display: grid; gap: 4px; border-radius: 9px; color: var(--warning); background: var(--warning-soft); }
.share-warning strong { font-size: 11px; }
.share-warning span { font-size: 10px; line-height: 1.45; }
.catalogue-category-filters { margin: 20px 0 28px; display: flex; flex-wrap: wrap; gap: 7px; }
.catalogue-category-filters .chip { min-height: 38px; display: inline-flex; align-items: center; gap: 7px; }
.catalogue-category-filters .chip span { min-width: 20px; padding: 2px 6px; border-radius: 99px; color: var(--muted); background: var(--soft); text-align: center; font-size: 9px; }
.catalogue-category-filters .chip.active span { color: #383334; background: white; }
.catalogue-groups { display: grid; gap: 34px; }
.catalogue-group { min-width: 0; }
.catalogue-group-heading { margin-bottom: 13px; padding-bottom: 11px; display: flex; align-items: end; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.catalogue-group-heading h3 { margin: 2px 0 3px; font-size: 18px; }
.catalogue-group-heading small, .catalogue-group-heading > span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.catalogue-group-heading > span { flex: 0 0 auto; padding-bottom: 2px; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.product-card { min-height: 170px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf8; }
.product-card.inactive { opacity: .55; }
.product-card h3 { margin: 7px 0 8px; font-size: 16px; }
.product-card p { min-height: 35px; margin-bottom: 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.product-card footer { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.product-card footer strong { flex: 1; font-family: Manrope, sans-serif; font-size: 12px; line-height: 1.4; }
.catalogue-picker-groups { display: grid; gap: 13px; }
.picker-category { display: grid; gap: 7px; }
.picker-category > strong { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.card-action { border: 0; padding: 4px; color: var(--brand); background: none; font-size: 11px; font-weight: 700; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 17px; align-items: start; }
.role-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 20px; }
.role-guide div { padding: 13px; display: grid; gap: 5px; border-radius: 10px; background: var(--soft); }
.role-guide strong { font-size: 10px; }
.role-guide small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.team-row { padding: 14px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; }
.team-person { display: grid; gap: 3px; }
.team-person strong { font-size: 12px; }
.team-person small { color: var(--muted); font-size: 10px; }
.role-badge { border-radius: 999px; padding: 6px 9px; color: #4d4848; background: var(--soft); font-size: 9px; font-weight: 700; }
.connection-card { margin: 20px 0 15px; padding: 17px; display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #fbfaf8; font-size: 11px; line-height: 1.5; }
.connection-card strong { color: var(--ink); font-size: 13px; }
.connection-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--warning); }
.connection-dot.connected { background: var(--success); }
.stripe-dashboard-link { display: inline-block; margin-top: 14px; text-decoration: none; text-align: center; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; }
.role-picker { margin: 17px 0 0; padding: 0; border: 0; }
.role-picker legend { margin-bottom: 9px; color: #4f494a; font-size: 11px; font-weight: 700; }
.role-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.role-picker label { cursor: pointer; }
.role-picker input { position: absolute; opacity: 0; pointer-events: none; }
.role-picker span { display: block; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; font-weight: 700; }
.role-picker input:checked + span { color: white; border-color: #383334; background: #383334; }

.bookkeeping-setup-banner { margin-bottom: 16px; padding: 15px 17px; display: grid; gap: 4px; border: 1px solid #d8d4cf; border-radius: 12px; color: #504b4b; background: #eceae6; }
.bookkeeping-setup-banner strong { font-size: 12px; }
.bookkeeping-setup-banner span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.bookkeeping-setup-banner.ready { border-color: #b9d6c7; color: var(--success); background: #edf5f1; }
.bookkeeping-summary { margin-bottom: 15px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; }
.bookkeeping-summary article { min-width: 0; padding: 16px; display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.bookkeeping-summary span, .bookkeeping-summary small { color: var(--muted); font-size: 9px; }
.bookkeeping-summary strong { overflow: hidden; font-family: Manrope,sans-serif; font-size: 17px; text-overflow: ellipsis; }
.bookkeeping-tabs { margin: 0 0 15px; padding: 4px; display: flex; gap: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #e9e7e3; scrollbar-width: none; }
.bookkeeping-tabs::-webkit-scrollbar { display: none; }
.bookkeeping-tabs button { min-height: 40px; padding: 9px 13px; flex: 1 0 auto; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; white-space: nowrap; }
.bookkeeping-tabs button.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(42,35,35,.08); }
.bookkeeping-panel { display: none; }
.bookkeeping-panel.active { display: block; }
.bookkeeping-two-column { display: grid; grid-template-columns: minmax(280px,.75fr) minmax(0,1.4fr); gap: 15px; align-items: start; }
.bookkeeping-two-column > .panel { min-width: 0; }
.bookkeeping-records { display: grid; gap: 9px; }
.bookkeeping-record { padding: 14px 0; display: grid; grid-template-columns: minmax(0,1.4fr) minmax(100px,.7fr) auto; gap: 12px; align-items: center; border-top: 1px solid var(--line); }
.bookkeeping-record:first-child { border-top: 0; }
.bookkeeping-record-main { min-width: 0; display: grid; gap: 3px; }
.bookkeeping-record-main strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; }
.bookkeeping-record-main small, .bookkeeping-record-meta small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.bookkeeping-record-meta { display: grid; gap: 4px; text-align: right; }
.bookkeeping-record-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.bookkeeping-record-actions .button, .bookkeeping-record-actions .card-action { min-height: 34px; }
.legal-control-note { margin: 13px 0 18px; padding: 14px 16px; display: grid; gap: 4px; border-left: 4px solid #5d5859; color: #423e3f; background: #eeece8; }
.legal-control-note strong { font-size: 11px; }
.legal-control-note span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.stacked-form { display: grid; gap: 13px; }
.mapping-fields { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8f7f5; }
.mapping-fields summary { cursor: pointer; font-size: 10px; font-weight: 700; }
.mapping-fields .form-grid { margin-top: 12px; }
.bank-line-list { display: grid; gap: 9px; }
.bank-line-card { padding: 13px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf8; }
.bank-line-card header { min-width: 0; display: grid; gap: 3px; }
.bank-line-card header strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.bank-line-card header small { color: var(--muted); font-size: 9px; }
.bank-line-amount { font-family: Manrope,sans-serif; font-size: 12px; text-align: right; }
.bank-line-amount.credit { color: var(--success); }
.match-suggestions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.match-suggestions button { padding: 7px 10px; border: 1px solid #cfc9c5; border-radius: 999px; color: #464142; background: white; font-size: 9px; font-weight: 700; }
.match-suggestions button:hover { border-color: var(--brand); color: var(--brand); }
.bookkeeping-setup-panel { margin-top: 15px; }
.bookkeeping-setup-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.bookkeeping-setup-grid h3 { margin-bottom: 9px; font-size: 12px; }
.setup-list { display: grid; gap: 7px; }
.setup-list div { padding: 9px 10px; display: grid; gap: 2px; border-radius: 8px; background: var(--soft); }
.setup-list strong { font-size: 10px; }
.setup-list small { color: var(--muted); font-size: 8px; }
.export-preview-card { margin-top: 15px; padding: 15px; display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fbfaf8; }
.export-preview-grid { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 10px; }
.export-preview-grid span { color: var(--muted); }
.bookkeeping-report { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.bookkeeping-report > summary { min-height: 38px; cursor: pointer; font-family: Manrope,sans-serif; font-size: 12px; font-weight: 750; }
.report-range-form { margin: 5px 0 10px; display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.report-range-form .field { min-width: 150px; flex: 0 1 180px; }
.report-total { margin-top: 12px; padding: 14px; display: grid; gap: 3px; border-radius: 10px; color: white; background: #494545; }
.report-total span, .report-total small { color: #d8d4d1; font-size: 9px; }
.report-total strong { font-family: Manrope,sans-serif; font-size: 20px; }
.report-breakdowns { margin-top: 10px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.report-breakdown { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf8; }
.report-breakdown h4 { margin: 0 0 7px; font-size: 10px; }
.report-breakdown > div { padding: 6px 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 8px; border-top: 1px solid #ebe8e4; }
.report-breakdown > div:first-of-type { border-top: 0; }
.report-breakdown span { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.report-breakdown strong { font-size: 9px; }
.report-breakdown small { grid-column: 1 / -1; color: var(--muted); font-size: 8px; }
.wide-dialog { width: min(880px,calc(100vw - 32px)); }
.wide-dialog form { max-height: min(88vh,860px); overflow-y: auto; }
.reimbursement-field[hidden] { display: none; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 22px 12px; }
  .brand { padding-inline: 4px; justify-content: center; }
  .brand span, .nav-section-label, .issuer-note, .drawer-account { display: none; }
  .nav-link { justify-content: center; padding: 12px; font-size: 0; }
  .nav-link span { font-size: 18px; }
  main { padding: 26px 25px 45px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .home-quick-actions { grid-template-columns: 1fr 1fr; }
  .dashboard-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .dashboard-kpis .metric-card:nth-child(4), .dashboard-kpis .metric-card:nth-child(5) { grid-column: span 1; }
  .status-card { grid-column: 1 / -1; }
  .content-grid, .editor-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr 1fr; }
  .form-summary { position: static; }
  .multi-line-row { grid-template-columns: minmax(180px, 1fr) 100px 80px 110px 30px; }
  .schedules-layout { grid-template-columns: 1fr; }
  .bookkeeping-summary { grid-template-columns: 1fr 1fr; }
  .bookkeeping-two-column, .bookkeeping-setup-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body.authenticated .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(86vw, 320px); height: 100dvh; padding: 20px 16px max(18px, env(safe-area-inset-bottom)); visibility: hidden; transform: translateX(-105%); transition: transform .22s ease, visibility 0s linear .22s; box-shadow: 16px 0 50px rgba(0,0,0,.26); }
  body.drawer-open { overflow: hidden; }
  body.drawer-open .sidebar { visibility: visible; transform: translateX(0); transition-delay: 0s; }
  .brand { display: flex; justify-content: flex-start; padding: 0 8px 20px; }
  .brand span, .nav-section-label { display: block; }
  .sidebar nav { display: grid; gap: 14px; padding-right: 4px; }
  .nav-group { display: grid; gap: 4px; }
  .nav-link { min-height: 44px; justify-content: flex-start; padding: 10px 12px; gap: 11px; font-size: 12px; line-height: 1.15; }
  .nav-link span { font-size: 17px; }
  .issuer-note { display: none; }
  .drawer-account { margin-top: auto; padding: 15px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255,255,255,.12); }
  .drawer-account div { display: grid; gap: 3px; }
  .drawer-account strong { font-size: 11px; }
  .drawer-account small { color: #aaa4a5; font-size: 9px; }
  .drawer-account button { min-height: 44px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; color: white; background: transparent; font-size: 10px; font-weight: 700; }
  .drawer-overlay { position: fixed; z-index: 40; inset: 0; width: 100%; border: 0; display: block; background: rgba(35,31,32,.52); }
  main { padding: 0 16px calc(86px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; z-index: 30; top: 0; min-height: 66px; margin: 0 -1px 20px; padding: 9px 1px; display: grid; grid-template-columns: 44px minmax(0, 1fr) 38px; align-items: center; gap: 10px; background: rgba(243,242,239,.96); backdrop-filter: blur(12px); }
  .mobile-header-controls { display: block; }
  .mobile-menu-button { width: 44px; height: 44px; padding: 12px; display: grid; align-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 11px; background: white; }
  .mobile-menu-button span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); }
  .topbar-heading { min-width: 0; }
  .topbar-heading .eyebrow { display: none; }
  .topbar-heading h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { display: none; }
  .mobile-user-indicator { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; color: white; background: #383334; font-size: 11px; font-weight: 800; }
  .mobile-dock { position: fixed; z-index: 35; right: 0; bottom: 0; left: 0; min-height: calc(68px + env(safe-area-inset-bottom)); padding: 6px max(10px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(10px, env(safe-area-inset-right)); display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -8px 28px rgba(42,35,35,.08); backdrop-filter: blur(14px); }
  .mobile-dock-link { min-width: 0; min-height: 56px; padding: 5px 3px; display: grid; place-items: center; align-content: center; gap: 2px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; }
  .mobile-dock-link span { font-size: 19px; line-height: 1; }
  .mobile-dock-link small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; font-weight: 700; }
  .mobile-dock-link.active { color: var(--brand); background: #faf5f4; }
  .mobile-dock-create span { width: 38px; height: 38px; margin-top: -10px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--brand); box-shadow: 0 7px 16px rgba(182,15,34,.22); }
  h1 { font-size: 22px; }
  .dashboard-heading-panel { align-items: stretch; flex-direction: column; gap: 14px; }
  .dashboard-period-controls { align-items: stretch; justify-content: flex-start; }
  #dashboard-period-form { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto; }
  #dashboard-period-form .field { width: auto; }
  .home-quick-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .home-quick-action { min-height: 75px; padding: 11px; grid-template-columns: 32px minmax(0,1fr); }
  .home-quick-action .quick-action-arrow { display: none; }
  .home-quick-action small { -webkit-line-clamp: 1; }
  .quick-action-icon { width: 32px; height: 32px; }
  .dashboard-kpis { grid-template-columns: 1fr 1fr; gap: 9px; }
  .dashboard-kpis .metric-card { min-height: 112px; padding: 14px; }
  .dashboard-kpis .metric-card:nth-child(5) { grid-column: 1 / -1; }
  .dashboard-kpis .metric-card > span { font-size: 9px; }
  .dashboard-kpis .metric-card > strong { font-size: 19px; }
  .dashboard-analytics-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .dashboard-trend-panel, .dashboard-recent-panel { grid-column: auto; }
  .trend-bars { height: 145px; gap: 4px; overflow: hidden; }
  .trend-month i { width: min(5px, 29%); }
  .quick-action-choice { grid-template-columns: 23px 32px minmax(0,1fr); }
  .quick-action-choice .quick-action-controls { grid-column: 1 / -1; justify-content: flex-end; }
  .quick-action-controls button { width: 44px; height: 44px; }
  .metrics { grid-template-columns: 1fr; }
  .status-card { grid-column: auto; }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 18px; border-radius: 12px; }
  .record-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 12px 0; }
  .record-row .record-title{grid-column:1/-1;overflow-wrap:anywhere}
  .record-row .record-amount{text-align:right}
  .record-row .record-actions-button{grid-column:1/-1;justify-self:end}
  .record-row .record-cell { display: none; }
  .record-row .status { display: inline-flex; font-size: 7px; padding: 4px 6px; }
  .payment-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 13px 0; }
  .payment-row .record-cell { display: none; }
  .payment-row .status, .payment-row .record-amount { display: inline-flex; }
  .payment-row .record-amount { font-size: 11px; }
  .payment-row .row-actions { grid-column: 1 / -1; }
  .form-grid.two-columns { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .line-item-row { grid-template-columns: 1fr 70px 110px; }
  .line-item-row .description { grid-column: 1 / -1; }
  .document-sheet { min-height: 0; padding: 25px 20px; }
  .document-toolbar { align-items: flex-start; gap: 10px; }
  .document-actions .button { padding: 9px 10px; font-size: 10px; }
  .doc-header, .doc-parties { display: grid; grid-template-columns: 1fr; }
  .doc-title { text-align: left; }
  .doc-brand strong { white-space: normal; }
  .payment-grid { grid-template-columns: 1fr; }
  .product-grid, .role-guide { grid-template-columns: 1fr; }
  .catalogue-category-filters { margin: 16px 0 24px; }
  .catalogue-category-filters .chip { min-height: 44px; }
  .catalogue-groups { gap: 30px; }
  .catalogue-group-heading { align-items: start; }
  .catalogue-group-heading > span { max-width: 82px; text-align: right; }
  .multi-line-row { grid-template-columns: 1fr 1fr 1fr 30px; }
  .multi-line-row .description { grid-column: 1 / -1; }
  .type-picker { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
  .draft-review { grid-template-columns: 1fr; }
  .draft-review strong { text-align: left; }
  .doc-footer { display: grid; gap: 5px; }
  .assistant-layout { grid-template-columns: minmax(0, 1fr); }
  .assistant-chat-panel { grid-row: auto; }
  .assistant-project-panel { grid-row: auto; position: static; max-height: 360px; padding: 16px; }
  .assistant-project-list { display: grid; overflow-x: visible; }
  .assistant-project { min-width: 0; }
  .assistant-chat-panel { min-height: 450px; }
  .assistant-empty-state { min-height: 450px; padding: 26px 16px; }
  .assistant-starter-form { grid-template-columns: minmax(0, 1fr); }
  .assistant-starter-form button { width: 100%; }
  .assistant-chat-header { padding: 16px; }
  .assistant-messages { min-height: 180px; max-height: 330px; padding: 18px 16px; }
  .assistant-message { max-width: 88%; }
  .assistant-chips { padding: 0 16px 13px; }
  .assistant-details, .assistant-review-card { margin-inline: 16px; }
  .assistant-line-item { grid-template-columns: minmax(0, 1fr) 70px 94px 44px; }
  .assistant-line-item .description { grid-column: 1 / -1; }
  .assistant-composer { padding-inline: 16px; }
  .assistant-safety-note { padding-inline: 16px; }
  .assistant-date-spacer { display: none; }
  .assistant-mode-banner { align-items: start; flex-direction: column; }
  .assistant-limitations summary { min-height: 44px; }
  .receipt-queue-item { grid-template-columns: minmax(0,1fr); }
  .receipt-queue-item .button { width: 100%; }
  .quick-actions-panel .panel-heading { flex-wrap: wrap; }
  .bookkeeping-summary { grid-template-columns: 1fr 1fr; }
  .bookkeeping-summary article { padding: 13px; }
  .bookkeeping-tabs { margin-inline: -4px; }
  .bookkeeping-tabs button { flex: 0 0 auto; min-height: 44px; }
  .bookkeeping-record { grid-template-columns: minmax(0,1fr) auto; }
  .bookkeeping-record-meta { text-align: right; }
  .bookkeeping-record-actions { justify-content: flex-start; }
  .report-breakdowns { grid-template-columns: minmax(0,1fr); }
  .report-range-form .field, .report-range-form .button { width: 100%; flex-basis: 100%; }
  .bookkeeping-two-column { grid-template-columns: minmax(0,1fr); }
  .bank-line-card { grid-template-columns: minmax(0,1fr) auto; }
  .wide-dialog { width: calc(100vw - 20px); }
}

@media (max-width: 350px) {
  main { padding-inline: 11px; }
  .dashboard-kpis { grid-template-columns: minmax(0,1fr); }
  .dashboard-kpis .metric-card:nth-child(5) { grid-column: auto; }
  .home-quick-actions { grid-template-columns: minmax(0,1fr); }
  #dashboard-period-form { grid-template-columns: 1fr 1fr; }
  #dashboard-period-form .button { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .receipt-issue-summary dl { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .receipt-issue-summary dt { font-size: 12px; }
  .receipt-issue-summary dd { text-align: left; margin-bottom: 8px; }
  #receipt-issue-dialog .dialog-actions { flex-wrap: wrap; }
}

@container (max-width: 620px) {
  .assistant-details .form-grid.two-columns { grid-template-columns: minmax(0, 1fr); }
  .assistant-line-item { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assistant-line-item .description { grid-column: 1 / -1; }
  .assistant-line-remove { justify-self: end; }
  .assistant-chat-header { align-items: flex-start; flex-wrap: wrap; }
  .assistant-composer { grid-template-columns: minmax(0, 1fr); }
  .assistant-composer button { justify-self: end; min-height: 44px; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: white; }
  .sidebar, .topbar, .notice, .no-print, .mobile-dock, .drawer-overlay { display: none !important; }
  .app-shell { display: block; }
  main { padding: 0; }
  .view { display: none !important; }
  #document-view.active { display: block !important; }
  .document-sheet { width: 100%; max-width: none; min-height: 0; padding: 0; border: 0; box-shadow: none; }
  .stripe-button, .bank-paid-button { display: none; }
  .payment-card { break-inside: avoid; }
}
/* Payment intake stays neutral and separate from the commercial AI transcript. */
.payment-intake { margin: 16px 0 22px; padding: 16px; border: 1px solid #dddcd7; border-radius: 14px; background: #f5f5f2; min-width: 0; }
.payment-intake-actions, .payment-chat-shortcuts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.payment-chat-shortcuts { margin-top: 12px; }
.payment-intake .fine-print { margin: 12px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
#payment-paste-panel { margin-top: 14px; }
#payment-read-text { margin-top: 10px; }
#payment-intake-progress { font-size: 13px; line-height: 1.5; margin: 10px 0; overflow-wrap: anywhere; }
.payment-intake-summary { margin-top: 12px; padding: 14px; background: white; border: 1px solid #d7d9d2; border-radius: 10px; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.payment-intake-summary p { margin: 6px 0; }
.payment-intake-summary ul { margin: 10px 0 0; padding-left: 18px; }
.payment-intake-summary li + li { margin-top: 5px; }
.payment-intake-review { margin: 18px 0; padding: 14px; border-radius: 10px; background: #f5f5f2; line-height: 1.5; }
.payment-intake button, .payment-chat-shortcuts button { min-height: 44px; }
.assistant-starter-form > .payment-recorder-only { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 480px) { .payment-intake { padding: 12px; } .payment-intake-actions { gap: 8px; } .payment-intake-summary { padding: 10px; } }
/* Shared client directory and inline billing picker. */
.client-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 0; border-bottom:1px solid #e5e1df; }
.client-row > div { min-width:0; overflow-wrap:anywhere; }
.client-row small { display:block; color:#716c6d; margin-top:5px; font-size:13px; }
.client-row .button { flex-shrink:0; min-height:44px; }
.client-picker { grid-column:1/-1; border:1px solid #ddd9d5; border-radius:14px; padding:16px; background:#fafaf8; min-width:0; }
.client-picker .fine-print { margin:10px 0; }
.client-picker-actions { display:flex; flex-wrap:wrap; gap:8px; }
.client-picker-actions .button { min-height:44px; padding:9px 12px; font-size:13px; }
.client-suggestion { display:block; width:100%; text-align:left; padding:12px; margin-top:8px; min-height:44px; border:1px solid #d9d5d1; border-radius:10px; background:#fff; color:#231f20; overflow-wrap:anywhere; cursor:pointer; }
.client-suggestion:hover,.client-suggestion:focus-visible { border-color:#b60f22; background:#f5f4f1; }
.client-suggestion small { display:block; color:#716c6d; margin-top:4px; }
.client-import { margin-top:28px; padding-top:18px; border-top:1px solid #ddd9d5; }
.client-import summary { min-height:44px; cursor:pointer; font-weight:600; }
#client-form .form-grid { margin-top:20px; }
#client-form,#clients-view { min-width:0; }
@media(max-width:430px) { .client-row { align-items:flex-start; flex-wrap:wrap; } .client-picker { padding:12px; } }
:root { --enquiry-surface: #f4f5f3; }
#enquiries-view { min-width: 0; }
#enquiries-view > .panel { margin-bottom: 24px; }
#enquiries-view .panel-heading { flex-wrap: wrap; gap: 16px; }
.enquiry-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 10px 0 0; align-items: end; }
.enquiry-filters input, .enquiry-filters select, .enquiry-form input, .enquiry-form select, .enquiry-inline-form select { width: 100%; min-width: 0; }
.enquiry-filters .field { gap: 4px; }
.enquiry-filters input:not([type="checkbox"]), .enquiry-filters select { min-height: 44px; padding: 8px 9px; font-size: 14px; }
.enquiry-filters .enquiry-check { align-items: center; gap: 8px; font-size: 13px; }
.enquiry-filters .enquiry-check input[type="checkbox"] { flex-basis: 18px; width: 18px; height: 18px; margin: 0; }
.enquiry-filters .enquiry-actions { grid-column: 1 / -1; gap: 8px; }
.enquiry-filters .enquiry-actions > .button { flex: 0 1 auto; padding: 8px 14px; }
.enquiry-filters .text-button { padding: 8px 12px; }
.enquiry-list { display: grid; gap: 12px; }
.enquiry-card { display: grid; gap: 10px; text-align: left; padding: 20px; border: 1px solid #dededb; border-radius: 14px; background: white; color: inherit; width: 100%; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.enquiry-card:hover { background: var(--enquiry-surface); border-color: #8c9690; }
.enquiry-card-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.enquiry-status { font-size: .8rem; padding: 4px 10px; border-radius: 20px; background: #edf1ed; color: #365047; white-space: nowrap; }
.enquiry-card-meta { display: flex; gap: 10px 24px; flex-wrap: wrap; font-size: .82rem; color: #656963; }
.enquiry-overdue { color: #945711; font-weight: 700; }
.enquiry-pagination, .enquiry-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.enquiry-pagination { justify-content: space-between; margin-top: 20px; }
.enquiry-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 24px 0; }
.enquiry-facts > div { min-width: 0; }
.enquiry-facts dt { font-size: .8rem; color: #646762; margin-bottom: 5px; }
.enquiry-facts dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.enquiry-disclosure { border-top: 1px solid #e3e4e0; padding-top: 18px; margin: 22px 0; }
.enquiry-disclosure summary { cursor: pointer; padding: 10px 0; min-height: 44px; font-weight: 700; }
.enquiry-filter-disclosure { padding-top: 8px; margin: 14px 0; }
.enquiry-filter-disclosure summary { padding: 10px 0; font-size: 14px; line-height: 24px; }
.enquiry-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 20px 0; align-items: start; }
.enquiry-form .full { grid-column: 1 / -1; }
.enquiry-check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; line-height: 1.5; }
.enquiry-check input[type="checkbox"] { flex: 0 0 22px; width: 22px; height: 22px; margin: 2px 0 0; min-height: 0; }
.enquiry-inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin: 24px 0; }
.enquiry-inline-form .field { flex: 1; min-width: 160px; }
.enquiry-client, .enquiry-quote-context { padding: 24px; background: var(--enquiry-surface); border: 1px solid #e3e4e0; border-radius: 14px; margin: 24px 0; overflow-wrap: anywhere; }
.enquiry-client h3, #enquiry-detail h3 { margin-bottom: 12px; }
.enquiry-client p, .enquiry-quote-context p { margin-bottom: 14px; line-height: 1.6; }
.enquiry-history { padding-left: 20px; margin: 20px 0; }
.enquiry-history li { padding-bottom: 18px; overflow-wrap: anywhere; }
.enquiry-history small, .enquiry-attention small { display: block; color: #686b65; margin: 6px 0; }
.enquiry-history p { white-space: pre-wrap; }
.enquiry-warning { background: #faf4e8; padding: 12px 16px; border-radius: 8px; margin-top: 16px; line-height: 1.5; }
.enquiry-attention { border-top: 1px solid #ddd; padding: 16px 0; }
#enquiry-integration-body p { margin: 16px 0; }
#enquiry-attention-detail pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
#enquiry-detail { scroll-margin-top: 80px; min-width: 0; }
#enquiry-detail-title { overflow-wrap: anywhere; }
#enquiries-view button, #enquiries-view summary { min-height: 44px; min-width: 44px; }
#enquiries-view :focus-visible { outline: 3px solid #507b6a; outline-offset: 3px; }
#enquiry-badge { padding: 2px 7px; border-radius: 12px; background: #eef3ef; color: #254735; font-size: .75rem; }
@media (max-width: 768px) {
  .enquiry-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .enquiry-filters .enquiry-filter-package, .enquiry-filters .enquiry-check { grid-column: 1 / -1; }
  .enquiry-form, .enquiry-facts { grid-template-columns: minmax(0, 1fr); }
  .enquiry-card { padding: 16px; }
  .enquiry-client, .enquiry-quote-context { padding: 16px; }
  .enquiry-actions > .button { flex: 1 1 auto; }
  #enquiries-view .panel { padding: 20px; }
  #enquiries-view input, #enquiries-view select { font-size: 16px; }
}
@media (max-width: 359px) { .enquiry-filters .enquiry-filter-date { grid-column: 1 / -1; } }
@media print { #enquiries-view, #enquiry-quote-context { display: none !important; } }

/* Chat-first Home: calm canvas, one contained composer, no payment modal jump. */
.chat-workbench { background: #fff; border: 1px solid #e3e2dd; border-radius: 22px; margin: 0 0 28px; min-width: 0; box-shadow: 0 12px 38px #25212206; }
.chat-top { padding: 18px 24px; border-bottom: 1px solid #efeeea; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-brand { display: flex; gap: 9px; align-items: center; font-size: 14px; font-weight: 700; color: #544f4d; }
.chat-brand > span { color: #af1528; font-size: 21px; }
.chat-inner { max-width: 840px; margin: auto; padding: 34px 30px 24px; min-width: 0; }
.chat-intro { text-align: center; margin-bottom: 12px; }
.chat-intro h2 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.25; letter-spacing: -.8px; margin: 0 0 10px; }
.chat-intro p { margin: 0; color: #736e6b; font-size: 15px; line-height: 1.5; }
.chat-mode { color: #6e7267; text-align: center; font-size: 12px; line-height: 1.5; margin-bottom: 24px; }
.chat-starters, .chat-replies { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.chat-starters { justify-content: center; margin-bottom: 24px; }
.chat-workbench .assistant-chip { border: 1px solid #dedfd7; background: #f7f7f3; color: #3d433b; border-radius: 24px; padding: 10px 15px; min-height: 44px; font-size: 14px; box-shadow: none; }
.chat-workbench .assistant-chip:hover { background: #eeefe7; border-color: #abb29d; }
.chat-workbench button, .chat-workbench a.button { min-height: 44px; }
.chat-top .text-button { min-width: 64px; }
.chat-workbench button:focus-visible, .chat-workbench summary:focus-visible { outline: 3px solid #71896f; outline-offset: 3px; }
.chat-workbench :disabled { opacity: .55; cursor: wait; }
.chat-workbench [hidden] { display: none !important; }
.chat-log { display: grid; gap: 14px; margin: 14px 0; }
.chat-bubble { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; max-width: 92%; }
.chat-bubble.user { justify-self: end; padding: 11px 16px; border-radius: 16px 16px 3px 16px; background: #f0f1eb; color: #464c40; }
.chat-bubble.assistant { padding: 4px 0; color: #292927; }
.chat-bubble.assistant strong { font-weight: 600; }
.chat-composer { border: 1px solid #cecec6; border-radius: 18px; padding: 12px; margin-top: 22px; background: #fff; box-shadow: 0 5px 18px #25212205; }
.chat-composer:focus-within { border-color: #77866c; box-shadow: 0 0 0 3px #77866c15; }
.chat-composer textarea { width: 100%; min-height: 72px; max-height: 220px; resize: vertical; border: 0; outline: 0; box-shadow: none; padding: 8px; font: inherit; font-size: 16px; background: transparent; line-height: 1.5; }
.chat-composer textarea:focus { box-shadow: none; outline: 0; }
.chat-composer-tools { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.chat-composer-tools > div { display: flex; gap: 4px; flex-wrap: wrap; }
.chat-composer-tools .button { padding: 10px 17px; min-height: 44px; border-radius: 14px; font-size: 14px; box-shadow: none; }
.chat-tool { min-height: 44px; padding: 8px 10px; border: 0; border-radius: 9px; color: #565b50; background: transparent; font-size: 13px; }
.chat-tool:hover { background: #f1f2ed; }
.chat-tool.chat-icon-tool { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; padding:0; flex-shrink:0; font-size:30px; line-height:1; }
.chat-icon-tool[aria-pressed="true"] { color:#b80c24; background:#fff0f2; outline:2px solid #b80c24; outline-offset:-2px; }
.chat-attachment-menu { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:6px; margin:4px 0 8px; border:1px solid #dedfd7; border-radius:12px; background:#f7f8f3; }
.chat-attachment-menu button { min-width:0; padding:8px 4px; border:0; border-radius:8px; background:transparent; font-size:14px; }
.chat-attachment-menu button:hover,.chat-attachment-menu button:focus-visible { background:#e9ede2; }
.chat-attachment-menu:popover-open { position:fixed; inset:auto; margin:0; width:180px; grid-template-columns:1fr; box-shadow:0 6px 24px #24281c22; z-index:30; }
.chat-attachment-menu:popover-open button { text-align:left; padding-left:14px; }
.chat-voice-dialog { width:min(420px,calc(100vw - 32px)); max-height:calc(100dvh - 40px); padding:24px; border:1px solid #dedfd7; border-radius:18px; color:#292927; overflow:auto; }
.chat-voice-dialog::backdrop { background:#2228; }
.chat-voice-dialog h3 { margin:0 0 14px; font-size:20px; }
.chat-voice-dialog p { font-size:14px; line-height:1.55; margin:0 0 14px; }
.chat-voice-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:16px; }
.chat-voice-actions .button { min-height:44px; padding:10px 14px; }
.chat-composer .chat-voice-status { margin:6px 8px 0; color:#555e4c; font-size:12px; }
.chat-small { color: #77736d; font-size: 12px; line-height: 1.6; margin: 10px 0; }
.chat-privacy { max-width: 610px; margin: 10px auto 0; text-align: center; }
.chat-file-label { display: flex; align-items: center; gap: 12px; padding: 8px; font-size: 12px; overflow-wrap: anywhere; }
.chat-details { margin: 18px 0; border: 1px solid #e1e1da; border-radius: 12px; background: #fcfcfa; padding: 0 16px; }
.chat-details > summary { min-height: 48px; padding: 14px 0; font-size: 14px; font-weight: 600; cursor: pointer; }
.chat-details > summary span { float: right; font-size: 12px; font-weight: 400; color: #78796f; }
.chat-details[open] { padding-bottom: 16px; }
.chat-workbench fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.chat-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chat-workbench .field { margin: 8px 0; min-width: 0; }
.chat-workbench .field > span { font-size: 12px; margin-bottom: 6px; }
.chat-workbench .field input, .chat-workbench .field textarea, .chat-workbench .field select { font-size: 16px; min-height: 44px; padding: 10px; width: 100%; min-width: 0; border: 1px solid #d9d9d2; border-radius: 9px; background: #fff; }
.chat-workbench .field input:focus, .chat-workbench .field textarea:focus, .chat-workbench .field select:focus { outline: 2px solid #8d9b7d; outline-offset: 1px; }
.chat-answer-form { display: flex; align-items: end; gap: 10px; margin-bottom: 15px; }
.chat-answer-form .field { flex: 1; }
.chat-answer-form .button { margin-bottom: 8px; min-height: 44px; }
.chat-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, .7fr) minmax(0, 1fr); gap: 8px; border-top: 1px solid #e3e3dd; padding: 10px 0; }
.chat-line > button { grid-column: 3; justify-self: end; min-height: 44px; }
.chat-catalogue { margin: 14px 0; min-width: 0; }
.chat-review, .chat-success { padding: 20px; border: 1px solid #dce1d4; border-radius: 14px; background: #f8faf5; margin: 20px 0; }
.chat-review h3, .chat-success h3 { font-size: 18px; margin: 0 0 14px; }
.chat-summary { margin: 12px 0; }
.chat-summary > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 18px; padding: 8px 0; border-bottom: 1px solid #e5e8df; font-size: 14px; }
.chat-summary dt { color: #787a71; }
.chat-summary dd { margin: 0; text-align: right; overflow-wrap: anywhere; white-space: pre-wrap; font-weight: 500; }
.chat-success-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e5edda; color: #466132; margin-bottom: 12px; }
.chat-success a { overflow-wrap: anywhere; }
.chat-warning { color: #756a48; background: #f8f6ee; border-radius: 10px; font-size: 13px; padding: 12px 14px; margin: 14px 0; line-height: 1.5; }
.chat-warning summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.chat-warning li + li { margin-top: 5px; }
.chat-error { color: #9b1930; background: #fbf5f4; padding: 12px; border-radius: 10px; overflow-wrap: anywhere; }
.chat-progress { font-size: 13px; color: #5f6c54; padding: 8px; }
.chat-matches > div { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; padding: 10px 0; }
.legacy-workspace > summary { min-height: 44px; cursor: pointer; font-size: 14px; color: #77716c; padding: 12px 0; }
.legacy-workspace[open] > summary { margin-bottom: 16px; }
@media (max-width: 768px) {
  .chat-workbench { border-radius: 16px; margin-bottom: 20px; }
  .chat-top { padding: 12px 14px; }
  .chat-brand { font-size: 12px; }
  .chat-inner { padding: 22px 16px 16px; }
  .chat-intro h2 { font-size: 25px; }
  .chat-intro p { font-size: 14px; }
  .chat-starters { gap: 6px; }
  .chat-workbench .assistant-chip { font-size: 13px; padding: 8px 12px; }
  .chat-field-grid { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .chat-review, .chat-success { padding: 14px; }
  .chat-composer { padding: 8px; }
  .chat-composer:focus-within { scroll-margin-bottom: 20px; }
  .chat-bubble { max-width: 100%; }
  .chat-line > .field:first-child { grid-column: 1 / -1; }
  .chat-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.chat-line > button { grid-column: 2; }
  .chat-replies .button { width: 100%; }
}
@media (max-width: 359px) {
  .chat-inner { padding: 18px 10px 12px; }
  .chat-brand { max-width: 165px; }
  .chat-top .text-button { font-size: 12px; min-width: 54px; }
  .chat-tool { padding: 8px 5px; font-size: 12px; }
  .chat-composer-tools .button { padding: 8px 12px; }
  .chat-answer-form { flex-wrap: wrap; }
  .chat-summary > div { gap: 10px; }
}
@media print { .chat-workbench, .legacy-workspace { display: none !important; } }
/* Record corrections: compact controls, explicit review, no mobile overflow. */
.record-actions-shortcut{display:flex;justify-content:flex-end;margin:-8px 0 12px}
.record-actions-button{min-width:72px;min-height:44px;white-space:nowrap}
.correction-dialog{width:min(760px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:calc(100dvh - 32px);padding:24px;border:1px solid #ddd8d3;border-radius:18px;color:#272323;background:#fff;overflow:auto}
.correction-dialog::backdrop{background:#18161688}
.correction-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:16px}
.correction-header{position:sticky;top:-24px;background:#fff;z-index:2;padding:10px 0;border-bottom:1px solid #eeeae5}
.correction-header h2{font-size:22px;line-height:1.3;overflow-wrap:anywhere}
.correction-header button{flex-shrink:0}
.correction-dialog button,.correction-dialog input,.correction-dialog select,.correction-dialog summary{min-height:44px}
.correction-dialog form{display:grid;gap:16px}
.correction-dialog input,.correction-dialog select,.correction-dialog textarea{width:100%;min-width:0;font-size:16px;box-sizing:border-box}
.correction-dialog textarea{min-height:72px}
.correction-dialog .field{min-width:0;margin:0}
.correction-dialog .toggle-field{display:flex;align-items:center;gap:12px;padding:14px;background:#f4f3f0;border-radius:10px;line-height:1.5}
.correction-dialog .toggle-field input{width:24px;min-height:24px;height:24px;flex:0 0 24px}
.correction-explanation{padding:14px;background:#f4f3f0;border-radius:10px;line-height:1.6;margin:12px 0 18px}
.correction-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.correction-actions{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0}
.correction-lines{padding:12px;border:1px solid #ddd8d3;border-radius:10px;min-width:0}
.correction-line{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,1fr) minmax(0,1.3fr) auto;gap:8px;align-items:end;margin-bottom:12px}
.correction-line-tools{display:flex;gap:8px}.correction-line-tools select{min-width:0;flex:1}
.correction-history{margin-top:24px;border-top:1px solid #ddd8d3;padding-top:12px}
.correction-history summary{cursor:pointer;display:flex;align-items:center;font-weight:650}
.correction-history article{padding:14px 0;border-bottom:1px solid #ddd8d3;overflow-wrap:anywhere}
.correction-history-values{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.correction-history pre{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%;font-size:12px;background:#f4f3f0;padding:10px;border-radius:8px}
.correction-effects{padding-left:22px;line-height:1.7;margin:16px 0}
.correction-related{padding:12px;border:1px solid #ddd8d3;border-radius:10px;font-size:14px;overflow-wrap:anywhere}
.correction-diff{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,3fr);gap:12px;font-size:14px}
.correction-diff dd{margin:0;display:grid;gap:6px;white-space:pre-wrap;overflow-wrap:anywhere}
.correction-diff dt{overflow-wrap:anywhere}.correction-diff span{color:#746f69}
.correction-dialog .dialog-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:10px}
.correction-search-results{display:grid;gap:8px;margin-top:16px}
.correction-search-results button{display:grid;gap:6px;text-align:left;border:1px solid #ddd8d3;border-radius:10px;background:#fff;padding:12px;overflow-wrap:anywhere;color:inherit}
.correction-search-results small{color:#746f69}
.document-void-notice{margin:20px 0;padding:16px;border:2px solid #625a51;background:#f4f3f0;color:#332e28;font-weight:700;line-height:1.5}
.status.void,.status.reversed,.status.withdrawn,.status.superseded,.status.archived{color:#625a51;background:#eeece8}
.invoice-drafts-inline{margin-top:24px}.invoice-drafts-inline summary{min-height:44px;cursor:pointer;font-weight:700}
@media(max-width:600px){.correction-dialog{padding:16px}.correction-fields{grid-template-columns:1fr}.correction-line{grid-template-columns:repeat(2,minmax(0,1fr))}.correction-line>.field:first-child{grid-column:1/-1}.correction-line>button{grid-column:1/-1;justify-self:end}.correction-header h2{font-size:19px}.correction-history-values{grid-template-columns:1fr}.correction-diff{grid-template-columns:1fr;gap:6px}.correction-diff dd{margin-bottom:12px}.record-actions-shortcut{margin:0 0 8px}}
@media print{.correction-dialog,.record-actions-shortcut,.record-actions-button{display:none!important}}
.chat-payment-review,.chat-delivery{border:1px solid #ddd9d3;border-radius:14px;padding:20px;margin:16px 0;background:#fafaf8;min-width:0}
.chat-payment-review h3,.chat-delivery h3{font-size:18px;margin:0 0 12px}
.chat-payment-review .field,.chat-delivery .field{margin:14px 0;min-width:0}
.chat-payment-review input,.chat-payment-review select,.chat-delivery input,.chat-delivery select{max-width:100%;min-width:0;font-size:16px}
.chat-payment-review .toggle-field,.chat-delivery .toggle-field{display:flex;align-items:center;gap:12px;min-height:54px;padding:14px;background:#eeeee8;border-radius:10px;cursor:pointer;line-height:1.5}
.chat-payment-review .toggle-field input,.chat-delivery .toggle-field input{width:24px;height:24px;min-height:24px;flex:0 0 24px;margin:0}
.chat-output-note{display:grid;gap:5px;font-size:14px;line-height:1.5;margin:12px 0}
.chat-output-note span{color:#6b665f}
.chat-invoice-matches{display:grid;gap:10px;margin:12px 0}
.chat-invoice-matches article{display:flex;justify-content:space-between;align-items:center;gap:12px;border:1px solid #d8dcd6;border-radius:10px;padding:12px;background:#fff;min-width:0}
.chat-invoice-matches article>div{display:grid;gap:5px;min-width:0;overflow-wrap:anywhere}
.chat-invoice-matches small{font-size:12px;color:#6b665f}
.chat-invoice-matches [aria-pressed=true]{background:#e6eee8;color:#28583b;border-color:#7c9d87}
.chat-delivery-result{padding:16px;margin:16px 0;background:#f2f2ed;border-radius:10px;overflow-wrap:anywhere}
.chat-payment-review button,.chat-delivery button{min-height:44px;white-space:normal}
@media(max-width:600px){.chat-payment-review,.chat-delivery{padding:14px 12px}.chat-invoice-matches article{align-items:stretch;flex-direction:column}.chat-bank-check{font-size:14px}.chat-payment-review .chat-answer-form{flex-direction:column;align-items:stretch}.chat-payment-review .chat-summary>div{grid-template-columns:1fr;gap:3px}.chat-payment-review .chat-summary dd{text-align:left}.chat-delivery-result .button{width:100%}}

/* Conversation and customer document: separate work areas, one send destination. */
.chat-workbench { background:transparent; border:0; box-shadow:none; border-radius:0; }
.chat-split-layout { display:grid; gap:18px; min-width:0; align-items:start; }
.chat-panel-divider { display:none; }
.chat-middle-panel,.chat-preview-panel { min-width:0; background:#fff; border:1px solid #dfded8; border-radius:16px; overflow:hidden; }
.chat-inner { width:100%; max-width:none; padding:0; }
.chat-middle-body { padding:24px; min-width:0; }
.chat-intro { text-align:left; }
.chat-intro h2 { font-size:26px; }
.chat-intro p { font-size:13px; }
.chat-mode { text-align:left; margin:12px 0 20px; font-size:11px; }
.chat-starters { justify-content:flex-start; }
.chat-compose-wrap { background:#fff; padding:14px 18px; border-top:1px solid #eeede7; }
.chat-composer { margin:0; padding:8px; border-radius:12px; }
.chat-composer textarea { min-height:60px; }
.chat-privacy { text-align:left; font-size:10px; margin-bottom:0; }
.chat-payment-review { margin:14px 0; padding:14px; }
.chat-payment-review .chat-small { font-size:11px; }
.chat-payment-review .chat-answer-form { flex-direction:column; align-items:stretch; margin-bottom:0; }
.chat-payment-review .chat-answer-form .field { width:100%; }
.chat-payment-review .chat-bank-check { font-size:13px; padding:12px; }
.chat-preview-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px; border-bottom:1px solid #e8e6e0; }
.chat-panel-kicker { display:block; font-size:9px; letter-spacing:.12em; font-weight:700; color:#78766f; margin-bottom:6px; }
.chat-preview-header h3 { font-size:17px; line-height:1.3; }
.chat-preview-status { flex-shrink:0; border:1px solid #dedfd5; border-radius:20px; padding:6px 9px; font-size:10px; color:#626858; background:#f6f7f1; }
.chat-preview-scroll { padding:20px; background:#eae9e4; min-width:0; }
.chat-document-paper { background:white; padding:26px; box-shadow:0 3px 12px #2521220c; min-width:0; overflow-wrap:anywhere; color:var(--ink); }
.chat-document-paper .doc-header { gap:12px; padding-bottom:16px; align-items:center; }
.chat-document-paper .doc-brand { gap:7px; }
.chat-document-paper .doc-brand img { width:48px; height:48px; }
.chat-document-paper .doc-brand strong { display:none; }
.chat-document-paper .doc-title h2 { font-size:19px; }
.chat-document-paper .doc-title strong { font-size:10px; }
.chat-document-paper .doc-parties { margin:24px 0; }
.chat-document-paper .paid-banner { padding:14px; margin:20px 0; font-size:11px; gap:12px; }
.chat-document-paper .paid-banner>strong { font-size:15px; white-space:nowrap; }
.chat-document-paper .doc-total { font-size:14px; }
.chat-document-paper .doc-table { font-size:11px; margin:20px 0; table-layout:fixed; }
.chat-document-paper .doc-table td { padding:12px 6px; }
.chat-document-paper .doc-table:not(.receipt-meta) th:first-child { width:45%; }
.chat-document-paper .doc-table th { font-size:8px; padding:8px 5px; }
.chat-document-paper .doc-footer { display:grid; gap:6px; font-size:8px; line-height:1.5; margin-top:35px; }
.chat-draft-watermark { margin-top:16px; padding:9px 10px; color:#6b675c; background:#f5f3ec; border:1px dashed #cbc6b7; font-size:10px; font-weight:700; letter-spacing:.04em; }
.chat-draft-watermark span { display:block; font-weight:400; letter-spacing:0; margin-top:5px; line-height:1.4; }
.chat-preview-dispatch { padding:16px 18px; background:#fff; border-top:1px solid #e8e6e0; }
.chat-preview-ready { display:grid; gap:3px; }
.chat-preview-ready .button,.chat-preview-dispatch>.chat-success>.button { width:100%; }
.chat-preview-dispatch .chat-review,.chat-preview-dispatch .chat-success { border:0; background:none; padding:0; margin:0; }
.chat-preview-dispatch .chat-delivery { margin:0; border:0; background:none; padding:0; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.15fr); gap:0 10px; }
.chat-preview-dispatch .chat-delivery h3 { font-size:14px; margin:0 0 5px; }
.chat-preview-dispatch .chat-delivery h3,.chat-preview-dispatch .chat-delivery>p,.chat-preview-dispatch .chat-delivery>.toggle-field { grid-column:1/-1; }
.chat-preview-dispatch .chat-delivery .field { margin:7px 0; }
.chat-preview-dispatch .chat-delivery .field:only-of-type { grid-column:1/-1; }
.chat-save-buttons,.chat-saved-tools { display:flex; flex-wrap:wrap; gap:8px; }
.chat-save-buttons>.button { flex:1; min-width:0; min-height:44px; padding:12px 10px; white-space:normal; }
.chat-save-note { font-size:12px; line-height:1.5; margin:9px 0; color:#555950; }
.chat-saved-tools>.button { flex:1; min-height:44px; white-space:normal; padding:10px; }
.chat-saved-link { margin:10px 0; }
.chat-saved-link span { font-size:10px; color:#716f66; }
.chat-saved-link input { width:100%; font-size:12px; min-height:44px; padding:8px; }
.chat-link-card { margin:10px 0; padding:10px 12px; background:#f5f6f2; border-radius:10px; }
.chat-link-card>a { display:inline-flex; align-items:center; min-height:44px; font-weight:700; font-size:14px; color:var(--ink); }
.chat-link-card summary { cursor:pointer; min-height:44px; display:flex; align-items:center; font-size:11px; color:#716f66; }
.chat-link-card input { width:100%; min-height:44px; padding:8px; font-size:12px; }
.chat-preview-dispatch .chat-delivery input,.chat-preview-dispatch .chat-delivery select { font-size:13px; padding:8px; min-height:44px; }
.chat-preview-dispatch .chat-delivery .toggle-field { padding:8px; min-height:44px; font-size:11px; background:#f6f6f2; }
.chat-preview-dispatch .chat-small { font-size:10px; margin:6px 0; }
.chat-preview-dispatch .chat-replies { margin:8px 0 0; }
.chat-preview-dispatch .chat-replies>.primary { flex:1; }
.chat-preview-dispatch .chat-delivery-result { margin:0 0 12px; padding:10px; font-size:12px; }
.chat-preview-dispatch .chat-delivery-result p { margin:6px 0 0; font-size:11px; line-height:1.5; }
.chat-document-tools { margin-top:12px; font-size:11px; }
.chat-document-tools summary { min-height:44px; display:flex; align-items:center; cursor:pointer; color:#716f66; text-decoration:underline; }
.chat-complete-note { margin-top:14px; padding:12px 14px; border:1px solid #dce3d5; border-radius:12px; background:#f7f9f4; font-size:13px; overflow-wrap:anywhere; }
.chat-complete-note h3 { font-size:15px; margin:0 0 6px; }
.chat-complete-note h3>span { color:#5b7650; margin-right:4px; }
.chat-complete-note p { margin:6px 0; line-height:1.5; }
.chat-complete-note .text-button { min-height:44px; padding:8px 0; }
.chat-next-task-note { margin:0 0 9px; font-size:12px; line-height:1.5; color:#66675f; }
.chat-preview-empty { padding:50px 15px; text-align:center; color:#79776f; line-height:1.6; font-size:13px; }
.chat-preview-empty>span { font-size:44px; color:#a6a89b; }
.chat-preview-empty h3 { margin:12px 0; font-size:18px; color:#5a5b50; }
@media(min-width:1000px) {
  body.chat-page-visible .app-shell>main,.app-shell>main:has(#dashboard-view.active) { padding-inline:24px; max-width:1700px; }
  .chat-split-layout { grid-template-columns:minmax(0,var(--chat-left-width,1fr)) 16px minmax(0,var(--chat-right-width,1.06fr)); gap:0; }
  .chat-panel-divider { display:flex; width:44px; min-height:44px; margin-inline:-14px; align-self:stretch; align-items:center; justify-content:center; cursor:col-resize; touch-action:none; position:relative; z-index:2; outline:0; }
  .chat-panel-divider>span:first-child { width:4px; height:44px; border-radius:4px; background:#b8bab1; transition:background .15s; }
  .chat-panel-divider:hover>span:first-child,.chat-panel-divider:focus-visible>span:first-child { background:#63715c; }
  .chat-panel-divider:focus-visible::after { content:''; position:absolute; width:12px; height:64px; border-radius:8px; outline:2px solid #63715c; outline-offset:2px; }
  .chat-panels-resizing,.chat-panels-resizing * { cursor:col-resize!important; user-select:none!important; }
  .chat-middle-panel,.chat-preview-panel { height:clamp(380px,calc(100dvh - 180px - var(--home-mode-height,0px)),1000px); display:flex; flex-direction:column; }
  .chat-inner { display:flex; flex-direction:column; min-height:0; flex:1; }
  .chat-middle-body,.chat-preview-scroll { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
  .chat-compose-wrap,.chat-preview-header,.chat-top { flex-shrink:0; }
  .chat-preview-dispatch { flex-shrink:0; max-height:55%; display:flex; flex-direction:column; overflow:hidden; }
  .chat-middle-body { padding:20px; }
  .chat-field-grid { grid-template-columns:1fr; }
}
@media(min-width:1000px) and (max-width:1150px) {
  .chat-middle-body { padding:16px; }
  .chat-preview-scroll { padding:12px; }
  .chat-document-paper { padding:18px; }
  .chat-preview-header { align-items:flex-start; }
  .chat-preview-status { font-size:9px; padding:5px 7px; }
}
@media(max-width:999px) {
  .chat-preview-panel { scroll-margin-top:85px; }
  .chat-preview-scroll { max-height:650px; overflow-y:auto; }
}
@media(max-width:600px) {
  .chat-middle-body { padding:18px 14px; }
  .chat-compose-wrap { padding:12px; }
  .chat-preview-header,.chat-preview-dispatch { padding:14px; }
  .chat-preview-scroll { padding:12px; }
  .chat-document-paper { padding:18px 14px; }
  .chat-document-paper .doc-header { display:flex; }
  .chat-document-paper .doc-title { text-align:right; }
  .chat-document-paper .doc-title h2 { font-size:17px; }
  .chat-document-paper .doc-brand img { width:44px; height:44px; }
  .chat-preview-dispatch .chat-delivery { grid-template-columns:1fr; }
  .chat-preview-dispatch .chat-delivery input,.chat-preview-dispatch .chat-delivery select { font-size:16px; }
}
@media(max-width:600px){.correction-header{top:-16px}.schedule-row{flex-wrap:wrap}.schedule-row>div{flex-basis:100%}.record-row .record-title{min-width:0}}

/* Chat is the landing page. Analytics require an explicit tab switch. */
#chat-home-slot { --home-mode-height:62px; }
#chat-home-slot[hidden],#home-dashboard-panel[hidden] { display:none!important; }
.home-mode-bar { position:sticky; top:0; z-index:10; padding:0 0 14px; margin:0; background:var(--paper,#f3f2ef); }
.home-mode-tabs { display:inline-flex; gap:4px; padding:3px; border:1px solid #ddded6; border-radius:14px; background:#eaece5; }
.home-mode-tabs button { min-height:44px; min-width:108px; padding:8px 18px; border:0; border-radius:10px; background:transparent; color:#62665c; font-size:14px; font-weight:600; }
.home-mode-tabs button[aria-selected="true"] { color:#30382a; background:#fff; box-shadow:0 1px 4px #25212212; }
.home-mode-tabs button:focus-visible { outline:2px solid #63715c; outline-offset:2px; }
#home-dashboard-panel { min-width:0; }
#home-dashboard-panel .dashboard-heading-panel { margin-top:0; }
.app-shell>main:has(#dashboard-view.active) .record-actions-shortcut { display:none; }
@media(max-width:768px) { .home-mode-bar { top:66px; } }
body.chat-task-active .record-actions-shortcut,body.chat-task-active #new-invoice-button { display:none; }
.chat-header-actions { display:flex; gap:8px; align-items:center; }
.chat-header-actions .button { min-height:44px; padding:8px 10px; font-size:12px; box-shadow:none; }
.chat-reply-hint { margin:7px 0 0; color:#62665e; font-size:11px; line-height:1.4; }
.chat-mobile-panes { display:none; }
.chat-preview-dispatch>.chat-save-actions,.chat-preview-dispatch>.chat-success,.chat-preview-dispatch>.chat-review { display:flex; flex-direction:column; min-height:0; }
.chat-dispatch-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.chat-dispatch-buttons { flex-shrink:0; padding-top:10px; margin-top:4px; border-top:1px solid #e8e6e0; background:#fff; }
#chat-preview-error { flex-shrink:0; max-height:80px; overflow:auto; }
#chat-payment-notes-form textarea { min-height:64px; font-size:16px; }
/* Conversation first: one question, options in its bubble, one action card. */
.chat-conversation-first .chat-intro { text-align:left; margin:14px 0 18px; }
.chat-conversation-first .chat-mode { text-align:left; margin:0 0 12px; font-size:11px; }
.chat-conversation-first .chat-bubble.assistant { padding:14px 16px; border-radius:16px 16px 16px 4px; background:#f4f5f1; max-width:100%; white-space:normal; }
.chat-conversation-first .chat-bubble.assistant>p { margin:0; }
.chat-conversation-first .chat-bubble .chat-replies { margin-bottom:0; }
.chat-payer-options { flex-direction:column; align-items:stretch; }
.chat-payer-options .assistant-chip { text-align:left; min-height:44px; white-space:normal; overflow-wrap:anywhere; }
.chat-start-area { margin:0 0 16px; }
.chat-start-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; gap:8px; align-items:stretch; }
.chat-start-row .assistant-chip { min-width:0; min-height:44px; padding:10px 12px; font-size:12px; white-space:normal; overflow-wrap:anywhere; }
.chat-start-row #chat-more-toggle { background:transparent; font-weight:500; }
.chat-more-actions { margin-top:12px; padding:12px 0 0; border-top:1px solid #e2e3db; }
.chat-more-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.chat-more-choices .assistant-chip { min-height:44px; text-align:left; border-radius:12px; white-space:normal; overflow-wrap:anywhere; font-size:13px; }
.chat-more-tools { display:flex; flex-wrap:wrap; gap:8px 16px; margin-top:8px; }
.chat-more-tools .text-button { min-height:44px; font-size:12px; }
.chat-workbench[data-active="false"] #chat-new { display:none; }
body.chat-page-visible .record-actions-shortcut,
body.chat-page-visible #new-invoice-button { display:none; }
@media(max-width:999px){
  #chat-workbench[data-active="false"] .chat-middle-panel { height:max(300px,calc(100dvh - 240px - var(--home-mode-height,0px) - env(safe-area-inset-bottom))); }
}
.chat-start-options summary { min-height:44px; display:flex; align-items:center; color:#686b61; cursor:pointer; }
.chat-conversation-first .chat-starters { justify-content:flex-start; margin:0 0 12px; }
.chat-conversation-first .chat-inner { width:100%; }
.chat-action-slot { flex-shrink:0; min-height:0; max-height:65%; padding:12px 16px; display:flex; flex-direction:column; border-top:1px solid #e4e5de; background:#fafbf8; }
.chat-action-slot>.chat-save-actions,.chat-action-slot>.chat-success { display:flex; flex-direction:column; min-height:0; margin:0; padding:0; background:transparent; border:0; }
.chat-action-slot h3 { margin:0 0 6px; font-size:17px; }
.chat-action-slot .chat-card-total { margin:6px 0; font-size:15px; font-weight:650; }
.chat-action-slot .chat-delivery { padding:0; margin:0; border:0; background:transparent; }
.chat-action-slot .chat-delivery-summary { display:flex; gap:8px; align-items:center; font-size:13px; }
.chat-action-slot .chat-delivery-summary .text-button { margin-left:auto; }
.chat-action-slot .chat-dispatch-buttons { background:#fafbf8; }
.chat-action-slot .chat-save-note { margin:5px 0; font-size:12px; line-height:1.5; color:#5c6355; }
.chat-action-slot .chat-save-buttons { display:grid; grid-template-columns:1fr 1.25fr; gap:8px; }
.chat-action-slot .button { font-size:13px; padding:10px; box-shadow:none; }
.chat-compose-collapsed { flex-shrink:0; padding:0 16px; border-top:1px solid #eeefe9; }
.chat-compose-collapsed button { min-height:44px; font-size:12px; }
.chat-conversation-first .chat-compose-wrap { max-height:48%; overflow:auto; }
.chat-conversation-first .chat-reply-hint { display:none; }
.chat-conversation-first .chat-privacy { text-align:left; font-size:10px; margin:6px 0 0; }
#chat-back-conversation { display:none; }
@media(min-width:1000px) { .chat-conversation-first #chat-jump-preview { display:none; } }
@media(max-width:999px) {
  body.chat-task-active .mobile-dock { display:none!important; }
  .chat-conversation-first .chat-middle-panel,.chat-conversation-first .chat-preview-panel { height:max(300px,calc(100dvh - 112px - var(--home-mode-height,0px) - env(safe-area-inset-bottom))); display:flex; flex-direction:column; }
  .chat-conversation-first .chat-inner { display:flex; flex-direction:column; flex:1; min-height:0; }
  .chat-conversation-first .chat-middle-body,.chat-conversation-first .chat-preview-scroll { flex:1; min-height:0; overflow:auto; max-height:none; }
  .chat-conversation-first .chat-top,.chat-conversation-first .chat-preview-header { flex-shrink:0; padding:10px 12px; }
  .chat-conversation-first[data-pane=chat] .chat-preview-panel,.chat-conversation-first[data-pane=preview] .chat-middle-panel { display:none; }
  .chat-conversation-first .chat-header-actions #chat-jump-preview { display:inline-flex; }
  .chat-conversation-first .chat-brand { font-size:12px; }
  #chat-back-conversation { display:inline-flex; font-size:12px; padding:8px; }
  .chat-action-slot { padding:10px 12px; }
  .chat-conversation-first .chat-compose-wrap { padding:10px 12px; }
}
@media(max-width:999px) {
  .chat-mobile-panes { display:flex; gap:8px; margin-bottom:10px; }
  .chat-mobile-panes button { flex:1; min-height:44px; font-size:14px; }
  .chat-mobile-panes button[aria-pressed=true] { background:#ecefe8; border-color:#818f77; }
  .chat-header-actions #chat-jump-preview { display:none; }
  #chat-workbench:has(.chat-mobile-panes) .chat-middle-panel,#chat-workbench:has(.chat-mobile-panes) .chat-preview-panel { height:max(240px,calc(100dvh - 205px - env(safe-area-inset-bottom))); display:flex; flex-direction:column; }
  #chat-workbench:has(.chat-mobile-panes) .chat-inner { display:flex; flex-direction:column; flex:1; min-height:0; }
  #chat-workbench:has(.chat-mobile-panes) .chat-middle-body,#chat-workbench:has(.chat-mobile-panes) .chat-preview-scroll { flex:1; min-height:0; overflow-y:auto; }
  #chat-workbench:has(.chat-mobile-panes) .chat-top,#chat-workbench:has(.chat-mobile-panes) .chat-compose-wrap,#chat-workbench:has(.chat-mobile-panes) .chat-preview-header { flex-shrink:0; }
  #chat-workbench:has(.chat-mobile-panes) .chat-preview-dispatch { flex-shrink:0; max-height:60%; display:flex; flex-direction:column; overflow:hidden; }
  #chat-workbench:has(.chat-mobile-panes)[data-pane=chat] .chat-preview-panel,#chat-workbench:has(.chat-mobile-panes)[data-pane=preview] .chat-middle-panel { display:none; }
}

/* Keep creation and history reuse reachable on narrow invoice screens. */
#invoices-view .panel-heading { flex-wrap: wrap; }
[data-reuse-invoice] { min-height: 44px; white-space: nowrap; }

.record-history-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
@media (max-width: 768px) { .record-row .record-history-actions { grid-column: 1 / -1; } }

#direct-invoice-review { width: min(720px, calc(100% - 30px)); }
.direct-invoice-review-content { padding: 28px; }
#direct-invoice-review .dialog-actions { flex-wrap: wrap; }
