/* The workspace theme never changes the invoice PDF or email paper palette. */
.sidebar-company-logo { display: block; max-width: 136px; max-height: 54px; object-fit: contain; background: white; padding: 6px; border-radius: 6px; margin: 12px 0; }
.appearance-control { margin-top: 22px; }
.appearance-control label { display: block; font-size: 12px; }
.appearance-control select { max-width: 180px; min-height: 36px; margin: 6px 0 0; padding: 6px 10px; }
.appearance-settings { margin-bottom: 24px; }
.appearance-settings .appearance-control { margin: 0 0 18px; }
.main-content { position: relative; }
.workspace-container { position: relative; min-width: 0; width: 100%; max-width: 1660px; margin: 0 auto; }
.main-content .page-top { min-height: 44px; padding-right: 250px; justify-content: flex-start; flex-wrap: wrap; gap: 12px; }
.company-brand-logo { display: block; max-width: 188px; max-height: 64px; object-fit: contain; background: white; padding: 6px; border-radius: 6px; }
.company-card-logo { display: block; width: 152px; height: 64px; object-fit: contain; object-position: left center; background: white; padding: 4px; border-radius: 6px; }
.company-card-top { flex-wrap: wrap; gap: 12px; }
.account-menu { position: absolute; top: 30px; right: 45px; z-index: 120; max-width: 240px; }
.account-menu > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px 6px 7px; border: 1px solid var(--border-surface); border-radius: 7px; background: var(--surface-card); color: var(--text-primary); cursor: pointer; list-style: none; font-size: 13px; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:focus-visible { outline: 3px solid #88b2ff; outline-offset: 2px; }
.account-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-weight: 600; }
.account-menu .avatar { flex-shrink: 0; width: 30px; height: 30px; font-size: 11px; }
.account-menu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; max-width: calc(100vw - 32px); border: 1px solid var(--border-surface); border-radius: 8px; background: var(--surface-card); color: var(--text-primary); box-shadow: 0 12px 32px #07152633; padding: 7px; }
.account-menu-panel a, .account-menu-panel button { display: block; width: 100%; padding: 10px 12px; text-align: left; border: 0; border-radius: 4px; background: transparent; color: inherit; font-size: 13px; cursor: pointer; }
.account-menu-panel a:hover, .account-menu-panel button:hover { background: var(--surface-section); }
.account-menu-identity { display: grid; gap: 5px; padding: 10px 12px 14px; border-bottom: 1px solid var(--border-surface); margin-bottom: 6px; overflow-wrap: anywhere; font-size: 13px; }
.account-menu-identity span, .account-menu-group { color: var(--text-secondary); font-size: 11px; }
.account-menu-group { padding: 12px 12px 5px; }
.account-menu-panel form { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--border-surface); }
@media(max-width:720px) { .account-menu { right: 24px; top: 20px; } }
@media(max-width:600px) { .account-menu-name { display: none; } .main-content .page-top { padding-right: 76px; } .account-menu > summary { gap: 5px; padding-right: 7px; } }
.sidebar .appearance-control label { color: #c4d1e2; }
.sidebar .appearance-control select { color: #ecf2fa; background: #20334d; border-color: #52637b; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 24px; text-align: center; }
.auth-brand .brand { justify-content: center; max-width: 100%; overflow-wrap: anywhere; }
.auth-brand .appearance-control { margin: 0; min-width: 120px; }
html[data-theme="dark"] {
    color-scheme: dark;
    --surface-page: #111925;
    --surface-card: #1c2736;
    --surface-section: #172231;
    --border-surface: #3c4c60;
    --border-control: #728299;
    --text-primary: #e5edf7;
    --text-secondary: #b7c5d8;
    --action-primary: #88b2ff;
    --muted: #b7c5d8;
    background: var(--surface-page);
    color: var(--text-primary);
}
html[data-theme="dark"] body,
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .auth-shell { background: var(--surface-page); color: var(--text-primary); }
html[data-theme="dark"] :is(.panel, .login-card, .company-card, .stat-card, .editor, .record-lookup, .lookup-option, .picker-choice, .search-popup, .search-option, .module-option, .document-card, .invoice-detail) { background: var(--surface-card); color: var(--text-primary); border-color: var(--border-surface); }
html[data-theme="dark"] :is(.form-section, .list-toolbar, .list-footer, .picker-content, .lookup-search, .checkbox-row, .report-total, .user-avatar, .list-context) { background: var(--surface-section); color: var(--text-primary); border-color: var(--border-surface); }
html[data-theme="dark"] :is(label, legend, h1, h2, h3, h4, dt, dd, .account-select-label, .user-summary-grid dd, .list-empty strong, .record-list-table td) { color: var(--text-primary); }
html[data-theme="dark"] :is(.intro, .muted, .small, .form-section-description, .list-range, .list-size, .list-empty p, .user-identity p, .user-memberships header p, .user-summary-grid dt, .utility-summary dt, .record-primary span, .lookup-option small, .picker-choice span, .search-status, .module-description, .settings-history summary) { color: var(--text-secondary); }
html[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #14202f; color: var(--text-primary); border-color: var(--border-control); box-shadow: none; }
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #a8b8cd; }
html[data-theme="dark"] :is(input, select, textarea):focus { border-color: #9bbfff; outline-color: #436898; }
html[data-theme="dark"] :is(input, select, textarea):disabled,
html[data-theme="dark"] fieldset:disabled :is(input, select, textarea),
html[data-theme="dark"] :is(input, textarea)[readonly] { background: #253244; color: #b7c5d8; border-color: #52637b; }
html[data-theme="dark"] :is(input, select, textarea).invalid,
html[data-theme="dark"] :is(input, select, textarea)[aria-invalid=true] { background: #39232e; border-color: #ff9dad; }
html[data-theme="dark"] :is(.validation-message, .validation-errors, .import-file-error) { color: #ffabb9; }
html[data-theme="dark"] .validation-errors { background: #38222c; border-color: #a85466; }
html[data-theme="dark"] input[type=file]::file-selector-button { background: #2c4161; color: #d7e7ff; border-color: #728299; }
html[data-theme="dark"] :is(th, thead, .table-header) { background: #253449; color: #c8d8ee; border-color: var(--border-surface); }
html[data-theme="dark"] :is(td, tr, .workspace-tabs, .payments-panel, .payment-history, .user-summary-header, .lookup-option, .search-status) { border-color: var(--border-surface); }
html[data-theme="dark"] :is(tbody tr:hover, .workspace-tabs a:hover, .search-option:hover, .search-option.active, .lookup-option:hover, .lookup-option:focus-visible, .picker-choice.chosen) { background: #2c405b; }
html[data-theme="dark"] :is(.workspace-tabs a, .workspace-tabs > span, .record-list-table th a, .record-primary strong, .record-row-actions a, .lookup-select, .search-option[aria-selected=true], .list-context a, .back-link, .text-link) { color: #a7c7ff; }
html[data-theme="dark"] :is(.workspace-tabs a[aria-current=page], .workspace-tabs > span[aria-current=step]) { color: #eff5ff; border-color: #91b7ff; }
html[data-theme="dark"] .button { color: #dceaff; background: #263a55; border-color: #6d83a2; }
html[data-theme="dark"] .button.primary { color: white; background: #345fae; border-color: #759ae0; }
html[data-theme="dark"] .button:hover:not(:disabled) { filter: brightness(1.14); }
html[data-theme="dark"] :is(.button.danger, .danger) { color: #ffd0d7; background: #613040; border-color: #c27b8b; }
html[data-theme="dark"] :is(.status, .list-status) { color: #d7e1ee; background: #2b3a4d; border-color: #65778f; }
html[data-theme="dark"] :is(.status-active, .status-enabled, .status-posted, .status-issued, .status.paid, .success) { color: #a8edce; background: #1e4038; border-color: #4d8b73; }
html[data-theme="dark"] :is(.status-pending, .status-draft, .status.outstanding, .warning, .duplicate-warning) { color: #f7d69a; background: #443824; border-color: #9a8152; }
html[data-theme="dark"] :is(.notice, .info, .notice-panel) { color: #cfdef8; background: #233854; border-color: #617da4; }
html[data-theme="dark"] :is(.error, .error-panel) { color: #ffc0cd; background: #452a35; border-color: #9c6677; }
html[data-theme="dark"] :is(code, pre) { background: #14202f; color: #d6e5fa; border-color: var(--border-surface); }
html[data-theme="dark"] .module-info { color: #d7e7ff; background: #2c4161; border-color: #728299; }
html[data-theme="dark"] .module-purpose { color: #fff; background: #0a111c; border-color: #728299; }
html[data-theme="dark"] .sidebar { background: #0d1623; }
html[data-theme="dark"] .sidebar h2 { color: #ecf3fc; }
html[data-theme="dark"] .brand { color: #e5edf7; }
html[data-theme="dark"] :is(.breadcrumb, .eyebrow, caption, .stat-card span, .stat-card small) { color: #b7c5d8; }
html[data-theme="dark"] .pill { color: #d7e1ee; background: #253449; border-color: #65778f; }
html[data-theme="dark"] .workspace-note { background: var(--surface-section); color: var(--text-primary); border-color: var(--border-surface); }
html[data-theme="dark"] .workspace-note p { color: var(--text-secondary); }
html[data-theme="dark"] .branding-paper { background: #fff; color: #203040; }
html[data-theme="dark"] .branding-paper :is(h3, h4, p, strong, span, div) { color: #203040; }
html[data-theme="dark"] .branding-paper p.small { color: #203040; }
html[data-theme="dark"] .branding-logo-tile { background: white; }
@media(max-width:600px) { .auth-brand { gap: 12px; } .auth-brand .appearance-control { min-width: 100px; } }
