/* Shared CRM design: white surfaces, quiet borders and outline controls.
   Loaded after app.css. Keep display/visibility utilities and status semantics. */
:where(.shell-body, .crm-theme-body) {
    --shell: #fff; --band: #fff; --sheet: #fff; --surface: #fff; --content: #fff;
    --paper: #fff; --paper-sunken: #f6f7f8; --canvas: #fafbfc;
    --ink: #171a1e; --ink-soft: #535961; --ink-faint: #727983;
    --line-soft: #e8eaed; --line-ctl: #b6bbc2;
    --bg-primary: #fff; --bg-secondary: #fafbfc; --bg-tertiary: #f4f5f6; --bg-input: #fff;
    --text-primary: #171a1e; --text-secondary: #535961; --text-tertiary: #727983; --text-muted: #727983;
    --border-primary: #e8eaed; --border-secondary: #eef0f2; --border-input: #b6bbc2;
    --p50: #f6f7f8; --p100: #eef0f2; --p200: #dfe2e6; --p300: #b6bbc2; --p400: #868d97;
    --p500: #606771; --p600: #20252b; --p700: #353b43; --p800: #20252b; --p900: #111418;
    --btn-bg: #20252b; --btn-bg-hover: #353b43; --btn-fg: #fff;
    --fill-dark: #20252b; --fill-neutral: #535961;
    --accent: #dfe2e6; --accent-soft: #f6f7f8; --accent-deep: #b6bbc2;
    --link: #1d4ed8; --link-hover: #1e40af; --focus-ring: rgba(37,99,235,.18);
    --ui-blue-control: #2563eb; --ui-blue-control-hover: #1d4ed8; --ui-blue-text: #1d4ed8; --ui-blue-soft: #eff6ff; --ui-blue-border: #bfdbfe;
    --grad-a: #353b43; --grad-b: #535961; --grad-c: #727983;
    --ctl-soft: #f6f7f8; --ctl-soft-hover: #edf0f2; --ctl-line: #dfe2e6; --ctl-hover: #f8f9fa;
    --ctl-seg-on: #eef0f2; --ctl-field: #fff; --ctl-field-line: #dfe2e6; --ctl-divider: #e8eaed;
    --ctl-text: #20252b; --ctl-muted: #727983; --ctl-create: #14804a; --ctl-create-hover: #106b3e;
    --kanban-bg: #fafbfc; --kanban-drag: #f1f3f5; --kanban-card: #fff; --kb-col-bg: #fafbfc;
    --table-hover: #fafbfc; --mark-bg: #eef0f2; --spinner-fg: #535961; --spinner-bg: #e8eaed;
    --scrollbar-thumb: #d1d5da; --scrollbar-hover: #a9afb8; --overlay-bg: rgba(23,26,30,.38);
    --chart-accent: #353b43; --chart-muted: #727983; --chart-grid: #eef0f2; --chart-fill: rgba(83,89,97,.10);
    color: var(--ink); background-color: var(--paper); font-size: 14px; -webkit-font-smoothing: antialiased;
}
html.dark :where(.shell-body, .crm-theme-body) {
    --shell: #1b1d20; --band: #1b1d20; --sheet: #1b1d20; --surface: #1f2226; --content: #1b1d20;
    --paper: #1b1d20; --paper-sunken: #272b30; --canvas: #191b1e;
    --ink: #f0f2f4; --ink-soft: #bcc1c8; --ink-faint: #969ea9;
    --line-soft: #33383e; --line-ctl: #646c77;
    --bg-primary: #1f2226; --bg-secondary: #191b1e; --bg-tertiary: #272b30; --bg-input: #1f2226;
    --text-primary: #f0f2f4; --text-secondary: #bcc1c8; --text-tertiary: #969ea9; --text-muted: #969ea9;
    --border-primary: #33383e; --border-secondary: #2b3036; --border-input: #646c77;
    --p50: #272b30; --p100: #30363d; --p200: #444b55; --p300: #bcc1c8; --p400: #a5adb8;
    --p500: #c5cbd3; --p600: #e8ebef; --p700: #fff; --p800: #e8ebef; --p900: #fff;
    --btn-bg: #e8ebef; --btn-bg-hover: #fff; --btn-fg: #1b1d20;
    --fill-dark: #30363d; --fill-neutral: #444b55;
    --accent: #444b55; --accent-soft: #272b30; --accent-deep: #646c77;
    --link: #93c5fd; --link-hover: #bfdbfe; --focus-ring: rgba(96,165,250,.24);
    --ui-blue-control: #2563eb; --ui-blue-control-hover: #1d4ed8; --ui-blue-text: #93c5fd; --ui-blue-soft: #172c48; --ui-blue-border: #2c4f79;
    --grad-a: #444b55; --grad-b: #535b66; --grad-c: #727c89;
    --ctl-soft: #272b30; --ctl-soft-hover: #33383e; --ctl-line: #444b55; --ctl-hover: #272b30;
    --ctl-seg-on: #33383e; --ctl-field: #1f2226; --ctl-field-line: #444b55; --ctl-divider: #33383e;
    --ctl-text: #f0f2f4; --ctl-muted: #969ea9; --ctl-create: #14804a; --ctl-create-hover: #189859;
    --kanban-bg: #191b1e; --kanban-drag: #30363d; --kanban-card: #1f2226; --kb-col-bg: #191b1e;
    --table-hover: #272b30; --mark-bg: #444b55; --spinner-fg: #c5cbd3; --spinner-bg: #33383e;
    --scrollbar-thumb: #444b55; --scrollbar-hover: #646c77; --overlay-bg: rgba(0,0,0,.58);
    --chart-accent: #c5cbd3; --chart-muted: #969ea9; --chart-grid: #33383e; --chart-fill: rgba(197,203,211,.10);
}

/* Desktop shell. The sidebar is one white column, with no nested panels. */
.shell-body { --admin-sidebar-width: 256px; margin-left: var(--admin-sidebar-width); }
.shell-body .admin-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--admin-sidebar-width);
    overflow-y: auto; padding: 0 16px 24px; background: var(--sheet); border-right: 1px solid var(--line-soft);
    scrollbar-width: thin;
}
.shell-body .admin-brand-row { display: flex; align-items: center; height: 72px; margin-bottom: 16px; }
.shell-body .admin-brand {
    display: flex; align-items: center; gap: 10px; flex: 1; height: 72px; padding: 0 12px;
    color: var(--ink); font-size: 25px; font-weight: 600; letter-spacing: -.055em;
}
.shell-body .admin-brand span { color: inherit; }
.shell-body .admin-brand-mark { width: 24px; height: 24px; flex-shrink: 0; }
.shell-body .admin-brand-wordmark { line-height: 1; }
.shell-body .admin-nav-toggle { display: none; }
.shell-body .bd { padding: 0; background: transparent; }
.shell-body .bd-track { display: block; overflow: visible; padding: 0; margin: 0; }
.shell-body .bd-g { margin-bottom: 5px; }
.shell-body .bd-pill {
    display: flex; width: 100%; height: 43px; gap: 11px; padding: 0 12px;
    border-radius: 6px; color: var(--ink-soft); background: transparent; font-size: 13px; font-weight: 500;
}
.shell-body .bd-label { flex: 1; text-align: left; }
.shell-body .bd-pill:hover { background: var(--ctl-hover); color: var(--ink); }
.shell-body .bd-pill.on { color: var(--ink); background: var(--ctl-soft); font-weight: 600; }
.shell-body .bd-pill.on::after { content: none; }
.shell-body :is(.bd-ic, .sn-ic, .bd-item-ic) { width: 18px; height: 18px; color: inherit; flex-shrink: 0; }
.shell-body :is(.bd-count, .sn-count.sn-ink, .sn-tag) { background: var(--ctl-soft-hover); color: var(--ink-soft); font-weight: 500; }
.shell-body .bd-count.is-danger { background: var(--danger-soft); color: var(--danger); }
.shell-body .sn {
    position: static; max-height: none; overflow: visible; margin: 2px 0 12px; padding: 3px 0 3px 23px;
    border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
.shell-body .sn-head { display: none; }
.shell-body .sn-list { gap: 2px; }
.shell-body .sn-item { padding: 8px 12px; border-radius: 5px; color: var(--ink-soft); font-size: 12.5px; }
.shell-body :is(.sn-item.on, .sn-dir.on) { background: var(--ctl-hover); color: var(--ink); }
.shell-body .sn-dir.on .sn-dir-link { color: var(--ink); }
.shell-body .sn-group { padding: 13px 12px 7px; color: var(--ink-faint); font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.shell-body .sn-count.sn-danger { background: var(--danger-soft); color: var(--danger); }
.shell-body .sn-count.sn-ok { background: var(--ok-soft); color: var(--ok); }
.shell-body .sn-dirs { padding-left: 16px; }
.shell-body .sn-dir { border-radius: 5px; }
.shell-body .sn-dir-link { padding-top: 8px; padding-bottom: 8px; font-size: 12px; }
.shell-body .sn-dot { width: 6px; height: 6px; }
.shell-body .sn-dir-tools button { border-radius: 4px; }

/* Header, search and contextual toolbar. */
.shell-body .sh-top { background: var(--sheet); color: var(--ink); overflow: visible; }
.shell-body .sh { min-height: 72px; padding: 16px 32px; gap: 24px; border-bottom: 1px solid var(--line-soft); }
.shell-body .admin-search {
    display: flex; align-items: center; gap: 10px; flex: 1; min-width: 140px; max-width: 440px;
    height: 40px; padding: 0 13px; border: 1px solid var(--border-secondary); border-radius: 6px;
    background: var(--ctl-hover); color: var(--ink-faint); font-size: 13px; cursor: pointer; text-align: left;
}
.shell-body .admin-search span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.shell-body .admin-search kbd { font-family: inherit; font-size: 10px; padding: 2px 5px; border: 1px solid var(--ctl-line); border-radius: 4px; }
.shell-body .sh-right { gap: 10px; }
.shell-body :is(.sh-biz, .sh-dir, .sh-me) { color: var(--ink); background: transparent; border-radius: 6px; }
.shell-body .sh-biz { max-width: 175px; }
.shell-body .sh-dir { max-width: 150px; }
.shell-body :is(.sh-biz, .sh-dir, .sh-me):hover { color: var(--ink); background: var(--ctl-hover); }
.shell-body .sh-date { color: var(--ink-faint); }
.shell-body .sh-avatar { background: var(--ctl-soft); color: var(--ink); }
.shell-body .sh-icbtn { color: var(--ink-soft); border-radius: 6px; }
.shell-body .sh-icbtn:hover { color: var(--ink); background: var(--ctl-hover); }
.shell-body .sh-dot-count { border-color: var(--sheet); }
.shell-body .admin-now-strip { padding: 10px 32px; border-bottom: 1px solid var(--line-soft); }
.shell-body .sh-now { max-width: none; padding: 0; background: transparent; color: var(--ink); border-radius: 0; }
.shell-body :is(.sh-now-k, .sh-now-s) { color: var(--ink-faint); }
.shell-body .sh-now-t { color: var(--ink-soft); font-size: 12px; }
.shell-body .sh-now-go { padding: 5px 10px; border-radius: 5px; background: var(--ctl-soft); color: var(--ink); font-size: 12px; }
.shell-body .sh-now-more { border-radius: 5px; color: var(--ink-soft); }
.shell-body :is(.sh-menu, .bd-pop) { border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: 0 8px 28px rgba(23,26,30,.09); }
.shell-body .bd-pop { max-height: calc(100vh - 24px); overflow-y: auto; }
.shell-body :is(.sh-menu-item, .bd-item) { border-radius: 5px; }
.shell-body :is(.sh-menu-item.on, .bd-item.on) { background: var(--ctl-hover); color: var(--ink); }
.shell-body .sh-theme-control { border-top: 1px solid var(--line-soft); margin-top: 6px; padding-top: 12px; }

/* Canvas, panels and typography shared by every administration page. */
.shell-body .sheet { display: block; min-height: calc(100vh - var(--shell-h, 150px)); margin-top: 0; border-radius: 0; background: var(--sheet); }
.shell-body .sheet-main { padding: 26px 32px 40px; border-radius: 0; background: var(--sheet); }
.shell-body .sheet-top { margin-bottom: 26px; align-items: center; gap: 16px; }
.shell-body .sh-crumbs { color: var(--ink-faint); font-size: 10px; font-weight: 500; letter-spacing: .03em; }
.shell-body :is(.rounded-lg, .rounded-xl, .rounded-2xl, .rounded-3xl, .rounded-md) { border-radius: 8px; }
.shell-body :is(.card, .stat-card, .filter-bar, .filter-panel, .kb-board, .crm-panel, .crm-chart-panel) {
    border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface); box-shadow: none;
}
.shell-body :is(.shadow-soft, .shadow-sm, .shadow, .shadow-md, .hover\:shadow-lift:hover) { box-shadow: none; }
.shell-body .sheet-main .bg-white:is(.shadow-soft, .shadow-sm, .shadow, .shadow-md) { border: 1px solid var(--line-soft); }
.shell-body .sheet-main .bg-white:has(> table),
.shell-body .sheet-main .bg-white:has(> .table-responsive > table),
.shell-body .sheet-main .bg-white:has(> .overflow-x-auto > table) { border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: none; }
.shell-body .dashboard-heading { padding-bottom: 8px; color: var(--ink); }
.shell-body .dashboard-heading-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-soft); border-radius: 7px; color: var(--ink-soft); }
.shell-body :is(.crm-direction-header, .crm-metric-card) { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: none; }
.shell-body :is(.crm-direction-avatar, .crm-metric-icon) {
    display: flex; align-items: center; justify-content: center; color: var(--ink-soft); background: var(--ctl-hover);
    border: 1px solid var(--line-soft); border-radius: 8px;
}
.shell-body .crm-direction-avatar { width: 44px; height: 44px; font-size: 18px; font-weight: 600; flex-shrink: 0; }
.shell-body .crm-metric-icon { width: 38px; height: 38px; }
.shell-body .crm-empty-state { color: var(--ink-faint); font-size: 13px; }
.shell-body .crm-count-chip { color: var(--ink-soft); background: var(--ctl-soft); border-radius: 5px; }
.shell-body .crm-dashboard-action { color: var(--ink-soft); background: var(--surface); border: 1px solid var(--ctl-line); border-radius: 6px; }
.shell-body .crm-dashboard-action:hover { color: var(--ink); background: var(--ctl-hover); }
.shell-body .crm-tab-drop-marker { box-shadow: inset 2px 0 var(--ink-soft); }
.shell-body .crm-widget-dragging { outline: 1px solid var(--ink-faint); outline-offset: 2px; }
.shell-body :is(.crm-module-card, .crm-widget-catalog-item) { border-radius: 6px; border-color: var(--line-soft); }
.shell-body .crm-widget-catalog-item:hover { background: var(--ctl-hover); border-color: var(--line-ctl); }
:where(.shell-body, .crm-theme-body) .crm-drop-target { background-color: var(--ctl-soft); outline: 1px dashed var(--ink-faint); outline-offset: -2px; }
.shell-body .dashboard-stats > div,
.shell-body .dashboard-widget[data-widget-id^="stats_"] > .bg-white,
.shell-body .dashboard-widget[data-widget-id^="stats_"] > a > .bg-white,
.shell-body .dashboard-widget[data-widget-type^="stats_"] { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: none; }
.shell-body .dashboard-widget .crm-metric-icon svg { color: var(--ink-soft); }
.shell-body :is(.kb-board .kb-card, .kb-add) { border-radius: 6px; box-shadow: none; }
.shell-body .kb-kicker { color: var(--ink-faint); }
.shell-body .sched { border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface); color: var(--ink); }
.shell-body :is(.sched-day-l, .sched-empty) { color: var(--ink-faint); }
.shell-body .sched-seg { border-radius: 5px; color: var(--ink-soft); }
.shell-body .sched-seg:hover { color: var(--ink); background: var(--ctl-hover); }
.shell-body .sched-seg.is-now { color: var(--ink); background: var(--ctl-soft); }

/* Forms, actions, filters and tabs share one geometry. Never override .hidden. */
:where(.shell-body, .crm-theme-body) :is(.btn, .btn-icon, .fld, .sn-add, .sh-lang-btn) { border-radius: 6px; box-shadow: none; }
:where(.shell-body, .crm-theme-body) :is(button, a):is(.bg-primary-600, .bg-primary-700, .bg-gray-900, .border-gray-200, .border-gray-300) { border-radius: 6px; }
:where(.shell-body, .crm-theme-body) :is(.btn-primary, .btn-icon-primary) { background-color: var(--btn-bg); color: var(--btn-fg); box-shadow: none; }
:where(.shell-body, .crm-theme-body) :is(.btn-primary, .btn-icon-primary):hover { background-color: var(--btn-bg-hover); color: var(--btn-fg); }
:is(.shell-body, .crm-theme-body) .btn-icon.btn-icon-primary,
html.dark :is(.shell-body, .crm-theme-body) .btn-icon.btn-icon-primary { background-color: var(--btn-bg); color: var(--btn-fg); }
:is(.shell-body, .crm-theme-body) .btn-icon.btn-icon-primary:hover,
html.dark :is(.shell-body, .crm-theme-body) .btn-icon.btn-icon-primary:hover { background-color: var(--btn-bg-hover); color: var(--btn-fg); }
:where(.shell-body, .crm-theme-body) .btn-soft.btn-outline { background: var(--surface); border-color: var(--ctl-line); }
:where(.shell-body, .crm-theme-body) .btn-soft.btn-outline:hover { background: var(--ctl-hover); }
.shell-body :is(.bg-white, #modal-container, #quick-create-overlay) .btn-soft.btn-outline { background: var(--surface); border-color: var(--ctl-line); }
.shell-body :is(.bg-white, #modal-container, #quick-create-overlay) .btn-soft.btn-outline:hover { background: var(--ctl-hover); }
:where(.shell-body, .crm-theme-body) .btn-icon { color: var(--ink-soft); }
:where(.shell-body, .crm-theme-body) .btn-icon-go { color: #fff; }
.shell-body form:has(input[type="hidden"][name="id"][value=""]) button[type="submit"].btn-primary { background: var(--ctl-create); color: #fff; }
.shell-body form:has(input[type="hidden"][name="id"][value=""]) button[type="submit"].btn-primary:hover { background: var(--ctl-create-hover); color: #fff; }
.shell-body .sheet-tools #create-btn-wrapper .btn-create .rounded-full { background: transparent; color: inherit; }
:where(.shell-body, .crm-theme-body) :is(input, select, textarea):is(.border, .border-gray-200, .border-gray-300, .fld):not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"], [type="color"], [type="file"], [type="submit"], [type="button"], [type="reset"], [type="image"], .rounded-full, .fld-title) { border-radius: 6px; }
.shell-body :is(#modal-container, #quick-create-overlay, .sheet-main) :is(input, select, textarea):is(.border, .border-gray-200, .border-gray-300, .fld):not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"], [type="color"], [type="file"], [type="submit"], [type="button"], [type="reset"], [type="image"], .rounded-full, .fld-title) { border-radius: 6px; }
:where(.shell-body, .crm-theme-body) .fld:not(.fld-title) { background-color: var(--surface); border-color: var(--ctl-line); }
:where(.shell-body, .crm-theme-body) :is(input, select, textarea):focus { --tw-ring-color: var(--focus-ring); }
:where(.shell-body, .crm-theme-body) .seg-btn { border-radius: 5px; }
.shell-body .tabs { gap: 22px; border-bottom: 1px solid var(--line-soft); padding-bottom: 0; }
.shell-body .tab { padding: 11px 0 13px; border-radius: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-faint); }
.shell-body .tab.is-active,
.shell-body .tab.is-active:not(:is(.bg-white, #modal-container, #quick-create-overlay) *) { border-bottom-color: var(--ink); color: var(--ink); background: transparent; box-shadow: none; }
.shell-body .tab svg { color: inherit; }
:where(.shell-body, .crm-theme-body) :is(.chip-indigo, .chip-gray) { background: var(--ctl-soft); color: var(--ink-soft); }
:where(.shell-body, .crm-theme-body) .chip:not(:is(.chip-red, .chip-green, .chip-blue, .chip-yellow, .chip-orange, .status-dot, [style])) { background: var(--ctl-soft); color: var(--ink-soft); }
.shell-body table { font-size: 13px; }
.shell-body th { font-weight: 500; color: var(--ink-faint); }
.shell-body tr { border-color: var(--line-soft); }
.shell-body .ai-fab-pulse { animation: none; }
.shell-body #ai-fab-btn { width: 42px; height: 42px; background: var(--btn-bg); color: var(--btn-fg); box-shadow: none; }
.shell-body :is(.admin-search, .admin-nav-toggle, .bd-pill, .sn-item, .sh-icbtn, .sh-biz, .sh-dir, .sh-me, .btn, .btn-icon, .tab, .sched-seg, .sched-go):focus-visible { outline: 2px solid var(--ink-soft); outline-offset: 2px; }

/* Utility compatibility: legacy class names remain valid JS selectors. */
:where(.shell-body, .crm-theme-body) :is(.text-primary-200, .text-primary-300, .text-primary-400, .text-primary-500) { color: var(--ink-faint); }
:where(.shell-body, .crm-theme-body) :is(.text-indigo-400, .text-indigo-500, .text-indigo-600, .text-indigo-700, .text-indigo-800, .text-purple-500, .text-purple-600, .text-purple-700, .text-violet-500, .text-violet-600) { color: var(--ink-soft); }
:where(.shell-body, .crm-theme-body) :is(.bg-indigo-50, .bg-indigo-100, .bg-purple-50, .bg-purple-100, .bg-violet-50, .bg-violet-100) { background-color: var(--ctl-soft); }
:where(.shell-body, .crm-theme-body) :is(.border-indigo-100, .border-indigo-200, .border-purple-200, .border-violet-200) { border-color: var(--line-soft); }
:where(.shell-body, .crm-theme-body) :is(.border-primary-400, .border-primary-500, .border-primary-600, .border-indigo-400, .border-indigo-500) { border-color: var(--ink-faint); }
:where(.shell-body, .crm-theme-body) :is(.focus\:ring-primary-500, .focus\:ring-indigo-500, .focus\:ring-purple-500):focus { --tw-ring-color: var(--focus-ring); }
:where(.shell-body, .crm-theme-body) :is(.hover\:text-indigo-500, .hover\:text-indigo-600, .hover\:text-indigo-700, .hover\:text-purple-500, .hover\:text-purple-600):hover { color: var(--ink); }
:where(.shell-body, .crm-theme-body) :is(.hover\:bg-indigo-50, .hover\:bg-indigo-100, .hover\:bg-purple-50, .hover\:bg-purple-100):hover { background-color: var(--ctl-hover); }
:where(.shell-body, .crm-theme-body) :is(.hover\:border-indigo-200, .hover\:border-purple-200):hover { border-color: var(--line-soft); }
:where(.shell-body, .crm-theme-body) :is(.focus\:ring-primary-300, .focus\:ring-primary-400, .focus\:ring-indigo-300, .focus\:ring-indigo-400, .focus\:ring-purple-300, .focus\:ring-purple-400):focus { --tw-ring-color: var(--focus-ring); }

/* Old dark utilities use !important; normalize only the decorative classes. */
html.dark :where(.shell-body, .crm-theme-body) :is(.bg-primary-50, .bg-primary-100, .bg-primary-50\/50, .bg-indigo-50, .bg-indigo-100, .bg-purple-50, .bg-purple-100) { background-color: var(--ctl-soft) !important; }
html.dark :where(.shell-body, .crm-theme-body) :is(.text-primary-400, .text-primary-500, .text-primary-600, .text-primary-700, .text-indigo-500, .text-indigo-600, .text-indigo-700, .text-purple-500, .text-purple-600, .text-purple-700) { color: var(--ink-soft) !important; }
html.dark :where(.shell-body, .crm-theme-body) :is(.chip-indigo, .chip-gray) { background-color: var(--ctl-soft) !important; color: var(--ink-soft) !important; }
html.dark :where(.shell-body, .crm-theme-body) :is(.bg-primary-600, .bg-primary-700) { background-color: var(--btn-bg) !important; color: var(--btn-fg) !important; }
html.dark :where(.shell-body, .crm-theme-body) :is(.bg-primary-600, .bg-primary-700) svg { color: inherit !important; }
html.dark .shell-body .tab.is-active { background: transparent; color: var(--ink); box-shadow: none; }
html.dark .shell-body :is(.sn-item.on, .bd-item.on, .sh-menu-item.on) { color: var(--ink); }
html.dark .shell-body .bd-pill.on { background-color: var(--ctl-soft); color: var(--ink); }
html.dark .shell-body .sh-lang-btn.on { background: var(--btn-bg); color: var(--btn-fg); }
html.dark .shell-body .sn-dir.on .sn-dir-link { color: var(--ink); }
html.dark .shell-body .dashboard-widget[data-widget-type^="stats_"] { background-color: var(--surface) !important; }
html.dark :where(.shell-body, .crm-theme-body) :is(.bg-gray-700, .bg-gray-800, .bg-slate-700, .bg-slate-800, .dark\:bg-gray-700, .dark\:bg-gray-750, .dark\:bg-gray-800, .dark\:bg-slate-700, .dark\:bg-slate-800) { background-color: var(--surface) !important; }
html.dark :where(.shell-body, .crm-theme-body) :is(.dark\:text-gray-200, .dark\:text-gray-300, .dark\:text-slate-300) { color: var(--ink-soft) !important; }

/* Login/registration and client shells use the same surface system. */
.crm-theme-body :is(.rounded-xl, .rounded-2xl, .rounded-3xl) { border-radius: 8px; }
.crm-auth-page .crm-auth-hero { background: var(--surface); color: var(--ink); border-right: 1px solid var(--line-soft); }
.crm-auth-page .crm-auth-hero :is(.text-white, .text-primary-200, .text-primary-300, .text-emerald-200, .text-emerald-300) { color: var(--ink-soft); }
.crm-auth-page .crm-auth-hero h1 { color: var(--ink); font-weight: 600; letter-spacing: -.04em; }
.crm-auth-page .crm-auth-hero :is(.bg-white\/10, .bg-white\/20) { background: var(--ctl-hover); border: 1px solid var(--line-soft); }
.crm-auth-page .crm-auth-hero > .absolute { display: none; }

@media (max-width: 1279px) {
    .shell-body .sh { gap: 14px; }
    .shell-body .sh-biz { max-width: 135px; }
    .shell-body .sh-dir { max-width: 115px; }
    .shell-body .sh-me-name { display: none; }
    .shell-body .sh-me { padding-right: 3px; }
}
@media (max-width: 1023px) {
    .shell-body { margin-left: 0; }
    .shell-body .admin-sidebar { position: static; width: auto; padding: 0 20px 12px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
    .shell-body .admin-brand-row { height: 60px; margin-bottom: 0; }
    .shell-body .admin-brand { height: 60px; padding: 0; font-size: 24px; }
    .shell-body .admin-nav-toggle { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--ctl-line); border-radius: 6px; background: var(--surface); color: var(--ink-soft); font-size: 12px; cursor: pointer; }
    .shell-body #shell-band { display: none; }
    .shell-body.admin-nav-open #shell-band { display: block; }
    .shell-body .bd-track { display: flex; flex-wrap: wrap; gap: 4px; }
    .shell-body .bd-g { display: contents; }
    .shell-body .bd-pill { width: auto; height: 35px; padding: 0 10px; font-size: 12px; gap: 6px; }
    .shell-body .bd-label { flex: none; }
    .shell-body .bd-ic { width: 16px; height: 16px; }
    .shell-body .sn { order: 1; flex-basis: 100%; min-width: 0; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line-soft); }
    .shell-body .sn-list .sn-item { background: transparent; border-radius: 5px; }
    .shell-body .sn-list .sn-item.on { background: var(--ctl-soft); }
    .shell-body .sn-tree { background: transparent; }
    .shell-body .sh { padding: 14px 20px; gap: 12px; }
    .shell-body .admin-search { order: 2; flex-basis: 100%; max-width: none; }
    .shell-body .sh-right { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
    .shell-body .admin-now-strip { padding: 10px 20px; }
    .shell-body .sh-now { order: 0; }
    .shell-body .sheet-main { padding: 22px 20px 32px; }
    .shell-body .sheet-top { margin-bottom: 22px; }
}
@media (max-width: 639px) {
    .shell-body .admin-sidebar { padding: 0 14px 12px; }
    .shell-body .bd-pill { padding: 0 8px; }
    .shell-body .sh, .shell-body .sheet-main { padding-left: 16px; padding-right: 16px; }
    .shell-body .admin-now-strip { padding: 10px 16px; }
    .shell-body .sh { position: relative; }
    .shell-body .sh-right { gap: 3px; justify-content: flex-start; }
    .shell-body .sh-right .sh-dd { position: static; }
    .shell-body .sh-right .sh-menu { left: 16px; right: 16px; top: calc(100% + 8px); max-width: none; }
    .shell-body #notif-panel { left: 16px; right: 16px !important; top: calc(100% + 8px); width: auto !important; margin-top: 0; }
    .shell-body .sh-biz { max-width: 110px; padding: 8px; }
    .shell-body .sh-dir { max-width: 110px; padding: 8px; }
    .shell-body .sh-now-body { gap: 6px; }
    .shell-body .dashboard-heading-icon { display: none; }
    .shell-body .tabs { gap: 18px; }
    .shell-body .sheet-top { flex-wrap: wrap; }
    .shell-body .sheet-tools { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
    :where(.shell-body, .crm-theme-body) :is(.animate-fade-in, .animate-slide-up, .animate-scale-in) { animation: none; }
}
@media print {
    .shell-body { margin-left: 0; }
    .shell-body .admin-sidebar, .shell-body .sh-top { display: none !important; }
    .shell-body .sheet { display: block; margin: 0; min-height: 0; background: #fff; }
    .shell-body .sheet-main { padding: 0; overflow: visible; }
}

/* Blue accents include state variants that are not ordinary utility classes. */
:where(.shell-body,.crm-theme-body) :is(.text-indigo-400,.text-indigo-500,.text-indigo-600,.text-indigo-700,.text-indigo-800,.text-purple-500,.text-purple-600,.text-purple-700,.text-purple-800,.text-violet-500,.text-violet-600) { color: var(--ui-blue-text); }
:where(.shell-body,.crm-theme-body) :is(.bg-indigo-50,.bg-indigo-100,.bg-purple-50,.bg-purple-100,.bg-violet-50,.bg-violet-100,.chip-indigo) { background-color: var(--ui-blue-soft); }
:where(.shell-body,.crm-theme-body) .chip-indigo { color: var(--ui-blue-text); }
html.dark :where(.shell-body,.crm-theme-body) :is(.bg-indigo-50,.bg-indigo-100,.bg-purple-50,.bg-purple-100,.bg-violet-50,.bg-violet-100,.chip-indigo) { background-color: var(--ui-blue-soft) !important; }
html.dark :where(.shell-body,.crm-theme-body) :is(.text-indigo-400,.text-indigo-500,.text-indigo-600,.text-indigo-700,.text-indigo-800,.text-purple-500,.text-purple-600,.text-purple-700,.text-purple-800,.text-violet-500,.text-violet-600,.chip-indigo) { color: var(--ui-blue-text) !important; }
:where(.shell-body,.crm-theme-body) .peer:checked ~ .peer-checked\:bg-primary-600 { background-color: var(--ui-blue-control); }
:where(.shell-body,.crm-theme-body) .has-\[\:checked\]\:bg-primary-50:has(:checked), html.dark :where(.shell-body,.crm-theme-body) .has-\[\:checked\]\:bg-primary-50:has(:checked) { background-color: var(--ui-blue-soft) !important; }
:where(.shell-body,.crm-theme-body) .has-\[\:checked\]\:border-primary-500:has(:checked) { border-color: var(--ui-blue-control); }

html.dark :where(.shell-body,.crm-theme-body) .peer:checked ~ .peer-checked\:bg-primary-600 { background-color: var(--ui-blue-control) !important; }
:where(.shell-body,.crm-theme-body) :is(.hover\:bg-indigo-50,.hover\:bg-indigo-100,.hover\:bg-purple-50,.hover\:bg-purple-100,.hover\:bg-violet-50,.hover\:bg-violet-100):hover { background-color: var(--ui-blue-soft); }

/* Management catalogue; append after the shared blue palette. */
.management-page .settings-shell {
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.settings-content { min-width: 0; }
.settings-nav {
    padding: 12px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-primary);
}
.settings-nav-group { margin-top: 20px; }
.settings-nav-heading {
    margin: 0 8px 8px;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .025em;
}
.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
    text-decoration: none;
}
.settings-nav-link svg, .settings-catalogue-link > svg, .settings-group-title svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.settings-nav-link:hover, .settings-catalogue-link:hover { background: var(--bg-secondary); color: var(--text-primary); }
.settings-nav-link.is-active { background: var(--bg-tertiary); color: var(--ui-blue-text); font-weight: 600; }
.settings-nav-link:focus-visible, .settings-catalogue-link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.settings-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings-group-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-primary);
}
.settings-group-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--text-primary); font-size: 15px; line-height: 1.5; font-weight: 600; }
.settings-catalogue-links { display: flex; flex-direction: column; gap: 2px; }
.settings-catalogue-link { display: flex; align-items: center; gap: 10px; padding: 10px 8px; margin: 0 -8px; border-radius: 6px; color: var(--text-secondary); text-decoration: none; }
.settings-catalogue-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 13px; line-height: 1.4; }
.settings-scope { color: var(--text-tertiary); font-size: 11px; font-weight: 400; }
.settings-catalogue-arrow { margin-left: auto; padding-left: 8px; color: var(--text-tertiary); }
.management-page .team-summary-card, .management-page .team-members-panel { border: 1px solid var(--border-primary); border-radius: 8px; background: var(--bg-primary); box-shadow: none; }
.management-page .team-summary-card { padding: 20px; }
@media (max-width: 1050px) {
    .management-page .settings-shell { grid-template-columns: 190px minmax(0, 1fr); gap: 16px; }
    .settings-overview { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .management-page .settings-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .settings-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
    .settings-nav-group { display: contents; }
    .settings-nav-heading { display: none; }
    .settings-nav-link { flex: 0 0 auto; white-space: nowrap; }
    .settings-overview { gap: 16px; }
}
