.portal-body:is(.theme-store, .theme-admin) {
    --motion-shell: #f3f2ef;
    --motion-sidebar: #fbfaf7;
    --motion-surface: #fff;
    --motion-soft: #f2f3f9;
    --motion-divider: #e2e3e9;
    --motion-text: #171d36;
    --motion-muted: #5d647a;
    --motion-primary: #040d4a;
    --motion-highlight: #c4954d;
    --motion-highlight-soft: #f5ebd9;
    --motion-chart-bar: #aeb9db;
    --motion-chart-line: #172557;
    --motion-chart-negative: #ae6a75;
    --motion-chart-highlight: #f7f0e4;
    --motion-shadow: 0 2px 5px #040d4a04, 0 10px 24px #040d4a05;
    --ink: var(--motion-text);
    --muted: var(--motion-muted);
    --canvas: var(--motion-shell);
    --surface: var(--motion-surface);
    --line: var(--motion-divider);
    --workspace-line: var(--motion-divider);
    --workspace-ink: var(--motion-text);
    --workspace-card-shadow: var(--motion-shadow);
    --saas-muted: var(--motion-muted);
    --saas-line: var(--motion-divider);
    --saas-paper: var(--motion-soft);
}
.portal-body[data-workspace-theme="dark"] {
    color-scheme: dark;
    --motion-shell: #161a27;
    --motion-sidebar: #191e30;
    --motion-surface: #22283a;
    --motion-soft: #282f43;
    --motion-divider: #394158;
    --motion-text: #eef1ff;
    --motion-muted: #b8c0db;
    --motion-primary: #dce5ff;
    --motion-highlight: #e6bd7e;
    --motion-highlight-soft: #493d32;
    --motion-chart-bar: #6577aa;
    --motion-chart-line: #bacaff;
    --motion-chart-negative: #d58895;
    --motion-chart-highlight: #342e33;
    --motion-shadow: 0 8px 26px #080a1538;
    --primary: #a9bbff;
    --primary-dark: #edf0ff;
    --primary-soft: #313952;
}
.portal-body .portal-main { background: var(--motion-shell); }
.portal-body.theme-store[data-workspace-surface="soft"] .portal-main {
    background: linear-gradient(152deg, var(--motion-shell), var(--motion-soft));
}
.portal-body .portal-shell { grid-template-columns: 236px minmax(0, 1fr); }
.portal-body.theme-store .sidebar,
.portal-body.theme-admin .sidebar {
    padding: 20px 12px 14px;
    color: var(--motion-text);
    background: var(--motion-sidebar);
    border-inline-end: 1px solid var(--motion-divider);
    scrollbar-color: #a2a8bc70 transparent;
}
.portal-body .brand { min-height: 54px; gap: 9px; padding: 3px 5px 14px; border-color: var(--motion-divider); margin-block-end: 10px; }
.portal-body .brand-mark {
    inline-size: 36px; block-size: 36px; flex-basis: 36px; border-radius: 11px;
    color: #f8e5c3; background: var(--workspace-secure-primary); box-shadow: none;
}
.portal-body .brand-mark svg { width: 24px; height: 24px; }
.portal-body .brand-copy strong { font-size: .91rem; }
.portal-body .brand-copy small { font-size: .69rem; color: var(--motion-muted); }
.portal-body .primary-nav { margin-block-start: .55rem; gap: .15rem; }
.portal-body .nav-heading, .workspace-nav-group > summary { color: var(--motion-muted); }
.workspace-nav-group { border-color: var(--motion-divider); padding-block-start: 2px; margin-block-start: 3px; }
.workspace-nav-group > summary { min-height: 35px; }
.portal-body .sidebar .nav-link {
    color: var(--motion-muted); padding: 5px 8px; min-height: 40px;
    border-radius: 9px; font-size: .83rem; gap: 7px;
}
.portal-body .sidebar .nav-link:hover { color: var(--motion-text); background: var(--motion-soft); transform: none; }
.portal-body .sidebar .nav-link.is-active {
    color: var(--motion-primary); background: var(--motion-highlight-soft); border-color: transparent;
    box-shadow: inset -3px 0 var(--workspace-accent);
}
.portal-body .sidebar .nav-glyph { width: 26px; height: 26px; flex-basis: 26px; background: transparent; color: currentColor; }
.portal-body .sidebar-footer { border-color: var(--motion-divider); }
.portal-body .sidebar-user { padding-inline: 4px; }
.portal-body .sidebar-user-copy small { color: var(--motion-muted); }
.portal-body .sidebar .avatar { color: var(--motion-primary); background: var(--motion-highlight-soft); }
.portal-body .sidebar .logout-button { color: var(--motion-text); background: var(--motion-soft); min-height: 39px; }
.workspace-sidebar-fold, .workspace-tool {
    display: inline-flex; align-items: center; justify-content: center; gap: .38rem; border-radius: 9px;
    min-height: 39px; background: var(--motion-surface); color: var(--motion-text); border: 1px solid var(--motion-divider);
    cursor: pointer; padding: .33rem .55rem; transition: transform .2s ease, background .2s ease;
}
.workspace-sidebar-fold { align-self: start; margin-inline-start: 5px; min-height: 35px; width: 38px; }
.workspace-sidebar-fold[hidden], .workspace-tool[hidden], .workspace-chart-area[hidden], .workspace-months[hidden] { display: none; }
.workspace-tool:hover, .workspace-sidebar-fold:hover { background: var(--motion-soft); }
.workspace-tool:active, .workspace-sidebar-fold:active { transform: scale(.96); }
.workspace-tool :is(kbd, .workspace-tool-label) { font-size: .73rem; white-space: nowrap; }
.workspace-tool kbd { color: var(--motion-muted); background: var(--motion-soft); padding: 0 .28rem; border-radius: 4px; }
.workspace-tool .workspace-search-mark { margin: 0 .12rem; color: currentColor; border-color: currentColor; }
.workspace-tool .workspace-search-mark::after { background: currentColor; }
.workspace-toolbar { display: inline-flex; align-items: center; gap: .3rem; }
.workspace-command-live [data-search-fallback] { display: none; }
.workspace-search-launch {
    flex: 1 1 18rem; max-inline-size: 28rem; min-inline-size: 0; justify-content: flex-start;
    min-height: 42px; margin-inline: auto; background: var(--motion-soft); color: var(--motion-muted);
}
.workspace-search-launch .workspace-tool-label { overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.workspace-search-launch kbd { margin-inline-start: auto; background: var(--motion-surface); }
.workspace-theme-tool { inline-size: 39px; font-size: 1.12rem; }
.portal-body .topbar {
    min-height: 64px; background: color-mix(in srgb, var(--motion-surface) 91%, transparent);
    border-color: var(--motion-divider); padding: .57rem clamp(.75rem, 2.15vw, 1.9rem); gap: .7rem;
}
.portal-body .page-identity { margin-inline-end: .25rem; }
.portal-body .page-identity small { font-size: .68rem; color: var(--motion-muted); }
.portal-body .page-identity strong { font-size: .97rem; color: var(--motion-text); }
.portal-body .workspace-search { background: var(--motion-soft); border-color: var(--motion-divider); max-width: 430px; }
.portal-body .workspace-search input, .portal-body .workspace-search button { color: var(--motion-text); }
.portal-body .workspace-search button { background: var(--motion-surface); border-color: var(--motion-divider); }
.portal-body .topbar-user .avatar { background: var(--motion-highlight-soft); color: var(--motion-text); }
.workspace-account-link, .workspace-notification { color: var(--motion-text); }
.workspace-account-link:hover, .workspace-notification:hover { background: var(--motion-soft); }
.portal-body .page-content { padding: clamp(.9rem, 2.35vw, 2.2rem); padding-block-end: 3rem; }
.portal-body .page-content :is(.panel, .metric-card) { box-shadow: var(--motion-shadow); }
.portal-body .page-content .panel { border-radius: 15px; }
.portal-body .data-table th { background: var(--motion-soft); color: var(--motion-muted); }
.portal-body .data-table td, .portal-body .panel-heading { border-color: var(--motion-divider); }
.portal-body .data-table tbody tr:hover { background: var(--motion-soft); }
.portal-body :is(.button-secondary, .saas-button-outline, .button-light) {
    background: var(--motion-surface); border-color: var(--motion-divider); color: var(--motion-primary);
}
.portal-body :is(a, button, summary, input):focus-visible, .workspace-command :is(a, button, input):focus-visible {
    outline: 2px solid var(--motion-highlight); outline-offset: 2px;
}

.portal-body .dashboard-intro {
    min-height: 0; padding: clamp(.7rem, 1.8vw, 1.25rem); margin-block-end: .7rem;
    border: 0; border-radius: 0; background: transparent; color: var(--motion-text); box-shadow: none;
}
.portal-body .dashboard-intro::before, .portal-body .dashboard-intro::after { display: none; }
.portal-body .dashboard-intro :is(h1, p, small) { color: var(--motion-text); }
.portal-body .dashboard-intro .eyebrow { color: var(--motion-muted); font-weight: 700; margin-bottom: .15rem; }
.portal-body .dashboard-intro h1 { margin-block: .13rem .32rem; font-size: clamp(1.75rem, 3.35vw, 2.72rem); }
.portal-body .dashboard-intro .button-row { margin-block-start: .75rem; }
.portal-body .dashboard-intro .workspace-plan-link {
    min-width: min(100%, 13.5rem); background: var(--motion-surface); border-color: var(--motion-divider); color: var(--motion-text);
    box-shadow: var(--motion-shadow);
}
.dashboard-intro .workspace-plan-link small { color: var(--motion-muted); }
.dashboard-metrics { --metric-columns: repeat(auto-fit,minmax(min(100%, 135px),1fr)); margin-block-start: .55rem; }
.portal-body .dashboard-metrics .metric-card {
    padding: clamp(.75rem,1.5vw,1.15rem); min-height: 7.55rem;
    border-radius: 15px; background: var(--motion-surface); color: var(--motion-text);
}
.portal-body .dashboard-metrics .metric-card > span:not(.workspace-metric-icon), .portal-body .dashboard-metrics .metric-card > small { color: var(--motion-muted); }
.portal-body .dashboard-metrics .metric-card > strong { color: var(--motion-text); }
.portal-body .dashboard-metrics .workspace-metric-sales {
    background: linear-gradient(135deg, #0b1546, #233263); border-color: #21315f; color: #fff;
}
.portal-body .dashboard-metrics .workspace-metric-sales > :is(span:not(.workspace-metric-icon), strong, small) { color: #f4f5ff; }
.workspace-metric-icon { width: 30px; height: 30px; margin-block-end: .37rem; }
.workspace-payment { margin-block: .85rem; }
.workspace-tile { min-width: 0; border-radius: 13px; background: var(--motion-surface); }
.workspace-tile > span:not(.workspace-status-mark) { color: var(--motion-muted); }
.workspace-months li { background: var(--motion-soft); }
.workspace-insights-dual > * { min-inline-size: 0; }
.workspace-chart-area { padding: clamp(.75rem,2vw,1.4rem); }
.workspace-chart-tools { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: .7rem; }
.workspace-chart-readout { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .5rem; color: var(--motion-muted); max-inline-size: 100%; }
.workspace-chart-readout strong { color: var(--motion-text); font-size: clamp(1.25rem,3vw,1.9rem); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.workspace-segment { display: inline-flex; gap: .2rem; border: 1px solid var(--motion-divider); background: var(--motion-soft); padding: .2rem; border-radius: 9px; color: var(--motion-muted); }
.workspace-segment button, .workspace-chart-months button {
    border: 0; min-width: 0; min-height: 38px; padding: .3rem .52rem; border-radius: 7px;
    color: inherit; background: transparent; font: inherit; font-size: .76rem; cursor: pointer;
}
.workspace-segment button[aria-pressed="true"] { background: var(--motion-surface); color: var(--motion-text); box-shadow: var(--motion-shadow); font-weight: 750; }
.workspace-chart-canvas { display: block; width: 100%; height: clamp(120px,23vw,190px); margin-block: .65rem .2rem; }
.workspace-chart-months { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); color: var(--motion-muted); }
.workspace-chart-months button[aria-pressed="true"] { background: var(--motion-highlight-soft); color: var(--motion-text); font-weight: 750; }
.workspace-chart-months button { overflow-wrap: anywhere; font-size: clamp(.63rem,1.2vw,.78rem); }

.portal-body .crm-workspace .crm-hero {
    min-height: 0; padding: clamp(.85rem, 2vw, 1.45rem); color: var(--motion-text); border: 0;
    border-radius: 0; background: transparent; align-items: center;
}
.portal-body .crm-workspace .crm-hero::before, .portal-body .crm-workspace .crm-hero::after { display: none; }
.portal-body .crm-workspace .crm-hero h1 { color: var(--motion-text); font-size: clamp(1.6rem,3vw,2.5rem); }
.portal-body .crm-workspace .crm-hero p { color: var(--motion-muted); }
.portal-body .crm-workspace .crm-hero-secondary { background: var(--motion-surface); border-color: var(--motion-divider); color: var(--motion-primary); }
.portal-body .crm-workspace .crm-tabs { background: var(--motion-surface); border-color: var(--motion-divider); box-shadow: var(--motion-shadow); border-radius: 12px; }
.portal-body .crm-workspace .crm-tabs a { color: var(--motion-muted); }
.portal-body .crm-workspace .crm-tabs a[aria-current="page"] { background: var(--motion-highlight-soft); color: var(--motion-text); box-shadow: inset 0 -2px var(--workspace-accent); }
.portal-body .crm-workspace .crm-tabs a:not([aria-current]):hover { background: var(--motion-soft); }
.portal-body .crm-workspace .crm-metric { min-height: 8.25rem; }
.portal-body .crm-workspace .crm-metric :is(h2, a, small) { color: var(--motion-muted); }
.portal-body .crm-workspace .crm-metric strong, .portal-body .crm-workspace .saas-panel h2 { color: var(--motion-text); }
.portal-body .crm-workspace .crm-metric-growth,
.portal-body .crm-workspace .crm-deal { background: var(--motion-surface); }
.portal-body .crm-workspace .crm-metric-forecast { background: var(--motion-highlight-soft); }
.portal-body .crm-workspace .crm-stage { background: var(--motion-soft); }
.portal-body .crm-workspace .crm-stage h3, .portal-body .crm-workspace .crm-deal-value { color: var(--motion-text); }
.portal-body .crm-workspace .crm-stage h3 bdi { background: var(--motion-surface); }
.portal-body .crm-workspace .crm-form label, .portal-body .crm-workspace .crm-filter label { color: var(--motion-muted); }
.portal-body .crm-workspace :is(.crm-form, .crm-filter, .crm-deal) :is(input:not([type="hidden"]), select, textarea) {
    background: var(--motion-surface); color: var(--motion-text); border-color: var(--motion-divider);
}
.portal-body[data-workspace-theme="dark"] :is(.menu-button, .workspace-drawer-close, .workspace-notification, .count-chip) {
    color: var(--motion-text); background: var(--motion-soft); border-color: var(--motion-divider);
}
.portal-body[data-workspace-theme="dark"] .menu-button span { background: var(--motion-text); }
.portal-body[data-workspace-theme="dark"] .sidebar .logout-button { color: var(--motion-text); }
.portal-body[data-workspace-theme="dark"] .field :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea) {
    color: var(--motion-text); background: var(--motion-surface); border-color: var(--motion-divider);
}
.portal-body[data-workspace-theme="dark"] :is(.saas-panel h2, .crm-filter-panel > summary, .crm-outcome-row bdi, .document-row, .crm-tabs a) { color: var(--motion-text); }
.portal-body[data-workspace-theme="dark"] .workspace-tile strong { color: var(--motion-text); }
.portal-body[data-workspace-theme="dark"] .crm-workspace .crm-outcome-row { color: var(--motion-muted); }
.portal-body[data-workspace-theme="dark"] .crm-workspace .crm-outcome-row meter::-webkit-meter-bar { background: var(--motion-divider); }
.portal-body[data-workspace-theme="dark"] :is(.button-primary, .saas-button-primary) { background: #364a90; border-color: #5164a0; color: #fff; }
.portal-body[data-workspace-theme="dark"] .crm-leads-table tr, .portal-body[data-workspace-theme="dark"] .crm-calendar > div { background: var(--motion-soft); }
.portal-body[data-workspace-theme="dark"] .crm-calendar .crm-today { background: var(--motion-highlight-soft); }
.portal-body[data-workspace-theme="dark"] .crm-board-switch { background: var(--motion-soft); border-color: var(--motion-divider); }
.portal-body[data-workspace-theme="dark"] .crm-board-switch button { color: var(--motion-muted); }
.portal-body[data-workspace-theme="dark"] .crm-board-switch button[aria-pressed="true"] { background: var(--motion-surface); color: var(--motion-text); }
.portal-body[data-workspace-theme="dark"] .text-link { color: #bbcbff; }
.portal-body[data-workspace-theme="dark"] .document-row:hover { background: var(--motion-soft); }
.portal-body .alert[data-motion] { border-radius: 10px; box-shadow: var(--motion-shadow); }
.account-body .account-content { background: #f5f3ed; }
.account-body .account-card { border-color: #e5e0d6; border-radius: 17px; box-shadow: 0 14px 42px #040d4a0d; }

.workspace-command {
    inline-size: min(620px, calc(100% - 1.5rem)); max-block-size: min(73dvh, 640px); inset-block-start: clamp(.5rem, 10vh, 8rem);
    margin: 0 auto; padding: 0; border: 1px solid var(--motion-divider); border-radius: 17px;
    color: var(--motion-text); background: var(--motion-surface); box-shadow: 0 26px 65px #070c2a45;
    overflow: auto; overscroll-behavior: contain;
}
.workspace-command::backdrop { background: #0b123d82; backdrop-filter: blur(3px); }
.workspace-command-heading { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .75rem .85rem .55rem; }
.workspace-command-heading h2 { margin: 0; font-size: 1.03rem; }
.workspace-command-heading .workspace-tool { font-size: 1.3rem; width: 37px; }
.workspace-command-input {
    display: flex; align-items: center; gap: .5rem; min-height: 45px; margin-inline: .85rem;
    border: 1px solid var(--motion-divider); border-radius: 9px; background: var(--motion-soft);
}
.workspace-command-input input { flex: 1; min-width: 0; padding: .48rem .4rem; border: 0; background: transparent; color: var(--motion-text); }
.workspace-command-results { padding: .45rem .85rem .78rem; }
.workspace-command-status { margin-block: .35rem; color: var(--motion-muted); font-size: .77rem; }
.workspace-command-results ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.workspace-command-results a { display: flex; justify-content: space-between; align-items: center; min-height: 42px; gap: .52rem; padding: .4rem .52rem; border-radius: 8px; overflow-wrap: anywhere; }
.workspace-command-results a :is(strong, small) { min-width: 0; }
.workspace-command-results a small { color: var(--motion-muted); font-size: .71rem; white-space: nowrap; }
.workspace-command-results a:is(:focus-visible, :hover) { background: var(--motion-soft); }
.workspace-motion-ready .workspace-entrance, .workspace-motion-ready .crm-workspace .crm-metric { animation: none; }
@media (prefers-reduced-motion: no-preference) {
    .workspace-command[open] { animation: workspace-command-arrive .27s cubic-bezier(.18,.76,.28,1) both; }
    @keyframes workspace-command-arrive { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
    @view-transition { navigation: auto; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
}
@media (min-width: 1024px) {
    .portal-body[data-sidebar-folded="true"] .portal-shell { grid-template-columns: 70px minmax(0, 1fr); }
    .portal-body[data-sidebar-folded="true"] .sidebar { padding-inline: 8px; }
    .portal-body[data-sidebar-folded="true"] .brand { justify-content: center; }
    .portal-body[data-sidebar-folded="true"] :is(.brand-copy, .sidebar-user-copy, .nav-heading) { display: none; }
    .portal-body[data-sidebar-folded="true"] .nav-link { justify-content: center; min-width: 0; }
    .portal-body[data-sidebar-folded="true"] .nav-link > :last-child { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
    .portal-body[data-sidebar-folded="true"] .workspace-nav-group summary { font-size: 0; justify-content: center; min-height: 26px; }
    .portal-body[data-sidebar-folded="true"] .workspace-sidebar-fold { align-self: center; margin-inline: 0; transform: rotate(180deg); }
    .portal-body[data-sidebar-folded="true"] .logout-button { font-size: 0; }
    .portal-body[data-sidebar-folded="true"] .logout-button span { font-size: 1rem; }
    .portal-body[data-sidebar-folded="true"] .sidebar-user { justify-content: center; padding-inline: 0; }
}
@media (min-width: 1150px) {
    .workspace-insights-dual { display: grid; grid-template-columns: minmax(205px, .8fr) minmax(0, 2fr); gap: .85rem; margin-block: .85rem; align-items: start; }
    .workspace-insights-dual > :is(.workspace-payment, .workspace-trend) { margin-block: 0; }
    .workspace-insights-dual .workspace-payment { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
    .workspace-insights-dual .workspace-tile { grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: .45rem; }
    .workspace-insights-dual .workspace-tile a { grid-column: 2 / -1; }
}
@media (max-width: 1023px) {
    .workspace-sidebar-fold { display: none; }
    .portal-body .workspace-drawer-close { color: var(--motion-text); border-color: var(--motion-divider); background: var(--motion-soft); }
}
@media (max-width: 680px) {
    .portal-body .workspace-toolbar { gap: .15rem; }
    .workspace-toolbar .workspace-tool { min-width: 35px; min-height: 38px; padding-inline: .35rem; }
    .workspace-toolbar :is(kbd, .workspace-tool-label) { display: none; }
    .workspace-search-launch { flex: 0 0 36px; min-height: 38px; margin: 0; padding: .3rem; justify-content: center; }
    .workspace-search-launch :is(kbd, .workspace-tool-label) { display: none; }
    .portal-body .topbar { gap: .34rem; }
    .portal-body .page-identity strong { font-size: .9rem; }
    .dashboard-metrics { --metric-columns: repeat(2,minmax(0,1fr)); }
    .workspace-chart-months button { padding-inline: .15rem; }
}
@media print {
    .workspace-toolbar, .workspace-command, .workspace-sidebar-fold { display: none !important; }
    .portal-body .portal-main { background: white; }
}
