/* RAVENTIQ product UI, aligned with the main website's tokens and refinements.
   Screen-only layer: supplier branding, invoice previews and print keep their own styles. */
:root {
  --bg: #0c1423;
  --panel: #142335;
  --panel2: #1d3147;
  --line: #344c63;
  --ink: #edf4fd;
  --muted: #b4c5d7;
  --teal: #42decf;
  --teal2: #a3f4e7;
  --radius: 16px;
  --ui-field: #0f1c2c;
  --ui-panel: linear-gradient(125deg, #17293d, #132235);
  --ui-accent-surface: #19454f;
  --ui-accent-line: #4c969b;
  --ui-success: #a0eed0;
  --ui-success-surface: #173b36;
  --ui-success-line: #397768;
  --ui-warning: #f4d6a1;
  --ui-danger: #ffd6e5;
  --ui-radius-small: 10px;
  --ui-shadow: 0 7px 24px #02081326;
}
body { background: var(--bg); -webkit-font-smoothing: antialiased; }
.app-shell {
  grid-template-columns: 228px minmax(0, 1fr);
  grid-template-rows: 82px minmax(0, 1fr);
}
.product-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  height: 82px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #101b2a;
  border-color: #24354a;
  box-shadow: 0 2px 20px #02081624;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.product-brand { padding: 0; gap: 9px; white-space: nowrap; }
.product-brand img { width: 37px; height: 37px; flex: none; object-fit: contain; filter: brightness(1.85) saturate(.72) hue-rotate(-10deg) drop-shadow(0 0 10px #53e4d72e); }
.product-brand .brand-word { font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: 700; letter-spacing: .065em; line-height: 1; color: #eaf6ff; }
.product-brand .brand-word > span { color: #83e9df; }
.brand-product { border-left: 1px solid var(--line); padding-left: 13px; margin-left: 7px; color: var(--muted); font-size: 13px; }
.top-user { font-size: 12px; color: #bccbdd; overflow-wrap: anywhere; }
.top-right { gap: 14px; min-width: 0; }
.demo-badge { border-color: var(--line); color: var(--muted); border-radius: 30px; }
.product-topbar .top-logout { min-height: 44px; }
.sidebar {
  width: 228px;
  top: 82px;
  height: calc(100dvh - 82px);
  padding: 26px 14px 20px;
  background: linear-gradient(170deg, #122234 0%, #101a29 55%);
  border-color: #24354a;
}
.workspace-switch { min-width: 0; padding: 0 7px 20px; border-bottom: 1px solid #25394f; margin-bottom: 22px; }
.workspace-switch .workspace-label { display: block; margin: 0 0 9px; font-size: 11px; font-weight: 400; letter-spacing: .025em; color: #a1b6cb; }
.workspace-switch select {
  width: 100%; min-width: 0; min-height: 44px; padding: 11px 9px;
  background: var(--ui-field); border: 1px solid var(--line);
  border-radius: var(--ui-radius-small); color: var(--ink); font-size: 12px;
}
.workspace-role { display: flex; align-items: center; gap: 7px; margin-top: 14px; color: var(--teal2); font-size: 11px; }
.workspace-role::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #75a8be; flex: none; }
.nav { gap: 5px; }
.nav-item { border: 1px solid transparent; min-height: 44px; padding: 11px 12px; gap: 13px; border-radius: 10px; font-size: 13px; color: #b9c9dc; }
.nav-item .icon { color: #8da6be; }
.nav-item:hover { color: #eff9ff; background: #1c3147; }
.nav-item.active { background: linear-gradient(105deg, #164b52, #183248); color: #a5fff1; border-color: #2b646c; box-shadow: 0 4px 15px #020f1926; }
.nav-item.active .icon { color: #70f0df; }
.nav-item.active::before { left: -7px; background: #52ecdc; height: 20px; }
.nav-count { background: #24505b; color: var(--teal2); }
.sidebar-note { background: #152b3c; border-color: var(--line); border-radius: var(--ui-radius-small); }
.sidebar-note strong { color: var(--ink); }
.sidebar-note p, .sidebar-help, .profile small { color: #a1b6cb; }
.sidebar-help:hover { color: var(--teal2); }
.profile { border-color: var(--line); }
.avatar { background: #1d3a4c; border-color: #355a70; color: #b2e8e7; }
.body-column { grid-column: 2; grid-row: 2; background: radial-gradient(ellipse 85% 380px at 65% 0, #17314d55, transparent); }
.content { max-width: none; padding: 32px clamp(24px, 2.2vw, 48px) 48px; }
.page-heading { margin-bottom: 24px; align-items: center; }
.page-heading h1 { font-size: clamp(27px, 2.4vw, 34px); letter-spacing: -.035em; }
.eyebrow { color: var(--teal2); letter-spacing: .16em; font-size: 10px; }
.subtitle { color: var(--muted); }
.btn { min-height: 44px; border-color: var(--line); border-radius: var(--ui-radius-small); background: var(--panel2); color: var(--ink); font-size: 13px; }
.btn:hover { background: #243f58; border-color: var(--teal2); }
.btn.primary { background: var(--teal); color: #06251f; border-color: transparent; font-weight: 700; box-shadow: 0 8px 24px #26c9b91f, inset 0 1px #e2fff847; }
.btn.primary:hover { background: #79ebdb; border-color: #a5fff3; box-shadow: 0 10px 30px #26c9b930; }
.btn.quiet { color: var(--muted); }
.icon-button { min-width: 40px; min-height: 40px; border-radius: var(--ui-radius-small); color: #a1b6cb; }
.icon-button:hover { background: var(--panel2); color: var(--ink); }
.text-button { color: var(--teal2); font-size: 12px; }
button:disabled { cursor: not-allowed; opacity: .55; }
.panel, .stat, .customer-card { background: var(--ui-panel); border-color: var(--line); border-radius: var(--radius); box-shadow: var(--ui-shadow); }
.panel .panel { background: var(--panel); box-shadow: none; }
.panel-header { padding: 24px; gap: 16px; }
.panel-header h2 { font-size: 16px; }
.panel-header p, .panel-footer, .caption, .stat-note, .cell-sub, .page-footer,
.field-hint, .settings-intro, .settings-meta, .settings-save p, .settings-preview-heading p,
.section-heading p, .account-description, .people-footnote, .local-note, .summary-foot { color: var(--muted); }
.panel-footer, .page-footer { border-color: var(--line); }
.stats { gap: 16px; margin-bottom: 24px; }
.stat { position: relative; overflow: hidden; padding: 22px 24px; }
.stat-top { color: var(--muted); font-size: 12px; }
.stat-icon { width: 39px; height: 39px; border-radius: 12px; color: var(--teal2); background: #19454f; }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-value { font-size: clamp(23px, 2.1vw, 31px); font-weight: 650; margin: 12px 0; letter-spacing: -.035em; }
.stat-note { font-size: 11px; line-height: 1.7; }
.stat.highlight .stat-icon { background: var(--ui-accent-surface); color: var(--teal2); }
.stat.warning .stat-icon { background: #3a3025; color: var(--ui-warning); }
.stat.warning .stat-note { color: var(--ui-warning); }
.stat.paid .stat-icon { background: var(--ui-success-surface); color: var(--ui-success); }
.stat.paid .stat-note { color: var(--ui-success); }
.overview-grid { grid-template-columns: minmax(0, 1fr) minmax(270px, 25%); gap: 24px; }
.overview-main, .side-stack { gap: 24px; }
.invoice-table { font-size: 12px; }
.table-scroll { position: relative; }
.invoice-table th { color: var(--muted); font-size: 11px; background: #192b3e; border-color: var(--line); }
.invoice-table td { border-color: #2b4056; }
.invoice-table tbody tr:hover { background: #1d344bcc; }
.invoice-table .amount { font-size: 13px; color: var(--ink); }
.document-number { font-size: 12px; color: #d9efff; }
.document-number.draft { color: #bfd0e0; }
.customer-cell .avatar { background: #20394f; color: #bad4e4; }
.cell-sub { font-size: 10px; }
.pill { border-radius: 30px; padding: 5px 9px; font-size: 10px; }
.pill.unpaid { background: #3a3025; color: var(--ui-warning); border-color: #78613e; }
.pill.paid { background: var(--ui-success-surface); color: var(--ui-success); border-color: var(--ui-success-line); }
.pill.overdue { background: #3a2334; color: var(--ui-danger); border-color: #835768; }
.pill.draft { background: #22364b; color: #c5d5e6; border-color: #455d74; }
.pill.partial { background: var(--ui-accent-surface); color: var(--teal2); border-color: var(--ui-accent-line); }
.payment-balance { color: var(--teal2); white-space: normal; }
.settlement-summary { display: grid; gap: 1px; overflow: hidden; margin: 0 0 24px; border: 1px solid var(--line); border-radius: var(--ui-radius-small); background: var(--line); }
.settlement-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 15px; background: var(--ui-field); }
.settlement-summary span { color: var(--muted); font-size: 12px; }
.settlement-summary strong { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.settlement-summary > div:last-child { background: #173b46; }
.settlement-summary > div:last-child strong { color: var(--teal2); }
#payment-form h3 { margin-bottom: 20px; }
#payment-form > .btn { margin-top: 19px; }
.payment-history { margin-top: 28px; }
.payment-history h3 { margin-bottom: 15px; }
.payment-history ol { list-style: none; padding: 0; margin: 0; }
.payment-history li { padding: 17px 0; border-top: 1px solid var(--line); }
.payment-entry-heading { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.payment-entry-heading strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.payment-entry-heading span, .payment-history li p, .payment-note { font-size: 12px; color: var(--muted); line-height: 1.8; overflow-wrap: anywhere; }
.payment-history li p { margin-top: 8px; }
.payment-note { margin: 18px 0; }
.payment-reversed .payment-entry-heading strong { text-decoration: line-through; color: var(--muted); }
.payment-history .payment-reversal-note { color: var(--ui-warning); }
#payment-error:not(:empty) { margin: 16px 0; }
#payment-form .field > span, #payment-reversal-form .field > span { display: block; margin-bottom: 8px; font-size: 12px; }
.document-settlement { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid #dce5e8; font-size: 11px; color: #304753; }
.document-settlement > span { display: flex; justify-content: space-between; gap: 14px; }
.cashflow .caption, .legend, .draft-shortcut small { color: var(--muted); }
.cashflow-value { color: var(--ink); }
.split-bar { background: #344c63; }
.split-bar > span { background: linear-gradient(90deg, #63ebd9, #3ad3d0); }
.legend strong { color: var(--ink); }
.activity-icon, .draft-shortcut-icon, .export-icon, .mail-mode-icon, .mail-row-icon, .security-mail-icon { background: var(--ui-accent-surface); color: var(--teal2); border-color: var(--ui-accent-line); }
.activity-panel p, .draft-shortcut strong, .quick-action { color: #c5d8e8; }
.draft-shortcut, .quick-action { border-color: var(--line); }
.draft-shortcut:hover, .quick-action:hover { background: #1d344b; }
.filters { background: var(--ui-panel); border-color: var(--line); }
.tabs { background: #102035; border-color: var(--line); }
.tab { color: var(--muted); border-radius: 9px; }
.tab.active { background: var(--ui-accent-surface); color: var(--teal2); border-color: var(--ui-accent-line); }
.search-box { background: var(--ui-field); border-color: var(--line); border-radius: var(--ui-radius-small); }
.search-box input { color: var(--ink); }
.customer-card .details, .customer-card .customer-note { color: var(--muted); }
.customer-card .customer-avatar { background: var(--ui-accent-surface); color: var(--teal2); }
.form-panel h2, .editor-summary h2, .account-panel h2 { color: var(--ink); }
.form-panel, .account-panel { padding: 24px; margin-bottom: 24px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; align-items: start; }
.form-grid > .full { grid-column: 1 / -1; }
.form-grid > .field-hint { margin: 0; }
.field { gap: 8px; }
.field > span { line-height: 1.5; }
.field small, .field-hint { line-height: 1.7; }
.settings-layout, .personal-grid { gap: 24px; }
.settings-layout > *, .personal-grid > *, .heading-actions { min-width: 0; }
.settings-preview { top: 106px; }
.settings-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.settings-toolbar .settings-tabs { margin: 0; padding: 0; background: transparent; }
.settings-intro { margin-bottom: 24px; }
.settings-save { align-items: flex-start; }
.settings-save p { margin: 0; }
.system-mail-settings { max-width: none; }
.invite-form .field > span { margin-bottom: 0; }
.invite-form .btn { min-height: 44px; }
.step-number { background: var(--ui-accent-surface); color: var(--teal2); border-color: var(--ui-accent-line); }
.field > span, .line-head, .radio-label { color: #c6d7e8; }
.line-field { display: contents; }
.line-field > span { display: none; }
.field input, .field select, .field textarea, .line-item input, .vat-lines select, .ares-search input {
  background: var(--ui-field); border: 1px solid var(--line);
  color: var(--ink); border-radius: var(--ui-radius-small); min-height: 44px; font-size: 13px;
}
.field input::placeholder, .field textarea::placeholder, .line-item input::placeholder, .search-box input::placeholder { color: #98aec5; opacity: 1; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .line-item input:focus-visible { border-color: #5bded3; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--teal); }
.customer-results { background: var(--panel); border-color: var(--line); border-radius: var(--ui-radius-small); box-shadow: var(--ui-shadow); }
.customer-result { color: var(--ink); border-color: var(--line); }
.customer-result:hover, .customer-result.active { background: var(--ui-accent-surface); }
.customer-result small { color: var(--muted); }
.editor-summary { background: var(--ui-panel); border-color: var(--line); }
.summary-row { color: var(--muted); }
.summary-row strong, .editor-total { color: var(--ink); }
.summary-divider, .customer-details, .bank-account-row { border-color: var(--line); }
.customer-details summary, .editor-details summary { color: var(--teal2); }
.bank-account-row, .tax-history { background: var(--ui-field); border-radius: var(--ui-radius-small); }
.tax-history > div > span, .tax-history small { color: var(--muted); }
.tax-history strong { color: var(--ink); }
.settings-preview-heading h2 { color: var(--ink); }
.account-notice, .mail-mode, .ares-lookup { background: #173b46; border-color: #3c737e; color: #b0f6ef; border-radius: var(--radius); }
.mail-mode p, .ares-hint, .ares-status { color: #bdd8e6; }
.ares-result { background: #193348; border-color: var(--line); color: var(--ink); }
.ares-result:hover, .ares-result:focus-visible { background: #24505b; }
.ares-result small { color: var(--muted); }
.modal-backdrop { background: #040b17bf; }
.modal { background: var(--panel); border-color: var(--line); border-radius: var(--radius); box-shadow: 0 24px 80px #02081380; }
.modal-header, .member-row, .invitation-row, .incoming-invitation, .security-message { border-color: var(--line); }
.modal-description, .member-person span:not(.avatar), .member-person strong small,
.invitation-row span:not(.pill), .incoming-invitation p, .incoming-invitation small, .security-message small { color: var(--muted); }
.member-person strong, .invitation-row strong, .security-message strong { color: var(--ink); }
.security-message:hover, .mail-row:hover { background: #1c3449; }
.error-box, .delivery-error { background: #3a2334; color: var(--ui-danger); border-color: #835768; }
.error-box ul { color: inherit; }
.success-box, .delivery-status:not(.delivery-error) { background: var(--ui-success-surface); color: var(--ui-success); border-color: var(--ui-success-line); }
.delivery-status:not(.delivery-error) strong { color: var(--ui-success); }
.delivery-status:not(.delivery-error) p { color: #b9dfd2; }
.danger-text { color: var(--ui-danger); }
.mail-row { border-color: var(--line); }
.mail-row-main strong { color: var(--ink); }
.mail-row-main small, .mail-addresses dt, .mail-addresses small, .delivery-history p, .delivery-history small { color: var(--muted); }
.mail-addresses dd, .delivery-history strong { color: #d8e9f4; }
.connection-panel .platform-mark { background: var(--ui-accent-surface); color: var(--teal2); }
.connection-panel p, .info-panel p, .export-panel p { color: var(--muted); }
.empty h3 { color: var(--ink); }
.empty p { color: var(--muted); }
#toast { background: var(--panel2); border-color: var(--ui-accent-line); color: var(--ink); box-shadow: var(--ui-shadow); }

/* A shared container and horizontal rhythm, following the main RAVENTIQ hero. */
.auth-page {
  display: flex; flex-direction: column; min-height: 100dvh; padding: 0 clamp(24px, 5vw, 72px);
  background: radial-gradient(ellipse at 92% 10%, #6c8bd329, transparent 53%), radial-gradient(ellipse at 58% 16%, #26c9b922, transparent 62%), linear-gradient(120deg, #0c1423 14%, #102437 66%, #152b42);
}
.auth-header, .auth-layout, .auth-footer { width: 100%; max-width: 1200px; margin: 0 auto; }
.auth-header { display: flex; align-items: center; min-height: 96px; border-bottom: 1px solid #2a3d52; }
.auth-header .product-brand img { width: 48px; height: 48px; }
.auth-header .brand-word { font-size: 24px; }
.auth-layout { position: relative; isolation: isolate; flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .9fr); gap: clamp(40px, 6vw, 88px); align-items: center; padding: 64px 0; }
.auth-layout::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(#b6ddf908 1px, transparent 1px), linear-gradient(90deg, #b6ddf908 1px, transparent 1px); background-size: 92px 92px; mask-image: linear-gradient(90deg, transparent 15%, #000); }
.auth-intro { padding: 0; border: 0; background: none; min-width: 0; }
.auth-intro-copy { margin: 0; padding: 0; }
.auth-intro .eyebrow { display: flex; align-items: center; gap: 12px; }
.auth-intro .eyebrow::before { content: ''; width: 24px; height: 2px; background: var(--teal); flex: none; }
.auth-intro h1 { margin: 24px 0; font-size: clamp(36px, 3.6vw, 52px); font-weight: 800; line-height: 1.12; letter-spacing: -.045em; }
.auth-intro h1 span { color: #94eddf; }
.auth-intro-copy > p { margin: 0; max-width: 43ch; font-size: 15px; line-height: 1.8; }
.auth-intro-copy > p, .auth-description, .auth-switch, .auth-examples, .auth-footer { color: var(--muted); }
.auth-points { gap: 16px; margin-top: 32px; color: #c5d8e8; font-size: 12px; }
.auth-points > span { display: flex; align-items: center; gap: 12px; }
.auth-points .icon { color: var(--teal2); }
.auth-form-panel { padding: 0; min-width: 0; }
.auth-card { max-width: 440px; padding: 32px; border: 1px solid #446a81; border-radius: 20px; background: var(--ui-panel); box-shadow: 0 24px 60px #020c1b40, inset 0 1px #d3fff51a; }
.auth-card h2 { color: var(--ink); font-size: 27px; font-weight: 700; line-height: 1.25; margin: 16px 0 12px; letter-spacing: -.035em; }
.auth-description { font-size: 13px; line-height: 1.7; margin: 0 0 24px; }
.auth-card form { display: grid; gap: 20px; }
.auth-card #auth-error:empty { display: none; }
.auth-card .field { display: flex; gap: 8px; margin: 0; }
.auth-card .field > span { margin: 0; font-size: 12px; }
.auth-card .field input { min-height: 48px; }
.auth-card .field small { color: var(--muted); margin: 0; font-size: 11px; }
.auth-card .auth-submit { min-height: 48px; margin: 4px 0 0; justify-content: center; white-space: normal; }
.auth-switch { margin: 24px 0 0; font-size: 12px; }
.auth-switch .text-button { font-size: inherit; }
.auth-forgot { margin-top: 12px; }
.auth-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding: 24px 0; border-top: 1px solid #2a3d52; font-size: 11px; line-height: 1.7; }
.auth-examples { border-color: var(--line); }
.auth-examples summary { color: #d1e5f2; }
.auth-loading { background: var(--bg); color: var(--muted); }

@media (min-width: 1920px) {
  .workspace-welcome { grid-template-columns: 1fr 440px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-value { font-size: 34px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 23%); }
}
@media (max-width: 1200px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .side-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 18px 16px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-top { font-size: 11px; }
  .stat-value { font-size: 23px; }
  .workspace-welcome { padding: 28px; grid-template-columns: 1.3fr 1fr; }
  .invoice-art { transform: scale(.88); }
}
@media (max-width: 1100px) {
  .invite-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .invite-form > .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 950px) {
  .top-user, .demo-badge { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-column: 1 / -1; }
  .workspace-welcome { grid-template-columns: 1fr; padding: 30px; }
  .invoice-art { display: none; }
  .welcome-copy h2 { font-size: 38px; }
  .stat-value { font-size: 29px; }
}
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); max-width: 560px; gap: 32px; padding: 40px 0; }
  .auth-header { min-height: 80px; }
  .auth-intro h1 { font-size: 38px; margin: 20px 0; }
  .auth-intro-copy > p { max-width: none; font-size: 14px; }
  .auth-points { display: none; }
  .auth-card { max-width: none; }
}
@media (min-width: 901px) and (max-height: 800px) {
  .auth-header { min-height: 80px; }
  .auth-layout { padding-top: 20px; padding-bottom: 20px; }
  .auth-footer { padding-top: 16px; padding-bottom: 16px; }
}
@media (max-width: 700px) {
  .app-shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 68px minmax(0, 1fr); }
  .product-topbar { height: 68px; padding: 0 16px; gap: 8px; }
  .topbar-brand { gap: 7px; }
  .product-brand { gap: 6px; }
  .product-brand img { width: 29px; height: 29px; }
  .product-brand .brand-word { font-size: 17px; }
  .brand-product { padding-left: 9px; margin-left: 3px; font-size: 12px; }
  .top-right { gap: 4px; }
  .top-right > .icon-button { display: none; }
  .product-topbar .top-logout { min-width: 40px; min-height: 40px; padding: 8px; background: transparent; border-color: transparent; }
  .top-logout span { display: none; }
  .mobile-menu { display: inline-flex; min-width: 36px; min-height: 44px; }
  .sidebar { z-index: 45; top: 68px; width: min(288px, calc(100vw - 24px)); height: calc(100dvh - 68px); padding: 26px 16px 20px; visibility: hidden; transition: transform .2s ease, visibility .2s; }
  .sidebar.mobile-open { visibility: visible; }
  .sidebar > .mobile-close { display: inline-flex; position: absolute; top: 8px; right: 8px; width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
  .workspace-switch .workspace-label { padding-right: 24px; }
  .workspace-switch select { margin-top: 3px; }
  .sidebar-spacer { min-height: 24px; }
  .sidebar-note { display: none; }
  .body-column { grid-column: 1; grid-row: 2; }
  .content { padding: 25px 18px 32px; }
  .page-heading h1 { font-size: 26px; }
  .page-heading { margin-bottom: 24px; flex-wrap: wrap; align-items: flex-start; }
  .heading-actions { flex-wrap: wrap; }
  .subtitle { max-width: none; font-size: 12px; }
  .heading-actions > .btn { min-height: 44px; }
  .workspace-welcome { padding: 25px 23px; border-radius: 18px; min-height: 0; }
  .welcome-copy h2 { font-size: clamp(30px, 8vw, 38px); margin-top: 14px; }
  .welcome-copy p { font-size: 12px; }
  .welcome-actions { gap: 9px; }
  .welcome-actions .btn { font-size: 12px; }
  .stats { gap: 12px; }
  .stat { padding: 16px 14px; }
  .stat-icon { width: 26px; height: 26px; border-radius: 8px; }
  .stat-icon .icon { width: 15px; height: 15px; }
  .stat-top { font-size: 10px; gap: 5px; }
  .stat-value { font-size: clamp(19px, 5.1vw, 29px); }
  .stat-note { font-size: 10px; }
  .overview-grid, .overview-main { gap: 20px; }
  .side-stack { grid-template-columns: 1fr; }
  .quick-actions { grid-column: auto; }
  .panel-header { padding: 18px; }
  .panel-header h2 { font-size: 15px; }
  .panel-header .text-button { font-size: 11px; }
  .invoice-table .amount { font-size: 12px; }
  .invoice-table th, .invoice-table { font-size: 11px; }
  .field input, .field select, .field textarea { font-size: 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .invite-form { grid-template-columns: minmax(0, 1fr); }
  .form-panel, .account-panel { padding: 20px; }
  .settings-toolbar { align-items: flex-start; gap: 12px; }
  .settings-toolbar > .btn { width: 100%; }
  .line-head { display: none; }
  .line-item, .vat-lines .line-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 12px 8px; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 18px; }
  .line-field { display: grid; gap: 6px; min-width: 0; }
  .line-field > span { display: block; font-size: 10px; color: var(--muted); }
  .line-description { grid-column: 1 / 3; grid-row: 1; }
  .line-quantity { grid-column: 1; grid-row: 2; }
  .line-price { grid-column: 2; grid-row: 2; }
  .line-vat { grid-column: 1 / 3; grid-row: 3; }
  .line-item input, .vat-lines .line-item input, .vat-lines .line-item select { grid-area: auto; width: 100%; min-width: 0; font-size: 13px; }
  .line-item > .icon-button { grid-column: 3; grid-row: 1; align-self: end; }
  .line-item .icon-button { min-width: 24px; }
  .auth-page { padding: 0 20px; }
  .auth-header .product-brand img { width: 40px; height: 40px; }
  .auth-header .brand-word { font-size: 21px; }
  .auth-form-panel, .auth-intro { padding: 0; }
  .auth-card { padding: 24px; }
  .auth-intro h1 { font-size: clamp(31px, 8vw, 38px); }
  .auth-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 360px) {
  .content { padding-left: 14px; padding-right: 14px; }
  .product-topbar { padding: 0 10px; }
  .product-brand .brand-word { font-size: 16px; }
  .brand-product { padding-left: 7px; font-size: 11px; }
  .product-brand img { width: 25px; height: 25px; }
  .stats { grid-template-columns: 1fr; }
  .stat-value { font-size: 30px; }
  .stat-top { font-size: 12px; }
  .welcome-actions > .btn { width: 100%; }
  .workspace-welcome { padding: 24px 20px; }
  .auth-page { padding: 0 16px; }
  .auth-card { padding: 20px; }
  .auth-card h2 { font-size: 25px; }
  .document-top { flex-direction: column; align-items: flex-start; gap: 18px; }
  .document-title { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
@media screen {
  .pill.credit, .pill.credited { background: #e9e5f7; color: #574288; white-space: normal; }
  .document-credit-reference { margin: 20px 0; padding: 12px 16px; border-left: 3px solid var(--invoice-accent); background: #f3f6fa; overflow-wrap: anywhere; }
  #credit-form .radio-label { align-items: flex-start; line-height: 1.5; }
  .settings-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:22px; border:0; }
  .settings-tabs .tab { min-height:44px; min-width:86px; padding:10px 18px; border:1px solid var(--line); border-radius:10px; background:var(--panel2); }
  .settings-tabs .tab.active { background:var(--ui-accent-surface); border-color:var(--ui-accent-line); color:var(--teal2); }
  [data-settings-panel][hidden] { display:none !important; }
  .tax-settings > summary { cursor:pointer; font-size:15px; font-weight:600; min-height:24px; color:var(--ink); }
  .tax-settings[open] > summary { margin-bottom:18px; }
  .system-mail-settings > summary {cursor:pointer;font-weight:600;min-height:24px;}
  .system-mail-settings[open] > summary {margin-bottom:18px;}
  .payment-history li > .btn { margin-top:12px; }
}
.export-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; margin:24px 0; }
.export-choices > div { display:flex; flex-direction:column; align-items:flex-start; min-width:0; padding-top:20px; border-top:1px solid var(--line,#dbe5ec); }
.export-choices h3 { margin:0 0 8px; }
.export-choices p { font-size:14px; line-height:1.6; color:var(--muted,#64748b); margin:0 0 16px; }
.export-choices .btn { margin-top:auto; max-width:100%; white-space:normal; text-align:left; }
@media(max-width:700px) { .export-choices {grid-template-columns:1fr;gap:20px;} }
.setup-steps { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; list-style:none; padding:0; margin:0 0 24px; }
.setup-steps li { display:flex; align-items:center; gap:10px; color:var(--muted); padding:12px; border:1px solid var(--line); border-radius:12px; }
.setup-steps li span { display:grid; place-items:center; flex:0 0 28px; height:28px; border-radius:50%; background:var(--panel2); }
.setup-steps [aria-current=step] { color:var(--teal); border-color:var(--teal); background:#173c48; }
.setup-layout { display:grid; align-items:start; grid-template-columns:minmax(0,1fr); gap:24px; max-width:960px; }
.setup-layout:has(.setup-preview) { grid-template-columns:minmax(0,1fr) minmax(260px,.8fr); max-width:none; }
.setup-layout > *, .setup-layout form { min-width:0; }
.setup-layout h2 { margin-top:0; }
.setup-layout .form-panel h2 { margin-bottom:8px; }
.setup-layout form > p { color:var(--muted); line-height:1.6; margin:0 0 24px; }
.setup-layout form > .field-hint { margin:20px 0 0; }
.setup-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin-top:24px; }
.setup-actions .btn { white-space:normal; }
.setup-summary { display:grid; gap:16px; }
.setup-summary > div { padding:16px 0; border-top:1px solid var(--line); }
.setup-summary dt { color:var(--muted); font-size:13px; margin-bottom:6px; }
.setup-summary dd { margin:0; line-height:1.7; overflow-wrap:anywhere; }
@media(max-width:1000px) { .setup-layout:has(.setup-preview) {grid-template-columns:minmax(0,1fr);} }
@media(max-width:600px) { .setup-steps {grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;} .setup-steps li {padding:8px;font-size:13px;} }
.period-panel { padding:20px 24px; margin-bottom:24px; }
.period-panel form { display:flex; flex-wrap:wrap; gap:14px; align-items:end; }
.period-panel .field { flex:1 1 140px; min-width:0; margin:0; }
.period-panel .field:first-child { flex-grow:2; }
.period-panel [hidden] { display:none !important; }
.period-panel #period-error { flex:0 0 100%; color:#ffbbb6; font-size:14px; }
.period-panel #period-error:empty { display:none; }
.period-panel .field-hint { margin:12px 0 0; }
.stat[data-action] { text-align:left; font:inherit; cursor:pointer; width:100%; }
.stat[data-action]:hover { border-color:var(--teal); }
.stat[data-action]:focus-visible { outline:3px solid var(--teal); outline-offset:3px; }
@media(max-width:600px) { .period-panel {padding:18px;} .period-panel .field {flex-basis:100%;} .period-panel .btn {white-space:normal;} }
.verification-page .content { max-width:1100px; margin:0 auto; padding-top:clamp(28px,6vw,80px); }
.verification-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; align-items:start; }
.verification-layout > * { min-width:0; }
.verification-symbol { display:grid; place-items:center; width:58px; height:58px; background:var(--ui-accent-surface); color:var(--teal); border-radius:16px; font-size:32px; margin-bottom:26px; }
.verification-card h1 { font-size:clamp(25px,4vw,34px); margin:12px 0 18px; }
.verification-card p, .verification-steps { color:var(--muted); line-height:1.7; overflow-wrap:anywhere; }
.verification-card strong { color:var(--ink); }
.verification-steps { padding-left:22px; margin:22px 0; }
.verification-actions { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin:22px 0 12px; }
.verification-actions .btn { white-space:normal; }
.verification-inbox .security-message { grid-template-columns:40px minmax(0,1fr); }
.verification-inbox .security-message strong { overflow-wrap:anywhere; }
@media(max-width:760px) { .verification-layout {grid-template-columns:minmax(0,1fr);} .verification-page .page-footer {display:block;} .verification-card {padding:24px;} }
