:root {
  --ink: #14263b;
  --muted: #485d70;
  --canvas: #f2f5f8;
  --surface: #fff;
  --line: #dce4ec;
  --navy: #142b41;
  --navy-hover: #203d53;
  --teal: #09675d;
  --teal-soft: #e2f2ed;
  font: 16px/1.5 "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; }
.storage-notice { display: none; }
[data-temporary-storage] .storage-notice { display: block; padding: 8px 16px; text-align: center; background: #e4f1ed; }
.admin-activity { margin-block: 16px; padding: 18px; }
.admin-activity-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.admin-activity-controls label { flex: 1 1 12rem; }
.admin-activity-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 2px; height: 110px; margin-block: 12px; border-bottom: 1px solid #a8b9c8; }
.admin-activity-bars span { background: #086860; }
.admin-activity-table { max-height: 18rem; overflow: auto; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar, main { max-width: 960px; margin: auto; padding-inline: clamp(16px, 5vw, 48px); }
.bar, .heading, li, .actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bar { min-height: 68px; }
.bar img { width: 155px; margin-left: -18px; }
#connection { font-size: .88rem; font-weight: 650; color: #285c51; }
main { padding-block: 52px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -.045em; line-height: 1.1; }
.heading p, dialog p { margin-top: 9px; color: var(--muted); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid #aebecb; border-radius: 8px; padding: 9px 14px; background: var(--surface); color: var(--ink); font-weight: 650; }
.primary { color: white; background: var(--teal); border-color: var(--teal); }
a { color: var(--teal); }
button:hover { filter: brightness(.94); }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid #138578; outline-offset: 2px; }
.panel { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
#empty { padding: 38px 18px; text-align: center; color: #49606a; }
ul { margin: 0; padding: 0; list-style: none; }
li { padding: 15px 18px; }
li + li { border-top: 1px solid #dce6e3; }
li strong, li small { display: block; overflow-wrap: anywhere; }
li small { color: #49606a; }
li button { flex-shrink: 0; }
#notice { margin-top: 16px; color: #824619; }
dialog { width: min(100% - 24px, 620px); border: 1px solid #dce6e3; border-radius: 15px; padding: 24px; color: inherit; }
#policy-reader { width: min(100% - 24px, 760px); }
.policy-reader-body { max-height: min(70vh, 640px); overflow: auto; margin-top: 12px; }
.policy-reader-body h2, .policy-reader-body h3 { margin-top: 1.1rem; }
dialog::backdrop { background: #102b3c77; }
label { display: grid; gap: 5px; margin-top: 15px; font-weight: 600; }
input, select, textarea { border: 1px solid #a8b9c8; border-radius: 7px; padding: 8px; width: 100%; color: inherit; background: var(--surface); }
.row, .compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare { margin-top: 18px; }
.compare section { min-width: 0; padding: 10px; background: #f4f7f6; border-radius: 8px; }
dt { font-weight: 600; }
dd { margin: 0 0 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
.actions { justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
[hidden] { display: none !important; }
.account-bar { display: flex; align-items: center; gap: 12px; }
#install-iphone-help ol { padding-inline-start: 1.5rem; }
#install-iphone-help li { display: list-item; padding: 4px 0; border: 0; }
.access-card { max-width: 440px; margin: auto; background: white; border: 1px solid #dce6e3; border-radius: 14px; padding: 26px; }
.access-card p, #directory-count { margin-top: 10px; color: #49606a; }
#access-tagline { margin: 0 0 8px; color: #086860; font-size: .9rem; font-weight: 650; }
#access-error { color: #8b371f; }
#access-error:empty { display: none; }
/* Turnstile fails if the host is display:none or has no box. Keep a reserved size
   after the widget mounts; do not hide #human-check. */
#human-check { display: block; min-width: min(100%, 300px); min-height: 65px; margin: 12px 0 0; }
.text-button { background: transparent; border: 0; padding: 0; text-align: left; text-decoration: underline; }
.access-card a { color: #086860; }
.provider-buttons { display: grid; gap: 8px; }
.provider-buttons button { width: 100%; }
.access-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; }
.access-divider::before, .access-divider::after { content: ""; flex: 1; border-top: 1px solid #dce6e3; }
#confirmed-email, #email-code-status { color: #49606a; }
#email-code-status:empty, #confirmed-email:empty { display: none; }
#email-code-panel { margin-top: 4px; }
.directory-panel { padding: 18px; }
.directory-panel label { margin-top: 12px; }
#admin-billing-status:not(:empty) { margin-block: 12px; color: var(--muted); }
#directory .admin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#open-feedback { margin-bottom: 16px; }
#billing-error { color: #963a22; }
#billing-error:empty { display: none; }
#feedback-inbox summary { cursor: pointer; font-weight: 700; }
#feedback-inbox-status:not(:empty) { margin-top: 10px; color: #49606a; }
#feedback-list li { display: block; padding-inline: 0; }
#feedback-list p { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
#feedback-status:empty { display: none; }
#business-name { margin: 0 0 6px; color: #49606a; font-weight: 650; }
.workflow summary { cursor: pointer; font-weight: 650; padding: 16px 18px; }
.workflow ol { padding: 0; margin: 0; }
.workflow li { display: block; border-top: 1px solid #dce6e3; }
.workflow li p { margin-top: 4px; }
.workspace-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 24px; }
.workspace-nav [aria-current="page"] { background: #dcefea; border-color: #78a79d; }
.setup-card { padding: 18px; }
.setup-card fieldset, #setup-editor fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.setup-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.record-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
#setup-status, #setup-empty, #template-preview { margin-block: 12px; color: #49606a; }
#setup-editor-message { color: #8b371f; }
#setup-editor-message:empty { display: none; }

#registration-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
#registration-policy { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
#registration-policy .check { align-items: flex-start; font-weight: 400; }
#registration-policy input { flex: none; margin-top: 4px; }
#team-view fieldset { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
#team-view legend { font-weight: 650; }
.team-member { margin-top: 14px; padding-top: 12px; border-top: 1px solid #dce6e3; }

.registration-mode .access-card { max-width: 660px; }
#registration-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.registration-phone { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 8px; }
.registration-wide { grid-column: 1 / -1; }
#registration-documents { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
#registration-documents legend, .profile-document-choices legend { padding: 0; font-weight: 650; }
#registration-documents p { margin-top: 3px; color: #49606a; font-size: .9rem; }
#registration-document-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
#registration-document-options label { margin-top: 8px; }
#profile-form .profile-document-choices { margin-top: 16px; }
@media (max-width: 520px) {
  main { padding-block: 24px; }
  .access-card { padding: 18px; }
  #registration-fields, #registration-document-options { grid-template-columns: minmax(0, 1fr); }
  .record-actions { justify-content: start; }
  .setup-card li { flex-wrap: wrap; }
}

/* Signed-in workspace */
body:has(#workspace:not([hidden])) .bar { max-width: 1440px; padding-inline: clamp(16px, 3vw, 42px); }
#workspace {
  --workspace-accent: #0a6c62;
  display: block;
  max-width: 1440px;
  min-height: calc(100vh - 69px);
  padding: 0;
  background: var(--canvas);
}
.workspace-top { background: var(--navy); color: #e6edf5; padding: 14px clamp(16px, 3vw, 42px) 10px; }
.workspace-top-row, .workspace-top-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.company-switcher { display: flex; align-items: end; gap: 8px; }
.company-switcher label { display: flex; flex-direction: column; gap: 2px; margin: 0; color: #c5d4e0; font-size: .75rem; }
.company-switcher select { min-height: 36px; min-width: 12rem; background: #0f2436; color: white; border: 1px solid #637e94; border-radius: 8px; }
.workspace-top #add-company { background: transparent; border-color: #637e94; color: #e6edf5; min-height: 36px; }
.workspace-picker { display: none; }
#business-name { color: white; font-size: 1rem; margin: 0; padding: 0; overflow-wrap: anywhere; }
.workspace-picker select { color: var(--ink); }
.workspace-top #open-feedback { background: transparent; border-color: #637e94; color: #e6edf5; }
.workspace-top #open-feedback:hover { background: var(--navy-hover); }
.workspace-top :focus-visible { outline-color: #83ded0; }
.workspace-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 10px 0 0; }
.workspace-nav > button, .workspace-nav-group > summary {
  position: relative;
  border: 0;
  background: transparent;
  color: #e6edf5;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
}
.workspace-nav > button:hover, .workspace-nav-group > summary:hover { background: var(--navy-hover); filter: none; }
.workspace-nav-group { position: relative; }
.workspace-nav-group[open] { z-index: 4; }
.workspace-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px #10283c29;
}
.workspace-menu button {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
}
.workspace-menu button:hover { background: #edf5f2; filter: none; }
.workspace-nav [aria-current="page"], .workspace-nav [aria-current="page"]:hover { background: var(--teal-soft); color: #07574f; }
.quick-create { position: relative; }
.quick-create > summary {
  list-style: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #9be0d0;
  color: #0c413b;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
}
.quick-create > summary::-webkit-details-marker { display: none; }
#quick-create-options { position: absolute; z-index: 6; inset-inline-end: 0; margin-top: 6px; box-shadow: 0 8px 24px #12382c22; }
.home-widgets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.home-widget:first-child { grid-column: 1 / -1; }
.home-widget, .home-checklist { background: white; border: 1px solid #e0e8eb; border-radius: 12px; padding: 16px; }
.home-widget h2, .home-checklist h2 { font-size: 1rem; }
.home-widget p, .age-total { margin-top: 6px; font-variant-numeric: tabular-nums; }
.home-widget ul, .home-checklist ul { margin: 8px 0 0; padding: 0; list-style: none; }
.home-widget li { display: block; padding: 8px 0; }
.age-buckets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.age-buckets div { min-width: 0; padding: 10px; border-radius: 8px; background: #f4f7f8; }
.age-buckets dt { color: #48606a; font-size: .78rem; white-space: nowrap; }
.age-buckets dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.home-checklist { margin-top: 16px; }
.home-checklist li { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.home-checklist .done { color: #08776c; font-weight: 700; }
.import-table, .report-table { width: 100%; border-collapse: collapse; }
.import-table th, .import-table td, .report-table th, .report-table td { border-bottom: 1px solid #e0e8eb; padding: 8px 6px; text-align: left; vertical-align: top; }
.import-errors { color: #8b371f; }
#gst-settings { margin-top: 18px; }
.workspace-content { min-width: 0; padding: clamp(24px, 4vw, 52px); }
.workspace-content .heading { align-items: flex-start; }
.workspace-content .heading > button { flex-shrink: 0; }
.workspace-content .panel { border-color: #e0e8eb; border-radius: 12px; }
.dashboard-heading { padding: clamp(18px, 3vw, 30px); border-radius: 14px; background: var(--navy); color: white; }
.dashboard-heading p { color: #d4e1eb; }
.dashboard-panels { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 20px; }
.dashboard-panels .panel { min-width: 0; margin: 0; }
#dashboard-create { flex-shrink: 0; }
#dashboard-create > summary { color: #0c413b; background: #9be0d0; border-color: #9be0d0; }
#dashboard-create > summary:focus-visible { outline-color: #9be0d0; }
@media (max-width: 1080px) and (min-width: 901px), (max-width: 740px) {
  .dashboard-panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .dashboard-heading { flex-direction: column; }
}
.draft-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 28px 0 0; }
.draft-summary > div { min-width: 0; padding: 16px 18px; border: 1px solid #e0e8eb; border-radius: 12px; background: #fff; }
.draft-summary dt { color: #48606a; font-size: .84rem; }
.draft-summary dd { margin: 5px 0 0; font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.draft-panel h2 { padding: 15px 18px; border-bottom: 1px solid #e0e8eb; font-size: 1rem; }
.draft-panel li { padding: 16px 18px; }
.draft-panel #empty { padding: 42px 16px; }
#empty-title { color: #12283a; font-weight: 700; }
#empty-detail { margin-top: 5px; font-size: .91rem; }
#empty-create { margin-top: 15px; color: #075d54; }
.workspace-content .workflow { margin-top: 18px; }
@media (max-width: 900px) {
  .workspace-picker { display: grid; max-width: 360px; margin: 10px 0 0; font-size: .875rem; }
  .workspace-picker select { min-height: 44px; font-size: 1rem; }
  .workspace-top #open-feedback { min-height: 44px; font-size: .875rem; }
  .home-widgets { grid-template-columns: minmax(0, 1fr); }
  .age-buckets { gap: 4px; font-size: .78rem; }
  .age-buckets div { padding: 8px 4px; }
}
@media (max-width: 480px) {
  .workspace-content { padding: 20px 16px 32px; }
  .draft-summary { gap: 7px; margin-top: 20px; }
  .draft-summary > div { padding: 10px 8px; }
  .draft-summary dt { font-size: .75rem; }
  .workspace-content .heading { gap: 8px; }
  .workspace-content .heading > button { padding: 8px 10px; font-size: .85rem; }
  .draft-panel #empty { padding-block: 27px; }
}

#document-status { margin-top: 12px; color: #48606a; }
#document-status:empty, #document-error:empty { display: none; }
#document-lines { display: grid; gap: 12px; margin-block: 16px 10px; }
.document-item { min-width: 0; border: 1px solid #e0e8eb; border-radius: 8px; padding: 0 12px 12px; }
.document-item button { margin-top: 10px; }
#document-total { font-weight: 700; }
#document-error { color: #8b371f; }
.document-item { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.document-item button { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 600px) {
  .document-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .document-item > label:first-of-type { grid-column: 1 / -1; }
}

.draft-chart { margin: 18px 0 0; padding: 16px 18px; }
.draft-chart figcaption { font-size: 1rem; font-weight: 700; }
.draft-chart dl { display: grid; gap: 10px; margin: 14px 0 0; }
.draft-chart dl > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 10px; }
.draft-chart dt { font-size: .85rem; color: #405562; }
.draft-chart dd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(20px, auto); align-items: center; gap: 10px; margin: 0; }
.draft-chart dd strong { text-align: right; font-variant-numeric: tabular-nums; }
.draft-chart-track { display: block; height: 10px; border-radius: 4px; background: #e9eff1; }
.draft-chart-track > span { display: block; height: 100%; border-radius: inherit; background: #08776c; }
#chart-pending-bar { background: #966118; }
#chart-conflicts-bar { background: #a64450; }

.item-pricing { grid-column: 1 / -1; min-width: 0; }
.item-pricing-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.item-pricing-actions button[aria-expanded="true"] { background: #e6f3ef; color: #075d54; }
.tier-panel, .history-panel { margin-top: 10px; padding: 10px; border: 1px solid #e0e8eb; border-radius: 8px; background: #f8fafb; }
.tier-panel > label { margin-top: 0; }
.tier-rates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.history-panel { overflow-x: auto; }
.history-panel table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.history-panel caption { text-align: left; font-weight: 700; margin-bottom: 8px; }
.history-panel th, .history-panel td { text-align: left; padding: 6px; border-bottom: 1px solid #e0e8eb; }
.item-pricing-message:empty { display: none; }
@media (max-width: 480px) { .tier-rates { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) {
  .history-panel table { table-layout: fixed; font-size: .75rem; }
  .history-panel th, .history-panel td { padding: 5px 3px; overflow-wrap: anywhere; }
}

.document-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: flex-start; }
.action-dropdown { position: relative; }
.action-dropdown > summary { cursor: pointer; border: 1px solid #aebecb; border-radius: 8px; padding: 9px 14px; background: var(--surface); font-weight: 650; }
.action-dropdown-options { display: grid; gap: 2px; min-width: min(216px, 75vw); margin-top: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.action-dropdown-options button { border: 0; text-align: left; padding: 9px; }
.action-dropdown-options button:hover { background: #edf5f2; filter: none; }
#dashboard-create-options { position: absolute; z-index: 2; inset-inline-end: 0; box-shadow: 0 8px 24px #12382c22; }
@media (max-width: 560px) { #dashboard-create-options { inset-inline: 0 auto; } }
#document-list li > div:first-child { min-width: 0; }
#item-import { margin-top: 18px; }
#item-import summary { cursor: pointer; font-weight: 700; }
#item-import p, #item-import button { margin-top: 8px; }
@media (max-width: 760px) {
  #document-list li { align-items: flex-start; flex-direction: column; }
  .document-actions { justify-content: flex-start; }
}

#profile-form #document-branding { margin-top: 24px; padding: 14px; border: 1px solid #e0e8eb; border-radius: 8px; }
#document-branding legend { font-weight: 700; padding: 0 5px; }
#company-logo-preview { display: block; max-width: min(100%, 180px); max-height: 100px; object-fit: contain; margin-top: 12px; }
#document-branding .logo-hint { font-size: .85rem; color: #48606a; margin: 5px 0; }
#company-logo-remove { margin-top: 8px; }
.footer-logo-settings { border-top: 1px solid #e0e8eb; margin-top: 16px; }
.invoice-layout-settings { border-top: 1px solid #e0e8eb; margin-top: 16px; padding-top: 12px; }
.invoice-layout-settings h3 { margin: 0 0 4px; }
.invoice-page-guide {
  --header-line: calc(18% + var(--headerHeight, 0%));
  --footer-line: calc(62% + var(--footerGap, 0%));
  position: relative; height: 250px; max-width: 340px; margin: 12px 0;
  border: 1px solid #bacdca; border-radius: 8px; background: #f6faf9; color: #405562;
  font-size: .82rem;
}
.invoice-page-guide > span { position: absolute; inset-inline-start: 12px; }
.invoice-guide-heading { top: 8px; font-weight: 700; }
.invoice-guide-body { top: calc(var(--header-line) + 23px); }
.invoice-guide-footer { top: calc(var(--footer-line) + 23px); }
.invoice-cutoff {
  position: absolute; inset-inline: 0; height: 44px; transform: translateY(-50%);
  display: flex; justify-content: flex-end; align-items: center;
  cursor: ns-resize; touch-action: none; user-select: none;
}
.invoice-cutoff::before { content: ""; position: absolute; inset-inline: 0; border-top: 2px dashed #08786e; }
.header-cutoff { top: var(--header-line); }
.footer-cutoff { top: var(--footer-line); }
.invoice-cutoff span { z-index: 1; margin-inline-end: 8px; padding: 3px 8px; border-radius: 4px; background: #08655d; color: #fff; }
.invoice-layout-controls { max-width: 340px; }
.invoice-layout-controls label { display: flex; justify-content: space-between; gap: 8px; }
.invoice-layout-controls input[type="range"] { width: 100%; min-height: 36px; padding: 0; margin: 0 0 8px; accent-color: #08655d; }
#document-branding:disabled .invoice-cutoff { cursor: default; pointer-events: none; }
#footer-logo-list { display: flex; flex-wrap: wrap; gap: 10px; }
#footer-logo-list > div { display: grid; justify-items: center; gap: 6px; padding: 8px; border: 1px solid #e0e8eb; border-radius: 8px; }
#footer-logo-list img { width: 76px; height: 40px; object-fit: contain; }
#footer-logo-status:empty { display: none; }
#company-logo-box { display: flex; padding: 12px; margin-top: 12px; border: 1px dashed #c6d5d9; border-radius: 8px; }
#company-logo-box[data-position="right"] { justify-content: flex-end; }
#company-logo-box[data-position="center"] { justify-content: center; }
#company-logo-box #company-logo-preview { margin: 0; }
#purchase-order-editor { margin-block: 16px; }
#purchase-order-scan { margin-block: 12px 18px; padding: 12px 16px; background: #f4f7f6; border-radius: 8px; }
#purchase-order-scan label { margin-top: 0; }
#purchase-order-scan p { margin: 8px 0 0; color: #49606a; }
#po-scan-status:empty { display: none; }
#invoice-remarks:has(#payment-qr-controls:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
#payment-qr-preview, #invoice-footer-image-preview { display: block; width: 88px; height: 88px; object-fit: contain; margin-top: 8px; }
#payment-qr-remove, #invoice-footer-image-remove { margin-top: 8px; }
@media (max-width: 480px) {
  #invoice-remarks:has(#payment-qr-controls:not([hidden])) { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .bar img { width: 120px; }
  .account-bar { gap: 5px; }
  .account-bar button { padding: 7px; font-size: .8rem; }
}

#purchase-order-scan #document-scan-error { color: #963a22; font-weight: 600; }
#document-scan-error:empty { display: none; }

.invoice-search, .invoice-filters { display: grid; align-items: end; gap: 12px; }
.invoice-search { grid-template-columns: minmax(0, 1fr) auto; }
.invoice-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#invoice-library-status:empty, #invoice-library-error:empty { display: none; }
#invoice-library-error { color: #963a22; font-weight: 600; }
#document-list.invoice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); gap: 12px; padding: 16px; }
#document-list.invoice-grid li { flex-direction: column; align-items: flex-start; gap: 12px; border: 1px solid #d8e4e3; border-radius: 10px; }
#document-list.invoice-grid .document-actions { justify-content: flex-start; }
#invoice-batch-progress { overflow-wrap: anywhere; }
@media (max-width: 660px) {
  .invoice-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.site-footer { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 24px clamp(16px, 4vw, 64px); color: #49606a; font-size: .875rem; }
.site-footer a, .legal-content a, #billing-view a { color: #086860; }
.app-update { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 16px; padding: 8px 16px; background: #dcefe9; color: #163c37; }
#release-announcement p { margin: 4px 0 0; }
.legal-content { max-width: 780px; margin: 0 auto; padding: 36px 20px; }
.legal-content section { margin-top: 32px; scroll-margin-top: 16px; }
.legal-content h3 { margin-top: 20px; }
.legal-content p { margin-top: 8px; }
.legal-content ul { padding-inline-start: 1.4rem; list-style: disc; }
.legal-content li { display: list-item; padding: 6px 0; border: 0; }
.legal-content nav { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.legal-notice { padding: 12px 16px; background: #f5ede1; border-radius: 8px; }


.document-group { margin: 16px 0 0; border: 1px solid #d8e4e3; border-radius: 10px; padding: 10px 14px 14px; min-width: 0; }
.document-group legend { padding: 0 5px; font-weight: 700; }
.document-group #document-total { font-weight: 750; margin-top: 8px; }
.document-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid #d8e4e3; }
#document-editor .document-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding-bottom: 8px;
  background: var(--surface);
}
#invoice-original-options { padding: 10px 14px; margin: 10px 0; border-radius: 8px; background: #eaf5f2; overflow-wrap: anywhere; }
#invoice-storage-summary { margin-top: 0; }
#billing-storage-meter { width: min(100%, 360px); accent-color: #086860; }
#billing-regions, #einvoice-checklist { padding-inline-start: 1.25rem; }
#einvoice-error { color: #963a22; }
#einvoice-error:empty, #einvoice-checklist:empty { display: none; }
#einvoice-content .setup-card { margin-block-end: 16px; }
#einvoice-sandbox { margin-top: 12px; }
.billing-plan-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-block: 16px; }
.billing-plan-options > section { border: 1px solid #d8e4e3; border-radius: 10px; padding: 14px; }
.billing-plan-options > section h3 { margin: 0 0 6px; }
.billing-plan-options > section button { margin-top: 10px; }
#billing-references { margin-block: 16px; }
#billing-references h3 { margin: 0 0 8px; }
.billing-reference-list { display: grid; gap: 8px; margin: 0; }
.billing-reference-list > div { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.billing-reference-list dt { font-weight: 600; }
.billing-reference-list dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#billing-plan-price, #billing-lite-price, #billing-plus-price { color: #0b6057; font-weight: 750; }
#billing-base-note { margin: 0 0 4px; color: #4d6168; font-size: .85rem; }
.public-pricing { margin: 4px 0 12px; }
.public-pricing h2 { margin: 0 0 4px; font-size: 1rem; }
.public-pricing p, .public-pricing ul { margin: 4px 0; }
.public-pricing li { margin: 2px 0; }
#billing-view .setup-card + .setup-card { margin-top: 16px; }
#einvoice-checklist li { display: list-item; }
@media (max-width: 860px) {
  .billing-plan-options { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
  .billing-plan-options, #einvoice-form .row { grid-template-columns: minmax(0, 1fr); }
}

#transaction-fields section { padding: 12px 0; border-top: 1px solid #dce6e3; margin-top: 12px; }
#transaction-fields button { margin: 4px 6px 4px 0; }
.transaction-table { overflow-x: auto; }
.transaction-table table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.transaction-table th, .transaction-table td { text-align: left; padding: 8px; border-bottom: 1px solid #dce6e3; }
.transaction-installment { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.transaction-installment label { flex: 1 1 120px; margin: 0; }
#invoice-statement summary { cursor: pointer; font-weight: 700; }
#invoice-default-qr-preview { object-fit: contain; margin: 8px 0; }

.bank-summary { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0; }
.bank-summary dt { color: #4d6168; }
.bank-summary dd { margin: 0; font-variant-numeric: tabular-nums; }
.bank-lines td:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bank-lines .bank-out { color: #9b2c1f; }
.bank-lines tr.bank-matched td { color: #4d6168; }
.bank-lines td button { margin-inline-start: 8px; }
.bank-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bank-entry:not(:empty) { margin-top: 16px; padding: 12px; border: 1px solid #e0e8eb; border-radius: 10px; }
#bank-mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
#bank-mapping[hidden] { display: none; }
