:root {
    --surface: #fff;
    --ink: #24272a;
    --muted: #62686d;
    --line: #dfe2e4;
    --anthracite: #292d30;
    --accent: #b34423;
    --content-width: 1440px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--ink); }
button, input { font: inherit; }
a, button, input { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link { position: absolute; top: -80px; left: 16px; padding: 10px; background: white; z-index: 10; }
.skip-link:focus { top: 8px; }
.header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner, .secondary-inner, .workspace { max-width: var(--content-width); margin: 0 auto; }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 58px; padding: 0 24px; }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.brand-logo { display: block; height: 42px; width: auto; }
.primary-navigation { display: flex; flex-wrap: wrap; column-gap: 44px; }
.nav-item { display: inline-flex; align-items: center; min-height: 42px; font-size: 12px; letter-spacing: .3px; text-transform: uppercase; font-weight: 400; color: white; text-decoration: none; }
[aria-disabled="true"] { cursor: default; }
.nav-item:hover, .nav-item[aria-current="page"] { color: white; background: #3b3f42; }
.secondary-bar { background: var(--anthracite); color: white; }
.secondary-inner { min-height: 42px; padding: 0 24px; }
.section-label { display: inline-flex; align-items: center; min-height: 42px; }
.account { display: flex; align-items: center; justify-content: flex-end; min-width: 0; gap: 28px; font-size: 13px; font-weight: 400; }
.account-name { max-width: 320px; overflow-wrap: anywhere; padding: 6px 0; }
.account form { margin: 0; flex-shrink: 0; }
.logout-button { appearance: none; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink); font-weight: 400; cursor: pointer; }
.logout-button:hover { color: #62686d; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.secondary-bar :focus-visible { outline-color: #dfe2e4; }
.workspace { padding: 28px 24px; width: 100%; }
h1 { margin: 0 0 12px; font-size: 22px; line-height: 1.3; font-weight: 600; }
h2 { font-size: 18px; margin: 16px 0 8px; }
p { line-height: 1.5; margin: 0 0 12px; overflow-wrap: anywhere; }
.page-heading h1 { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); }
.auth-main { padding: 32px 24px; }
.login-panel { max-width: 340px; margin: 0 auto; }
.login-form { display: flex; flex-direction: column; margin-top: 20px; }
.login-form label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.login-form input { min-width: 0; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #aeb5b9; border-radius: 2px; background: white; color: var(--ink); margin-bottom: 16px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 2px; font-weight: 400; cursor: pointer; text-decoration: none; }
.button-primary { background: var(--anthracite); color: white; }
.button-primary:hover { background: #41464a; }
.notice { margin-top: 16px; padding: 10px 12px; line-height: 1.5; overflow-wrap: anywhere; }
.notice-error { color: #842f29; background: #fff4f2; border: 1px solid #edcec8; }
/* Compact defaults for future record lists; wide tables scroll within their wrapper. */
.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #f5f6f6; font-weight: 600; }
/* Contacts retain the existing two-row header and compact backoffice surface. */
.contacts-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 16px; }
.contacts-heading h1 { margin: 0; }
.result-count { color: var(--muted); font-size: 13px; }
.contacts-search { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 0 0 16px; }
.contacts-search label, .contact-field label { display: block; margin-bottom: 5px; font-size: 13px; }
.search-field { flex: 1 1 320px; min-width: 0; }
.contacts-overview .contacts-new { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.contacts-summary { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.contacts-summary p { margin: 0; }
.page-count { text-align: right; }
.contacts-overview .contacts-search, .services-overview .contacts-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 8px; }
.contacts-overview .search-field label, .services-overview .search-field label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.contacts-status-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 13px; }
.contacts-status-filter a { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 10px; text-decoration: none; }
.contacts-status-filter a:hover, .contacts-status-filter [aria-current="page"] { background: #e9ebec; color: var(--ink); }
.contacts-status-filter .clear-search { margin-left: auto; color: var(--muted); }
.contacts-search input, .contacts-search select, .contact-field input, .contact-field select { width: 100%; min-width: 0; min-height: 38px; border: 1px solid #aeb5b9; border-radius: 2px; padding: 8px 10px; background: white; color: var(--ink); font: inherit; }
.contact-field input[readonly] { background: #f5f6f6; color: var(--muted); }
.button-secondary { border-color: #aeb5b9; background: #f5f6f6; color: var(--ink); }
.button-secondary:hover { background: #e9ebec; }
.contacts-table { width: max(100%, 780px); min-width: 780px; table-layout: fixed; }
.contacts-table th:nth-child(1) { width: 80px; }
.contacts-table th:nth-child(3) { width: 23%; }
.contacts-table th:nth-child(4) { width: 28%; }
.contacts-table th:nth-child(5) { width: 70px; }
.contacts-table td { overflow-wrap: anywhere; vertical-align: top; line-height: 1.4; }
.contacts-table td a { text-decoration: none; }
.contacts-table td a:hover { text-decoration: underline; }
.contacts-table tbody tr:hover { background: #fafafa; }
.contact-id { font-variant-numeric: tabular-nums; text-align: right; }
.contact-status { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 5px; border: 1px solid #cdd1d4; white-space: nowrap; }
.contact-status-active { background: #edf0f1; color: #303438; }
.contact-status-inactive { background: white; color: var(--muted); border-style: dashed; }
.empty-results { padding: 24px 10px; color: var(--muted); }
.pagination { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 16px; align-items: center; font-size: 13px; }
.pagination a, .pagination > span { display: inline-flex; min-width: 34px; min-height: 36px; padding: 8px 10px; justify-content: center; align-items: center; text-decoration: none; }
.pagination a:hover, .pagination [aria-current="page"] { background: #e9ebec; }
.pagination [aria-disabled="true"], .page-gap { color: var(--muted); }
.contact-form { width: 100%; max-width: 650px; }
.contact-form fieldset { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.contact-form legend { width: 100%; padding: 0 0 8px; margin-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.contact-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.contact-field { min-width: 0; }
.kvk-autocomplete { position: relative; }
.kvk-results { position: absolute; top: 65px; left: 0; right: 0; z-index: 10; max-height: 310px; overflow-y: auto; border: 1px solid var(--line); background: #fff; }
.kvk-results[hidden] { display: none; }
.kvk-result { padding: 9px 12px; cursor: pointer; overflow-wrap: anywhere; }
.kvk-result + .kvk-result { border-top: 1px solid var(--line); }
.kvk-result:hover, .kvk-result[aria-selected="true"] { background: #f2f3f4; }
.kvk-result strong, .kvk-result span { display: block; }
.kvk-result strong { font-weight: 600; }
.kvk-result span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.field-wide { grid-column: auto; }
.field-hint { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 5px; }
.field-error { display: block; color: #842f29; font-size: 12px; margin-top: 5px; }
.contact-field [aria-invalid="true"] { border-color: #842f29; }
.notice-success { border: 1px solid var(--line); background: #f5f6f6; }
.notice ul { padding-left: 20px; margin: 0; }
.moneybird-reference { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.moneybird-reference h2 { margin: 0; font-size: 15px; color: var(--muted); font-weight: 400; }
.moneybird-reference dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; font-size: 12px; }
.moneybird-reference dt { color: var(--muted); margin-bottom: 5px; }
.moneybird-reference dd { margin: 0; overflow-wrap: anywhere; }
.contact-actions { display: flex; align-items: center; gap: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
    .header-inner { padding: 0 16px; gap: 12px; }
    .primary-navigation { column-gap: 24px; }
    .nav-item, .section-label { min-height: 44px; }
    .secondary-inner { padding: 0 16px; }
    .account { gap: 18px; }
    .account-name { min-width: 0; }
    .workspace { padding: 24px 16px; }
    .auth-main { padding: 24px 16px; }
    .login-form input, .login-form .button { min-height: 44px; font-size: 16px; }
    .contacts-search input, .contacts-search select, .contact-field input, .contact-field select { min-height: 44px; font-size: 16px; }
    .contacts-search .button, .contacts-heading .button, .contact-actions .button { min-height: 44px; }
    .pagination a, .pagination > span { min-height: 44px; }
    .contacts-status-filter a { min-height: 44px; }
}
@media (max-width: 440px) {
    .primary-navigation { column-gap: 20px; }
    .account { gap: 14px; }
}
/* Services reuse contact form/status primitives; all additions are scoped. */
/* Read-only subscriptions overview; wide content scrolls within the table region. */
.subscriptions-overview .contacts-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 8px; }
.subscriptions-overview .search-field label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.subscriptions-table { width: max(100%, 1200px); min-width: 1200px; table-layout: fixed; }
.subscriptions-table th a { text-decoration: none; display: block; }
.subscriptions-table th:nth-child(1) { width: 85px; }
.subscriptions-table th:nth-child(2) { width: 95px; }
.subscriptions-table th:nth-child(5), .subscriptions-table th:nth-child(6) { width: 100px; }
.subscriptions-table th:nth-child(7) { width: 100px; }
.subscriptions-table th:nth-child(8) { width: 120px; }
.subscriptions-table th:nth-child(9) { width: 180px; }
.subscriptions-table th:nth-child(10) { width: 50px; }
.subscriptions-table th:nth-child(n+5):nth-child(-n+8), .subscriptions-table td:nth-child(n+5):nth-child(-n+8) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.subscriptions-table td { overflow-wrap: anywhere; vertical-align: top; line-height: 1.4; }
.subscriptions-table tbody tr:hover { background: #fafafa; }
.subscriptions-table td a { text-decoration: none; }
.subscriptions-table td a:hover { text-decoration: underline; }
.services-overview .contacts-heading .button { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.services-table { width: max(100%, 820px); min-width: 820px; table-layout: fixed; }
.services-table th a { text-decoration: none; display: block; }
.services-table th:first-child { width: 80px; }
.services-table th:nth-child(3), .services-table th:nth-child(4) { width: 110px; }
.services-table th:nth-child(5) { width: 125px; }
.services-table th:nth-child(6) { width: 110px; }
.services-table th:nth-child(n+3), .services-table td:nth-child(n+3) { text-align: right; }
.services-table td { overflow-wrap: anywhere; vertical-align: top; line-height: 1.4; }
.services-table tbody tr[data-service-row] { cursor: pointer; }
.services-table tbody tr:hover { background: #fafafa; }
.services-table td a { text-decoration: none; }
.services-table td a:hover { text-decoration: underline; }
.services-table .service-number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.services-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.services-pagination .pagination, .services-pagination p { margin: 0; }
.services-form textarea, .project-form textarea { display: block; width: 100%; min-width: 0; resize: vertical; border: 1px solid #aeb5b9; border-radius: 2px; padding: 8px 10px; font: inherit; color: var(--ink); background: white; }
.services-form fieldset[hidden] { display: none; }
@media (max-width: 720px) {
    .services-form textarea, .project-form textarea { font-size: 16px; }
}

/* Subscription detail presentation only. */
.contacts-heading .detail-back { margin-left: auto; }
.subscription-detail .subscription-service small { color: #62676b; font-weight: 400; }
.subscription-detail .contact-field p { margin-bottom: 0; }

.contact-object-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; margin-bottom: 20px; }
.contact-object-actions .contact-subscription-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; }
.contact-subscription-actions > span:first-child { margin-right: 6px; }
.contact-subscription-actions form { margin: 0; }

.subscription-service-search { position: relative; }
.subscription-service-results { position: absolute; top: 65px; left: 0; right: 0; z-index: 10; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); background: white; }
.subscription-service-option { padding: 9px 12px; cursor: pointer; overflow-wrap: anywhere; }
.subscription-service-option + .subscription-service-option { border-top: 1px solid var(--line); }
.subscription-service-option:hover, .subscription-service-option[aria-selected="true"] { background: #f2f3f4; }
.subscription-password-create { display: flex; flex-wrap: wrap; gap: 8px; }
.subscription-password-create input { flex: 1 1 220px; min-width: 0; }

.projects-table { width: 100%; min-width: 650px; table-layout: fixed; }
.projects-table th:nth-child(1) { width: 90px; }
.projects-table th:nth-child(3) { width: 28%; }
.projects-table th:nth-child(4) { width: 120px; }
.projects-table th, .projects-table td { text-align: left; vertical-align: top; overflow-wrap: anywhere; line-height: 1.4; }
.projects-table th:nth-child(4), .projects-table td:nth-child(4) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.projects-table th a { display: block; text-decoration: none; }
.projects-table td a { text-decoration: none; }
.projects-table td a:hover { text-decoration: underline; }
.projects-table tbody tr:hover { background: #fafafa; }

#general-project-fields[hidden] { display: none; }

/* Read-only billing source overview. */
.to-bill-table { width:100%; min-width:650px; }
.to-bill-table th,.to-bill-table td { text-align:left; }
.to-bill-table th:nth-child(4),.to-bill-table td:nth-child(4) { text-align:right; white-space:nowrap; }
.to-bill-table th:nth-child(5),.to-bill-table td:nth-child(5) { white-space:nowrap; }
.to-bill-table td:nth-child(2) { overflow-wrap:anywhere; }

.invoices-table th:last-child, .invoices-table td:last-child { text-align: right; }

.invoice-metadata { margin: 1rem 0; }
.invoice-metadata dt { color: #555; margin-top: .65rem; }
.invoice-metadata dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.invoice-lines th, .invoice-lines td { text-align: left; }
.invoice-lines th:last-child, .invoice-lines td:last-child:not([colspan]) { text-align: right; }
.invoice-lines td:last-child:not([colspan]) { white-space: nowrap; }
.invoice-lines td:not(:last-child) { overflow-wrap: anywhere; }
.invoice-totals { display: grid; grid-template-columns: 1fr auto; gap: .45rem 1.5rem; width: min(100%, 22rem); margin: 1rem 0 0 auto; padding: 0 10px; }
.invoice-totals dt, .invoice-totals dd { margin: 0; }
.invoice-totals dd { text-align: right; white-space: nowrap; }
.invoice-grand-total { font-weight: 600; border-top: 1px solid #ddd; padding-top: .5rem; }

/* CP-created invoice amounts, using the existing compact invoice components. */
.invoice-new-lines th:nth-child(n+3), .invoice-new-lines td:nth-child(n+3):not([colspan]) { text-align: right; white-space: nowrap; }
.invoice-new-lines { min-width: 680px; }
.invoice-create { margin-top: 1.25rem; }
.invoice-preview-contact { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.5rem; margin: 1rem 0; }
.invoice-preview-contact .invoice-metadata { margin: 0 0 .75rem; }
@media (max-width: 640px) { .invoice-preview-contact { grid-template-columns: 1fr; } }

/* BusineZ uses the shared contact forms and scrolling overview tables. */
.businez-table { width: 100%; min-width: 650px; table-layout: fixed; }
.businez-table th, .businez-table td { text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.businez-table th:nth-child(1) { width: 30%; }
.businez-table th:nth-child(2) { width: 25%; }
.businez-table tbody tr:hover { background: #fafafa; }
.businez-editor .contact-field p { margin: .5rem 0; overflow-wrap: anywhere; }
.redaction { min-width: 0; }
.redaction h1 { overflow-wrap: anywhere; }
.redaction .contact-actions { flex-wrap: wrap; }
.redaction-table { width: 100%; min-width: 700px; }
.redaction-topics { min-width: 1000px; }
.redaction-table th, .redaction-table td { text-align: left; vertical-align: top; overflow-wrap: anywhere; max-width: 320px; }
.redaction-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.redaction-stats > div { padding: 16px; border: 1px solid var(--line); }
.redaction-stats dt { font-size: 14px; }
.redaction-stats dd { margin: 8px 0 0; font-size: 28px; font-weight: 600; }
.redaction-detail > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.redaction-detail dt { font-weight: 600; }
.redaction-detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.redaction-source { margin: 16px 0; padding: 16px; border: 1px solid var(--line); overflow-wrap: anywhere; }
.redaction-content { white-space: pre-wrap; }
.redaction .contact-field textarea { width: 100%; min-width: 0; }
.redaction-source-usages legend { border: 0; margin-bottom: 4px; font-size: 13px; font-weight: 400; padding: 0; }
.redaction-source-usages .source-usage-choice { display: flex; align-items: center; gap: 8px; min-height: 38px; margin: 0; cursor: pointer; }
.redaction-source-usages input[type="checkbox"] { flex: 0 0 16px; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; }
@media (max-width: 800px) { .redaction-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .redaction-detail > div { grid-template-columns: minmax(0, 1fr); gap: 6px; } .redaction-stats { grid-template-columns: minmax(0, 1fr); } }

.invoices-table td:first-child { overflow-wrap: anywhere; }
