/* Infinite Science: official brand palette, regular typography and original logo assets. */
:root {
  --navy: #005681;
  --blue: #007cbb;
  --cyan: #00a6e2;
  --ink: #30383d;
  --muted: #6e7477;
  --line: #d8e5eb;
  --surface: #f6f6f4;
  --white: #fff;
  --red: #a03b3b;
  --radius: 8px;
  --masthead-height: 110px;
  --sidebar-width: 230px;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.55;
  background: var(--surface);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
a { color: var(--blue); }
a:hover { color: var(--navy); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #00a6e266; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--navy); font-weight: 400; }
h1 { font-size: 32px; line-height: 1.2; letter-spacing: -.5px; }
h2 { font-size: 18px; line-height: 1.35; }
h3 { font-size: 16px; }
strong, b { font-weight: 500; }

/* Centered, unmodified corporate wordmark. */
.brand-masthead { height: var(--masthead-height); display: flex; align-items: center; justify-content: center; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand-masthead a { display: block; line-height: 0; }
.brand-masthead img { display: block; width: 216px; max-width: calc(100vw - 48px); height: auto; }
.app-shell { display: flex; min-height: calc(100vh - var(--masthead-height)); }
.sidebar { width: var(--sidebar-width); position: fixed; inset: var(--masthead-height) auto 0 0; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 29px 18px 23px; z-index: 10; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--navy); font-size: 18px; font-weight: 400; text-decoration: none; }
.brand-mark { display: block; width: 43px; height: auto; flex-shrink: 0; object-fit: contain; }
.brand small { display: block; font-size: 10px; color: var(--muted); margin-top: 1px; font-weight: 400; overflow-wrap: anywhere; }
.nav-caption { color: var(--muted); font-size: 10px; letter-spacing: .9px; margin: 36px 12px 13px; }
.sidebar nav { display: flex; flex-direction: column; gap: 5px; }
.nav-button { display: flex; align-items: center; gap: 10px; width: 100%; color: #546875; font-weight: 400; border: 1px solid transparent; background: transparent; padding: 12px 11px; border-radius: 6px; text-align: left; font-size: 13px; }
.nav-button > span:first-child { font-size: 19px; line-height: 1; width: 20px; text-align: center; font-weight: 400; }
.nav-button:hover { background: #f3f8fb; color: var(--navy); }
.nav-button.active { background: #edf7fc; color: var(--navy); border-color: #dceef7; }
.nav-count { margin-left: auto; min-width: 22px; padding: 3px 5px; border-radius: 4px; text-align: center; font-size: 10px; line-height: 1.2; background: #dceef7; }
.sidebar-note { margin: auto 11px 0; padding-top: 40px; color: #546875; font-size: 11px; }
.sidebar-note small { display: block; color: var(--muted); font-size: 10px; line-height: 1.7; margin-top: 7px; }
.sidebar-note > a { display: inline-block; margin-top: 12px; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #548973; vertical-align: middle; margin-right: 7px; }
.version { display: block; font-size: 10px; color: var(--muted); margin-top: 19px; }
.mobile-logout { display: none; }
.sidebar + main { width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); min-width: 0; }
.topbar { height: 55px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: #fff; }
.breadcrumb { font-size: 10px; letter-spacing: .8px; color: var(--muted); }
.breadcrumb > span { margin: 0 12px; color: #a2b4bf; }
.breadcrumb strong { font-weight: 400; letter-spacing: 0; color: var(--navy); font-size: 12px; }
.topbar-right { font-size: 11px; color: var(--muted); }
.panel { padding: 31px 34px 0; max-width: 1536px; margin: auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 25px; }
.eyebrow { font-size: 10px; letter-spacing: 1.1px; color: var(--muted); font-weight: 400; margin-bottom: 8px; }
.page-intro { color: var(--muted); font-size: 13px; margin-top: 9px; }

/* Forms and reusable controls. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 5px; font-size: 13px; font-weight: 400; line-height: 1.35; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.button-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.button-primary:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.button-secondary { background: #fff; border-color: #c5dce7; color: var(--navy); }
.button-secondary:hover { background: #f0f8fc; border-color: #8dbed5; }
.button-quiet { background: transparent; color: #526a77; }
.button-quiet:hover { background: #edf4f7; }
.button-danger { background: var(--red); color: #fff; }
.button-danger:hover { background: #862e2e; }
.button-small { min-height: 35px; padding: 7px 11px; font-size: 12px; }
.text-button { border: 0; background: none; color: var(--blue); font-size: 12px; font-weight: 400; text-decoration: none; padding: 4px 0; cursor: pointer; }
.text-button:hover { text-decoration: underline; color: var(--navy); }
.action-buttons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card-heading { min-height: 65px; padding: 19px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.card-heading h2 { display: flex; align-items: center; gap: 11px; }
.section-number { display: inline-grid; place-items: center; min-width: 24px; height: 24px; background: #f0f7fa; border-radius: 4px; color: var(--blue); font-size: 10px; font-weight: 400; }
.micro-label { color: var(--muted); font-size: 10px; }
.card-body { padding: 22px; }
.card-body > p { font-size: 13px; color: #546875; margin-bottom: 14px; line-height: 1.7; }
.card-body > p:last-child { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 17px; color: #465d69; font-size: 12px; font-weight: 400; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field input, .field select, .field textarea, .inline-field select { width: 100%; min-width: 0; min-height: 42px; border: 1px solid #cbdce5; border-radius: 5px; background: #fff; color: var(--ink); padding: 10px 11px; font-size: 13px; font-weight: 400; outline: none; transition: border .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus, .inline-field select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #00a6e217; }
.field input::placeholder, .field textarea::placeholder { color: #788b95; opacity: 1; font-weight: 400; }
.field textarea { resize: vertical; line-height: 1.55; }
.field input:disabled, .field select:disabled { background: #f3f6f7; color: var(--muted); }
.field input[type=file] { padding: 8px; font-size: 12px; }
.field input::file-selector-button { padding: 6px 10px; border: 0; border-radius: 3px; background: #eaf5fa; color: var(--navy); font: inherit; font-size: 11px; margin-right: 9px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.field-grid .field:last-child { margin-bottom: 17px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.postcode-grid { grid-template-columns: 115px minmax(0, 1fr); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-bottom: 22px; }
.helper { font-size: 11px !important; color: var(--muted) !important; line-height: 1.65 !important; margin-top: 8px; }
.inline-field { display: flex; gap: 10px; align-items: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.inline-field select { width: auto; min-height: 35px; padding: 7px 9px; font-size: 12px; }
.notice { border: 1px solid; padding: 14px 17px; display: flex; align-items: center; gap: 12px; font-size: 12px; border-radius: 6px; margin-bottom: 23px; line-height: 1.6; }
.notice strong { font-weight: 500; white-space: nowrap; }
.notice .text-button { margin-left: auto; white-space: nowrap; }
.notice-info { border-color: #d5e7f0; background: #edf7fc; color: #446b80; }
.notice-error { border-color: #e8c4c4; background: #fff2f2; color: var(--red); margin: 18px 34px; }
.profile-bar { display: flex; align-items: center; padding: 19px 22px; gap: 24px; margin-bottom: 22px; }
.profile-bar .profile-field { flex: 1; max-width: 350px; min-width: 160px; margin: 0; }
.language-field { width: 175px; margin: 0 !important; }
.profile-number { margin-left: auto; padding-left: 23px; border-left: 1px solid var(--line); }
.profile-number > span { display: block; font-size: 10px; letter-spacing: .6px; color: var(--muted); }
.profile-number strong { display: block; font-size: 17px; font-weight: 400; color: var(--navy); margin: 3px 0; }
.profile-number small { display: block; font-size: 10px; color: var(--muted); }
.customer-select-row { display: flex; align-items: end; gap: 12px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.customer-select-row .field { flex: 1; margin-bottom: 0; }
.customer-select-row .text-button { margin-bottom: 10px; white-space: nowrap; }
.recipient-salutations { margin: 13px 0 0; }
.recipient-salutations summary { font-size: 11px; color: #536f80; cursor: pointer; }
.recipient-salutations .field-grid { margin-top: 12px; }

/* Each position keeps its quantity, unit and price together. */
.items-card { margin-bottom: 22px; }
.items-header, .line-item { display: grid; grid-template-columns: minmax(180px, 1fr) 64px 111px 106px 65px 102px 28px; gap: 11px; padding-left: 22px; padding-right: 22px; }
.items-header { background: #f8fafb; font-size: 9px; letter-spacing: .35px; color: #596f7b; padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); align-items: center; }
.items-header > span:nth-child(6) { text-align: right; }
.line-item { padding-top: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); align-items: start; }
.line-item .field { margin: 0; }
.line-item .field input, .line-item .field textarea, .line-item .field select { min-height: 40px; padding: 9px 8px; font-size: 12px; }
.line-item .line-label { display: none; }
.line-item textarea { min-height: 40px; resize: vertical; line-height: 1.55; }
.line-item .line-amount { text-align: right; padding-top: 10px; font-size: 13px; color: var(--navy); font-variant-numeric: tabular-nums; }
.line-item .remove-line { display: grid; place-items: center; color: #728893; border: 0; border-radius: 4px; background: none; font-size: 22px; padding: 4px 0; width: 28px; height: 38px; line-height: 1; }
.line-item .remove-line:hover { color: var(--red); background: #fff1f1; }
.line-extra { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; margin-top: 3px; }
.line-extra .field { gap: 5px; }
.line-extra .field > span { font-size: 11px; color: var(--muted); }
.line-extra input, .line-extra textarea { background: #fcfdfd; min-height: 36px !important; padding: 7px 9px !important; }
.tax-note-field { grid-column: 1 / -1; max-width: 100%; }
.tax-note-field input { background: #fffdf8; border-color: #e1d3b6; }
.items-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 22px; }
.subtle { font-size: 11px; color: var(--muted); }
.totals-area { background: #f8fafb; border-top: 1px solid var(--line); padding: 22px; display: flex; justify-content: space-between; gap: 24px; border-radius: 0 0 var(--radius) var(--radius); }
.calculation-note { font-size: 11px; color: var(--muted); max-width: 46%; align-self: center; }
.calculation-note.error { color: var(--red); }
.totals { min-width: 305px; font-size: 13px; color: #546875; }
.totals > div:not(#tax-breakdown), #tax-breakdown > div { display: flex; justify-content: space-between; gap: 22px; padding: 5px 0; }
.totals strong { font-weight: 400; font-variant-numeric: tabular-nums; color: var(--navy); }
.totals .total-final { border-top: 1px solid #c9dce6; margin-top: 10px; padding-top: 14px !important; font-size: 14px; color: var(--navy); align-items: center; }
.total-final strong { font-size: 25px; letter-spacing: -.3px; line-height: 1.2; }
.email-option { padding: 18px 22px; margin-bottom: 17px; }
.email-option .check-field { margin: 0; }
.email-option .check-field strong { color: var(--navy); font-size: 13px; font-weight: 400; }
.email-option .check-field small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.email-option > .helper { margin-left: 26px; }
.warning-text { color: #876029 !important; }
.check-field { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: #536c7c; line-height: 1.7; margin: 13px 0; }
.check-field input { accent-color: var(--blue); margin: 4px 0 0; width: 16px; height: 16px; flex: 0 0 16px; }
.action-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 19px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.action-bar > div > strong { font-size: 12px; font-weight: 400; color: #4e6978; }
.action-bar > div > small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.drafts-card { margin-bottom: 25px; }
.drafts-card .card-heading { min-height: 55px; padding-top: 15px; padding-bottom: 15px; }
.drafts-card h2 { font-size: 16px; }
.draft-row { display: flex; align-items: center; gap: 20px; padding: 15px 22px; border-top: 1px solid var(--line); }
.draft-row:first-child { border-top: none; }
.draft-row > div { min-width: 0; flex: 1; }
.draft-row strong { display: block; font-size: 13px; font-weight: 400; overflow-wrap: anywhere; }
.draft-row small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.draft-empty { padding: 21px 22px; color: var(--muted); font-size: 12px; }

/* Overview, customers, settings and backup. */
.badge { display: inline-block; border-radius: 4px; padding: 4px 7px; font-size: 10px; line-height: 1.4; font-weight: 400; white-space: nowrap; }
.badge-neutral { background: #eff3f5; color: #586f7b; }
.badge-test { background: #eef6fc; color: #477b99; }
.badge-open { background: #fff4df; color: #825d26; }
.badge-paid { background: #eaf5ee; color: #3d755b; }
.badge-cancelled { background: #f1eff4; color: #70657e; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0 0 23px; }
.stat-card { background: #fff; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); }
.stat-card > span { display: block; font-size: 10px; color: var(--muted); letter-spacing: .8px; }
.stat-card > strong { display: block; font-size: 29px; font-weight: 400; letter-spacing: -.5px; margin: 9px 0 4px; color: var(--navy); }
.stat-card > small { color: var(--muted); font-size: 11px; }
.table-toolbar { display: flex; flex-wrap: wrap; gap: 13px; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.table-toolbar .field { margin: 0; }
.search-field { flex: 1; min-width: 190px; }
.table-toolbar .field input, .table-toolbar .field select { font-size: 12px; min-height: 38px; padding: 8px 10px; }
.table-scroll { overflow: auto; contain: layout; }
.invoice-table { width: 100%; border-collapse: collapse; text-align: left; }
.invoice-table th { font-size: 10px; letter-spacing: .5px; color: #596f7b; font-weight: 400; padding: 14px 17px; background: #f8fafb; border-bottom: 1px solid var(--line); white-space: nowrap; }
.invoice-table th:first-child, .invoice-table td:first-child { padding-left: 22px; }
.invoice-table th:last-child, .invoice-table td:last-child { padding-right: 22px; }
.invoice-table td { padding: 17px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; line-height: 1.6; }
.invoice-table tr:last-child td { border-bottom: 0; }
.invoice-table td strong { font-weight: 400; font-size: 12px; }
.invoice-table .number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.invoice-table .invoice-name { color: var(--navy); font-weight: 400; font-size: 12px; border: 0; background: none; text-align: left; padding: 0; }
.invoice-table .invoice-name:hover { text-decoration: underline; }
.invoice-table small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.invoice-table .related-invoice { display: block; font-size: 10px; margin-top: 5px; text-align: left; white-space: nowrap; }
.invoice-table .payment-balance { white-space: nowrap; }
.invoice-table .row-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.empty-state { text-align: center; padding: 47px 20px 51px; }
.empty-state .empty-icon { display: grid; place-items: center; margin: 0 auto 15px; width: 50px; height: 50px; border-radius: 8px; background: #edf7fb; color: var(--blue); font-size: 28px; }
.empty-state h3 { font-size: 17px; }
.empty-state p { font-size: 12px; color: var(--muted); margin: 8px 0 20px; }
.settings-defaults { margin-top: 22px; }
.smtp-card { margin-bottom: 20px; }
.settings-actions { display: flex; justify-content: flex-end; margin: 22px 0 24px; }
.upload-box { background: #f7fafb; border: 1px dashed #b7d0df; border-radius: 6px; padding: 17px; }
.upload-box .field { margin: 0; }
.backup-hero { display: flex; gap: 26px; padding: 33px; margin-bottom: 24px; }
.backup-icon { display: grid; place-items: center; flex: 0 0 56px; height: 56px; border-radius: 8px; background: #eaf5fa; color: var(--blue); font-size: 32px; }
.backup-hero h2 { font-size: 23px; margin-bottom: 12px; }
.backup-hero p:not(.helper) { font-size: 13px; color: #546875; max-width: 650px; line-height: 1.8; margin-bottom: 22px; }
.backup-hero .helper { margin-top: 14px; }
.app-footer { display: flex; justify-content: space-between; gap: 15px; padding: 33px 34px 25px; font-size: 10px; color: var(--muted); max-width: 1536px; margin: auto; }
.loading-screen { padding: 100px 30px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner { display: inline-block; width: 25px; height: 25px; border: 2px solid #d8e9f2; border-top-color: var(--cyan); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dialogs and feedback. */
dialog { border: 1px solid var(--line); border-radius: 9px; padding: 0; box-shadow: 0 24px 90px #0056812e; max-height: 92vh; color: var(--ink); overflow: auto; background: #fff; }
dialog::backdrop { background: #17384b66; }
.dialog-heading { padding: 22px 25px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; position: sticky; top: 0; background: #fff; z-index: 2; }
.dialog-heading h2 { font-size: 23px; }
.dialog-heading .eyebrow { margin-bottom: 5px; font-size: 9px; }
.icon-button { border: 0; background: #f2f7f9; color: #587384; width: 32px; height: 32px; border-radius: 5px; font-size: 23px; display: grid; place-items: center; line-height: 1; flex-shrink: 0; }
.dialog-body { padding: 24px 25px; }
.dialog-body > p { font-size: 13px; color: #546875; line-height: 1.8; margin-bottom: 17px; }
.dialog-footer { padding: 18px 25px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; background: #f8fafb; position: sticky; bottom: 0; z-index: 2; }
.dialog-footer .subtle { margin-right: auto; }
.preview-dialog { width: min(1000px, 95vw); }
.preview-dialog iframe { display: block; width: 100%; height: 67vh; border: 0; background: #e3e7e9; }
.confirm-dialog { width: min(550px, 95vw); }
.confirm-summary { margin: 20px 0; background: #f6f9fb; padding: 14px 17px; border-radius: 6px; }
.confirm-summary > div { display: flex; justify-content: space-between; gap: 25px; padding: 7px 0; font-size: 12px; }
.confirm-summary dt { color: var(--muted); min-width: 105px; }
.confirm-summary dd { margin: 0; text-align: right; font-weight: 400; color: var(--navy); overflow-wrap: anywhere; }
.profile-dialog { width: min(790px, 95vw); }
.form-subheading { font-size: 14px; margin: 25px 0 15px; border-top: 1px solid var(--line); padding-top: 20px; color: var(--navy); }
.inline-error { color: var(--red) !important; font-size: 12px !important; padding: 11px 13px; background: #fff1f1; border-radius: 5px; margin: 12px 0 0 !important; white-space: pre-wrap; }
.detail-dialog { width: min(680px, 95vw); }
.detail-statuses { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-start; font-size: 12px; }
.detail-statuses > div > span:first-child { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.linked-document { margin: 17px 0; font-size: 12px; overflow-wrap: anywhere; }
.linked-document .text-button { font-size: 12px; }
.detail-address { font-size: 13px; line-height: 1.8; white-space: pre-line; margin: 12px 0 22px; color: #546875; overflow-wrap: anywhere; }
.detail-kpis { display: flex; justify-content: space-between; gap: 16px; background: #f6f9fb; padding: 18px; border-radius: 6px; margin: 20px 0; }
.detail-kpis span { display: block; font-size: 10px; color: var(--muted); }
.detail-kpis strong { display: block; font-size: 20px; color: var(--navy); font-weight: 400; margin-top: 4px; }
.detail-settlement, .detail-refunds { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.detail-settlement h3, .detail-refunds h3 { font-size: 16px; margin: 0 0 14px; }
.detail-refunds > .detail-actions h3 { margin-bottom: 0; }
.settlement-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.settlement-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settlement-grid > div { min-width: 0; padding: 13px; background: #f6f9fb; border-radius: 5px; }
.settlement-grid span { display: block; font-size: 9px; color: var(--muted); }
.settlement-grid strong { display: block; font-size: 19px; font-weight: 400; color: var(--navy); margin-top: 5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.refund-form { margin-top: 15px; }
.refund-form > .helper { margin-bottom: 16px; }
.refund-form .check-field, .late-payment .check-field { margin: 14px 0; }
.refund-form > button, .late-payment form > button { margin-top: 14px; }
.refund-history { margin-top: 23px; font-size: 12px; color: #546875; }
.refund-history h4 { font-size: 13px; font-weight: 400; margin: 0 0 10px; }
.refund-history article { margin: 10px 0; padding: 13px; border: 1px solid var(--line); border-radius: 5px; }
.refund-history article > p { margin: 5px 0; overflow-wrap: anywhere; }
.refund-history .refund-reference { white-space: pre-wrap; }
.refund-history .text-button { font-size: 12px; margin-top: 7px; }
.detail-payment { margin: 22px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.late-payment > summary { cursor: pointer; color: var(--navy); font-size: 14px; }
.late-payment[open] > summary { margin-bottom: 14px; }
.late-payment > .helper { margin-bottom: 16px; }
.detail-payment h3 { font-size: 16px; margin-bottom: 14px; }
.detail-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.detail-mail { margin: 22px 0; padding-top: 19px; border-top: 1px solid var(--line); }
.detail-mail h3 { font-size: 16px; }
.detail-mail > .action-buttons { margin-top: 14px; }
.document-format-note { padding: 13px 15px; background: #fff8ec; border: 1px solid #e5d8bf; border-radius: 6px; margin: 17px 0; color: #856128; font-size: 12px; line-height: 1.7; }
.document-format-note strong { font-weight: 400; }
.document-format-note p { margin-top: 5px; }
.document-format-note.format-standard { background: #f5f8fa; border-color: var(--line); color: #546875; }
.document-format-note.format-ready { background: #eef8f2; border-color: #d5eadd; color: #497b60; }
.mail-history { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 13px; font-size: 12px; color: #546875; }
.mail-history summary { cursor: pointer; }
.mail-history article { margin: 12px 0; padding: 13px; border: 1px solid var(--line); border-radius: 5px; }
.mail-history article > p { margin: 5px 0; overflow-wrap: anywhere; }
.mail-history .mail-body { white-space: pre-wrap; font-size: 12px; line-height: 1.7; margin: 10px 0; }
.toast { position: fixed; bottom: 24px; right: 28px; z-index: 100; border-radius: 6px; background: var(--navy); color: #fff; padding: 14px 22px; box-shadow: 0 8px 30px #00568126; font-size: 13px; max-width: min(450px, 90vw); }
.toast.error { background: var(--red); }
.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; }

/* Sign-in and first setup share the corporate masthead and genuine infinity symbol. */
.auth-body { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: var(--masthead-height) 1fr; background: var(--surface); }
.auth-body .brand-masthead { position: static; }
.auth-card { width: min(440px, calc(100% - 36px)); align-self: center; margin: 38px auto; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 35px 36px; }
.auth-card-wide { width: min(510px, calc(100% - 36px)); }
.auth-brand { display: flex; align-items: center; gap: 14px; font-size: 17px; font-weight: 400; color: var(--navy); margin-bottom: 31px; }
.auth-brand .brand-mark { width: 53px; height: auto; }
.auth-brand > span { min-width: 0; overflow-wrap: anywhere; }
.auth-brand small { display: block; font-size: 9px; letter-spacing: 1.1px; color: var(--muted); margin-top: 4px; }
.auth-card h1 { font-size: 29px; }
.auth-intro { font-size: 13px; color: var(--muted); line-height: 1.75; margin-top: 12px; }
.auth-form { margin-top: 25px; }
.auth-form .field { font-size: 12px; margin-bottom: 19px; }
.auth-form .field input { font-size: 15px; min-height: 45px; }
.auth-form .button { width: 100%; margin-top: 5px; min-height: 45px; }
.auth-footer { font-size: 10px; color: var(--muted); text-align: center; margin-top: 27px; }

@media (max-width: 1250px) {
  :root { --sidebar-width: 208px; }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .brand { font-size: 16px; gap: 9px; }
  .brand-mark { width: 38px; }
  .nav-button { font-size: 12px; gap: 8px; padding-left: 10px; padding-right: 10px; }
  .panel { padding: 28px 25px 0; }
  .topbar { padding: 0 25px; }
  .app-footer { padding-left: 25px; padding-right: 25px; }
  .profile-bar { gap: 18px; }
  .profile-number { padding-left: 18px; }
  .profile-number small { max-width: 190px; }
  .action-bar { flex-wrap: wrap; }
  .action-bar .action-buttons { margin-left: auto; }
}
@media (max-width: 1100px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-bar { flex-wrap: wrap; }
  .profile-bar .profile-field { max-width: none; }
  .profile-number { flex-basis: 100%; border-left: 0; border-top: 1px solid var(--line); padding: 13px 0 0; margin: 0; }
  .profile-number > span, .profile-number strong { display: inline-block; margin-right: 12px; }
  .profile-number small { max-width: none; }
  .items-header { display: none; }
  .line-item { grid-template-columns: repeat(4, minmax(0, 1fr)) 30px; gap: 13px 11px; align-items: end; }
  .line-item .description-field { grid-column: 1 / 5; grid-row: 1; }
  .line-item .remove-line { grid-column: 5; grid-row: 1; align-self: center; }
  .line-item .quantity-field { grid-column: 1; grid-row: 2; }
  .line-item .unit-field { grid-column: 2; grid-row: 2; }
  .line-item .price-field { grid-column: 3; grid-row: 2; }
  .line-item .vat-field { grid-column: 4 / 6; grid-row: 2; }
  .line-item .line-label { display: block; font-size: 11px; color: #546875; }
  .line-item .line-amount { grid-column: 1 / -1; padding: 0; }
  .line-item .line-amount::before { content: "Positionsbetrag "; font-size: 11px; color: var(--muted); margin-right: 8px; }
  .line-extra { margin-top: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 18px; }
  .stat-card > strong { font-size: 26px; }
  .stat-card > span { font-size: 9px; }
  .table-toolbar { flex-wrap: wrap; }
  .table-toolbar .search-field { flex-basis: 100%; }
  .table-toolbar .field:not(.search-field) { flex: 1; }
  .notice { flex-wrap: wrap; }
  .totals { min-width: 270px; }
}
@media (max-width: 860px) {
  :root { --masthead-height: 94px; }
  .brand-masthead { position: static; }
  .brand-masthead img { width: 192px; }
  .app-shell { display: block; }
  .sidebar { position: relative; inset: auto; width: 100%; height: auto; padding: 17px 20px 0; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { font-size: 18px; }
  .brand-mark { width: 40px; }
  .brand small { font-size: 10px; }
  .nav-caption, .sidebar-note { display: none; }
  .sidebar nav { flex-direction: row; gap: 4px; margin-top: 16px; overflow-x: auto; scrollbar-width: thin; }
  .nav-button { flex-shrink: 0; width: auto; padding: 12px 11px; border-radius: 5px 5px 0 0; border: 0; border-bottom: 2px solid transparent; font-size: 12px; white-space: nowrap; }
  .nav-button.active { background: #f0f8fc; border-bottom-color: var(--cyan); }
  .nav-button > span:first-child { width: 17px; font-size: 18px; }
  .nav-count { display: none; }
  .mobile-logout { display: block; position: absolute; top: 28px; right: 20px; font-size: 11px; color: var(--blue); text-decoration: none; }
  .sidebar + main { width: 100%; margin-left: 0; }
  .topbar { display: none; }
  .panel { padding: 26px 22px 0; }
  .page-heading h1 { font-size: 30px; }
  .page-heading { margin-bottom: 23px; }
  .profile-bar { padding: 18px 20px; }
  .profile-number small { font-size: 11px; }
  .form-grid { gap: 20px; margin-bottom: 20px; }
  .app-footer { padding: 28px 22px; flex-wrap: wrap; }
  .notice-error { margin: 18px 22px; }
  .action-bar > .action-buttons { width: 100%; justify-content: flex-end; }
}
@media (max-width: 560px) {
  .sidebar { padding-left: 17px; padding-right: 17px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 36px; }
  .mobile-logout { right: 17px; }
  .nav-button { font-size: 11px; padding: 11px 9px; gap: 6px; }
  .panel { padding: 23px 16px 0; }
  .page-heading { gap: 15px; align-items: flex-start; }
  .page-heading h1 { font-size: 27px; }
  .page-heading .button { padding: 8px 10px; min-height: 36px; font-size: 11px; white-space: normal; }
  .page-intro { font-size: 12px; }
  .eyebrow { font-size: 9px; letter-spacing: .8px; }
  .card-heading { padding: 17px; min-height: 59px; gap: 10px; }
  .card-heading h2 { font-size: 17px; gap: 9px; }
  .card-body { padding: 18px 17px; }
  .micro-label { font-size: 9px; }
  .field-grid { gap: 0 12px; }
  .field input, .field select, .field textarea { font-size: 16px; padding: 10px; }
  .field input[type=file] { font-size: 12px; }
  .postcode-grid { grid-template-columns: 105px minmax(0, 1fr); }
  .profile-bar { gap: 15px; padding: 17px; }
  .profile-bar .profile-field { min-width: 140px; }
  .language-field { width: 135px; }
  .profile-number > span { font-size: 9px; }
  .profile-number strong { font-size: 16px; }
  .profile-number small { font-size: 10px; }
  .profile-bar .field { font-size: 11px; }
  .items-card .card-heading { align-items: center; }
  .inline-field { flex-direction: column; align-items: flex-end; gap: 5px; font-size: 10px; }
  .inline-field select { min-height: 33px; padding: 5px 7px; font-size: 12px; }
  .line-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 13px 12px; padding: 18px 17px; }
  .line-item .description-field { grid-column: 1 / 3; grid-row: 1; }
  .line-item .remove-line { grid-column: 3; grid-row: 1; }
  .line-item .quantity-field { grid-column: 1; grid-row: 2; }
  .line-item .unit-field { grid-column: 2 / 4; grid-row: 2; }
  .line-item .price-field { grid-column: 1; grid-row: 3; }
  .line-item .vat-field { grid-column: 2 / 4; grid-row: 3; }
  .line-item .field input, .line-item .field select, .line-item .field textarea { font-size: 16px; padding: 9px; min-height: 42px; }
  .line-item .line-label { font-size: 11px; }
  .line-extra { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .line-extra .field > span { font-size: 11px; }
  .items-footer { padding: 15px 17px; flex-wrap: wrap; gap: 9px; }
  .items-footer .subtle { font-size: 10px; }
  .totals-area { padding: 19px 17px; flex-direction: column-reverse; gap: 15px; }
  .totals { min-width: 0; width: 100%; font-size: 12px; }
  .calculation-note { max-width: 100%; align-self: stretch; }
  .total-final strong { font-size: 26px; }
  .email-option { padding: 17px; }
  .action-bar { padding: 17px; gap: 16px; }
  .action-bar > .action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .action-bar .action-buttons .button { min-height: 42px; padding: 9px 7px; font-size: 12px; }
  .action-bar .action-buttons .button-primary { grid-column: 1 / -1; }
  .action-bar .action-buttons .button-quiet { border-color: var(--line); }
  .customer-select-row { gap: 9px; }
  .customer-select-row .text-button { font-size: 11px; }
  .draft-row { padding: 14px 17px; gap: 12px; }
  .draft-row strong { font-size: 12px; }
  .draft-row > .button { padding: 7px 9px; font-size: 11px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card > strong { font-size: 27px; }
  .stat-card > small { font-size: 10px; }
  .table-toolbar { padding: 17px; gap: 10px; }
  .table-toolbar .field:not(.search-field) { flex: 1 1 100%; }
  .table-toolbar .field input, .table-toolbar .field select { font-size: 16px; }
  .invoice-table th, .invoice-table td { padding: 14px 12px; }
  .invoice-table td:first-child, .invoice-table th:first-child { padding-left: 17px; }
  .invoice-table td:last-child, .invoice-table th:last-child { padding-right: 17px; }
  .invoice-table td { min-width: 90px; }
  .invoice-table td:nth-child(2) { min-width: 150px; }
  .field-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid.three > .field:last-child { grid-column: 1 / -1; }
  .smtp-card .field-grid.three > .field:first-child { grid-column: 1 / -1; }
  .smtp-card .field-grid.three > .field:last-child { grid-column: auto; }
  .settings-actions .button { width: 100%; }
  .backup-hero { padding: 23px 19px; gap: 16px; }
  .backup-icon { flex-basis: 42px; height: 42px; font-size: 26px; }
  .backup-hero h2 { font-size: 20px; }
  .backup-hero p:not(.helper) { font-size: 12px; }
  .app-footer { padding: 26px 17px; font-size: 10px; gap: 7px; }
  .dialog-heading { padding: 19px; }
  .dialog-heading h2 { font-size: 21px; }
  .dialog-body { padding: 20px 19px; }
  .dialog-footer { padding: 15px 18px; flex-wrap: wrap; }
  .dialog-footer .button { min-height: 38px; font-size: 12px; padding: 9px 12px; }
  .preview-dialog .dialog-footer .subtle { flex-basis: 100%; }
  .preview-dialog iframe { height: 65vh; }
  .detail-kpis { gap: 10px; padding: 14px; }
  .detail-kpis strong { font-size: 17px; }
  .detail-actions { flex-wrap: wrap; }
  .settlement-grid { grid-template-columns: 1fr; }
  .settlement-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settlement-grid > div { padding: 12px; }
  .settlement-grid strong { font-size: 18px; }
  .confirm-summary > div { font-size: 11px; gap: 12px; }
  .confirm-summary dt { min-width: 90px; }
  .confirm-summary dd { max-width: 65%; }
  .notice-error { margin: 17px 16px; }
  .toast { bottom: 17px; right: 17px; font-size: 12px; padding: 13px 17px; }
  .auth-card { padding: 29px 25px; margin: 28px auto; }
  .auth-card h1 { font-size: 27px; }
  .auth-brand { font-size: 16px; margin-bottom: 27px; }
  .auth-form .field input { font-size: 16px; }
}
@media (max-width: 360px) {
  .profile-bar .profile-field, .profile-bar .language-field { width: 100%; flex-basis: 100%; }
  .field-grid, .field-grid.three { grid-template-columns: minmax(0, 1fr); }
  .field-grid.three > .field { grid-column: auto !important; }
  .page-heading { flex-wrap: wrap; }
  .detail-kpis { flex-wrap: wrap; }
  .settlement-grid.two { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
