:root {
    --ink: #17202b;
    --muted: #687580;
    --subtle: #9aa5ad;
    --line: #e1e6ea;
    --line-soft: #eef1f3;
    --canvas: #f7f8fa;
    --paper: #fff;
    --teal: #42aaf5;
    --teal-dark: #307ab1;
    --teal-soft: #e8f5fe;
    --nav: #fff;
    --nav-muted: #63707b;
    --coral: #d46e5a;
    --amber: #b87817;
    --focus-ring: rgba(66, 170, 245, .22);
    --shadow: 0 1px 3px rgba(25, 42, 52, .04), 0 10px 28px rgba(25, 42, 52, .035);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--teal-dark); font-weight: 750; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; }
.workspace-shell { background: var(--canvas); }

/* Shared navigation */
.sidebar { width: 224px; height: 100vh; height: 100dvh; flex: 0 0 224px; padding: 20px 13px 16px; position: sticky; top: 0; color: var(--ink); background: var(--nav); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.sidebar-close, .mobile-menu-toggle { display: none; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: #fff; background: var(--teal); font-size: 12px; font-weight: 900; letter-spacing: -.08em; }
.brand-name { font-size: 15px; font-weight: 850; }
.brand small { display: none; }
.sidebar-company { min-width: 0; display: flex; gap: 9px; align-items: center; margin: 29px 5px 20px; padding: 10px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd; }
.sidebar-company > div { min-width: 0; flex: 1; }
.sidebar-company strong { display: -webkit-box; margin-top: 2px; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 11px; line-height: 1.3; }
.company-avatar { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 8px; color: var(--teal-dark); background: var(--teal-soft); font-size: 10px; font-weight: 900; }
.nav-links { min-height: 0; display: grid; align-content: start; gap: 2px; overflow-y: auto; padding-right: 2px; }
.nav-group { display: grid; gap: 3px; }
.nav-group-last { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); }
.nav-group-label { margin: 0 11px 5px; color: #9aa5ad; text-transform: uppercase; letter-spacing: .13em; font-size: 9px; font-weight: 850; }
.nav-links a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; color: var(--nav-muted); font-size: 12px; font-weight: 700; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: #f0f3f6; text-decoration: none; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; display: inline-flex; align-items: center; justify-content: center; color: #85919a; }
.nav-links a.active .nav-icon { color: var(--teal); }
.sidebar-footer { margin-top: auto; padding: 15px 7px 0; border-top: 1px solid var(--line); }
.sidebar-user { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 13px; }
.sidebar-user > div { min-width: 0; display: grid; }
.sidebar-user strong, .sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 11px; }
.sidebar-user span { color: var(--muted); font-size: 10px; }
.sidebar-settings { display: flex; align-items: center; gap: 9px; padding: 8px 10px; color: var(--muted); font-size: 11px; }
.sidebar-settings:hover { color: var(--ink); text-decoration: none; }
.avatar { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 50%; color: var(--teal-dark); background: var(--teal-soft); font-size: 11px; font-weight: 850; }

/* Page frame */
.main-content { min-width: 0; flex: 1 1 auto; width: 100%; padding: 20px clamp(20px, 3.5vw, 50px) 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 53px; margin-bottom: 29px; border-bottom: 1px solid var(--line); }
.topbar-left, .topbar-actions { min-width: 0; display: flex; align-items: center; gap: 14px; }
.sidebar-backdrop { display: none; }
.topbar-context { min-width: 0; }
.topbar-context h1 { max-width: clamp(160px, 32vw, 440px); margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.025em; font-size: 13px; line-height: 1.1; }
.eyebrow { color: #7c8992; text-transform: uppercase; letter-spacing: .15em; font-size: 9px; font-weight: 900; }
.topbar-company-form { display: flex; align-items: center; gap: 7px; }
.topbar-company-form select { min-width: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 31px 8px 10px; color: var(--ink); background: var(--paper); }
.profile-menu { position: relative; }
.profile-menu summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.chevron { color: var(--muted); font-size: 17px; }
.profile-menu-popover { position: absolute; z-index: 20; top: calc(100% + 12px); right: 0; width: 215px; max-width: calc(100vw - 24px); padding: 8px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.profile-menu-header { display: grid; gap: 1px; padding: 9px 10px 11px; border-bottom: 1px solid var(--line-soft); }
.profile-menu-header span { color: var(--muted); overflow-wrap: anywhere; font-size: 11px; }
.profile-menu-popover a, .profile-menu-popover button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; text-align: left; font-weight: 700; }
.profile-menu-popover a:hover, .profile-menu-popover button:hover { background: var(--canvas); text-decoration: none; }
.lucide { width: 18px; height: 18px; display: block; }
.sidebar-settings .lucide { width: 16px; height: 16px; }
.chevron .lucide { width: 15px; height: 15px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 25px; }
.page-header > div:first-child { min-width: 0; flex: 1 1 24rem; }
.page-header h2 { margin: 4px 0 0; overflow-wrap: anywhere; letter-spacing: -.055em; font-size: clamp(27px, 3.5vw, 37px); line-height: 1.07; }
.page-header p { max-width: 680px; margin: 9px 0 0; color: var(--muted); }
.page-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; flex: 0 1 auto; flex-wrap: wrap; gap: 9px; }
.page-actions form { min-width: 0; display: inline-flex; }
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 15px; margin-bottom: 20px; border-radius: 10px; font-size: 13px; }
.notice-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 20px; border-radius: 50%; color: inherit; border: 1px solid currentColor; font-size: 11px; font-weight: 900; }
.notice-success { color: #16624c; border: 1px solid #b9e5d1; background: #e3f6ed; }
.notice-info { color: #315966; border: 1px solid #c9dce3; background: #e9f2f5; }
.notice-error { color: #9d4433; border: 1px solid #f0c5b9; background: #fff1ed; }

/* Controls and panels */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 9px 14px; border: 0; border-radius: 9px; font-weight: 800; line-height: 1.25; text-align: center; text-decoration: none; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); text-decoration: none; }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { color: #fff; background: var(--teal-dark); }
.button-secondary { color: var(--ink); border: 1px solid var(--line); background: #fff; }
.button-secondary:hover { background: #f7fbfa; }
.button-danger { color: #a34537; border: 1px solid #efc8c0; background: #fff6f4; }
.button-quiet { color: var(--teal-dark); background: var(--teal-soft); }
.panel { min-width: 0; scroll-margin-top: 20px; padding: clamp(18px, 2.6vw, 25px); border: 1px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 20px; }
.panel-heading { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 17px; margin-bottom: 0; border-bottom: 1px solid var(--line-soft); }
.panel-heading > div:first-child { min-width: 0; flex: 1; }
.panel-heading h3, .panel h3 { margin: 0; overflow-wrap: anywhere; letter-spacing: -.025em; font-size: 17px; }
.panel-heading > a, .panel-heading > .status, .panel-heading > .security-label { flex: 0 0 auto; }
.panel-heading p, .panel p { color: var(--muted); }
.panel-heading p { margin: 4px 0 0; font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-width: 0; position: relative; overflow: hidden; padding: 16px 17px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(25,42,52,.025); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 750; }
.stat-value { display: block; margin-top: 9px; letter-spacing: -.04em; font-size: 25px; font-weight: 850; }
.stat-note { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 9px; padding: 13px; margin: 20px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.toolbar .field { min-width: 135px; min-inline-size: 0; flex: 1 1 150px; }
.toolbar .field-wide { min-width: 210px; flex: 2 1 260px; }
.toolbar .button { min-height: 46px; }
.toolbar.is-searching { cursor: progress; }
.toolbar.is-searching input[type="search"], .data-panel[aria-busy="true"] { opacity: .65; }
.filter-menu { position: relative; flex: 0 0 auto; }
.filter-trigger { list-style: none; cursor: pointer; }
.filter-trigger::-webkit-details-marker { display: none; }
.filter-trigger .lucide { width: 17px; height: 17px; }
.filter-count { min-width: 20px; min-height: 20px; display: inline-grid; place-items: center; padding: 0 5px; border-radius: 999px; color: #fff; background: var(--teal); font-size: 10px; line-height: 1; }
.filter-menu-panel { position: absolute; z-index: 30; top: calc(100% + 9px); right: 0; width: min(560px, calc(100vw - 40px)); padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: 0 16px 38px rgba(25, 58, 61, .17); }
.filter-menu-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding-bottom: 13px; margin-bottom: 15px; border-bottom: 1px solid var(--line-soft); }
.filter-menu-heading strong { font-size: 14px; }
.filter-menu-heading span { color: var(--muted); font-size: 11px; }
.filter-menu-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.filter-menu-fields .field { min-width: 0; }
.range-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 20px 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.range-summary strong { margin-right: auto; font-size: 14px; }
.field { min-width: 0; display: grid; gap: 5px; }
.field > span { color: #52666a; font-size: 12px; font-weight: 850; line-height: 1.25; }
.field b { color: var(--coral); }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 46px; border: 1px solid #c8d8d5; border-radius: 9px; padding: 11px 12px; color: var(--ink); outline: 0; background: #fcfefd; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.field textarea { min-height: 108px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--focus-ring); background: #fff; }
.field input::placeholder, .field textarea::placeholder { color: #899697; opacity: 1; }
.theme-color-field { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.theme-color-control { display: flex; align-items: center; gap: 12px; }
.theme-color-control > input[type="color"] { width: 48px; height: 48px; flex: 0 0 48px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.theme-color-control > label { min-width: 0; display: grid; gap: 2px; flex: 1; cursor: pointer; }
.theme-color-control > label strong { font-size: 13px; }
.theme-color-control > label small { color: var(--muted); font-size: 11px; font-weight: 500; }
.theme-color-reset { min-height: 35px; }
.secret-field > label { display: grid; gap: 5px; }
.secret-status { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin-top: 2px; }
.secret-clear { min-height: 24px; color: #a34537; font-size: 11px; }
.field-help { color: var(--muted); overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal); }
.product-autocomplete, .customer-autocomplete { position: relative; }
.product-suggestions { position: absolute; z-index: 15; top: calc(100% - 2px); right: 0; left: 0; max-height: 250px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); box-shadow: 0 14px 30px rgba(25, 58, 61, .15); }
.product-suggestion { width: 100%; display: grid; gap: 2px; padding: 9px 10px; border: 0; border-radius: 7px; color: var(--ink); background: transparent; text-align: left; }
.product-suggestion:hover, .product-suggestion.is-active { background: var(--teal-soft); }
.product-suggestion strong { font-size: 12px; }
.product-suggestion span, .product-suggestion-empty { color: var(--muted); font-size: 11px; }
.product-suggestion-empty { padding: 10px; }
.invoice-editor { display: grid; gap: 20px; }
.invoice-lines-panel { padding-top: 0; }
.invoice-lines-panel .panel-heading { padding-top: clamp(19px, 3vw, 28px); }
.invoice-line { position: relative; min-width: 0; padding: 18px; margin: 16px 0 0; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfc; }
.invoice-line legend { padding: 0 6px; color: var(--muted); font-size: 11px; font-weight: 850; }
.invoice-line-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 13px; align-items: end; }
.invoice-line-grid > * { min-width: 0; grid-column: span 3; }
.invoice-line-grid .product-autocomplete, .invoice-line-grid .line-description { grid-column: span 6; }
.line-remove { min-height: 44px; padding: 8px; position: absolute; top: 4px; right: 6px; border: 0; color: #a14537; background: transparent; font-size: 11px; font-weight: 800; }
.line-live-total { min-width: 0; display: grid; gap: 5px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.line-live-total span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.line-live-total strong { font-size: 15px; }
.invoice-totals, .invoice-summary { display: grid; justify-content: end; gap: 0; margin-top: 20px; }
.invoice-totals { max-width: 330px; margin-left: auto; }
.invoice-totals > div, .invoice-summary > div { display: flex; justify-content: space-between; gap: 35px; padding: 8px 0; }
.invoice-totals span, .invoice-summary span { color: var(--muted); }
.invoice-grand-total { padding-top: 13px !important; margin-top: 5px; border-top: 2px solid var(--ink); font-size: 18px; }
.form-card { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.form-grid > * { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
.form-section + .form-section { padding-top: 25px; margin-top: 25px; border-top: 1px solid var(--line-soft); }
.form-section-heading { margin-bottom: 17px; }
.form-section-heading h3 { margin: 0; letter-spacing: -.02em; font-size: 17px; }
.form-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.document-fields, .simple-line-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px 20px; }
.document-fields > *, .simple-line-grid > * { min-width: 0; }
.document-fields > * { grid-column: span 4; }
.document-fields > :nth-child(-n+2) { grid-column: span 6; }
.simple-line-grid > * { grid-column: span 4; }
.simple-line-grid .product-autocomplete, .simple-line-grid > :nth-child(2) { grid-column: span 6; }
.simple-line-grid + .callout { margin-top: 18px; }
.account-form { width: 100%; }
.account-form .password-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px 24px; }
.inline-entry-form, .scan-form { display: grid; gap: 18px; padding: 18px; margin-top: 18px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfc; }
.inline-entry-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 18px; }
.inline-entry-actions, .scan-form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.scan-form { grid-template-columns: minmax(0, 1fr); }
.scan-form .field { max-width: 720px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding-top: 19px; margin-top: 21px; border-top: 1px solid var(--line-soft); }
.payment-form { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 18px 16px; padding: 20px; margin-top: 18px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfc; }
.payment-field { min-width: 0; grid-column: span 3; }
.payment-notes { grid-column: span 9; }
.payment-notes textarea { min-height: 88px; }
.payment-submit { grid-column: span 3; width: 100%; min-height: 46px; }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--ink); font-weight: 700; }
.check-field input { width: 17px; height: 17px; accent-color: var(--teal); }

/* Data presentation */
.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; min-width: 620px; border-collapse: collapse; }
.data-table th { padding: 11px 12px; color: #7d8c8e; border-bottom: 1px solid var(--line); text-align: left; text-transform: uppercase; letter-spacing: .09em; font-size: 9px; font-weight: 900; white-space: nowrap; }
.data-table td { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; overflow-wrap: anywhere; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td:first-child, .data-table th:first-child { padding-left: 4px; }
.data-table td:last-child, .data-table th:last-child { padding-right: 4px; text-align: right; }
.clickable-row { cursor: pointer; }
.clickable-row td { transition: background .15s ease, box-shadow .15s ease; }
.clickable-row:hover td, .clickable-row:focus-within td { background: var(--teal-soft); }
.clickable-row:focus-within td { box-shadow: inset 0 2px 0 var(--teal), inset 0 -2px 0 var(--teal); }
.clickable-row:focus-within td:first-child { box-shadow: inset 2px 2px 0 var(--teal), inset 0 -2px 0 var(--teal); }
.clickable-row:focus-within td:last-child { box-shadow: inset 0 2px 0 var(--teal), inset -2px -2px 0 var(--teal); }
.row-access-link:focus-visible { outline: 0; }
.primary-cell { display: grid; gap: 1px; }
.primary-cell strong { color: var(--ink); overflow-wrap: anywhere; }
.secondary-cell { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.row-actions a { font-size: 12px; }
.row-actions form { display: inline-flex; }
.row-actions .button { min-height: 31px; padding: 5px 9px; font-size: 11px; }
.row-switch-form { display: inline-flex; }
.row-switch-form .button { min-height: 31px; padding: 5px 9px; font-size: 11px; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 99px; font-size: 10px; font-weight: 850; white-space: nowrap; }
.status-draft { color: #647377; background: #edf1f1; }
.status-approved { color: #8a6119; background: #fff3d6; }
.status-sent, .status-partially_paid { color: #385ea0; background: #e9effb; }
.status-paid { color: #1d765e; background: #e2f5ec; }
.status-overdue, .status-cancelled, .status-void { color: #a14537; background: #fff0ed; }
.status-active { color: #1d765e; background: #e2f5ec; }
.status-inactive { color: #737d7f; background: #edf0ef; }
.role-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 99px; color: var(--teal-dark); background: var(--teal-soft); font-size: 10px; font-weight: 850; }
.role-owner { color: #945718; background: #fce9cf; }
.role-admin { color: #455a9b; background: #e7ebfc; }
.role-staff { color: #177267; background: #e1f3ee; }
.security-label { color: var(--teal-dark); font-size: 11px; font-weight: 800; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 18px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 7px; }
.pagination-button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font-size: 12px; }
.pagination-button:hover { background: var(--canvas); text-decoration: none; }
.pagination-button.disabled { color: #b3bdbd; background: #f8faf9; }
.empty-state { display: grid; justify-items: center; padding: 46px 20px 38px; color: var(--muted); text-align: center; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 14px; color: var(--teal-dark); background: var(--teal-soft); font-size: 22px; }
.empty-state h3 { margin: 0; color: var(--ink); font-size: 17px; }
.empty-state p { max-width: 410px; margin: 6px 0 17px; }
.empty-action { display: flex; gap: 8px; }
.loading-state { display: grid; gap: 13px; padding: 20px 0; }
.loading-state span { display: block; height: 17px; border-radius: 6px; background: linear-gradient(90deg, #f0f4f3 25%, #e5ecea 45%, #f0f4f3 65%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* Dashboard and detail layouts */
.welcome-band { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.welcome-band > div:first-child { min-width: 0; flex: 1 1 24rem; }
.welcome-band h2 { margin: 3px 0 0; overflow-wrap: anywhere; letter-spacing: -.055em; font-size: clamp(28px, 3.5vw, 40px); }
.welcome-band p { margin: 8px 0 0; color: var(--muted); }
.stat-grid { margin-bottom: 20px; }
.activity-list { display: grid; }
.activity-row { min-width: 0; display: grid; grid-template-columns: 33px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 8px; border-bottom: 1px solid var(--line-soft); border-radius: 8px; color: var(--ink); }
.activity-row:hover { color: var(--teal-dark); text-decoration: none; background: var(--teal-soft); }
.activity-row:last-child { border-bottom: 0; }
.activity-mark { width: 33px; height: 33px; display: grid; place-items: center; flex: 0 0 33px; border-radius: 10px; color: var(--teal-dark); background: var(--teal-soft); font-weight: 850; }
.activity-copy { min-width: 0; display: grid; flex: 1; }
.activity-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.amount, .stat-value, .invoice-summary, .invoice-totals, .data-table { font-variant-numeric: tabular-nums; }
.amount { font-weight: 850; white-space: nowrap; }
.quick-links { display: grid; }
.quick-link { display: flex; align-items: center; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.quick-link:last-child { border-bottom: 0; }
.quick-link:hover { color: var(--teal-dark); text-decoration: none; }
.quick-link > span:nth-child(2) { display: grid; flex: 1; gap: 1px; }
.quick-link small { color: var(--muted); font-size: 11px; font-weight: 500; }
.quick-link b { color: var(--teal); font-size: 17px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(240px, .8fr); gap: 20px; }
.detail-list { display: grid; gap: 0; }
.detail-item { min-width: 0; display: grid; grid-template-columns: minmax(7rem, .8fr) minmax(0, 1.2fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.detail-item:last-child { border-bottom: 0; }
.detail-item span { color: var(--muted); }
.detail-item strong { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.summary-total { display: flex; justify-content: space-between; padding-top: 14px; margin-top: 9px; border-top: 2px solid var(--ink); }
.line-items { margin-top: 17px; }
.line-items .data-table { min-width: 520px; }
.callout { padding: 14px; border-radius: 10px; color: #315966; background: #e9f2f5; overflow-wrap: anywhere; }
.callout strong { display: block; margin-bottom: 3px; }
.note-callout { margin-top: 18px; }
.danger-panel { border-color: #efc8c0; background: #fffaf9; }
.danger-panel .panel-heading { border-color: #f2d9d2; }
.delete-confirm-row { display: flex; align-items: end; gap: 12px; padding-top: 18px; }
.delete-confirm-row .field { flex: 1; }
.member-list { display: grid; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.member-row:last-child { border-bottom: 0; }
.member-info { display: grid; gap: 1px; min-width: 0; }
.member-info span { color: var(--muted); font-size: 12px; }
.report-bars { display: grid; gap: 17px; padding-top: 18px; }
.report-bar { display: grid; grid-template-columns: 76px minmax(20px, 1fr) auto; align-items: center; gap: 10px; font-size: 12px; font-weight: 750; }
.report-bar b { display: block; width: 4%; min-width: 5px; height: 10px; border-radius: 999px; background: var(--teal); transition: width .25s ease; }
.report-bar strong { font-size: 12px; }
.report-navigation { display: grid; gap: 12px; margin-bottom: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: var(--shadow); }
.report-year-navigation, .report-view-navigation { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.report-year-navigation > div { min-width: 150px; display: grid; justify-items: center; gap: 1px; margin: 0 auto; text-align: center; }
.report-year-navigation > div strong { font-size: 17px; }
.report-year-navigation > div small { color: var(--muted); }
.report-view-navigation { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.report-view-navigation > span { color: var(--muted); font-size: 12px; font-weight: 750; }
.report-view-navigation nav { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); }
.report-period-link { min-width: 70px; padding: 7px 11px; border-radius: 7px; color: var(--muted); text-align: center; font-size: 12px; }
.report-period-link:hover { color: var(--ink); text-decoration: none; }
.report-period-link.active { color: #fff; background: var(--teal); }
.report-view-navigation > .button { margin-left: auto; }
.report-graphics { margin-bottom: 20px; }
.report-graphic-panel { overflow: hidden; }
.report-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.report-legend::before { width: 9px; height: 9px; border-radius: 3px; content: ""; }
.report-legend-revenue::before { background: #42aaf5; }
.report-legend-expense::before { background: #ee8c5d; }
.report-chart { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; padding: 19px 4px 19px 0; }
.report-chart-row { display: grid; grid-template-columns: minmax(88px, 120px) minmax(80px, 1fr) auto; align-items: center; gap: 10px; font-size: 11px; }
.report-chart-row > span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.report-chart-row > strong { min-width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.report-chart-track { height: 12px; overflow: hidden; border-radius: 999px; background: var(--line-soft); }
.report-chart-fill { display: block; min-width: 3px; height: 100%; border-radius: inherit; }
.report-chart-revenue { background: linear-gradient(90deg, #42aaf5, #70c5ff); }
.report-chart-expense { background: linear-gradient(90deg, #df7652, #f3aa68); }
.report-chart-empty { padding: 22px 0; }
.report-graphic-panel .table-wrap { max-height: 360px; overflow: auto; border-top: 1px solid var(--line-soft); }
.tips-list { display: grid; gap: 12px; padding-left: 19px; color: var(--muted); }
.muted { color: var(--muted); }

/* Authentication */
.auth-content { width: 100%; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 28px 18px; background: radial-gradient(circle at 15% 10%, #e1f5ed 0, transparent 30%), var(--canvas); }
.auth-card { width: min(100%, 442px); padding: clamp(25px, 6vw, 43px); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; color: var(--teal-dark); }
.auth-card h1 { margin: 0 0 9px; letter-spacing: -.055em; font-size: 32px; line-height: 1.08; }
.lead { margin: 0 0 27px; color: var(--muted); }
.form-stack { display: grid; gap: 16px; }
.form-meta { margin-top: -5px; text-align: right; font-size: 12px; }
.auth-footer { padding-top: 19px; margin-top: 27px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 13px; }
.error-state { width: min(100%, 500px); margin: 10vh auto; padding: 45px 25px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.error-state h1 { margin: 20px 0 8px; letter-spacing: -.04em; }
.error-state p { margin: 0 0 24px; color: var(--muted); }

@media (max-width: 1100px) {
    .main-content { padding-right: 28px; padding-left: 28px; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .invoice-line-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .invoice-line-grid > *, .invoice-line-grid .product-autocomplete, .invoice-line-grid .line-description { grid-column: auto; }
    .line-remove { position: static; padding: 0; margin: 0 0 12px; }
}
@media (max-width: 920px) {
    .app-shell { flex-direction: row; }
    .sidebar { width: min(292px, 88vw); height: 100vh; height: 100dvh; min-height: 0; flex: 0 0 min(292px, 88vw); padding: 20px 13px 16px; position: fixed; z-index: 60; top: 0; left: 0; overflow-y: auto; box-shadow: 18px 0 42px rgba(23, 32, 43, .18); transform: translateX(-105%); transition: transform .22s ease; }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-close { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; }
    .sidebar-close:hover { color: var(--ink); background: var(--canvas); }
    .sidebar-close .lucide { width: 18px; height: 18px; }
    .sidebar-backdrop { display: block; position: fixed; z-index: 50; inset: 0; background: rgba(23, 32, 43, .42); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
    .sidebar-backdrop.is-visible { opacity: 1; pointer-events: auto; }
    .mobile-menu-toggle { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 42px; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; }
    .mobile-menu-toggle:hover { background: var(--canvas); }
    .mobile-menu-toggle .lucide { width: 19px; height: 19px; }
    body.sidebar-open { overflow: hidden; }
    .main-content { width: 100%; padding-top: 17px; }
    .topbar { margin-bottom: 27px; }
    .nav-links a, .sidebar-settings { min-height: 44px; }
    .page-header, .welcome-band { display: block; }
    .page-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); justify-content: stretch; width: 100%; margin-top: 16px; }
    .page-actions form { display: flex; }
    .page-actions .button, .page-actions form .button { width: 100%; min-width: 0; }
    .payment-field { grid-column: span 6; }
    .payment-notes { grid-column: 1 / -1; }
    .payment-submit { grid-column: 1 / -1; justify-self: end; width: min(100%, 320px); }
}
@media (max-width: 700px) {
    .main-content { padding: 13px max(16px, env(safe-area-inset-right)) max(42px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
    .topbar { min-height: 50px; gap: 10px; margin-bottom: 23px; }
    .topbar-actions { gap: 8px; }
    .topbar-company-form { display: none; }
    .profile-name { display: none; }
    .topbar-context h1 { max-width: min(52vw, 240px); }
    .page-header h2, .welcome-band h2 { font-size: 30px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 21px; }
    .toolbar { align-items: stretch; }
    .toolbar .field, .toolbar .field-wide { min-width: 100%; }
    .toolbar .button { width: 100%; min-height: 44px; }
    .toolbar .filter-menu { width: 100%; }
    .toolbar .filter-menu .filter-trigger { width: 100%; }
    .filter-menu-panel { right: 0; left: 0; width: auto; }
    .filter-menu-fields { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: auto; }
    .document-fields, .simple-line-grid, .account-form .password-fields, .inline-entry-main { grid-template-columns: 1fr; }
    .document-fields > *, .document-fields > :nth-child(-n+2), .simple-line-grid > *, .simple-line-grid .product-autocomplete, .simple-line-grid > :nth-child(2) { grid-column: 1; }
    .form-section + .form-section { padding-top: 21px; margin-top: 21px; }
    .inline-entry-form, .scan-form { padding: 17px; }
    .inline-entry-actions, .scan-form-actions { align-items: stretch; flex-direction: column; }
    .inline-entry-actions .button, .scan-form-actions .button { width: 100%; min-height: 44px; }
    .payment-form { grid-template-columns: 1fr; padding: 17px; }
    .payment-field, .payment-notes, .payment-submit { grid-column: 1; }
    .payment-submit { width: 100%; min-height: 44px; }
    .theme-color-control { align-items: stretch; flex-wrap: wrap; }
    .theme-color-control > label { min-width: calc(100% - 64px); justify-content: center; }
    .theme-color-reset { width: 100%; min-height: 44px; }
    .form-actions { justify-content: stretch; flex-direction: column; }
    .form-actions .button { width: 100%; min-height: 44px; }
    .delete-confirm-row { align-items: stretch; flex-direction: column; }
    .delete-confirm-row .button { width: 100%; }
    .panel { padding: 17px; }
    .panel-heading { flex-wrap: wrap; }
    .panel-heading .page-actions { margin-top: 11px; }
    .detail-layout { grid-template-columns: 1fr; }
    .invoice-line-grid { grid-template-columns: 1fr; }
    .invoice-line-grid > *, .invoice-line-grid .product-autocomplete, .invoice-line-grid .line-description { grid-column: auto; }
    .invoice-line { padding: 16px; }
    .line-remove { position: static; padding: 0; margin: 0 0 12px; }
    .pagination { align-items: stretch; flex-direction: column; }
    .pagination > div { justify-content: space-between; }
    .pagination-button { flex: 1; text-align: center; }
    .pagination-button, .row-actions .button, .row-switch-form .button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .line-remove { min-width: 44px; margin-left: auto; }
    .report-year-navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-year-navigation > div { grid-column: 1 / -1; grid-row: 1; width: 100%; }
    .report-year-navigation .button { width: 100%; }
    .report-view-navigation { align-items: stretch; flex-direction: column; }
    .report-view-navigation nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-period-link { min-width: 0; }
    .report-view-navigation > .button { width: 100%; margin-left: 0; }
    .report-chart-row { grid-template-columns: minmax(75px, 95px) minmax(60px, 1fr); }
    .report-chart-row > strong { grid-column: 2; min-width: 0; margin-top: -6px; text-align: left; }
}
@media (max-width: 480px) {
    .grid-4 { grid-template-columns: 1fr; }
    .activity-row { grid-template-columns: 33px minmax(0, 1fr); align-items: start; }
    .activity-copy span { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
    .activity-row > .amount { grid-column: 2; justify-self: start; margin-top: -7px; }
    .detail-item { grid-template-columns: 1fr; gap: 3px; }
    .detail-item strong { text-align: left; }
    .panel-heading > a, .panel-heading > .status, .panel-heading > .security-label { margin-top: 2px; }
    .invoice-totals, .invoice-summary { width: 100%; max-width: none; }
    .invoice-totals > div, .invoice-summary > div { min-width: 0; gap: 18px; }
    .invoice-totals span, .invoice-summary span { overflow-wrap: anywhere; }
    .table-wrap { margin-right: -4px; padding-bottom: 3px; }
}
@media (max-width: 380px) {
    .main-content { padding-right: 12px; padding-left: 12px; }
    .grid-4 { grid-template-columns: 1fr; }
    .page-actions { display: grid; grid-template-columns: 1fr; }
    .page-actions .button { width: 100%; }
    .panel { padding: 16px; border-radius: 9px; }
    .panel + .panel { margin-top: 14px; }
    .welcome-band h2, .page-header h2 { font-size: 27px; }
}

/* Reame form system */
.panel,
.toolbar,
.stat-card {
    border-color: #dfe5eb;
    border-radius: 13px;
    box-shadow: 0 1px 2px rgba(23, 32, 43, .025), 0 8px 24px rgba(23, 32, 43, .025);
}

.page-header h2,
.welcome-band h2 {
    color: #162033;
}

.field > span {
    color: #344054;
    font-size: 12px;
    font-weight: 750;
}

.field input,
.field select,
.field textarea {
    border-color: #d7dee6;
    background: #fff;
    border-radius: 8px;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #b9c5d0;
}

.gst-registration-field {
    padding: 16px;
    border: 1px solid #dfe5eb;
    border-radius: 11px;
    background: #fbfcfe;
}

.gst-registration-field select {
    max-width: 520px;
}

.gst-registration-field .field-help {
    max-width: 720px;
}

.button {
    border-radius: 8px;
    min-height: 40px;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.button-primary {
    box-shadow: 0 3px 9px rgba(66, 170, 245, .18);
}

.data-table th {
    color: #667085;
}

/* Invoice editor */
.invoice-editor-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 4px 0 27px;
}

.invoice-editor-header-main {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 17px;
}

.invoice-editor-header-main > div {
    min-width: 0;
}

.invoice-back-link {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    margin-top: 2px;
    border-radius: 8px;
    color: #344054;
}

.invoice-back-link:hover {
    color: var(--teal-dark);
    background: var(--teal-soft);
    text-decoration: none;
}

.invoice-back-link .lucide {
    width: 19px;
    height: 19px;
}

.invoice-editor-header h2 {
    margin: 4px 0 0;
    color: #162033;
    letter-spacing: -.055em;
    font-size: clamp(29px, 3.5vw, 39px);
    line-height: 1.05;
}

.invoice-editor-header p {
    max-width: 600px;
    margin: 8px 0 0;
    color: var(--muted);
}

.invoice-editor-header-meta {
    display: grid;
    justify-items: end;
    gap: 2px;
    padding-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 800;
}

.invoice-editor-header-meta strong {
    color: var(--ink);
    font-size: 18px;
    letter-spacing: -.02em;
}

.invoice-editor {
    gap: 22px;
}

.invoice-editor-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(290px, .82fr);
    align-items: stretch;
    gap: 22px;
}

.invoice-editor-overview .panel {
    min-width: 0;
    margin: 0;
}

.invoice-details-panel,
.invoice-summary-panel {
    padding: 24px;
}

.invoice-details-panel .panel-heading,
.invoice-summary-panel .panel-heading {
    padding-bottom: 18px;
    margin-bottom: 21px;
}

.invoice-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px 18px;
}

.invoice-details-grid > * {
    min-width: 0;
}

.invoice-details-grid > .customer-autocomplete,
.invoice-details-grid > .field:last-child {
    grid-column: 1 / -1;
}

.invoice-details-grid .field textarea {
    min-height: 92px;
}

.invoice-details-grid .field-help {
    font-size: 11px;
}

.invoice-summary-panel {
    background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
}

.invoice-summary-panel .invoice-summary {
    width: 100%;
    max-width: none;
    margin-top: 0;
}

.invoice-summary-panel .invoice-summary > div {
    padding: 11px 0;
}

.invoice-summary-panel .invoice-summary span {
    color: #667085;
}

.invoice-summary-panel .invoice-summary span small {
    color: #98a2b3;
    font-size: 11px;
}

.invoice-summary-panel .invoice-grand-total {
    padding-top: 19px !important;
    margin-top: 11px;
    border-top: 1px solid #dfe5eb;
    font-size: 19px;
}

.invoice-summary-panel .invoice-grand-total span,
.invoice-summary-panel .invoice-grand-total strong {
    color: #162033;
    font-weight: 800;
}

.invoice-lines-panel {
    padding: 0 24px 24px;
}

.invoice-lines-panel .panel-heading {
    padding: 24px 0 19px;
    margin-bottom: 0;
}

.invoice-lines-panel .panel-heading h3 {
    margin-top: 3px;
}

.invoice-lines-panel .panel-heading .eyebrow {
    display: block;
}

.invoice-lines-panel .panel-heading .button {
    min-height: 38px;
}

.invoice-lines-panel .panel-heading .button .lucide {
    width: 16px;
    height: 16px;
}

.invoice-line {
    padding: 20px;
    margin: 16px 0 0;
    border-color: #dfe5eb;
    border-radius: 11px;
    background: #fbfcfe;
    box-shadow: none;
}

.invoice-line legend {
    padding: 0 7px;
    color: #344054;
    font-size: 11px;
    letter-spacing: .01em;
}

.invoice-line-grid {
    grid-template-columns:
        minmax(240px, 4fr)
        minmax(132px, 1.75fr)
        minmax(118px, 1.65fr)
        minmax(72px, .9fr)
        minmax(94px, 1.15fr)
        minmax(96px, 1.15fr);
    gap: 14px 9px;
    align-items: start;
}

.invoice-line-grid > * {
    min-width: 0;
    grid-column: auto;
}

.invoice-line-grid .product-autocomplete,
.invoice-line-grid .line-description {
    grid-column: auto;
}

.invoice-line-grid .field > span,
.line-live-total > span {
    min-height: 16px;
    display: flex;
    align-items: center;
}

.invoice-line-grid .field > input,
.invoice-line-grid .field > select,
.line-live-total {
    min-height: 40px;
    height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.line-quantity-control {
    position: relative;
}

.quantity-value-slot {
    min-width: 0;
    height: 40px;
}

.quantity-value-slot > input {
    width: 100%;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.quantity-value-slot > input[hidden] {
    display: none;
}

.quantity-toggle {
    height: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    margin-top: -1px;
    border: 1px solid #d7dee6;
    border-radius: 0 0 6px 6px;
    background: #fff;
}

.quantity-toggle button {
    min-width: 0;
    padding: 2px 8px;
    border: 0;
    color: #667085;
    background: #fff;
    font-size: 10px;
    line-height: 1;
}

.quantity-toggle button + button {
    border-left: 1px solid #d7dee6;
}

.quantity-toggle button.is-active {
    color: #fff;
    background: #162033;
    font-weight: 800;
}

.line-quantity-control > input,
.quantity-value-slot > input {
    border-radius: 8px 8px 0 0;
}

.invoice-line-grid .field-help {
    min-height: 16px;
    font-size: 10px;
}

.line-remove {
    top: 14px;
    right: 15px;
    min-height: 28px;
    padding: 4px 7px;
    border-radius: 6px;
}

.line-remove:hover {
    background: #fff0ed;
}

.line-live-total {
    min-height: 40px;
    height: auto;
    align-content: start;
    padding: 8px 11px;
    border-color: transparent;
    border-radius: 8px;
    background: transparent;
}

.line-live-total span {
    color: #667085;
}

.line-live-total strong {
    color: #162033;
    padding-top: 2px;
    font-size: 14px;
}

.invoice-editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 2px 2px 0;
}

.invoice-editor-actions .form-actions {
    padding: 0;
    margin: 0;
    border: 0;
}

.invoice-editor-action-note {
    color: #98a2b3;
    font-size: 11px;
}

@media (max-width: 900px) {
    .invoice-editor-overview {
        grid-template-columns: 1fr;
    }

    .invoice-summary-panel {
        order: -1;
    }

    .invoice-line-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }

    .invoice-line-grid .line-description {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .invoice-editor-header {
        align-items: flex-start;
        margin-bottom: 21px;
    }

    .invoice-editor-header-meta {
        display: none;
    }

    .invoice-editor-header-main {
        gap: 9px;
    }

    .invoice-editor-header h2 {
        font-size: 30px;
    }

    .invoice-editor-header p {
        font-size: 12px;
    }

    .invoice-details-panel,
    .invoice-summary-panel {
        padding: 18px;
    }

    .invoice-lines-panel {
        padding: 0 17px 17px;
    }

    .invoice-line {
        padding: 16px;
    }

    .invoice-line-grid {
        grid-template-columns: 1fr;
    }

    .invoice-line-grid .line-description {
        grid-column: auto;
    }

    .invoice-editor-actions {
        align-items: stretch;
        flex-direction: column-reverse;
        gap: 10px;
    }

    .invoice-editor-actions .form-actions {
        width: 100%;
    }
}

/* Statement export preview */
.statement-export {
    min-width: 0;
    padding: clamp(17px, 2.5vw, 23px);
    margin: 0 0 20px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--teal);
    border-radius: 11px;
    background: var(--paper);
    box-shadow: var(--shadow);
}
.statement-export-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}
.statement-export-header h3 { margin: 3px 0 0; letter-spacing: -.03em; font-size: 18px; }
.statement-export-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.statement-download { flex: 0 0 auto; }
.statement-export-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.statement-export-actions .button { min-height: 38px; padding: 8px 12px; font-size: 12px; }
.statement-export-body {
    display: grid;
    grid-template-columns: minmax(210px, .75fr) minmax(0, 1.6fr);
    gap: 22px;
    padding-top: 17px;
}
.statement-form { display: grid; align-content: start; gap: 12px; }
.statement-form > input[type="hidden"] { display: none; }
.statement-form .button { width: 100%; }
.statement-period-inputs { display: grid; gap: 10px; }
.statement-period-fields { min-width: 0; display: grid; gap: 10px; }
.statement-period-fields[hidden] { display: none !important; }
.statement-range-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.statement-week-range { display: block; margin-top: -5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.statement-status-help { margin: -6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.statement-preview { min-width: 0; }
.statement-preview-range {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--line-soft);
}
.statement-preview-range > span,
.statement-total > span { color: var(--muted); font-size: 11px; font-weight: 750; }
.statement-preview-range strong { text-align: right; font-size: 13px; }
.statement-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px 0; }
.statement-total {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}
.statement-total strong { overflow-wrap: anywhere; font-size: clamp(15px, 1.6vw, 20px); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.statement-total small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.statement-result { border-color: #cbe7dc; background: #eff8f3; }
.statement-result strong { color: #276e58; }
.statement-context {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding-top: 11px;
    border-top: 1px solid var(--line-soft);
}
.statement-context > span { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; color: var(--muted); font-size: 10px; }
.statement-context strong { color: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.statement-period-navigation {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}
.statement-period-navigation > span { color: var(--muted); font-size: 11px; font-weight: 750; text-align: center; }
.statement-period-navigation .button { min-height: 34px; padding: 7px 10px; font-size: 11px; }
.statement-footnote { margin: 14px 0 0; color: var(--muted); font-size: 10px; }

@media (max-width: 720px) {
    .statement-export-header { align-items: stretch; flex-direction: column; }
    .statement-export-header .statement-download { align-self: flex-start; }
    .statement-export-actions { width: 100%; }
    .statement-export-actions .button { flex: 1 1 auto; }
    .statement-export-body { grid-template-columns: minmax(0, 1fr); gap: 17px; }
    .statement-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .statement-form > .field, .statement-form > .statement-period-inputs, .statement-form > .statement-status-help, .statement-form > .statement-preview-button { grid-column: 1 / -1; }
    .statement-form .field { min-width: 0; }
    .statement-form .statement-preview-button { grid-column: 1 / -1; }
    .statement-totals { grid-template-columns: 1fr; gap: 7px; }
    .statement-total { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 8px; }
    .statement-total strong { text-align: right; }
    .statement-total small { grid-column: 1 / -1; }
    .statement-result strong { grid-column: 2; grid-row: 1; }
    .statement-period-navigation { flex-wrap: wrap; }
    .statement-period-navigation > span { order: -1; width: 100%; }
    .statement-period-navigation .button { flex: 1 1 40%; }
}