/* Shared visual system: neutral surfaces, restrained blue, readable data, visible focus. */
:root {
    --crm-background: #f4f6f9;
    --crm-surface: #fff;
    --crm-text: #172b43;
    --crm-muted: #526277;
    --crm-border: #dce3ed;
    --crm-primary: #2457a7;
    --mud-palette-primary: #2457a7;
    --mud-palette-primary-rgb: 36, 87, 167;
    --mud-typography-default-family: "Segoe UI", Arial, sans-serif;
}
html { color-scheme: light; scroll-padding-top: 90px; }
body { background: var(--crm-background); color: var(--crm-text); font-size: 14px; line-height: 1.55; }
*, *::before, *::after { box-sizing: border-box; }
:where(a, button, input, textarea, select, [tabindex]):focus-visible { outline: 2px solid var(--crm-primary); outline-offset: 3px; }
.workspace-shell { min-height: 100vh; display: flex; flex-direction: column; }
.workspace-header { position: sticky; top: 0; z-index: 35; background: white; border-bottom: 1px solid var(--crm-border); }
.workspace-header-inner { display: flex; align-items: center; gap: 24px; min-height: 76px; padding: 12px 28px; max-width: 1680px; margin: 0 auto; }
.workspace-brand { display: flex; align-items: center; gap: 10px; flex: 0 0 220px; text-decoration: none; color: var(--crm-text); }
.workspace-brand strong { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.workspace-brand small { display: block; color: var(--crm-muted); font-size: 11px; margin-top: 1px; }
.workspace-header-menu { flex: 1; min-width: 0; }
.workspace-body { flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; }
.workspace-body:has(.workspace-sidebar) { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.workspace-sidebar { position: sticky; top: 76px; height: calc(100vh - 76px); overflow-y: auto; padding: 24px 14px; border-right: 1px solid var(--crm-border); background: white; }
.workspace-sidebar-note { margin-top: 28px; padding: 16px 12px; border-top: 1px solid var(--crm-border); font-size: 11px; color: var(--crm-muted); }
.workspace-content { min-width: 0; width: 100%; padding: 28px 32px 40px; }
.workspace-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 28px; border-top: 1px solid var(--crm-border); background: white; color: var(--crm-muted); font-size: 12px; }
.workspace-skip-link { position: fixed; top: -100px; left: 24px; z-index: 1500; padding: 12px 18px; background: #163d75; color: white; border-radius: 6px; }
.workspace-skip-link:focus { top: 12px; }
.workspace-account-bar { justify-content: flex-end; }
.workspace-account-bar > nav { justify-content: flex-end; }
.workspace-menu-toggle { display: none; }
.workspace-account-bar button { box-shadow: none; }
.workspace-content h1 { letter-spacing: -.025em; line-height: 1.25; }
.workspace-content .crm-panel, .workspace-content .settings-panel { border: 1px solid var(--crm-border); border-radius: 10px; box-shadow: 0 1px 3px #172b4306; background: white; }
.crm-form-hero { padding: 24px; background: #fff; }
.crm-form-title { font-size: 24px; color: var(--crm-text); font-weight: 650; }
.crm-form-eyebrow { color: var(--crm-primary); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.crm-form-subtitle { color: var(--crm-muted); max-width: 64ch; }
.crm-form-mode-chip { border-radius: 5px; background: #edf3fc; color: #163d75; font-size: 12px; }
.crm-form-section { padding: 24px; border-bottom: 1px solid #edf0f5; }
.crm-form-section-heading h2 { font-size: 17px; font-weight: 650; color: var(--crm-text); }
.crm-form-section-heading p { color: var(--crm-muted); line-height: 1.5; }
.crm-record-form .mud-input-outlined { background: white; border-radius: 6px; }
.crm-record-form .mud-input-control { margin-top: 4px; }
.crm-form-actions { background: #f8fafc; border-top: 1px solid var(--crm-border); padding: 16px 24px; }
.crm-primary-button { background: var(--crm-primary) !important; box-shadow: none !important; border-radius: 6px; }
.crm-compact-grid .mud-table-head .mud-table-cell { background: #f8fafc; color: #526277; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; padding-block: 12px; }
.crm-compact-grid .mud-table-cell { border-bottom-color: #e8edf4; padding-block: 12px; font-size: 13px; line-height: 1.5; }
.crm-compact-grid .mud-table-row:hover { background: #f3f7fd; }
.crm-line-items { border: 1px solid var(--crm-border); border-radius: 8px; margin: 0 24px 24px; overflow: hidden; }
.crm-line-items table { font-variant-numeric: tabular-nums; }
.invoice-cell { min-height: 40px; padding: 10px 12px; background: white; }
.invoice-cell:focus { background: #f0f5fd; outline: 2px solid var(--crm-primary); outline-offset: -2px; }
.workspace-content .mud-button { text-transform: none; font-weight: 600; letter-spacing: 0; }
.workspace-content .mud-typography { font-family: "Segoe UI", Arial, sans-serif; }
.workspace-content .mud-input-control .mud-input-label { font-weight: 500; }
.workspace-content .mud-paper { color: var(--crm-text); }
@media (max-width: 1100px) {
    .workspace-body:has(.workspace-sidebar) { grid-template-columns: minmax(0, 1fr); }
    .workspace-sidebar { display: none; }
    .workspace-menu-toggle { display: inline-flex; }
    .workspace-header-inner { padding: 12px 20px; }
    .workspace-content { padding: 24px 20px; }
}
@media (max-width: 767px) {
    .workspace-header-inner { gap: 10px; padding: 10px 16px; min-height: 68px; }
    .workspace-brand { flex-basis: auto; }
    .workspace-brand strong { font-size: 15px; }
    .workspace-brand small { display: none; }
    .workspace-brand img { width: 30px; height: 30px; }
    .workspace-content { padding: 20px 12px 28px; }
    .workspace-footer { padding: 16px; }
    .crm-form-hero, .crm-form-section { padding: 20px 16px; }
    .crm-form-title { font-size: 21px; }
    .crm-line-items { margin-inline: 12px; }
    .crm-form-actions { padding: 14px 16px; }
    .crm-form-actions .mud-button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.crm-detail-label { color: #526277; font-size: 12px; }
.workspace-content .crm-modern-form .mud-input-outlined,
.workspace-content .settings-panel form .mud-input-outlined { border-radius: 6px; }
.workspace-content .crm-modern-form .mud-input-focused .mud-input-outlined-border { border-color: #2457a7; }

/* Consistent form focus without movement or decorative halos. */
.workspace-content .crm-modern-form .mud-input-label,
.workspace-content .settings-panel form .mud-input-label,
.workspace-content .crm-panel form .mud-input-label { font-weight: 500; color: #526277 !important; }
.workspace-content .crm-modern-form .mud-input-outlined-border,
.workspace-content .settings-panel form .mud-input-outlined-border,
.workspace-content .crm-panel form .mud-input-outlined-border { border-radius: 6px !important; }
.workspace-content .crm-modern-form .mud-input-control:focus-within .mud-input-outlined-border,
.workspace-content .settings-panel form .mud-input-control:focus-within .mud-input-outlined-border,
.workspace-content .crm-panel form .mud-input-control:focus-within .mud-input-outlined-border { border-color: #2457a7 !important; }
.workspace-content .crm-modern-form .mud-input-outlined.mud-input-focused,
.workspace-content .settings-panel form .mud-input-outlined.mud-input-focused,
.workspace-content .crm-panel form .mud-input-outlined.mud-input-focused { transform: none; box-shadow: 0 0 0 3px #2457a714; }
.crm-native-input { border-radius: 6px; }
.crm-native-input:focus, .crm-native-input:focus-within { transform: none; border-color: #2457a7; box-shadow: 0 0 0 3px #2457a714; }
.crm-form-section, .crm-line-items { box-shadow: none; }
.crm-form-section { border-radius: 8px; }
.crm-line-items > .overflow-x-auto { scrollbar-gutter: stable; }
.crm-line-items td > button { min-width: 40px; min-height: 40px; }
.crm-form-hero { gap: 16px; }
.crm-date-picker-today-button { min-width: 44px; min-height: 44px; }
.crm-breadcrumb-link { color: #2457a7; }
@media (max-width: 767px) {
    .crm-form-section { margin: 16px 12px; }
    .crm-form-actions { flex-wrap: wrap; }
}
.crm-search .mud-input-outlined { min-height: 44px; }
.crm-search .mud-input-slot { padding-block: 10px !important; }
body:has(#workspace-mobile-menu) { overflow: hidden; }

/* Account pages share the workspace's typography, surfaces and control sizing. */
.account-page { min-height: 65vh; background: transparent; padding: 32px 0; }
.account-page h1 { font-size: 28px; font-weight: 650; }
.account-page .rounded-2xl { border-radius: 10px; }
.account-page input:not([type=checkbox]), .account-page button { border-radius: 6px !important; box-shadow: none; }
.account-page input:focus { border-color: #2457a7; }
.account-page button[type=submit]:not([name=__passkeySubmit]) { min-height: 44px; background: #2457a7; color: white; box-shadow: none; }
.account-page button[name=__passkeySubmit] { min-height: 44px; border: 1px solid #dce3ed; background: white; color: #2457a7; }
.account-page .text-indigo-600 { color: #2457a7; }
.account-page .shadow-lg { box-shadow: none; }
@media (max-width: 767px) {
    .account-page { min-height: 0; padding: 8px 0; }
    .account-page .p-8, .account-page .p-10 { padding: 24px 16px; }
    .account-page h1 { font-size: 24px; }
}
.workspace-account-bar > nav { min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.account-manage-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; }
.account-manage-grid > section { min-width: 0; }
.account-manage .rounded-2xl { border-radius: 10px; }
.account-manage input:not([type=checkbox]), .account-manage button { border-radius: 6px !important; }
@media (max-width: 900px) { .account-manage-grid { grid-template-columns: minmax(0, 1fr); } }
