:root {
  color-scheme: light;
  --ink: #142e3a;
  --muted: #607480;
  --navy: #102c39;
  --navy-2: #173e4e;
  --teal: #237e75;
  --teal-dark: #126359;
  --gold: #d4ad68;
  --line: #dbe4e6;
  --surface: #ffffff;
  --canvas: #f3f6f5;
  --error: #9e3a32;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #b18b45; 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; }
.eyebrow { margin: 0 0 11px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.subtle { color: var(--muted); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(27px, 3vw, 37px); letter-spacing: -.045em; line-height: 1.15; margin-bottom: 11px; }
h2 { font-size: 17px; letter-spacing: -.025em; line-height: 1.25; margin-bottom: 5px; }
h3 { font-size: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 13px; border: 1px solid transparent; border-radius: 8px; padding: 11px 16px; min-height: 42px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap; transition: background .15s, transform .15s, border-color .15s; }
.button:not(:disabled):hover { transform: translateY(-1px); }
.button-primary { background: var(--teal); color: white; box-shadow: 0 5px 14px rgba(29, 113, 103, .13); }
.button-primary:not(:disabled):hover { background: var(--teal-dark); }
.button-light { background: #f8faf9; border-color: var(--line); color: var(--ink); }
.button-light:not(:disabled):hover { background: #e9f1ef; border-color: #a9c5c0; }
.button-full { width: 100%; }
.text-button { border: 0; background: none; color: var(--ink); padding: 7px 0; font-weight: 700; }
.text-button:hover { color: var(--teal-dark); text-decoration: underline; }
.message { margin: 0 0 17px; padding: 12px 14px; border-radius: 8px; background: #e7f2ee; color: #1c6052; border: 1px solid #bcd9cc; font-size: 13px; }
.message.error { background: #fff0ed; border-color: #e8bdb6; color: var(--error); }
.message.warning { background: #fff7e9; border-color: #e8d7b0; color: #775a24; }

/* Access */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .95fr) minmax(450px, 1.05fr); background: var(--surface); }
.login-illustration { position: relative; overflow: hidden; min-height: 650px; padding: clamp(32px, 5vw, 72px); display: flex; flex-direction: column; align-items: flex-start; color: white; background: radial-gradient(circle at 84% 20%, rgba(53, 119, 119, .35), transparent 42%), linear-gradient(145deg, #102c39 2%, #173d4b 70%, #20575b); }
.login-illustration::after { content: ""; position: absolute; width: 590px; height: 590px; left: -230px; bottom: -245px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 64px rgba(255,255,255,.025), 0 0 0 128px rgba(255,255,255,.025), 0 0 0 192px rgba(255,255,255,.02); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 10px; color: white; font-size: 14px; font-weight: 500; letter-spacing: .14em; white-space: nowrap; }
.brand strong { font-weight: 800; }
.brand-mark { width: 31px; height: 31px; display: inline-grid; place-items: center; flex: none; border: 2px solid currentColor; border-radius: 50%; color: var(--gold); font-family: Georgia, serif; font-size: 19px; font-weight: 700; letter-spacing: -.1em; padding-right: 2px; }
.brand-large { font-size: 17px; }
.brand-large .brand-mark { width: 38px; height: 38px; font-size: 24px; }
.login-statement { z-index: 1; margin-top: auto; max-width: 620px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 4.3vw, 72px); line-height: 1.08; letter-spacing: -.04em; }
.login-caption { z-index: 1; margin-top: 25px; margin-bottom: 92px; color: #c8d8d8; font-size: 14px; letter-spacing: .01em; }
.login-decoration { position: relative; z-index: 1; display: flex; gap: 18px; align-items: center; width: 100%; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.22); color: #d0dcda; font-size: 10px; letter-spacing: .13em; }
.login-decoration span:last-child { margin-left: auto; }
.login-panel { display: grid; place-items: center; padding: 42px; }
.login-form-wrap { width: min(100%, 386px); }
.login-form-wrap h1 { margin-bottom: 13px; }
.login-form-wrap .subtle { margin-bottom: 31px; line-height: 1.65; }
.login-form-wrap label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.login-form-wrap .password-label { margin-top: 20px; }
.login-form-wrap input { width: 100%; height: 47px; border: 1px solid #bfcdd1; border-radius: 7px; padding: 10px 13px; color: var(--ink); background: #fff; }
.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.field-link { margin: 5px 0 0; padding: 2px 0; border: 0; background: none; color: var(--teal-dark); font-size: 11px; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.login-form-wrap .field-hint { margin-bottom: 26px; }
.login-footnote { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-mobile-brand { display: none; }

/* App frame */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0,1fr); }
.sidebar { min-height: 100vh; padding: 29px 18px 25px; display: flex; flex-direction: column; background: var(--navy); color: white; }
.sidebar .brand { margin: 4px 8px 42px; font-size: 12px; }
.sidebar-context { margin: 0 3px 34px; padding: 17px 15px; border: 1px solid #3b5c66; border-radius: 9px; background: rgba(255,255,255,.045); display: flex; flex-direction: column; overflow-wrap: anywhere; }
.sidebar-context .eyebrow { color: #a4c8c0; font-size: 9px; margin-bottom: 9px; }
.sidebar-context strong { font-size: 13px; line-height: 1.3; }
.sidebar-rnc { margin-top: 4px; color: #b5c8cb; font-size: 11px; }
.nav-caption { margin: 0 12px 11px; color: #94aeb4; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.nav-link { display: flex; gap: 12px; align-items: center; min-height: 43px; margin: 3px 0; padding: 8px 12px; border-radius: 7px; color: #cbdadc; text-decoration: none; font-size: 13px; font-weight: 600; }
.nav-link:hover, .nav-link[aria-current="page"] { color: white; background: #285362; }
.nav-link[aria-current="page"] { box-shadow: inset 3px 0 0 var(--gold); }
.nav-icon { width: 17px; text-align: center; font-size: 18px; line-height: 1; }
.sidebar-bottom { margin-top: auto; padding: 24px 9px 0; color: #9db9bd; font-size: 11px; line-height: 1.55; }
.sidebar-bottom p { margin: 13px 0 0; }
.series-pill { display: inline-block; padding: 6px 8px; border: 1px solid #55717b; border-radius: 4px; color: #d7e6e3; font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.workspace { min-width: 0; }
.topbar { height: 65px; padding: 0 clamp(22px, 3.5vw, 51px); display: flex; justify-content: space-between; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); background: white; }
.topbar-title { display: flex; gap: 11px; align-items: center; min-width: 0; white-space: nowrap; }
.topbar-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.topbar-separator { color: #a8b7bb; }
.topbar-title strong { font-size: 12px; }
.topbar-actions { display: flex; gap: 25px; align-items: center; white-space: nowrap; }
#current-user { max-width: 140px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }
.timezone-label { color: var(--muted); font-size: 11px; }
.view { max-width: 1380px; margin: auto; padding: 42px clamp(22px, 3.5vw, 51px) 75px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 30px; }
.page-header .subtle { margin: 0; font-size: 13px; }
.header-action { margin-bottom: 3px; }
.overview-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; margin-bottom: 23px; }
.overview-card { min-height: 131px; display: flex; flex-direction: column; align-items: flex-start; padding: 20px 21px; border: 1px solid var(--line); border-radius: 11px; background: white; overflow-wrap: anywhere; }
.overview-label { margin-bottom: 11px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .11em; }
.overview-card strong { font-size: 24px; line-height: 1.2; letter-spacing: -.04em; }
.overview-card:first-child strong { font-size: 17px; letter-spacing: -.025em; }
.overview-card small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.overview-accent { background: var(--navy-2); border-color: var(--navy-2); color: white; }
.overview-accent .overview-label, .overview-accent small { color: #bdd3d5; }
.content-card { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 2px 5px rgba(14, 48, 55, .025); }
.invoice-card { min-height: 270px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 25px; border-bottom: 1px solid var(--line); }
.card-heading p { color: var(--muted); margin: 0; font-size: 12px; }
.invoice-card > .message { margin: 17px 25px 0; }
.loading-state { padding: 48px 25px; text-align: center; color: var(--muted); }
.empty-state { padding: 40px 25px 45px; text-align: center; }
.empty-symbol { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 12px; border-radius: 50%; background: #eaf2ef; color: var(--teal); font-size: 23px; }
.empty-state h3 { margin-bottom: 4px; font-size: 15px; }
.empty-state p { color: var(--muted); font-size: 12px; }
.empty-state .button { margin-top: 9px; }
.table-scroll { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: #f8faf9; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
th, td { padding: 14px 22px; border-bottom: 1px solid #e8eeee; }
tr:last-child td { border-bottom: 0; }
td { font-size: 12px; vertical-align: middle; }
td strong, td small { display: block; }
td small { margin-top: 2px; color: var(--muted); }
.align-right { text-align: right; }
.status { display: inline-block; padding: 4px 8px; border-radius: 5px; background: #eef3f2; color: #47646a; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status.ready { color: #1d6a57; background: #e5f3e9; }
.status.failed { color: #9e3a32; background: #fff0ed; }
.ecf-status { display: table; margin-top: 5px; }
.ecf-meta { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.table-action { border: 0; background: none; color: var(--teal-dark); font-size: 12px; font-weight: 800; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.table-action:hover { color: var(--navy); }

/* Draft and preview */
.flow-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; align-items: start; gap: 21px; }
#invoice-form { min-width: 0; }
.form-section { padding: 25px; margin-bottom: 17px; }
.section-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 25px; }
.section-heading h2 { margin: 0 0 3px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.step-number { width: 27px; height: 27px; flex: none; display: grid; place-items: center; border-radius: 6px; background: #e3f0ec; color: var(--teal-dark); font-size: 11px; font-weight: 800; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 19px; }
.field-full { grid-column: 1 / -1; }
.field label, .item-field label { display: block; margin-bottom: 7px; color: #24424a; font-size: 12px; font-weight: 700; }
.field input, .field select, .item-field input, .item-field select { width: 100%; height: 42px; border: 1px solid #c8d5d6; border-radius: 7px; padding: 9px 11px; background: white; color: var(--ink); font-size: 13px; }
.field input::placeholder, .item-field input::placeholder { color: #9aabad; }
.field input:focus, .field select:focus, .item-field input:focus, .item-field select:focus { border-color: var(--teal); outline: 2px solid rgba(35,126,117,.16); }
.field input:disabled { background: #f1f4f4; color: #8b9d9e; }
.items-container { display: grid; gap: 12px; }
.item-row { border: 1px solid #dce6e5; border-radius: 9px; padding: 16px; background: #fbfcfc; }
.item-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.item-topline strong { font-size: 12px; }
.item-remove { border: 0; background: none; color: var(--error); font-size: 11px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.item-grid { display: grid; grid-template-columns: minmax(0,2fr) repeat(4,minmax(84px,1fr)); gap: 10px; }
.item-field label { font-size: 10px; white-space: nowrap; }
.item-field input, .item-field select { height: 38px; padding: 8px 9px; font-size: 12px; }
.add-item { margin-top: 16px; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 5px 0 0; }
.form-actions p { margin: 0; color: var(--muted); font-size: 11px; }
.preview-column { position: sticky; top: 20px; }
.preview-card { padding: 23px; }
.preview-card .eyebrow { margin-bottom: 7px; }
.preview-card h2 { font-size: 20px; margin-bottom: 23px; }
.preview-placeholder { padding: 18px; border: 1px dashed #c9d9d7; border-radius: 7px; background: #f8fbfa; color: var(--muted); font-size: 12px; line-height: 1.6; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; color: var(--muted); font-size: 12px; }
.summary-row strong { color: var(--ink); font-weight: 700; }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 800; }
.summary-total strong { font-size: 23px; letter-spacing: -.045em; }
.preview-lines { padding: 18px 0 2px; border-bottom: 1px solid var(--line); }
.preview-lines h3 { margin: 0 0 9px; }
.preview-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; color: var(--muted); font-size: 11px; }
.preview-line span { overflow-wrap: anywhere; }
.preview-line strong { flex: none; color: var(--ink); }
.fiscal-review { padding: 18px 0 0; }
.fiscal-review h3 { margin: 0 0 10px; }
.fiscal-review p { margin: 0 0 6px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.preview-warning { margin: 17px 0; padding: 12px; border-radius: 6px; background: #fff8e9; color: #715626; font-size: 11px; line-height: 1.5; }
#draft-message { margin-top: 15px; }
.issued-card { margin-top: 16px; padding: 23px; border-color: #a6d2bd; }
.issued-kicker { display: block; color: var(--teal-dark); font-size: 10px; font-weight: 800; letter-spacing: .13em; margin-bottom: 7px; }
.issued-card h2 { margin-bottom: 15px; }
.issued-card dl { margin: 0; }
.issued-card dl div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #ebefed; font-size: 12px; }
.issued-card dt { color: var(--muted); }
.issued-card dd { margin: 0; font-weight: 800; text-align: right; overflow-wrap: anywhere; }
.issued-card p { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.issued-actions { display: flex; gap: 8px; margin-top: 17px; flex-wrap: wrap; }
.issued-actions .button { flex: 1 1 auto; }

/* Company configuration */
.settings-company-bar { display: flex; gap: 20px; padding: 24px; align-items: end; margin-bottom: 20px; }
.settings-company-bar > div:first-child { flex: 1; }
.settings-company-bar .field { flex: 2; min-width: 0; }
.settings-company-bar .subtle { font-size: 12px; margin: 0; }
.settings-details { margin-bottom: 22px; }
.settings-details summary { cursor: pointer; padding: 20px 24px; font-size: 14px; font-weight: 700; color: var(--teal-dark); }
.settings-details summary:focus-visible { outline: 2px solid var(--teal); outline-offset: -4px; }
.settings-form { padding: 24px; }
.settings-form .subtle { font-size: 13px; }
.settings-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.settings-fieldset:disabled { opacity: .75; }
.settings-form .button { margin-top: 16px; }
.settings-grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(240px,1fr); gap: 22px; margin-bottom: 24px; }
.settings-aside { display: flex; flex-direction: column; gap: 20px; }
.settings-divider { border-top: 1px solid var(--line); margin: 24px 0; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.5; margin: 18px 0; }
.checkbox-row input { flex: 0 0 auto; margin-top: 3px; width: 16px; height: 16px; accent-color: var(--teal); }
.settings-facts { margin: 24px 0 12px; font-size: 12px; }
.settings-facts div { border-top: 1px solid var(--line); padding: 12px 0; }
.settings-facts dt { color: var(--muted); margin-bottom: 5px; }
.settings-facts dd { margin: 0; overflow-wrap: anywhere; }
.settings-events { padding-left: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-events li { margin: 12px 0; }
.settings-ranges { margin-top: 22px; }
.settings-ranges td { font-size: 12px; }
.settings-ranges .settings-details { margin: 0; border-top: 1px solid var(--line); }
.settings-ranges .button { white-space: nowrap; }

@media (max-width: 1150px) {
  .flow-layout { grid-template-columns: minmax(0,1fr) 280px; }
  .item-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .item-field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: 0; padding: 16px 22px; display: flex; flex-direction: row; align-items: center; gap: 18px; }
  .sidebar .brand { margin: 0 auto 0 0; }
  .sidebar-context, .nav-caption, .sidebar-bottom { display: none; }
  .sidebar nav { display: flex; gap: 4px; }
  .nav-link { margin: 0; padding: 8px 10px; white-space: nowrap; }
  .flow-layout { grid-template-columns: minmax(0,1fr); }
  .preview-column { position: static; }
  .preview-card { max-width: none; }
  .settings-grid { grid-template-columns: minmax(0,1fr); }
  .settings-company-bar { flex-wrap: wrap; }
}
@media (max-width: 680px) {
  .login-screen { display: block; min-height: 100vh; }
  .login-illustration { display: none; }
  .login-panel { min-height: 100vh; padding: 28px 23px; display: flex; flex-direction: column; align-items: stretch; justify-content: center; }
  .login-mobile-brand { display: flex; position: absolute; top: 28px; left: 23px; color: var(--navy); }
  .login-form-wrap { width: 100%; }
  .sidebar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .sidebar .brand { width: 100%; font-size: 11px; }
  .sidebar nav { width: 100%; flex-wrap: wrap; }
  .nav-link { flex: 1; justify-content: center; font-size: 12px; }
  .topbar { height: auto; min-height: 55px; padding: 10px 18px; }
  .topbar-label, .topbar-separator, .timezone-label { display: none; }
  .topbar-actions { gap: 12px; min-width: 0; }
  #current-user { max-width: 70px; }
  .topbar-actions .text-button { flex-shrink: 0; }
  .view { padding: 28px 17px 50px; }
  .page-header { align-items: flex-start; }
  .page-header h1 { font-size: 29px; }
  .header-action { display: none; }
  .overview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .overview-card { min-height: 112px; padding: 14px; }
  .overview-card:first-child { grid-column: 1 / -1; min-height: 94px; }
  .overview-card strong { font-size: 21px; }
  .card-heading { padding: 18px; }
  th, td { padding: 12px 14px; }
  .form-section { padding: 18px; }
  .field-grid { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .field-full { grid-column: auto; }
  .settings-company-bar { display: block; padding: 18px; }
  .settings-company-bar .field { margin: 16px 0; }
  .settings-company-bar .button { width: 100%; }
  .settings-form { padding: 18px; }
  .item-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .item-field:first-child { grid-column: 1 / -1; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions p { order: 2; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .button { transition: none; } }

/* Customer directory, commercial records and invoice selection */
.crm-role { margin-bottom: 16px; }
.crm-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.crm-tabs [aria-pressed="true"] { color: var(--teal-dark); background: #e5f1ec; border-color: #9bbeb3; }
.crm-toolbar { display: flex; flex-wrap: wrap; gap: 13px; align-items: end; padding: 22px 24px; }
.crm-toolbar .field { flex: 1 1 150px; min-width: 0; }
.crm-toolbar .crm-search { flex: 3 1 230px; }
.crm-pagination { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; padding: 16px 24px; border-top: 1px solid var(--line); }
.crm-pagination p { margin: 0 auto 0 0; }
.crm-detail-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 20px; }
.crm-actions, .crm-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.crm-form-actions { margin-top: 20px; }
.crm-form-actions .button { margin-top: 0; }
.crm-profile { padding: 25px; margin-bottom: 22px; }
.crm-profile h2 { font-size: 25px; overflow-wrap: anywhere; }
.crm-profile > .subtle { margin-top: 8px; overflow-wrap: anywhere; }
.crm-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px 22px; padding: 18px 0; margin: 0 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.crm-facts dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.crm-facts dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; white-space: pre-line; }
.crm-contact { padding: 14px 0; border-top: 1px solid var(--line); }
.crm-contact strong { font-size: 13px; }
.crm-contact p { margin: 5px 0 0; font-size: 12px; overflow-wrap: anywhere; white-space: pre-line; }
.crm-offerings, .crm-history, .crm-stat-table { margin-bottom: 22px; overflow: hidden; }
.crm-offerings td:first-child, .crm-stat-table td:first-child { min-width: 180px; overflow-wrap: anywhere; }
.crm-offerings .card-heading, .crm-stat-table .card-heading { flex-wrap: wrap; }
.crm-events { margin: 0; padding: 0 28px 20px 40px; }
.crm-contacts-editor { display: grid; gap: 16px; margin-top: 18px; }
.crm-contact-editor { border: 1px solid var(--line); border-radius: 8px; padding: 20px; background: #fbfcfc; }
.crm-contact-editor .checkbox-row { margin-bottom: 0; }
.field textarea { display: block; width: 100%; min-height: 85px; resize: vertical; border: 1px solid #c8d5d6; border-radius: 7px; padding: 10px 12px; background: white; color: var(--ink); font-size: 13px; }
.field textarea:focus { border-color: var(--teal); outline: 2px solid rgba(35,126,117,.16); }
.field input:disabled, .field select:disabled, .field textarea:disabled { color: #536b73; background: #f1f4f4; }
#crm-form-message, #crm-offering-message { margin-top: 18px; }
#crm-dgii-message { margin-top: 12px; }
.crm-statistics-filter { padding: 22px 24px 0; margin-bottom: 20px; }
.crm-statistics-filter > .subtle { font-size: 12px; }
.crm-statistics-filter .crm-toolbar { padding-left: 0; padding-right: 0; }
.crm-period { margin: 18px 0; }
.crm-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.crm-metrics .overview-card { min-height: 125px; }
.crm-metrics .overview-card strong { font-size: clamp(18px, 1.8vw, 24px); }
.crm-metrics .overview-card:first-child { background: var(--navy-2); color: white; }
.crm-metrics .overview-card:first-child .overview-label, .crm-metrics .overview-card:first-child small { color: #c4d8d6; }
.crm-stat-table .card-heading h3 { margin: 0; }
.crm-stat-table .card-heading small { font-size: 11px; }
.customer-picker { padding: 17px; background: #f4f8f6; border: 1px solid #d5e5de; border-radius: 8px; }
.customer-picker .message { margin: 12px 0 0; }
.crm-inline-search { display: flex; align-items: center; gap: 9px; }
.crm-inline-search input, .crm-inline-search select { flex: 1 1 auto; min-width: 0; }
.crm-inline-search button { flex-shrink: 0; }
.crm-picker-results { display: grid; margin-top: 12px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; max-height: 300px; overflow-y: auto; }
.crm-picker-result { border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; background: white; color: var(--ink); text-align: left; font-size: 12px; overflow-wrap: anywhere; }
.crm-picker-result:last-child { border-bottom: 0; }
.crm-picker-result:not(:disabled):hover { background: #e4f0e9; }
.crm-picker-result:disabled { color: var(--muted); cursor: not-allowed; }
.crm-selection { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #ccdfd5; }
.crm-selection strong { font-size: 12px; overflow-wrap: anywhere; }
.crm-selection button { font-size: 12px; }
.customer-offerings-picker { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.item-offering-reference { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 12px; }
@media (max-width: 1050px) {
  .crm-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .crm-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  #customers-view .page-header { flex-wrap: wrap; }
  #customers-view .card-heading { align-items: start; }
  .crm-toolbar { padding: 18px; }
  .crm-toolbar > .button { flex: 1 1 auto; }
  .crm-pagination { padding: 14px 18px; }
  .crm-pagination p { flex-basis: 100%; margin-bottom: 5px; }
  .crm-profile, .crm-contact-editor { padding: 18px; }
  .crm-facts { grid-template-columns: minmax(0,1fr); }
  .crm-metrics { gap: 9px; }
  .crm-metrics .overview-card:first-child { grid-column: auto; }
  .crm-metrics .overview-card strong { font-size: 17px; }
  .crm-inline-search { flex-wrap: wrap; }
  .crm-inline-search > button { width: 100%; }
  .crm-form-actions > .button { flex: 1 1 auto; }
  .crm-statistics-filter { padding: 18px 18px 0; }
  .crm-statistics-filter .crm-toolbar .field { flex-basis: 100%; }
}

.crm-dgii-lookup { padding: 18px; margin-bottom: 24px; border: 1px solid #c7ded5; border-radius: 9px; background: #f3f9f6; }
.crm-dgii-lookup h3 { margin-bottom: 10px; }
.crm-dgii-lookup .button { margin-top: 0; }
#crm-dgii-profile:not(:empty), #crm-detail-dgii:not(:empty) { margin: 20px 0; padding: 18px; background: #f8faf9; border: 1px solid var(--line); border-radius: 8px; }
#crm-dgii-profile a, #crm-detail-dgii a { color: var(--teal-dark); font-size: 12px; }
.crm-dgii-lookup input { width: 100%; min-height: 43px; border: 1px solid #c8d5d6; border-radius: 7px; padding: 10px 12px; background: white; color: var(--ink); font: inherit; font-size: 13px; }
.crm-dgii-lookup input:focus { border-color: var(--teal); outline: 2px solid rgba(35,126,117,.16); }
.crm-dgcp{padding:20px;background:#f1f6f5;border:1px solid #dae4e4;border-radius:12px;margin:16px 0}.crm-dgcp .checkbox-row{align-items:flex-start;padding:8px 0}.crm-dgcp .button-primary{margin-top:14px}

#bank-accounts-body td, #preview-bank-account { white-space: pre-line; overflow-wrap: anywhere; }
.bank-picker { position: relative; }
.bank-picker input { display: block; }
.bank-suggestions { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; max-height: 270px; overflow-y: auto; background: #fff; border: 1px solid #c6d9d7; border-radius: 10px; box-shadow: 0 12px 28px #102c3926; padding: 5px; }
.bank-suggestions[hidden] { display: none; }
.bank-suggestions [role="option"] { display: block; width: 100%; border: 0; border-radius: 6px; background: #fff; color: #152d36; padding: 10px 12px; text-align: left; font: inherit; cursor: pointer; }
.bank-suggestions [role="option"]:hover, .bank-suggestions [role="option"][aria-selected="true"] { background: #e8f3f1; color: #185953; }
.bank-suggestions [role="option"] small { display: block; font-size: 11px; color: #607078; margin-top: 3px; }
.bank-suggestions p { padding: 9px 12px; font-size: 12px; color: #607078; }

/* Administrative confirmation stays readable and keyboard accessible. */
#invoice-delete-dialog { width: min(580px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; border: 1px solid #d7e3e7; border-radius: 16px; padding: 28px; color: #14313e; box-shadow: 0 24px 80px #102c3a33; }
#invoice-delete-dialog::backdrop { background: #102c3a99; }
#invoice-delete-dialog h2 { margin: 8px 0 16px; }
#invoice-delete-dialog .field { margin: 18px 0; }
#invoice-delete-dialog .checkbox-row { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; }
#invoice-delete-dialog .checkbox-row input { width: auto; margin-top: 4px; }
#invoice-delete-dialog .dialog-footer { display: flex; justify-content: flex-end; margin-top: 20px; }
.button-danger { background: #a92f32; color: white; border-color: #a92f32; }
.table-action-danger { color: #a92f32; margin-left: 12px; }
.payment-controls { margin: 1rem 0; padding: 1rem; border: 1px solid #d4e3e6; border-radius: 12px; background: #f6faf9; }
.payment-controls .checkbox-row { align-items: flex-start; }
.payment-controls fieldset { margin-top: 1rem; min-width: 0; }
.invoice-payment-status { font-weight: 700; color: #1e7066; }
#acc-settlement-summary .table-action { white-space: nowrap; }
#aut-payment-status { padding: 1rem; margin-bottom: 1rem; border: 1px solid #d4e3e6; border-radius: 12px; }
