html, body {

    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

body { font-size: 0.85rem; }

html[data-density="compact"] { font-size: 87.5%; }
html[data-density="normal"]  { font-size: 100%; }
html[data-density="large"]   { font-size: 112.5%; }

a, .btn-link {
    color: #2B579A;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {

  box-shadow: 0 0 0 3px rgba(43, 108, 176, .35);
}

.content {
    padding-top: 16px;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.mud-tabs .mud-tab,
.mud-button-root {
    text-transform: none !important;
}

:root {
    --crm-primary: #2456A6;
    --crm-primary-2: #3A7BD5;
    --crm-primary-soft: #E7F0FB;
    --crm-ink: #16233B;
    --crm-bg: #EAF0F8;
    --crm-card: #FFFFFF;
    --crm-border: #DCE6F2;
    --crm-line: #E8EEF6;
    --crm-text: #1A2436;

    --crm-muted: #5A6B80;
    --crm-hover: #EDF4FD;
    --crm-selected: #DBE9FA;
    --crm-header: #EEF4FC;
    --crm-shadow: 0 1px 2px rgba(23,45,84,.05), 0 2px 6px rgba(23,45,84,.07);
    --crm-shadow-lg: 0 10px 30px rgba(23,45,84,.14), 0 3px 10px rgba(23,45,84,.08);

    --sp-2: 2px;
    --sp-4: 4px;
    --sp-6: 6px;
    --sp-8: 8px;
    --sp-10: 10px;
    --sp-12: 12px;
    --sp-16: 16px;
    --sp-20: 20px;
    --sp-24: 24px;
    --sp-32: 32px;
}

.gap-1 { gap: var(--sp-4) !important; }
.gap-2 { gap: var(--sp-6) !important; }
.gap-3 { gap: var(--sp-12) !important; }
.gap-4 { gap: var(--sp-20) !important; }

.mud-paper:not(.stat-card) > .mud-typography-h6,
.mud-paper:not(.stat-card) > .mud-typography-subtitle1,
.mud-paper:not(.stat-card) > .mud-typography-subtitle2 {
    margin-bottom: var(--sp-8);
}

    .mud-paper:not(.stat-card) > .mud-typography-h6 + *,
    .mud-paper:not(.stat-card) > .mud-typography-subtitle1 + *,
    .mud-paper:not(.stat-card) > .mud-typography-subtitle2 + * {
        margin-top: 0;
    }

html, body { color: var(--crm-text); }

html, body { overflow-x: clip; max-width: 100%; }
.page-ribbon { overflow-x: clip; max-width: 100vw; }
.content, main, article { min-width: 0; max-width: 100%; }
.mud-grid, .mud-paper, .mud-tabs, .mud-tabs-panels { max-width: 100%; }

.mud-popover .mud-paper, .mud-popover.mud-paper { max-width: none; }

.mud-popover > .mud-list { max-height: none !important; overflow-y: visible !important; }
.mud-tabs-panels { min-width: 0; }

.mud-tabs-tabbar { position: relative; z-index: 1; }

.card-doc, .print-doc, .letter-doc, .rep-doc {
    background: #fff !important;
    color: #1f2430 !important;
    border-radius: 10px;
    box-shadow: 0 6px 26px rgba(0, 0, 0, .22);
    margin-top: 24px !important;
    margin-bottom: 24px !important;
}

.card-doc h1, .print-doc h1, .letter-doc h1, .rep-doc h1 { color: #1f2430 !important; }

@media print {

    html, body { background: #fff !important; }
    .card-doc, .print-doc, .letter-doc, .rep-doc {
        box-shadow: none !important; border-radius: 0 !important; margin: 0 auto !important; max-width: none !important;
    }
    .top-row, .ribbon, .status-bar, #blazor-error-ui { display: none !important; }
}

.rpt-sheet.card-doc, .rpt-sheet.print-doc, .rpt-sheet.letter-doc, .rpt-sheet.rep-doc {
    background: var(--rpt-page, #fff) !important;
    color: var(--rpt-ink, #1f2430) !important;
}
.rpt-sheet.card-doc h1, .rpt-sheet.print-doc h1, .rpt-sheet.letter-doc h1, .rpt-sheet.rep-doc h1 { color: var(--rpt-ink, #1f2430) !important; }

.rpt-theme-badge { font-size: .85rem; color: inherit; opacity: .75; text-decoration: none; border-bottom: 1px dotted currentColor; }
@media print { .rpt-theme-badge { display: none !important; } }
img, svg { max-width: 100%; height: auto; }
body {
    background:
        radial-gradient(680px 460px at 8% 6%, rgba(58,123,213,.10), transparent 60%),
        radial-gradient(620px 480px at 96% 96%, rgba(128,90,213,.09), transparent 62%),
        linear-gradient(160deg, #EAF0F8 0%, #E3EBF6 55%, #EAF0F8 100%);
    background-attachment: fixed;
    min-height: 100vh;
}
a, .btn-link { color: var(--crm-primary); }

.mud-paper {
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: var(--crm-shadow) !important;

    transition: box-shadow .18s ease, transform .18s ease !important;
}

.stat-card:hover, .landing-feat:hover, .mud-paper.interactive:hover, .dash-card:hover {
    box-shadow: var(--crm-shadow-lg) !important;
    transform: translateY(-3px);
}
.mud-popover { box-shadow: var(--crm-shadow-lg) !important; }

.num-cell, .num-cell .mud-table-cell-content { text-align: right; font-variant-numeric: tabular-nums; }
th.num-cell > .mud-table-header-sort-label { justify-content: flex-end; }

.page-ribbon > .top-row { position: relative; }
.top-row {
    background: linear-gradient(180deg, #FFFFFF 0%, #F7FAFF 100%) !important;
    border-bottom: 1px solid var(--crm-border);
    box-shadow: 0 2px 8px rgba(23,45,84,.06);
}

.top-row a.app-title {
    display: inline-flex; align-items: center; font-weight: 800; font-size: 1.15rem;
    color: var(--crm-primary); text-decoration: none; cursor: pointer;
    padding: 4px 8px; margin-left: -8px; border-radius: 8px; transition: background .15s, filter .15s;
}
.top-row a.app-title:hover { background: var(--crm-primary-soft); filter: brightness(1.05); }
html[data-theme="dark"] .top-row a.app-title:hover { background: rgba(90,155,224,.14); }

.top-row::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--crm-primary) 0%, var(--crm-primary-2) 50%, #805AD5 100%);
}

.ribbon { background: linear-gradient(180deg, #F4F8FE 0%, #EDF3FB 100%); border-bottom: 1px solid var(--crm-border); }
.ribbon-strip { display: flex; flex-wrap: wrap; align-items: flex-start; padding: 0 8px; }
.rt-radio { position: absolute; opacity: 0; width: 0; height: 0; }
.rt-label {
    padding: 10px 16px 8px; cursor: pointer; font-size: .84rem; font-weight: 600;
    color: var(--crm-muted); border-bottom: 2.5px solid transparent; user-select: none; line-height: 1.4;
    transition: color .15s ease, border-color .15s ease;
}
.rt-label:hover { color: var(--crm-primary); }

.rt-radio:focus-visible + .rt-label {
    outline: 2px solid var(--crm-primary);
    outline-offset: -2px;
    border-radius: 6px 6px 0 0;
    color: var(--crm-primary);
}
.rt-radio:checked + .rt-label { color: var(--crm-primary); border-bottom-color: var(--crm-primary); }

.ribbon-body {
    flex-basis: 100%; width: 100%; background: #FFFFFF; border-top: 1px solid var(--crm-line);

    padding: 8px 12px; min-height: auto; overflow-x: auto;
}
.ribbon-page { display: none; gap: 6px; }

#rt-home:checked ~ .ribbon-body #rp-home,
#rt-sales:checked ~ .ribbon-body #rp-sales,
#rt-secr:checked ~ .ribbon-body #rp-secr,
#rt-sellers:checked ~ .ribbon-body #rp-sellers,
#rt-mgmt:checked ~ .ribbon-body #rp-mgmt,
#rt-mkt:checked ~ .ribbon-body #rp-mkt,
#rt-targets:checked ~ .ribbon-body #rp-targets,
#rt-bi:checked ~ .ribbon-body #rp-bi,
#rt-org:checked ~ .ribbon-body #rp-org,
#rt-ai:checked ~ .ribbon-body #rp-ai { display: flex; }

.ribbon-page { flex-wrap: wrap; align-items: stretch; }
.rgroup { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 0 16px; border-right: 1px solid var(--crm-line); }
.rgroup:last-child { border-right: none; }

.rgroup-title { font-size: max(11px, .72rem); color: var(--crm-muted); margin-top: 6px; white-space: nowrap; letter-spacing: .3px; text-transform: uppercase; }

.rbtns { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; justify-content: center; align-content: flex-start; align-items: flex-start; }
.rbtn {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 2px; padding: 6px 10px; min-width: 64px; border-radius: 10px;
    color: var(--crm-text); text-decoration: none; font-size: max(11px, .72rem); text-align: center;
    transition: background .15s ease, color .15s ease;
}
.rbtn:hover { background: var(--crm-primary-soft); text-decoration: none; color: var(--crm-primary); }

.rbtn.active { background: var(--crm-primary); color: #fff; text-shadow: .3px 0 0 currentColor, -.3px 0 0 currentColor; }

.mud-icon-root.ri {
    width: 1em; height: 1em; display: inline-block; flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-image: var(--ri); mask-image: var(--ri);
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
    -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}

.rbtn .mud-icon-root { color: var(--crm-primary); }
.rbtn.active .mud-icon-root { color: #fff; }

:root { interpolate-size: allow-keywords; }

.rbtn-menu { display: flex; flex-direction: column; }

.rbtn-summary {
    display: flex; align-items: stretch; cursor: pointer; list-style: none;
    position: relative; padding-right: 16px; border-radius: 10px;
    transition: background .15s ease;
}
.rbtn-summary::-webkit-details-marker { display: none; }
.rbtn-summary:hover { background: var(--crm-primary-soft); }

.rbtn-summary::after {
    content: ""; position: absolute; right: 6px; top: 50%;
    width: 6px; height: 6px; margin-top: -4px;
    border-right: 1.5px solid var(--crm-primary);
    border-bottom: 1.5px solid var(--crm-primary);
    border-radius: 1px; opacity: .7;
    transform: rotate(45deg);
    transition: transform .16s cubic-bezier(.4, 0, .2, 1), opacity .16s ease;
}
.rbtn-summary:hover::after { opacity: 1; }
.rbtn-menu[open] > .rbtn-summary::after { transform: rotate(-135deg); margin-top: -1px; }

.rbtn-menu::details-content {
    block-size: 0; overflow: hidden;
    transition: block-size .16s cubic-bezier(.32, .72, 0, 1),
                content-visibility .16s allow-discrete;
}
.rbtn-menu[open]::details-content { block-size: auto; }

.rbtn-sub {
    display: flex; flex-direction: column; gap: 2px; padding: 4px 0 2px 8px;
    opacity: 1; transform: translateY(0);
    transition: opacity .14s ease, transform .18s cubic-bezier(.32, .72, 0, 1);
}
@starting-style { .rbtn-menu[open] .rbtn-sub { opacity: 0; transform: translateY(-6px); } }

.rbtn-sub .rbtn {
    flex-direction: row; justify-content: flex-start; gap: 6px;
    min-width: 0; padding: 4px 10px; font-size: max(11px, .68rem); text-align: left;
    border-radius: 8px; background: var(--crm-primary-soft);
    transition: background .15s ease, transform .15s ease;
}
.rbtn-sub .rbtn:hover { background: var(--crm-primary); color: #fff; transform: translateX(2px); }
.rbtn-sub .rbtn:hover .mud-icon-root { color: #fff; }
.rbtn-sub .rbtn .mud-icon-root { font-size: 1rem; }

.rbtn-sub .rbtn.active { background: var(--crm-primary); color: #fff; text-shadow: .3px 0 0 currentColor, -.3px 0 0 currentColor; }
.rbtn-sub .rbtn.active .mud-icon-root { color: #fff; }

.rbtn-menu:has(.rbtn-sub .rbtn.active) > .rbtn-summary { background: var(--crm-primary-soft); }
.rbtn-menu:has(.rbtn-sub .rbtn.active) > .rbtn-summary::after { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .rbtn-summary::after, .rbtn-menu::details-content, .rbtn-sub, .rbtn-sub .rbtn {
        transition: none;
    }
}

.app-tile-grid {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.app-tile {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 10px;
    text-decoration: none; color: var(--crm-text);
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.app-tile:hover {
    text-decoration: none; border-color: var(--crm-primary);
    box-shadow: var(--crm-shadow); transform: translateY(-1px);
}
.app-tile-icon { color: var(--crm-primary); flex: 0 0 auto; }
.app-tile-body { min-width: 0; }
.app-tile-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tile-sub { font-size: .74rem; color: var(--crm-primary); }

.grid-clickable tbody tr { cursor: pointer; }

.uc-lbl { color: var(--crm-text-secondary, var(--crm-muted)); width: 150px; white-space: nowrap; }
.uc-stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.uc-stat {
    padding: 12px 12px; border: 1px solid var(--crm-border); border-radius: 10px;
    background: var(--crm-card);
}
.uc-stat-hi { border-color: var(--crm-primary); background: var(--crm-primary-soft); }
.uc-stat-v { font-size: 1.35rem; font-weight: 700; color: var(--crm-text); font-variant-numeric: tabular-nums; }
.uc-stat-hi .uc-stat-v { color: var(--crm-primary); }
.uc-stat-l { font-size: .74rem; color: var(--crm-text-secondary, var(--crm-muted)); margin-top: 2px; }

.role-card-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.role-card {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 12px;
    text-decoration: none; color: var(--crm-text); transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.role-card:hover {
    text-decoration: none; border-color: var(--crm-primary);
    box-shadow: var(--crm-shadow); transform: translateY(-1px);
}
.role-card-icon {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
    background: var(--crm-primary-soft); color: var(--crm-primary);
}
.role-card-icon .mud-icon-root { color: var(--crm-primary); }
.role-card-body { flex: 1 1 auto; min-width: 0; }
.role-card-name { font-weight: 600; font-size: .95rem; color: var(--crm-text); }
.role-card-sub { font-size: .8rem; color: var(--crm-text-secondary, var(--crm-muted)); }
.role-card-active { color: var(--crm-primary); }
.role-card-count {
    flex: 0 0 auto; min-width: 34px; text-align: center;
    font-size: .95rem; font-weight: 700; padding: 4px 10px; border-radius: 10px;
    background: var(--crm-primary-soft); color: var(--crm-primary);
}

h1 {
    font-size: 1.55rem; font-weight: 800; color: var(--crm-ink);
    padding-bottom: 2px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px;
}
h1::before {
    content: ""; width: 5px; height: 1.35rem; border-radius: 3px;
    background: linear-gradient(180deg, var(--crm-primary-2), var(--crm-primary));
}

.filter-group {
    border: 1px solid var(--crm-border); border-radius: 8px;
    padding: 12px 12px 10px; position: relative;
}
.filter-group-title {
    position: absolute; top: -9px; left: 10px; padding: 0 6px;
    background: var(--crm-card); font-size: .7rem; font-weight: 700;
    color: var(--crm-primary); letter-spacing: .2px;
}
html[data-theme="dark"] .filter-group { border-color: #26324B; }
html[data-theme="dark"] .filter-group-title { background: #16213A; color: #82B6EC; }

.checklist {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 10px;
    max-height: 168px; overflow-y: auto;
    border: 1px solid var(--crm-line); border-radius: 6px; padding: 6px 8px;
    background: var(--crm-card);
}
.checklist-item {
    display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 4px;
    font-size: .8rem; cursor: pointer; min-width: 0; margin: 0;
}
.checklist-item:hover { background: var(--crm-hover); }
.checklist-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checklist-item input { accent-color: var(--crm-primary); cursor: pointer; flex: none; }
html[data-theme="dark"] .checklist { border-color: #26324B; background: #131E33; }
html[data-theme="dark"] .checklist-item:hover { background: #17233C; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 0; }

.page-head > h1 + * { margin-left: auto; }

.section-title {
    font-weight: 700; color: var(--crm-ink); display: inline-flex; align-items: center; gap: 8px;
}
.section-title::before {
    content: ""; width: 4px; height: .95em; border-radius: 2px;
    background: linear-gradient(180deg, var(--crm-primary-2), var(--crm-primary));
}

.dash-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(120deg, var(--crm-primary) 0%, #3B82C4 55%, #5A9BD8 100%);
    color: #fff; border-radius: 16px; padding: 24px 30px; box-shadow: var(--crm-shadow-lg);
    display: flex; align-items: center; justify-content: space-between;
}
.dash-hero::before {
    content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px;
    border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%);
}
.dash-hero .dash-hello { color: #fff; font-weight: 800; letter-spacing: .2px; }

.dash-hero .dash-sub { color: rgba(255,255,255,.9); }
.dash-hero .dash-hero-icon { font-size: 3.4rem !important; color: rgba(255,255,255,.28); position: relative; }
.dash-tagline { display: flex; align-items: center; justify-content: center; gap: 16px; margin: -8px 0 16px; }
.dash-tagline .dash-rule { width: 4px; height: 28px; border-radius: 2px; background: var(--crm-primary); flex: 0 0 auto; }
.dash-tagline .dash-tagline-text { font-size: 1.15rem; font-weight: 700; color: var(--crm-text); text-align: center; }
html[data-theme="dark"] .dash-hero {
    background: linear-gradient(120deg, #1E3A5F 0%, #24466F 55%, #2C5488 100%);
}

.stat-card {
    border-radius: 16px !important; position: relative; overflow: hidden;
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFCFF 100%) !important;
}
.stat-card:hover { box-shadow: var(--crm-shadow-lg) !important; transform: translateY(-3px); }

.stat-card-link { cursor: pointer; user-select: none; }
.stat-card-link:hover .stat-card-chevron { transform: translateX(3px); opacity: 1; }
.stat-card .stat-card-chevron {
    padding: 0; background: none; box-shadow: none; width: auto; height: auto;
    color: var(--crm-text-secondary); opacity: .5; transition: transform .18s, opacity .18s;
}
.stat-card .mud-typography-h6 { font-weight: 800; font-size: 1.55rem; color: var(--crm-ink); }

.dash-card-link { cursor: pointer; }
.dash-card-chevron { color: var(--crm-text-secondary); opacity: .45; transition: transform .18s, opacity .18s, color .18s; }

.dash-card-link:hover .dash-card-chevron { transform: translateX(3px); opacity: 1; color: var(--crm-ink); }

.dash-seller-wrap { overflow-x: auto; }
.dash-seller-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.dash-seller-table th, .dash-seller-table td { padding: 4px 10px; text-align: right; white-space: nowrap; }
.dash-seller-table th.lft, .dash-seller-table td.lft { text-align: left; }
.dash-seller-table thead th { color: var(--crm-text-secondary); font-weight: 600; border-bottom: 1px solid var(--crm-border); }
.dash-seller-table thead th.grp { text-align: center; border-bottom: 2px solid var(--crm-primary); }
.dash-seller-table thead th.grp-inv { border-bottom-color: #805AD5; }
.dash-seller-table tbody td { border-bottom: 1px solid var(--crm-border); font-variant-numeric: tabular-nums; color: var(--crm-ink); }
.dash-seller-table td.lft { font-weight: 600; }
.dash-seller-table tbody td.inv { color: var(--crm-text-secondary); }
.dash-seller-table tbody tr:hover td { background: var(--crm-primary-soft); }
.dash-seller-table tr.tot td { border-top: 2px solid var(--crm-border); }

.yoy-table tr.base-row td { background: var(--crm-primary-soft); font-weight: 600; }
.yoy-table td.delta-up { color: #2F855A; font-weight: 700; }
.yoy-table td.delta-down { color: #E53E3E; font-weight: 700; }
.yoy-table td.delta-flat { color: var(--crm-text-secondary); }

.yoy-table .delta-abs { display: block; font-size: .76rem; font-weight: 400; color: var(--crm-text-secondary); }

.portal-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.portal-card { display: flex; flex-direction: column; min-width: 0; }
.portal-title { font-weight: 700; color: var(--crm-ink); overflow-wrap: anywhere; }

.portal-descr {
    overflow-wrap: anywhere; white-space: pre-line;
    max-height: 8.5em; overflow-y: auto; line-height: 1.35;
}
.portal-descr::-webkit-scrollbar { width: 6px; }
.portal-descr::-webkit-scrollbar-thumb { background: var(--crm-border); border-radius: 3px; }
.portal-card .portal-icon { color: var(--crm-primary); }
.portal-inactive { opacity: .55; }

.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut-svg { flex: none; }
.donut-total { font-size: 20px; font-weight: 800; fill: var(--crm-ink); }
.donut-legend { list-style: none; margin: 0; padding: 0; min-width: 180px; flex: 1; }
.donut-legend li { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: .86rem; }
.donut-legend .dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.donut-legend .lbl { color: var(--crm-ink); }
.donut-legend .val { margin-left: auto; color: var(--crm-text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-card .mud-icon-root {
    padding: 8px; border-radius: 13px; background: var(--crm-primary-soft);
    width: 44px; height: 44px; box-sizing: content-box;
    box-shadow: inset 0 0 0 1px rgba(36,86,166,.08);
}

.delphi-grid { border-radius: 12px; border: 1px solid var(--crm-border); }

.delphi-grid .mud-table-container { overflow-x: auto; }
.delphi-grid .mud-table-root { min-width: max-content; }
.delphi-grid .mud-table-cell {
    padding: 8px 12px; font-size: .82rem; border-right: none;
    border-bottom: 1px solid var(--crm-line);
}
.delphi-grid .mud-table-head .mud-table-cell {
    background: linear-gradient(180deg, var(--crm-header) 0%, #E6EFFA 100%); color: var(--crm-primary);

    font-weight: 700; font-size: .74rem; letter-spacing: .2px;
    border-bottom: 2px solid var(--crm-border); white-space: nowrap;
}
.delphi-grid .mud-table-row:hover { background-color: var(--crm-hover) !important; cursor: pointer; }
.delphi-grid .mud-table-row.delphi-row-selected { background-color: var(--crm-selected) !important; }
.delphi-grid .mud-table-row.delphi-row-selected td { font-weight: 600; }

.delphi-grid .num { text-align: right; font-variant-numeric: tabular-nums; }

.status-bar {
    display: flex; align-items: center; height: 1.75rem;
    background: linear-gradient(180deg, #F2F6FC 0%, #E9EFF8 100%);
    border-top: 1px solid var(--crm-border);
    font-size: .74rem; color: #445064;
    position: sticky; bottom: 0; z-index: 1;

    overflow: visible;
}
.status-bar .sb-panel {
    padding: 0 12px; border-right: 1px solid var(--crm-border);
    white-space: nowrap; line-height: 1.5rem;
    overflow: hidden; text-overflow: ellipsis;
}

.status-bar .sb-panel:last-child { border-right: none; }
.status-bar .sb-right { margin-left: auto; border-right: none; padding-right: 12px; }

.status-bar .sb-bell { display: inline-flex; align-items: center; padding: 0 12px 0 4px; }
.status-bar .sb-bell .mud-icon-button { padding: 2px; }
.status-bar .sb-bell .mud-badge { --mud-badge-size: 15px; }

.hub-overlay { position: fixed; inset: 0; z-index: 1300; background: transparent; }
.hub-panel {
    position: fixed; right: 12px; bottom: 2.25rem; z-index: 1301;
    width: 370px; max-width: calc(100vw - 24px); max-height: min(72vh, 640px);
    display: flex; flex-direction: column;
    background: var(--crm-card); color: var(--crm-text);
    border: 1px solid var(--crm-border); border-radius: 14px;
    box-shadow: var(--crm-shadow-lg);
    overflow: hidden;
    animation: hub-slide-in .16s ease-out;
}
@@keyframes hub-slide-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hub-panel-head { display: flex; align-items: center; padding: 10px 12px; gap: 2px; }
.hub-panel-title { font-weight: 700; font-size: .95rem; }
.hub-settings { padding: 6px 12px; background: var(--crm-hover); }
.hub-set-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.hub-set-label { font-size: .82rem; font-weight: 600; }
.hub-set-sub { font-size: .7rem; color: var(--mud-palette-text-secondary); }
.hub-panel-actions { display: flex; align-items: center; padding: 4px 8px; }
.hub-panel-list { overflow-y: auto; flex: 1; padding: 4px; }
.hub-panel-foot { display: flex; gap: 4px; padding: 6px 8px; }

.hub-empty { display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 32px 0; color: var(--mud-palette-text-secondary); font-size: .85rem; }
.hub-empty .mud-icon-root { opacity: .5; }

.hub-card {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 10px;
    cursor: pointer; position: relative; transition: background .12s;
}
.hub-card:hover { background: var(--crm-hover); }

.hub-card:focus-visible { outline: 2px solid var(--crm-primary); outline-offset: -2px; background: var(--crm-hover); }

.stat-card-a { display: block; text-decoration: none; color: inherit; border-radius: 10px; }
.stat-card-a:focus-visible { outline: 2px solid var(--crm-primary); outline-offset: 2px; }
.stat-card-a:hover { text-decoration: none; }

.rte-help { font-size: .72rem; color: var(--crm-muted); margin-top: 4px; }
.hub-card:hover .hub-card-dismiss { opacity: 1; }
.hub-card-unread { background: var(--crm-primary-soft); }
.hub-card-icon { margin-top: 2px; flex: none; }
.hub-card-body { flex: 1; min-width: 0; }
.hub-card-title { font-size: .84rem; font-weight: 600; }
.hub-card-text { font-size: .78rem; color: var(--mud-palette-text-secondary);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hub-card-meta { font-size: .68rem; color: var(--mud-palette-text-secondary); margin-top: 2px; }
.hub-card-dismiss { opacity: 0; transition: opacity .12s; }

html[data-theme="dark"] .hub-panel { background: #16213A; border-color: #26324B; }
html[data-theme="dark"] .hub-settings { background: #131E33; }
html[data-theme="dark"] .hub-card-unread { background: #17233C; }

.mud-simple-table { border-radius: 10px; border: 1px solid var(--crm-border); overflow: hidden; }
.mud-simple-table table { border-collapse: collapse; }
.mud-simple-table thead th {
    background: linear-gradient(180deg, var(--crm-header) 0%, #E6EFFA 100%); color: var(--crm-primary);
    font-weight: 700; font-size: .74rem; letter-spacing: .2px;
    border-bottom: 2px solid var(--crm-border); white-space: nowrap; padding: 8px 12px;
}
.mud-simple-table tbody td { padding: 6px 12px; font-size: .82rem; border-bottom: 1px solid var(--crm-line); }
.mud-simple-table tbody tr:hover { background: var(--crm-hover); }

.katan-grid { max-height: 46vh; overflow-y: auto; border: 1px solid var(--crm-border); border-radius: 8px; }
.katan-table { width: 100%; border-collapse: collapse; }
.katan-table th, .katan-table td { padding: 2px 8px; border-bottom: 1px solid var(--crm-border); }
.katan-table thead th { position: sticky; top: 0; background: var(--crm-hover); z-index: 1; font-size: .8rem; }
.katan-table td.num, .katan-table th.num { text-align: right; width: 120px; }
.katan-num { max-width: 100px; margin-left: auto; }
.katan-sum td { font-weight: 700; background: var(--crm-hover); }
.katan-sum.ok td { color: var(--mud-palette-success); }
.katan-sum.bad td { color: var(--mud-palette-warning); }

.kb-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.kb-nav { position: sticky; top: 12px; max-height: calc(100vh - 160px); overflow-y: auto; }
.kb-item { cursor: pointer; border-radius: 6px; }
.kb-item:hover { background: var(--crm-hover); }
.kb-item-active { background: var(--crm-selected) !important; font-weight: 600; }
.kb-content { padding: 20px 24px; min-height: 300px; }
.kb-body { line-height: 1.65; font-size: .95rem; }
.kb-body p { margin: 0 0 12px; }
.kb-body ul { margin: 0 0 12px; padding-left: 20px; }
.kb-body li { margin-bottom: 6px; }
.kb-body .kb-note { color: var(--mud-palette-text-secondary); border-left: 3px solid var(--crm-border);
    padding-left: 10px; background: var(--crm-hover); border-radius: 4px; }
@media (max-width: 820px) { .kb-layout { grid-template-columns: 1fr; } .kb-nav { position: static; max-height: none; } }

.auth-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: calc(100vh - 120px); padding: 24px 16px; }
.auth-card {
    width: 100%; max-width: 420px; background: var(--crm-surface, #fff);
    border: 1px solid var(--crm-border); border-radius: 16px; padding: 32px 30px;
    box-shadow: var(--crm-shadow-lg, 0 12px 40px rgba(20,40,80,.12));
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 1.5rem; font-weight: 800; color: var(--crm-primary); letter-spacing: .3px; }

.auth-brand .auth-ico { font-size: 1.6rem; color: var(--crm-primary); }
.auth-ico { vertical-align: -.15em; }
.auth-redirect-note {
    text-align: center; color: var(--crm-muted); font-size: .9rem; margin: 12px 0 16px;
}
.auth-redirect-note b { color: var(--crm-primary); font-variant-numeric: tabular-nums; }

a.auth-btn { display: block; text-align: center; text-decoration: none; }
.auth-sub { text-align: center; color: var(--crm-muted); margin: 4px 0 20px; font-size: .95rem; }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: .82rem; font-weight: 600; color: var(--crm-muted); margin-bottom: 4px; }
.auth-card .form-control {
    width: 100%; padding: 10px 12px; border-radius: 10px; font-size: .95rem;
    border: 1px solid var(--crm-border); background: var(--crm-bg, #fff); color: var(--crm-text);
    transition: border-color .15s, box-shadow .15s;
}
.auth-card .form-control:focus { outline: none; border-color: var(--crm-primary);
    box-shadow: 0 0 0 3px rgba(43,87,154,.15); }
.auth-remember { display: flex; align-items: center; gap: 8px; margin: 4px 0 20px;
    font-size: .9rem; color: var(--crm-text); cursor: pointer; user-select: none; }
.auth-btn {
    width: 100%; padding: 12px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(180deg, var(--crm-primary) 0%, #22467E 100%); color: #fff;
    font-size: 1rem; font-weight: 600; transition: filter .15s, transform .05s;
}
.auth-btn:hover { filter: brightness(1.07); }
.auth-btn:active { transform: translateY(1px); }
.auth-or { display: flex; align-items: center; text-align: center; color: var(--crm-muted); margin: 16px 0; font-size: .85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--crm-line); }
.auth-or span { padding: 0 12px; }
.auth-passkey { display: block; width: 100%; padding: 10px; border-radius: 10px; text-align: center;
    border: 1px solid var(--crm-border); background: transparent; color: var(--crm-primary);
    font-weight: 500; text-decoration: none; cursor: pointer; }
.auth-passkey:hover { background: rgba(43,87,154,.06); }
.auth-links { text-align: center; margin-top: 16px; font-size: .9rem; }
.auth-links a { color: var(--crm-primary); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-footer { margin-top: 20px; color: var(--crm-muted); font-size: .8rem; }

.landing {
    max-width: 1120px; margin: 0 auto; padding: 8px 16px 64px;

    --lp-muted: #55637A;
}
html[data-theme="dark"] .landing { --lp-muted: var(--crm-muted); }

.lp-hero {
    display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center;
    padding: 56px 0 64px; position: relative;
}
.lp-hero::before {
    content: ""; position: absolute; inset: -40px -10% auto -10%; height: 480px; z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(48% 70% at 18% 18%, rgba(58,123,213,.22), transparent 70%),
      radial-gradient(42% 62% at 88% 8%,  rgba(36,86,166,.16), transparent 72%);
}
.lp-hero > * { position: relative; z-index: 1; }

.lp-badge {
    display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700;
    letter-spacing: .04em; color: var(--crm-primary); margin-bottom: 20px;
    padding: 6px 12px; border-radius: 999px;
    background: var(--crm-primary-soft); border: 1px solid var(--crm-border);
}
.lp-hero h1 {
    font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 800; line-height: 1.12;
    letter-spacing: -.02em; color: var(--crm-ink); margin: 0 0 16px;
}

.lp-hero h1 { display: block; }
.lp-hero h1::before { content: none; }
.lp-accent {
    background: linear-gradient(90deg, var(--crm-primary) 0%, var(--crm-primary-2) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lp-lead { color: var(--lp-muted); font-size: 1.06rem; line-height: 1.62; max-width: 46ch; margin: 0 0 28px; }

.lp-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-cta, .lp-cta-ghost {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 12px;
    font-weight: 650; font-size: 1rem; text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, filter .15s ease;
}

.lp-cta {
    background: linear-gradient(180deg, #2F6BC4 0%, #1F4E9A 100%);
    color: #fff !important; box-shadow: 0 8px 20px rgba(36,86,166,.28);
}
.lp-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(36,86,166,.36); filter: brightness(1.05); }
.lp-cta-ghost {
    color: var(--crm-primary) !important; background: var(--crm-card);
    border: 1px solid var(--crm-border); box-shadow: var(--crm-shadow);
}
.lp-cta-ghost:hover { background: var(--crm-hover); transform: translateY(-2px); }

.lp-badge .lp-ico, .lp-cta .lp-ico, .lp-cta-ghost .lp-ico { font-size: 1.05rem; }

.lp-trust { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 24px 0 0; padding: 0; }
.lp-trust li { display: inline-flex; align-items: center; gap: 6px; color: var(--lp-muted); font-size: .87rem; }
.lp-trust .lp-ico { color: var(--crm-primary); font-size: 1rem; }

.lp-shot {
    border: 1px solid var(--crm-border); border-radius: 18px; overflow: hidden;
    background: var(--crm-card); box-shadow: var(--crm-shadow-lg);
    transform: perspective(1400px) rotateY(-7deg) rotateX(2deg);
    transition: transform .4s cubic-bezier(.32,.72,0,1);
}
.lp-shot:hover { transform: perspective(1400px) rotateY(-2deg) rotateX(0deg); }
.lp-shot-bar { display: flex; gap: 6px; padding: 10px 12px; background: var(--crm-header); border-bottom: 1px solid var(--crm-line); }
.lp-shot-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--crm-border); }
.lp-shot-body { padding: 16px; display: grid; gap: 16px; }
.lp-shot-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lp-kpi { background: var(--crm-primary-soft); border-radius: 12px; padding: 12px 12px; }
.lp-kpi-l { display: block; font-size: .68rem; color: var(--crm-muted); letter-spacing: .02em; }
.lp-kpi b { font-size: 1.24rem; color: var(--crm-ink); }
.lp-shot-chart { display: flex; align-items: flex-end; gap: 6px; height: 92px; padding: 0 2px; }
.lp-shot-chart span {
    flex: 1; border-radius: 5px 5px 2px 2px;
    background: linear-gradient(180deg, var(--crm-primary-2), var(--crm-primary));
    opacity: .85;
}
.lp-shot-rows { display: grid; gap: 8px; }
.lp-row { display: flex; align-items: center; gap: 8px; }
.lp-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.lp-row .dot.ok { background: #2F855A; }
.lp-row .dot.warn { background: #DD6B20; }
.lp-row span { height: 8px; border-radius: 4px; background: var(--crm-line); }
.lp-row .w-15 { width: 15%; } .lp-row .w-20 { width: 20%; } .lp-row .w-25 { width: 25%; }
.lp-row .w-30 { width: 30%; } .lp-row .w-40 { width: 40%; } .lp-row .w-55 { width: 55%; }

.lp-why { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 8px 0 12px; }
.lp-why-item {
    background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 16px;
    padding: 24px 24px; box-shadow: var(--crm-shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.lp-why-item:hover { transform: translateY(-3px); box-shadow: var(--crm-shadow-lg); border-color: var(--crm-primary-2); }
.lp-why-item .lp-ico { font-size: 1.7rem; color: var(--crm-primary); }
.lp-why-item h3 { font-size: 1.05rem; font-weight: 700; color: var(--crm-ink); margin: 12px 0 8px; }
.lp-why-item p { color: var(--crm-muted); font-size: .9rem; line-height: 1.58; margin: 0; }

.lp-section { margin-top: 64px; text-align: center; }
.lp-section h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; color: var(--crm-ink); margin: 0 0 8px; letter-spacing: -.01em; }
.lp-section h2::before { content: none; }
.lp-sub { color: var(--lp-muted); font-size: 1rem; margin: 0 auto 32px; max-width: 56ch; }

.lp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; text-align: left; }
.lp-feat {
    background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 16px;
    padding: 24px 20px; box-shadow: var(--crm-shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.lp-feat:hover { transform: translateY(-4px); box-shadow: var(--crm-shadow-lg); border-color: var(--crm-primary-2); }

.lp-feat .lp-ico {
    box-sizing: content-box; width: 24px; height: 24px; padding: 10px; font-size: 24px;
    border-radius: 13px; background: var(--crm-primary-soft); color: var(--crm-primary);
}
.lp-feat h3 { font-size: 1.02rem; margin: 12px 0 6px; color: var(--crm-ink); font-weight: 700; }
.lp-feat p { color: var(--crm-muted); font-size: .88rem; margin: 0; line-height: 1.55; }

.lp-flow { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 0; padding: 0; position: relative; }
.lp-flow::before {
    content: ""; position: absolute; top: 21px; left: 10%; right: 10%; height: 2px;
    background: linear-gradient(90deg, var(--crm-primary-soft), var(--crm-primary-2), var(--crm-primary-soft));
}
.lp-flow li { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; padding: 0 8px; }
.lp-step {
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    background: var(--crm-card); border: 2px solid var(--crm-primary); color: var(--crm-primary);
    font-weight: 800; font-size: 1rem; margin-bottom: 8px;
}

.lp-flow .lp-flow-t { color: var(--crm-ink); font-size: .95rem; font-weight: 700; }
.lp-ext { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.lp-flow small { color: var(--lp-muted); font-size: .78rem; text-align: center; line-height: 1.4; }

.lp-final {
    margin-top: 68px; padding: 52px 28px; border-radius: 22px; text-align: center;
    background: linear-gradient(135deg, var(--crm-primary) 0%, #1B3F76 100%);
    box-shadow: var(--crm-shadow-lg);
}
.lp-final h2 { color: #fff; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; margin: 0 0 10px; }
.lp-final h2::before { content: none; }
.lp-final p { color: rgba(255,255,255,.88); margin: 0 auto 28px; max-width: 52ch; line-height: 1.6; }
.lp-final .lp-actions { justify-content: center; }

.lp-final .lp-cta { background: #fff; color: #1E4A8F !important; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.lp-cta-ghost.lp-on-dark {
    background: rgba(255,255,255,.10); color: #fff !important; border-color: rgba(255,255,255,.34);
}
.lp-cta-ghost.lp-on-dark:hover { background: rgba(255,255,255,.18); }

html[data-theme="dark"] .lp-badge { background: rgba(90,155,224,.12); }
html[data-theme="dark"] .lp-feat .lp-ico,
html[data-theme="dark"] .lp-kpi { background: rgba(90,155,224,.14); }
html[data-theme="dark"] .lp-final { background: linear-gradient(135deg, #1E3A66 0%, #142744 100%); }

@media (max-width: 980px) {
    .lp-hero { grid-template-columns: 1fr; gap: 36px; padding: 36px 0 44px; text-align: center; }
    .lp-lead { margin-inline: auto; }
    .lp-actions, .lp-trust { justify-content: center; }

    .lp-shot { transform: none; }
    .lp-flow { grid-template-columns: repeat(2, 1fr); gap: 24px 12px; }
    .lp-flow::before { content: none; }
}
@media (max-width: 560px) {
    .lp-flow { grid-template-columns: 1fr; }
    .lp-actions .lp-cta, .lp-actions .lp-cta-ghost { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .lp-shot, .lp-cta, .lp-cta-ghost, .lp-why-item, .lp-feat { transition: none; }
    .lp-shot { transform: none; }
}

html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .landing-feat { background: var(--crm-card); }
html[data-theme="dark"] .auth-card .form-control { background: #0E1626; }

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: #0E1626; color: var(--crm-text); border-color: var(--crm-border);
}
html[data-theme="dark"] .form-control::placeholder { color: #64748B; }
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: #0E1626; color: var(--crm-text); border-color: var(--crm-primary);
    box-shadow: 0 0 0 3px rgba(90,155,224,.2);
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .list-group-item { background-color: var(--crm-card); border-color: var(--crm-border); color: var(--crm-text); }
html[data-theme="dark"] .card-header { background-color: #1A2842; border-color: var(--crm-border); color: var(--crm-text); }
html[data-theme="dark"] .bg-light { background-color: #1A2842 !important; color: var(--crm-text); }
html[data-theme="dark"] .table { color: var(--crm-text); border-color: var(--crm-border); }
html[data-theme="dark"] .table > :not(caption) > * > * { background-color: transparent; color: var(--crm-text); border-color: var(--crm-border); }
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(255,255,255,.03); }
html[data-theme="dark"] .table-hover > tbody > tr:hover > * { background-color: var(--crm-hover); }
html[data-theme="dark"] .table-active > * { background-color: var(--crm-selected) !important; }
html[data-theme="dark"] .alert-info { background-color: #16283F; border-color: #24405F; color: #BCD8F5; }
html[data-theme="dark"] .alert-success { background-color: #14301F; border-color: #1F5236; color: #9BE3B8; }
html[data-theme="dark"] .alert-warning { background-color: #33280F; border-color: #5A4A1F; color: #F0D090; }
html[data-theme="dark"] .alert-danger { background-color: #3A1A1A; border-color: #6B2B2B; color: #F0A0A0; }
html[data-theme="dark"] .border { border-color: var(--crm-border) !important; }
html[data-theme="dark"] .text-muted, html[data-theme="dark"] .text-secondary { color: var(--crm-muted) !important; }
html[data-theme="dark"] .btn-outline-secondary { color: var(--crm-text); border-color: var(--crm-border); }
html[data-theme="dark"] code, html[data-theme="dark"] kbd { background-color: #1A2842; color: var(--crm-text); }
html[data-theme="dark"] hr { border-color: var(--crm-border); }

.csec-tabs {
    display: flex; flex-wrap: wrap; gap: 4px; padding: 6px;
    background: var(--crm-header); border: 1px solid var(--crm-border); border-radius: 10px;
}
.csec-tab {
    display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 8px;
    font-size: .82rem; color: var(--crm-text); text-decoration: none; white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}
.csec-tab:hover { background: rgba(43, 87, 154, .10); }
.csec-tab.active { background: var(--crm-primary); color: #fff; font-weight: 600; }
.csec-tab.active .mud-icon-root { color: #fff !important; }
.csec-ic { font-size: 1.05rem; }
html[data-theme="dark"] .csec-tab.active { background: #3A6FB5; }
@media (max-width: 760px) { .csec-tab { font-size: .76rem; padding: 4px 8px; } }

.delphi-toolbar {
    background: linear-gradient(180deg, #F5F9FE 0%, #ECF3FC 100%); border: 1px solid var(--crm-border);
    border-radius: 12px; min-height: 2.6rem;
}

.mud-button-root { border-radius: 10px !important; }
.mud-button-filled { box-shadow: none !important; }
.mud-button-filled:hover { box-shadow: 0 2px 8px rgba(43,108,176,.3) !important; }

.mud-input-control .mud-input.mud-input-outlined { border-radius: 10px; }

.customer-tabs .mud-tabs-tabbar {
    background: linear-gradient(180deg, #F6F9FE 0%, #EFF4FC 100%);
    border-right: 1px solid var(--crm-border); min-width: 216px;
}
.customer-tabs .mud-tab {
    justify-content: flex-start; text-align: left; font-size: .9rem;
    border-radius: 10px; margin: 2px 8px; min-height: 40px; transition: background .15s ease;
}
.customer-tabs .mud-tab:hover { background-color: rgba(36,86,166,.06); }
.customer-tabs .mud-tab.mud-tab-active {
    background: linear-gradient(180deg, var(--crm-primary-2), var(--crm-primary));
    color: #fff !important; font-weight: 600; box-shadow: 0 3px 10px rgba(36,86,166,.28);
}
.customer-tabs .mud-tab.mud-tab-active .mud-icon-root { color: #fff !important; }

.content > .mud-grid .stat-card::after { content: none; }

html[data-theme="dark"] {
    color-scheme: dark;

    --crm-primary: #5A9BE0;
    --crm-primary-2: #82B6EC;
    --crm-primary-soft: #1C2B47;
    --crm-ink: #E6EDF6;
    --crm-card: #16213A;
    --crm-border: #26324B;
    --crm-line: #212F49;
    --crm-text: #E6EDF6;
    --crm-muted: #94A3B8;
    --crm-hover: #1C2A45;
    --crm-selected: #24365B;
    --crm-header: #1A2842;
    --crm-shadow: 0 1px 2px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.5);
    --crm-shadow-lg: 0 14px 36px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.5);

    --mud-palette-primary: #5A9BE0;
    --mud-palette-primary-rgb: 90,155,224;
    --mud-palette-secondary: #B794F4;
    --mud-palette-success: #68D391;
    --mud-palette-warning: #F6AD55;

    --mud-palette-warning-text: #2A1A00;
    --mud-palette-error: #FC8181;
    --mud-palette-info: #5A9BE0;
    --mud-palette-dark: #0E1626;
    --mud-palette-surface: #16213A;
    --mud-palette-surface-rgb: 22,33,58;
    --mud-palette-background: #0E1626;
    --mud-palette-background-gray: #0B1220;
    --mud-palette-text-primary: #E6EDF6;
    --mud-palette-text-secondary: #94A3B8;
    --mud-palette-text-disabled: rgba(230,237,246,.4);
    --mud-palette-action-default: #94A3B8;
    --mud-palette-action-disabled: rgba(230,237,246,.3);
    --mud-palette-action-disabled-background: rgba(230,237,246,.12);
    --mud-palette-lines-default: #26324B;
    --mud-palette-lines-inputs: #33415E;
    --mud-palette-table-lines: #24304A;
    --mud-palette-divider: #26324B;
    --mud-palette-divider-light: rgba(230,237,246,.1);
    --mud-palette-drawer-background: #111A2B;
    --mud-palette-drawer-text: #CBD5E0;
    --mud-palette-appbar-background: #111A2B;
    --mud-palette-appbar-text: #E2E8F0;
}
html[data-theme="dark"] body, html[data-theme="dark"] .page-ribbon {
    background:
        radial-gradient(680px 460px at 8% 6%, rgba(58,123,213,.16), transparent 60%),
        radial-gradient(620px 480px at 96% 96%, rgba(128,90,213,.13), transparent 62%),
        linear-gradient(160deg, #0E1626 0%, #101A2E 55%, #0E1626 100%);
}
html[data-theme="dark"] .top-row {
    background: linear-gradient(180deg, #111A2B 0%, #0F1728 100%) !important;
    border-bottom-color: #26324B;
}
html[data-theme="dark"] .top-row .app-title { color: #82B6EC !important; }
html[data-theme="dark"] .top-row a, html[data-theme="dark"] .top-row .btn-link, html[data-theme="dark"] .top-row .theme-toggle { color: #94A3B8 !important; }
html[data-theme="dark"] .top-row a:hover, html[data-theme="dark"] .top-row .btn-link:hover { color: #82B6EC !important; }
html[data-theme="dark"] .ribbon { background: linear-gradient(180deg, #131E33 0%, #101A2E 100%); border-bottom-color: #26324B; }
html[data-theme="dark"] .ribbon-body { background: #101A2E; }
html[data-theme="dark"] .delphi-grid { border-color: #26324B; }
html[data-theme="dark"] .delphi-grid .mud-table-head .mud-table-cell {
    background: linear-gradient(180deg, #1B2A45 0%, #17233C 100%); color: #82B6EC; border-bottom-color: #2C3C59;
}
html[data-theme="dark"] .delphi-toolbar { background: linear-gradient(180deg, #16233C 0%, #131E33 100%); border-color: #26324B; }
html[data-theme="dark"] .mud-simple-table { border-color: #26324B; }
html[data-theme="dark"] .mud-simple-table thead th {
    background: linear-gradient(180deg, #1B2A45 0%, #17233C 100%); color: #82B6EC; border-bottom-color: #2C3C59;
}
html[data-theme="dark"] .mud-simple-table tbody td { border-bottom-color: #26324B; }
html[data-theme="dark"] .mud-simple-table tbody tr:hover { background: #17233C; }
html[data-theme="dark"] .status-bar { background: #111A2B !important; border-top-color: #26324B !important; color: #94A3B8 !important; }
html[data-theme="dark"] .status-bar .sb-panel { border-right-color: #26324B !important; }
html[data-theme="dark"] .status-bar .sb-panel:last-child,
html[data-theme="dark"] .status-bar .sb-right { border-right-color: transparent !important; }
html[data-theme="dark"] .stat-card { background: linear-gradient(180deg, #16213A 0%, #182642 100%) !important; }
html[data-theme="dark"] .customer-tabs .mud-tabs-tabbar { background: linear-gradient(180deg, #131E33 0%, #101A2E 100%); }

.theme-toggle {
    background: none; border: none; cursor: pointer; padding: 4px; border-radius: 8px;
    display: inline-flex; align-items: center; transition: background .15s ease, transform .15s ease;
}
.theme-toggle:hover { transform: scale(1.1); background: var(--crm-primary-soft); }
.theme-toggle .mud-icon-root { color: var(--crm-primary); }

.svg-val { fill: var(--crm-text); }
.svg-cat { fill: var(--crm-muted); }
.svg-grid { stroke: var(--crm-line); }
.svg-axis { stroke: var(--crm-border); }

.val-pos { color: #1E7E34; font-weight: 600; }
.val-neg { color: #C0392B; font-weight: 600; }
html[data-theme="dark"] .val-pos { color: #68D391; }
html[data-theme="dark"] .val-neg { color: #FC8181; }

@media (max-width: 760px) {

    .top-row { padding-left: 10px !important; padding-right: 10px !important; }
    .top-row .app-title { font-size: .98rem; }
    .top-row .top-user { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .ribbon-strip { padding: 0 2px; }
    .rt-label { padding: 8px 12px 6px; font-size: max(11px, .8rem); }
    .ribbon-body { padding: 8px 8px; min-height: 78px; }
    .rgroup { padding: 0 8px; }
    .rgroup-title { font-size: max(11px, .7rem); }
    .rbtn { min-width: 54px; padding: 6px 6px; font-size: max(11px, .72rem); }
    .rbtn .mud-icon-root { font-size: 1.15rem; }

    .content { padding-left: 12px !important; padding-right: 12px !important; }
    h1 { font-size: 1.25rem; }
    .dash-hero { padding: 16px 16px; }

    .delphi-grid .mud-table-cell { padding: 6px 8px; font-size: .78rem; }
    .stat-card .mud-typography-h6 { font-size: 1.25rem; }
    .delphi-toolbar { flex-wrap: wrap; }

    .customer-tabs .mud-tabs-tabbar { min-width: 150px !important; }
    .customer-tabs .mud-tab { font-size: .8rem; padding: 4px 8px; margin: 2px 4px; min-height: 36px; }
}

@media (max-width: 460px) {
    .rt-label { padding: 8px 8px 6px; font-size: max(11px, .76rem); }

    .status-bar .sb-panel:not(:first-child):not(.sb-right) { display: none; }
    .status-bar .sb-panel { padding: 0 8px; }
}

.rep-doc, .card-doc, .letter-doc {
    --crm-text: #1A202C; --crm-muted: #5A6472; --crm-line: #E0E6EF; --crm-border: #C9D0DA;
}

body, .mud-paper, .top-row, .ribbon, .ribbon-body, .status-bar, .delphi-toolbar,
.stat-card, .rt-label, .rbtn, .customer-tabs .mud-tab, .mud-table-cell, .mud-input-slot,
.dash-hero, h1, .section-title, .mud-typography, .mud-nav-link {
    transition: background-color .35s ease, color .3s ease, border-color .35s ease, box-shadow .3s ease;
}

html[data-theme="dark"] #blazor-error-ui {
    background: #2A1518; color: #FBD5D5; box-shadow: 0 -1px 8px rgba(0,0,0,.5);
}
html[data-theme="dark"] .blazor-error-boundary { background-color: #7A1F1F; }

.delphi-toolbar {
    background: linear-gradient(180deg, #FFFFFF 0%, var(--crm-header) 100%);
    border: 1px solid var(--crm-border); border-radius: 10px;
    padding: 2px 6px; min-height: 44px;
}
html[data-theme="dark"] .delphi-toolbar {
    background: linear-gradient(180deg, #16213A 0%, #121B2E 100%); border-color: #26324B;
}

.state-chip { font-weight: 600; }

.cell-clip { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.locked-form .mud-input-control,
.locked-form .mud-table,
.locked-form button:not(.mud-tab) {
    pointer-events: none;
}

.locked-form .mud-input-control { opacity: .8; }

.mud-tabs .mud-tab:has(.mud-tab-badge) {
    padding-right: 46px;
    overflow: visible;
}

.mud-tabs .mud-badge { font-weight: 700; }

.mud-tabs .mud-tab-slider.mud-tab-slider-horizontal {
    transition: left .16s ease-out, width .16s ease-out;
    will-change: left, width;
}

.mud-tabs .mud-tab-slider.mud-tab-slider-vertical {
    transition: top .16s ease-out, height .16s ease-out;
    will-change: top, height;
}

.mud-tabs .mud-tabs-panels { transition: transform .16s ease-out; }

@media (prefers-reduced-motion: reduce) {
    .mud-tabs .mud-tab-slider,
    .mud-tabs .mud-tabs-panels { transition: none; }
}

.rbtn-denied {
    opacity: .38;
    cursor: not-allowed;
    pointer-events: auto;
    user-select: none;
}

.auth-opt {
    font-weight: 400;
    opacity: .6;
    font-size: .85em;
}

.auth-hint {
    font-size: .8rem;
    opacity: .7;
    margin: -4px 0 12px;
    line-height: 1.35;
}

:root {

    --crm-field-border: #7E92AF;
    --crm-field-bg: #FBFCFE;
    --crm-zebra: rgba(23, 45, 84, .028);
    --crm-focus: rgba(36, 86, 166, .35);

    --crm-thead: #DFE9F7;
}

html[data-theme="dark"] {
    --crm-field-border: #5B6E93;
    --crm-field-bg: rgba(255, 255, 255, .022);

    --crm-zebra: rgba(255, 255, 255, .038);
    --crm-focus: rgba(90, 155, 224, .45);
    --crm-thead: #2A3B63;
}

.mud-input-outlined .mud-input-outlined-border,
.mud-input.mud-input-outlined fieldset {
    border-color: var(--crm-field-border) !important;
    border-radius: 8px;
}

.mud-input-outlined .mud-input-slot,
.mud-input.mud-input-outlined { background-color: var(--crm-field-bg); border-radius: 8px; }

.mud-input.mud-input-outlined:hover fieldset { border-color: var(--mud-palette-primary) !important; }

.mud-input.mud-disabled fieldset { border-style: dashed !important; opacity: .75; }

.mud-button-root:focus-visible,
.mud-icon-button:focus-visible,
.rbtn:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
    border-radius: 6px;
}

.mud-button-text.mud-button-text-default,
.mud-button-text.mud-button-text-inherit { color: var(--mud-palette-primary); }

.mud-button-text:hover { background-color: var(--crm-primary-soft); }
.mud-button-outlined { border-width: 1.5px; }
.mud-button-root { font-weight: 600; letter-spacing: .01em; }

.mud-table-head th,
.mud-table-head .mud-table-cell,
.mud-table-container thead th {
    background-color: var(--crm-thead) !important;
    font-weight: 600 !important;
    color: var(--crm-text);
    border-bottom: 2px solid var(--crm-border) !important;
    white-space: nowrap;
}

.mud-table-striped tbody tr:nth-of-type(odd),
.mud-table-striped tbody .mud-table-row:nth-of-type(odd) { background-color: var(--crm-zebra) !important; }

.mud-table-hover tbody tr:hover,
.mud-table-hover tbody .mud-table-row:hover { background-color: var(--crm-hover) !important; }

.mud-table tbody tr.selected,
.mud-table tbody .mud-table-row.mud-selected-row { background-color: var(--crm-selected) !important; }

.mud-paper { border: 1px solid var(--crm-border); }
.filter-group { border-width: 1.5px; }

.mud-dialog-title {
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-header);
    font-weight: 600;
}
.mud-dialog-actions {
    border-top: 1px solid var(--crm-border);
    background: var(--crm-header);
    gap: 6px;
}

.rte { border: 1px solid var(--crm-border); border-radius: 10px; overflow: hidden; background: var(--crm-card); }

.rte-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    padding: 6px 6px; background: var(--crm-thead); border-bottom: 1px solid var(--crm-border);
}
.rte-bar button {
    min-width: 2rem; height: 1.9rem; padding: 0 6px; border-radius: 6px; cursor: pointer;
    border: 1px solid transparent; background: transparent; color: var(--crm-text);
    font: inherit; font-size: .85rem; line-height: 1;
}
.rte-bar button:hover { background: var(--crm-primary-soft); border-color: var(--crm-field-border); }
.rte-bar button:active { transform: translateY(1px); }
.rte-sep { width: 1px; height: 1.2rem; background: var(--crm-border); margin: 0 4px; }

.rte-area { min-height: 26rem; max-height: 70vh; overflow: auto; padding: 12px 16px; outline: none; }
.rte-area:focus-visible { box-shadow: inset 0 0 0 2px var(--mud-palette-primary); }

.rte-paper { background: #fff; color: #1f2430; }
.rte-paper a { color: #2456A6; }
.rte-paper table { border-collapse: collapse; width: 100%; }
.rte-paper th, .rte-paper td { border: 1px solid #B9C7DC; padding: 4px 8px; }
.rte-paper thead th { background: #99CCFF; }
.rte-paper .pf-group td { background: #CCCCFF; font-weight: 600; }
.rte-paper .pf-total td { background: #EDF2FA; font-weight: 700; }
.rte-paper .num { text-align: right; font-variant-numeric: tabular-nums; }
.rte-paper h2 { color: #2456A6; text-align: center; }
.rte-paper h3 { color: #2456A6; border-bottom: 1px solid #C9D8EC; padding-bottom: 2px; }

.pf-split { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pf-split.on { grid-template-columns: 1fr 1fr; }

@media (max-width: 1100px) { .pf-split.on { grid-template-columns: 1fr; } }

.pf-pane { min-width: 0; }

.pf-preview-pane { border: 1px solid var(--crm-border); border-radius: 10px; overflow: hidden;
                   display: flex; flex-direction: column; }
.pf-preview-bar { padding: 6px 10px; background: var(--crm-thead);
                  border-bottom: 1px solid var(--crm-border); font-size: .8rem;
                  color: var(--crm-muted); }
.pf-preview { flex: 1; overflow: auto; max-height: 70vh; padding: 20px 24px;
              background: #fff; color: #1f2430; }

.pf-doc h2 { color: #2456A6; text-align: center; letter-spacing: .06em; }
.pf-doc h3 { color: #2456A6; border-bottom: 1px solid #C9D8EC; padding-bottom: 2px; }
.pf-doc hr { border: 0; border-top: 1px solid #B9C7DC; }
.pf-doc .pf-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.pf-doc .pf-brand { color: #336699; font-size: 1.3rem; font-weight: 600; line-height: 1.25; }
.pf-doc .pf-org { font-size: .8rem; color: #4a5568; }
.pf-doc .pf-date { text-align: right; }
.pf-doc table.pf-items { width: 100%; border-collapse: collapse; margin: 12px 0 16px; }
.pf-doc .pf-items th, .pf-doc .pf-items td { border: 1px solid #B9C7DC; padding: 4px 8px; font-size: .85rem; }
.pf-doc .pf-items thead th { background: #99CCFF; text-align: left; font-weight: 600; }
.pf-doc .pf-items .num { text-align: right; font-variant-numeric: tabular-nums; }
.pf-doc .pf-items tr.pf-group td { background: #CCCCFF; font-weight: 600; }
.pf-doc .pf-items tr.pf-total td { background: #EDF2FA; font-weight: 700; }

.lang-switch { position: relative; display: inline-block; margin-right: 12px; }
.lang-switch > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 6px; border-radius: 6px; transition: background .15s ease;
    color: var(--crm-primary);
}
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary::marker { content: ""; }
.lang-switch > summary:hover { background: var(--crm-primary-soft); }
.lang-switch .lang-code { font-size: .72rem; font-weight: 700; letter-spacing: .04em; }

.lang-switch .lang-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 1300;
    padding: 4px;
    background: var(--mud-palette-surface, #fff);
    border: 1px solid var(--crm-line, #E6EBF2); border-radius: 8px;
    box-shadow: 0 6px 20px rgba(16,24,40,.14);

    display: grid; grid-template-columns: repeat(3, minmax(9rem, 1fr));
    max-width: min(34rem, calc(100vw - 24px));
    max-height: min(24rem, calc(100vh - 80px));
    overflow-y: auto; overscroll-behavior: contain;
}

@media (max-width: 720px) {
    .lang-switch .lang-menu { grid-template-columns: repeat(2, minmax(8rem, 1fr)); }
}

.lang-switch .lang-item {
    display: flex; align-items: baseline; gap: 6px;
    padding: 6px 8px; border-radius: 6px;
    font-size: .82rem; text-decoration: none; color: inherit; white-space: nowrap;
    min-width: 0;
}

.lang-switch .lang-name { overflow: hidden; text-overflow: ellipsis; }
.lang-switch .lang-alt {
    font-size: .7rem; color: var(--crm-muted, #64748B);
    overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.lang-switch .lang-item:hover { background: var(--crm-primary-soft); }
.lang-switch .lang-item.on { font-weight: 600; }
.lang-switch .lang-flag { font-size: 1rem; line-height: 1; }
.lang-switch .lang-tick { margin-left: auto; color: var(--crm-primary); }
html[data-theme="dark"] .lang-switch .lang-menu { background: #16213A; border-color: #26324B; }
html[data-theme="dark"] .lang-switch > summary { color: #82B6EC; }

.tour-stack {
    position: fixed; right: 16px; bottom: 44px; z-index: 1400;
    width: min(380px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    display: flex; flex-direction: column; gap: 8px;

    overflow: hidden;
}
.tour-stack > * { min-height: 0; }
.tour-panel {
    position: static; z-index: 1400;
    width: auto;
    background: var(--crm-surface, #fff); color: inherit;
    border: 1px solid var(--crm-border, #CBD5E1); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.28);
    display: flex; flex-direction: column; overflow: hidden;
}
.tour-head {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: var(--crm-primary-soft, #E8F0FE);
    border-bottom: 1px solid var(--crm-border, #CBD5E1);
}
.tour-title { font-weight: 600; font-size: .85rem; }
.tour-count { margin-left: auto; font-size: .75rem; color: var(--crm-muted, #64748B); }
.tour-x {
    background: none; border: 0; cursor: pointer; font-size: 1.15rem; line-height: 1;
    color: var(--crm-muted, #64748B); padding: 0 2px;
}
.tour-x:hover { color: var(--crm-text, #0F172A); }
.tour-body { padding: 10px 12px; }
.tour-body h4 { margin: 0 0 6px; font-size: .95rem; }
.tour-body p { margin: 0 0 8px; font-size: .85rem; line-height: 1.45; }
.tour-tip {
    display: flex; gap: 6px; align-items: flex-start;
    background: var(--crm-primary-soft, #E8F0FE); border-radius: 6px; padding: 6px 8px;
    font-size: .8rem !important;
}
.tour-missed { color: var(--crm-muted, #64748B); font-style: italic; font-size: .78rem !important; }
.tour-foot {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-top: 1px solid var(--crm-border, #CBD5E1);
}
.tour-btn {
    border: 1px solid var(--crm-border, #CBD5E1); background: transparent; color: inherit;
    border-radius: 6px; padding: 4px 12px; font-size: .82rem; cursor: pointer;
}
.tour-btn:disabled { opacity: .45; cursor: default; }

.tour-done { display: flex; align-items: center; gap: .3rem; color: var(--crm-primary, #1565C0); font-size: .78rem !important; margin-top: .25rem; }
.tour-btn.ready { box-shadow: 0 0 0 0 rgba(21, 101, 192, .55); animation: tour-ready 1.9s ease-out infinite; }
@keyframes tour-ready {
    0%   { box-shadow: 0 0 0 0 rgba(21, 101, 192, .55); }
    70%  { box-shadow: 0 0 0 10px rgba(21, 101, 192, 0); }
    100% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0); }
}
@media (prefers-reduced-motion: reduce) { .tour-btn.ready { animation: none; outline: 2px solid var(--crm-primary, #1565C0); outline-offset: 2px; } }
.tour-btn.primary { background: var(--crm-primary, #1565C0); border-color: var(--crm-primary, #1565C0); color: #fff; }
.tour-dots { display: flex; gap: 4px; margin: 0 auto; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--crm-border, #CBD5E1); }
.tour-dot.on { background: var(--crm-primary, #1565C0); }

.tour-spot { scroll-margin: 120px; }

.tour-ring {
    position: fixed; z-index: 1390; pointer-events: none; border-radius: 10px;
    border: 3px solid var(--crm-primary, #1565C0);
    box-shadow: 0 0 0 4px rgba(21,101,192,.25), 0 0 0 100vmax rgba(8,15,30,.2);
    transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
    animation: tour-pulse 1.6s ease-in-out 3;
}
@keyframes tour-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(21,101,192,.25), 0 0 0 100vmax rgba(8,15,30,.2); }
    50%      { box-shadow: 0 0 0 12px rgba(21,101,192,.05), 0 0 0 100vmax rgba(8,15,30,.2); }
}
@media (prefers-reduced-motion: reduce) { .tour-ring { animation: none; transition: none; } }

.tour-arrow {
    position: fixed; z-index: 2000; width: 40px; height: 54px;
    pointer-events: none; transition: left .2s ease, top .2s ease;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.25));
    animation: tour-bounce 1.1s ease-in-out infinite;
}
.tour-arrow svg { display: block; }
.tour-arrow path { fill: var(--crm-primary, #1565C0); stroke: #fff; stroke-width: 2; }
.tour-arrow--up svg { transform: rotate(180deg); }
.tour-arrow--left, .tour-arrow--right { width: 54px; height: 40px; }
.tour-arrow--left svg { transform: translate(7px, -7px) rotate(90deg); }
.tour-arrow--right svg { transform: translate(7px, -7px) rotate(-90deg); }
@keyframes tour-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(6px); }
}
.tour-arrow--up { animation-name: tour-bounce-up; }
.tour-arrow--left { animation-name: tour-bounce-left; }
.tour-arrow--right { animation-name: tour-bounce-right; }
@keyframes tour-bounce-left { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }
@keyframes tour-bounce-right { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
@keyframes tour-bounce-up {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) { .tour-arrow { animation: none; transition: none; } }

.tour-progress { height: 3px; background: var(--crm-border, #CBD5E1); }
.tour-progress-bar { height: 100%; background: var(--crm-primary, #1565C0); transition: width .3s ease; }
.tour-play { display: inline-flex; align-items: center; padding: 2px 8px; }
.demo-card-full { border-left: 4px solid var(--crm-primary, #1565C0); }

.demo-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.demo-card { display: flex; flex-direction: column; }
.demo-card-title { font-size: 1.05rem; margin: 0; }
.demo-card-sum { font-size: .85rem; margin: 0 0 8px; }
.demo-card-steps {
    font-size: .8rem; color: var(--crm-muted, #64748B);
    margin: 0 0 12px; padding-left: 20px; flex: 1;
}
html[data-theme="dark"] .tour-panel { background: #16213A; border-color: #26324B; }
html[data-theme="dark"] .tour-head { background: #1B2947; border-color: #26324B; }
html[data-theme="dark"] .tour-foot { border-color: #26324B; }
html[data-theme="dark"] .tour-tip { background: #1B2947; }

.tour-ai {
    background: var(--crm-surface, #fff); color: inherit;
    border: 1px solid var(--crm-border, #CBD5E1); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.28);
    display: flex; flex-direction: column; overflow: hidden; max-height: 46vh;
}
.tour-ai-head {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: var(--crm-accent-soft, #EDE7F6);
    border-bottom: 1px solid var(--crm-border, #CBD5E1);
}
.tour-ai-title { font-weight: 600; font-size: .86rem; flex: 1 1 auto; }
.tour-ai-body { padding: 8px 10px; overflow: auto; font-size: .82rem; display: flex; flex-direction: column; gap: 6px; }
.tour-ai-where { display: flex; align-items: center; gap: .3rem; color: var(--crm-muted, #64748B); margin: 0; font-size: .78rem; }
.tour-ai-answer { white-space: pre-wrap; }
.tour-ai-note { display: flex; align-items: center; gap: .3rem; margin: 0; color: var(--crm-primary, #1565C0); font-size: .75rem; }
.tour-ai-foot { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--crm-border, #CBD5E1); }
.tour-ai-input {
    flex: 1 1 auto; min-width: 0; font: inherit; font-size: .82rem;
    padding: 5px 8px; border: 1px solid var(--crm-border, #CBD5E1); border-radius: 6px;
    background: var(--crm-surface, #fff); color: inherit;
}
.tour-ai-input:focus { outline: 2px solid var(--crm-primary, #1565C0); outline-offset: 1px; }
.tour-voice {
    font: inherit; font-size: .72rem; max-width: 120px; padding: 2px 4px;
    border: 1px solid var(--crm-border, #CBD5E1); border-radius: 6px;
    background: var(--crm-surface, #fff); color: inherit;
}
html[data-theme="dark"] .tour-voice { background: #101A2E; border-color: #26324B; }
.tour-btn.tour-play.on { background: var(--crm-primary, #1565C0); border-color: var(--crm-primary, #1565C0); color: #fff; }
html[data-theme="dark"] .tour-ai { background: #16213A; border-color: #26324B; }
html[data-theme="dark"] .tour-ai-head { background: #241B47; border-color: #26324B; }
html[data-theme="dark"] .tour-ai-input { background: #101A2E; border-color: #26324B; }

.ai-md { white-space: normal; }
.ai-md > :first-child { margin-top: 0; }
.ai-md > :last-child { margin-bottom: 0; }
.ai-md p { margin: 0 0 8px; }
.ai-md h3, .ai-md h4, .ai-md h5, .ai-md h6 { margin: 12px 0 4px; font-size: 1rem; font-weight: 600; }
.ai-md ul, .ai-md ol { margin: 0 0 8px; padding-left: 20px; }
.ai-md li { margin: 2px 0; }
.ai-md code {
    font-family: ui-monospace, Consolas, monospace; font-size: .85em;
    background: var(--crm-primary-soft, #E8F0FE); border-radius: 4px; padding: 1px 4px;
}
.ai-md pre.ai-code {
    background: var(--crm-primary-soft, #E8F0FE); border-radius: 6px;
    padding: 8px; overflow-x: auto; margin: 0 0 8px;
}
.ai-md pre.ai-code code { background: none; padding: 0; }
html[data-theme="dark"] .ai-md code,
html[data-theme="dark"] .ai-md pre.ai-code { background: #1B2947; }

.usage-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.usage-num { font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.usage-lbl { font-size: .8rem; color: var(--crm-muted, #64748B); }
.usage-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.usage-bar-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: 8px; align-items: center; margin: 4px 0; }
.usage-bar-key { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-bar-track { background: var(--crm-border, #CBD5E1); border-radius: 4px; height: 8px; overflow: hidden; }
.usage-bar-fill { display: block; height: 100%; background: var(--crm-primary, #1565C0); border-radius: 4px; }
.usage-bar-val { font-size: .78rem; color: var(--crm-muted, #64748B); min-width: 44px; text-align: right; }
html[data-theme="dark"] .usage-bar-track { background: #26324B; }

.disp-switch { position: relative; display: inline-block; }
.disp-switch > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center;
    padding: 2px 6px; border-radius: 6px; transition: background .15s ease;
    color: var(--crm-primary);
}
.disp-switch > summary::-webkit-details-marker { display: none; }
.disp-switch > summary::marker { content: ""; }
.disp-switch > summary:hover { background: var(--crm-primary-soft); }

.disp-switch .disp-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 1300;
    min-width: 15rem; padding: 8px;
    background: var(--mud-palette-surface, #fff);
    border: 1px solid var(--crm-line, #E6EBF2); border-radius: 8px;
    box-shadow: 0 6px 20px rgba(16,24,40,.14);
    text-align: start;
}
.disp-title { font-size: max(11px, .72rem); font-weight: 700; color: var(--crm-muted); margin-bottom: 6px; }

.disp-zoom { display: flex; align-items: center; gap: 8px; }
.disp-step {
    flex: 0 0 auto; width: 2rem; height: 2rem; line-height: 1;
    font-size: 1.05rem; font-weight: 700;
    background: var(--crm-primary-soft); color: var(--crm-primary);
    border: 1px solid var(--crm-line, #E6EBF2); border-radius: 6px; cursor: pointer;
}
.disp-step:hover:not(:disabled) { background: var(--crm-primary); color: #fff; }

.disp-step:disabled {
    cursor: default;
    background: transparent;
    color: var(--crm-muted);
    border-style: dashed;
}

.disp-switch .disp-menu { color: var(--crm-text); }
.disp-value {
    flex: 1 1 auto; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600;
    color: var(--crm-text);
}

.disp-presets { display: flex; gap: 4px; margin-top: 8px; }
.disp-preset {
    flex: 1 1 0; padding: 4px 6px; font-size: max(11px, .78rem);
    background: transparent; color: var(--crm-text);
    border: 1px solid var(--crm-line, #E6EBF2); border-radius: 6px; cursor: pointer;
}
.disp-preset:hover { background: var(--crm-primary-soft); }
.disp-preset[aria-pressed="true"] { background: var(--crm-primary); color: #fff; border-color: var(--crm-primary); }

.disp-sep { height: 1px; background: var(--crm-line, #E6EBF2); margin: 8px 0; }
.disp-row {

    display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%;
    padding: 5px 6px; font-size: max(11px, .82rem); text-align: start;
    background: transparent; color: var(--crm-text); border: 0; border-radius: 6px; cursor: pointer;
}
.disp-row:hover { background: var(--crm-primary-soft); }
.disp-note { margin-top: 8px; font-size: max(11px, .7rem); color: var(--crm-muted); line-height: 1.35; }

.disp-switch > summary:focus-visible,
.disp-step:focus-visible, .disp-preset:focus-visible, .disp-row:focus-visible {
    outline: 2px solid var(--crm-primary); outline-offset: 2px;
}

.ai-chart-host { margin: 10px 0; }
.ai-chart {
    --ai-surface: #fcfcfb; --ai-ink: #0b0b0b; --ai-ink2: #52514e; --ai-muted: #898781;
    --ai-grid: #e1e0d9; --ai-axis: #c3c2b7; --ai-border: #e1e0d9;
    --ai-c1: #2a78d6; --ai-c2: #eb6834; --ai-c3: #1baf7a; --ai-c4: #eda100;
    --ai-c5: #e87ba4; --ai-c6: #008300; --ai-c7: #4a3aa7; --ai-c8: #e34948;
    position: relative; margin: 0; padding: 12px 14px 10px; border: 1px solid var(--ai-border);
    border-radius: 8px; background: var(--ai-surface); color: var(--ai-ink); max-width: 100%;
    overflow: hidden;
}
html[data-theme="dark"] .ai-chart {
    --ai-surface: #1a1a19; --ai-ink: #f2f1ec; --ai-ink2: #b9b7af; --ai-muted: #898781;
    --ai-grid: #2c2c2a; --ai-axis: #383835; --ai-border: #2c2c2a;
    --ai-c1: #3987e5; --ai-c2: #d95926; --ai-c3: #199e70; --ai-c4: #c98500;
    --ai-c5: #d55181; --ai-c6: #008300; --ai-c7: #9085e9; --ai-c8: #e66767;
}
.ai-chart .ai-s1 { --c: var(--ai-c1); } .ai-chart .ai-s2 { --c: var(--ai-c2); }
.ai-chart .ai-s3 { --c: var(--ai-c3); } .ai-chart .ai-s4 { --c: var(--ai-c4); }
.ai-chart .ai-s5 { --c: var(--ai-c5); } .ai-chart .ai-s6 { --c: var(--ai-c6); }
.ai-chart .ai-s7 { --c: var(--ai-c7); } .ai-chart .ai-s8 { --c: var(--ai-c8); }

.ai-chart-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-chart-title { font-weight: 600; font-size: .95rem; color: var(--ai-ink); }
.ai-chart-unit { font-size: .8rem; color: var(--ai-muted); }
.ai-chart-tools { margin-left: auto; display: flex; gap: 4px; }
.ai-chart-btn {
    font: inherit; font-size: .75rem; padding: 2px 10px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--ai-axis); background: transparent; color: var(--ai-ink2);
}
.ai-chart-btn[aria-pressed="true"] { background: var(--ai-ink); color: var(--ai-surface); border-color: var(--ai-ink); }
.ai-chart-btn:focus-visible { outline: 2px solid var(--ai-c1); outline-offset: 2px; }
.ai-chart-note { font-size: .75rem; color: var(--ai-ink2); margin-top: 4px; }

.ai-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 6px; font-size: .78rem; color: var(--ai-ink2); }
.ai-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ai-legend-key { display: inline-block; background: var(--c); }
.ai-legend-rect { width: 10px; height: 10px; border-radius: 2px; }
.ai-legend-line { width: 14px; height: 2px; border-radius: 1px; }

.ai-chart-plot { position: relative; width: 100%; }
.ai-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.ai-grid { stroke: var(--ai-grid); stroke-width: 1; }
.ai-base { stroke: var(--ai-axis); stroke-width: 1; }
.ai-tick { fill: var(--ai-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ai-value { fill: var(--ai-ink2); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-bar { fill: var(--c); transition: opacity .12s; }
.ai-bar.on { opacity: .8; }
.ai-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ai-area { fill: var(--c); fill-opacity: .1; stroke: none; }
.ai-dot { fill: var(--c); stroke: var(--ai-surface); stroke-width: 2; }
.ai-cross { stroke: var(--ai-axis); stroke-width: 1; }
.ai-hit { fill: transparent; cursor: crosshair; outline: none; }
.ai-hit:focus-visible { stroke: var(--ai-c1); stroke-width: 2; }
.ai-slice { fill: var(--c); stroke: var(--ai-surface); stroke-width: 2; cursor: pointer; outline: none; transition: opacity .12s; }
.ai-slice.on, .ai-slice:focus-visible { opacity: .8; }
.ai-pie-total { fill: var(--ai-ink); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-pie { display: flex; justify-content: center; }

.ai-chart-tip {
    position: absolute; z-index: 5; pointer-events: none; min-width: 120px; max-width: 260px;
    padding: 6px 9px; border-radius: 6px; font-size: .78rem; line-height: 1.35;
    background: var(--ai-surface); color: var(--ai-ink); border: 1px solid var(--ai-axis);
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.ai-tip-head { color: var(--ai-ink2); margin-bottom: 3px; }
.ai-tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ai-tip-key { width: 12px; height: 2px; background: var(--c); border-radius: 1px; flex: none; }
.ai-tip-val { font-variant-numeric: tabular-nums; }
.ai-tip-name { color: var(--ai-ink2); overflow: hidden; text-overflow: ellipsis; }

.ai-chart-table-wrap { overflow-x: auto; margin-top: 8px; }
.ai-chart-table { border-collapse: collapse; font-size: .8rem; width: 100%; }
.ai-chart-table caption { text-align: left; color: var(--ai-muted); font-size: .75rem; padding-bottom: 4px; }
.ai-chart-table th, .ai-chart-table td { padding: 3px 8px; border-bottom: 1px solid var(--ai-grid); text-align: left; }
.ai-chart-table td { text-align: right; font-variant-numeric: tabular-nums; }

.ai3d-scene { perspective: 1100px; perspective-origin: 50% 0%; padding: 16px 0 6px; display: flex; justify-content: center; }
.ai3d-stage { position: relative; height: 240px; transform-style: preserve-3d; transform: rotateX(-14deg) rotateY(-24deg); }
.ai3d-floor {
    position: absolute; left: -8px; right: -8px; bottom: 0; transform-origin: bottom;
    transform: rotateX(90deg); background: var(--ai-grid); opacity: .6; border-radius: 2px;
}
.ai3d-wall { position: absolute; left: 0; right: 0; bottom: 0; height: 220px; pointer-events: none; }
.ai3d-wall-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--ai-grid); }
.ai3d-wall-label { position: absolute; left: -6px; transform: translate(-100%, -50%); font-size: 10px; color: var(--ai-muted); }
.ai3d-bar { position: absolute; bottom: 0; width: var(--w); height: var(--h); transform-style: preserve-3d; cursor: pointer; outline: none; }
.ai3d-face { position: absolute; background: var(--c); }
.ai3d-front, .ai3d-back { width: var(--w); height: var(--h); left: 0; bottom: 0; }
.ai3d-front { transform: translateZ(calc(var(--d) / 2)); }
.ai3d-back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.ai3d-left, .ai3d-right { width: var(--d); height: var(--h); bottom: 0; left: calc((var(--w) - var(--d)) / 2); }
.ai3d-left { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.ai3d-right { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.ai3d-top { width: var(--w); height: var(--d); left: 0; top: calc(var(--d) / -2); transform: rotateX(90deg); }
.ai3d-left::after, .ai3d-right::after, .ai3d-top::after, .ai3d-back::after {
    content: ""; position: absolute; inset: 0; background: #000;
}
.ai3d-right::after, .ai3d-back::after { opacity: .28; }
.ai3d-left::after { opacity: .18; }
.ai3d-top::after { background: #fff; opacity: .22; }
.ai3d-bar.on .ai3d-face, .ai3d-bar:focus-visible .ai3d-face { filter: brightness(1.12); }
.ai3d-labels { position: relative; height: 18px; margin: 4px auto 0; }
.ai3d-label { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--ai-muted); white-space: nowrap; }
.ai3d-scene-plane { perspective: 1200px; }
.ai3d-plane { transform: rotateX(18deg) rotateY(-10deg); transform-origin: 50% 100%; }
.ai3d-extrude { opacity: .35; }
.ai3d-pie-scene { position: relative; display: flex; justify-content: center; height: 230px; perspective: 900px; }
.ai3d-pie-layer { position: absolute; top: -30px; transform-origin: 50% 50%; }
.ai3d-pie-side { filter: brightness(.72); }
.ai3d-pie-side .ai-slice { cursor: default; }
@media (prefers-reduced-motion: reduce) { .ai-bar, .ai-slice { transition: none; } }

.ai-file-warn { font-size: .75rem; color: var(--mud-palette-warning-darken, #b26a00); padding: 4px 10px 0; }

.demo-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 6px 16px; font-size: .85rem; line-height: 1.35;
    background: #fff4d6; color: #5c4400; border-bottom: 1px solid #f0d48a;
}
html[data-theme="dark"] .demo-bar { background: #3a2f12; color: #f3dca0; border-bottom-color: #5c4a1c; }
.demo-end-open { margin-left: auto; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; font-weight: 600; text-decoration: underline; }
.demo-end-open:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.demo-end-dialog {
    margin: auto; width: min(420px, calc(100vw - 32px)); padding: 20px 22px; border: 1px solid var(--crm-line); border-radius: 12px;
    background: var(--mud-palette-surface, #fff); color: var(--mud-palette-text-primary, #1a202c); box-shadow: 0 18px 48px rgba(0,0,0,.35);
    opacity: 0; transform: translateY(8px) scale(.98);
    transition: opacity .18s ease, transform .2s ease, overlay .2s allow-discrete, display .2s allow-discrete;
}
.demo-end-dialog:popover-open { opacity: 1; transform: none; }
@starting-style { .demo-end-dialog:popover-open { opacity: 0; transform: translateY(8px) scale(.98); } }
.demo-end-dialog::backdrop { background: rgba(0,0,0,.45); }
.demo-end-dialog h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }
.demo-end-dialog p { margin: 0 0 16px; }
.demo-end-dialog form { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .demo-end-dialog { transition: none; } }

.cms { position: relative; display: inline-block; }
.cms-trigger { min-width: 180px; justify-content: space-between; text-transform: none; }
.cms-backdrop { position: fixed; inset: 0; z-index: 1300; background: transparent; }
.cms-panel {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 1301;
    width: min(360px, calc(100vw - 32px));
    display: flex; flex-direction: column; gap: 4px; padding: 8px 10px;
    background: var(--mud-palette-surface); color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default); border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
    opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.98); transform-origin: top right;
    transition: opacity .18s ease, transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .22s;
}
.cms-panel.open {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity .18s ease, transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
.cms-actions { display: flex; align-items: center; min-height: 36px; }
.cms-list {
    list-style: none; margin: 0; padding: 0 2px 0 0;
    max-height: min(320px, 50vh); overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth;
    animation: cms-page .2s ease;
}
.cms-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer;
    transition: background-color .12s ease;
}
.cms-item:hover { background: var(--mud-palette-action-default-hover); }
.cms-item:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: -2px; }
.cms-item.on { background: var(--mud-palette-primary-hover); }
.cms-flag { font-size: 1.1rem; line-height: 1; width: 1.4em; text-align: center; }
.cms-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cms-code { font-size: .75rem; color: var(--mud-palette-text-secondary); font-variant-numeric: tabular-nums; }
.cms-empty { padding: 12px 8px; color: var(--mud-palette-text-secondary); }
.cms-footer { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--mud-palette-lines-default); padding-top: 6px; }
@keyframes cms-page { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .cms-panel { right: auto; left: 0; transform-origin: top left; } }
@media (prefers-reduced-motion: reduce) {
    .cms-panel, .cms-panel.open, .cms-item { transition: none; }
    .cms-list { animation: none; scroll-behavior: auto; }
}
.cms-sub { display: block; font-size: .72rem; color: var(--mud-palette-text-secondary); overflow: hidden; text-overflow: ellipsis; }

.mud-input-slot:-webkit-autofill, .mud-input-slot:-webkit-autofill:hover, .mud-input-slot:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--mud-palette-text-primary);
    -webkit-box-shadow: 0 0 0 1000px var(--mud-palette-surface) inset;
    caret-color: var(--mud-palette-text-primary);
    transition: background-color 9999s ease-out 0s;
}

.crm-style-dlg {
    position: fixed; inset: 0; margin: auto; height: fit-content;
    width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
    padding: 0; border: 1px solid var(--crm-border); border-radius: 12px;
    background: var(--crm-card); color: var(--crm-text); box-shadow: var(--crm-shadow-lg);
}
.crm-style-dlg::backdrop { background: rgba(10, 18, 32, .45); }
.crm-style-dlg .sd-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 16px; border-bottom: 1px solid var(--crm-line); position: sticky; top: 0;
    background: var(--crm-card); z-index: 1;
}
.crm-style-dlg h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.crm-style-dlg h3 { font-size: max(11px, .78rem); font-weight: 700; color: var(--crm-muted); margin: 12px 0 8px; text-transform: uppercase; letter-spacing: .03em; }
.crm-style-dlg .sd-sec { padding: 4px 16px 12px; border-bottom: 1px solid var(--crm-line); }
.crm-style-dlg .sd-x {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--crm-border);
    background: transparent; color: var(--crm-text); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.crm-style-dlg .sd-x:hover { background: var(--crm-primary-soft); }
.crm-style-dlg .sd-pals { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.crm-style-dlg .sd-pal {
    display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 10px;
    border: 2px solid var(--crm-border); background: transparent; color: var(--crm-text); cursor: pointer; text-align: start;
}

.crm-style-dlg .sd-pal:hover { border-color: color-mix(in srgb, var(--crm-primary) 45%, transparent); }
.crm-style-dlg .sd-pal[aria-pressed="true"] { border-color: var(--crm-primary); box-shadow: 0 0 0 2px var(--crm-focus); position: relative; }
.crm-style-dlg .sd-pal[aria-pressed="true"]::after {
    content: "✓"; position: absolute; top: 4px; right: 6px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--crm-primary); color: #fff; font-size: 12px; line-height: 18px; text-align: center; font-weight: 700;
}
.crm-style-dlg .sd-sw {
    position: relative; display: flex; align-items: center; width: 100%; height: 44px; padding: 6px; border-radius: 6px; box-sizing: border-box;
    border: 1px solid rgba(0, 0, 0, .12);
}
.crm-style-dlg .sd-sw > span { padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: .85rem; }
.crm-style-dlg .sd-sw > i { position: absolute; inset-inline-end: 6px; bottom: 6px; width: 16px; height: 16px; border-radius: 50%; }
.crm-style-dlg .sd-pal-l { font-size: max(11px, .8rem); }
.crm-style-dlg .sd-own { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin-bottom: 10px; }
.crm-style-dlg .sd-own label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.crm-style-dlg .sd-own input[type="color"] {
    width: 36px; height: 32px; padding: 2px; border: 1px solid var(--crm-field-border); border-radius: 6px;
    background: var(--crm-field-bg); cursor: pointer;
}
.crm-style-dlg .sd-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
    border: 1px solid var(--crm-border); background: transparent; color: var(--crm-text); cursor: pointer; font: inherit;
}
.crm-style-dlg .sd-btn:hover { background: var(--crm-primary-soft); }
.crm-style-dlg .sd-btn.sd-primary { background: var(--crm-primary); border-color: var(--crm-primary); color: var(--mud-palette-primary-text, #fff); }
.crm-style-dlg .sd-btn.sd-primary:hover { filter: brightness(1.08); }
.crm-style-dlg .sd-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; }
.crm-style-dlg .sd-x:focus-visible, .crm-style-dlg .sd-pal:focus-visible, .crm-style-dlg .sd-btn:focus-visible,
.crm-style-dlg input[type="color"]:focus-visible { outline: 2px solid var(--crm-primary); outline-offset: 2px; }

.crm-style-dlg .sd-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.crm-style-dlg .sd-prev-wrap { margin: 0; }
.crm-style-dlg .sd-prev-wrap figcaption { font-size: max(11px, .75rem); color: var(--crm-muted); margin-top: 4px; text-align: center; }
.crm-style-dlg .sd-prev {
    border: 1px solid var(--crm-border); border-radius: 8px; overflow: hidden; font-size: 11px; line-height: 1.3;
    background: var(--crm-bg); color: var(--crm-text); color-scheme: inherit;
}
.sd-prev .pv-bar { display: flex; gap: 8px; align-items: center; padding: 4px 8px; background: var(--crm-card); border-bottom: 2px solid var(--crm-primary); color: var(--crm-muted); }
.sd-prev .pv-bar b { color: var(--crm-primary); margin-inline-end: auto; }
.sd-prev .pv-ribbon { display: flex; gap: 4px; padding: 4px 8px; background: var(--crm-header); border-bottom: 1px solid var(--crm-border); }
.sd-prev .pv-ribbon span { padding: 2px 6px; border-radius: 4px; }
.sd-prev .pv-ribbon .pv-on { background: var(--crm-primary); color: var(--mud-palette-primary-text); }
.sd-prev .pv-body { padding: 8px; display: grid; gap: 6px; }
.sd-prev .pv-card { background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 6px; padding: 6px 8px; box-shadow: var(--crm-shadow); }
.sd-prev .pv-h { font-weight: 700; color: var(--crm-text); }
.sd-prev .pv-muted { color: var(--crm-muted); }
.sd-prev .pv-row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.sd-prev .pv-link { color: var(--crm-primary); text-decoration: underline; }
.sd-prev .pv-btn { background: var(--crm-primary); color: var(--mud-palette-primary-text); border-radius: 4px; padding: 2px 8px; font-weight: 600; }
.sd-prev .pv-table { background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 6px; overflow: hidden; }
.sd-prev .pv-th, .sd-prev .pv-tr { display: grid; grid-template-columns: 1fr 1fr; padding: 2px 8px; }
.sd-prev .pv-th { background: var(--crm-thead); font-weight: 700; }
.sd-prev .pv-tr { border-top: 1px solid var(--crm-line); }
.sd-prev .pv-z { background: var(--crm-zebra); }
.crm-style-dlg .sd-apply-row { display: flex; justify-content: flex-end; margin-top: 12px; }

html[data-palette="custom"] body,
html[data-palette="custom"] .page-ribbon {
    background: linear-gradient(160deg, var(--crm-bg) 0%, color-mix(in srgb, var(--crm-bg) 92%, var(--crm-primary)) 55%, var(--crm-bg) 100%);
    color: var(--crm-text);
}
html[data-palette="custom"] a,
html[data-palette="custom"] .btn-link { color: var(--crm-link, var(--crm-primary)); }
html[data-palette="custom"] .mud-link.mud-primary-text { color: var(--crm-link, var(--mud-palette-primary)) !important; }
html[data-palette="custom"] .btn-primary { color: var(--mud-palette-primary-text); background-color: var(--crm-primary); border-color: var(--crm-primary); }

html[data-palette="custom"] .top-row {
    background: var(--crm-bar, linear-gradient(180deg, var(--crm-card) 0%, var(--crm-header) 100%)) !important;
    border-bottom-color: var(--crm-border);
    color: var(--crm-bar-ink, var(--crm-text));
}
html[data-palette="custom"] .top-row::before { background: linear-gradient(90deg, var(--crm-primary) 0%, var(--crm-primary-2) 100%); }
html[data-palette="custom"] .top-row .app-title { color: var(--crm-bar-accent, var(--crm-primary)) !important; }
html[data-palette="custom"] .top-row a,
html[data-palette="custom"] .top-row .btn-link,
html[data-palette="custom"] .top-row .theme-toggle,
html[data-palette="custom"] .top-row .disp-switch > summary,
html[data-palette="custom"] .top-row .lang-switch > summary { color: var(--crm-bar-muted, var(--crm-muted)) !important; }
html[data-palette="custom"] .top-row a:hover,
html[data-palette="custom"] .top-row .btn-link:hover { color: var(--crm-bar-accent, var(--crm-primary)) !important; }
html[data-palette="custom"] .top-row a.app-title:hover { background: var(--crm-primary-soft); }
html[data-palette="custom"] .lang-switch > summary { color: var(--crm-primary); }
html[data-palette="custom"] .lang-switch .lang-menu { background: var(--crm-card); border-color: var(--crm-border); }

html[data-palette="custom"] .ribbon { background: var(--crm-ribbon, var(--crm-header)); border-bottom-color: var(--crm-border); }
html[data-palette="custom"] .ribbon-body { background: var(--crm-ribbon, var(--crm-card)); }

html[data-palette="custom"] .ribbon .rbtn:not(.active) { color: var(--crm-ribbon-ink, var(--crm-text)); }
html[data-palette="custom"] .ribbon .rbtn:not(.active) .mud-icon-root { color: var(--crm-ribbon-accent, var(--crm-primary)); }
html[data-palette="custom"] .ribbon .rbtn:not(.active):hover,
html[data-palette="custom"] .ribbon .rbtn-sub .rbtn:not(.active) { color: var(--crm-text); }
html[data-palette="custom"] .ribbon .rbtn:not(.active):hover .mud-icon-root,
html[data-palette="custom"] .ribbon .rbtn-sub .rbtn:not(.active) .mud-icon-root { color: var(--crm-primary); }
html[data-palette="custom"] .ribbon .rt-label,
html[data-palette="custom"] .ribbon .rgroup-title { color: var(--crm-ribbon-muted, var(--crm-muted)); }
html[data-palette="custom"] .ribbon .rt-radio:checked + .rt-label,
html[data-palette="custom"] .ribbon .rt-label:hover { color: var(--crm-ribbon-accent, var(--crm-primary)); border-bottom-color: var(--crm-ribbon-accent, var(--crm-primary)); }
html[data-palette="custom"] .ribbon .rbtn-summary::after { border-color: var(--crm-ribbon-accent, var(--crm-primary)); }
html[data-palette="custom"] .rbtn.active,
html[data-palette="custom"] .rbtn-sub .rbtn:hover,
html[data-palette="custom"] .rbtn-sub .rbtn.active,
html[data-palette="custom"] .rbtn.active .mud-icon-root,
html[data-palette="custom"] .rbtn-sub .rbtn:hover .mud-icon-root,
html[data-palette="custom"] .rbtn-sub .rbtn.active .mud-icon-root { color: var(--mud-palette-primary-text); }
html[data-palette="custom"] .delphi-toolbar { background: linear-gradient(180deg, var(--crm-card) 0%, var(--crm-header) 100%); border-color: var(--crm-border); }
html[data-palette="custom"] .status-bar {
    background: var(--crm-bar, var(--crm-header)) !important;
    border-top-color: var(--crm-border) !important; color: var(--crm-bar-muted, var(--crm-muted)) !important;
}
html[data-palette="custom"] .status-bar .sb-panel { border-right-color: var(--crm-border) !important; }

html[data-palette="custom"] .customer-tabs .mud-tabs-tabbar { background: linear-gradient(180deg, var(--crm-card) 0%, var(--crm-header) 100%); }
html[data-palette="custom"] .customer-tabs .mud-tab:hover,
html[data-palette="custom"] .csec-tab:hover { background: var(--crm-hover); }
html[data-palette="custom"] .customer-tabs .mud-tab.mud-tab-active { background: var(--crm-primary); color: var(--mud-palette-primary-text) !important; }
html[data-palette="custom"] .customer-tabs .mud-tab.mud-tab-active .mud-icon-root,
html[data-palette="custom"] .csec-tab.active .mud-icon-root { color: var(--mud-palette-primary-text) !important; }
html[data-palette="custom"] .csec-tab.active { background: var(--crm-primary); color: var(--mud-palette-primary-text); }

html[data-palette="custom"] .delphi-grid,
html[data-palette="custom"] .mud-simple-table { border-color: var(--crm-border); }
html[data-palette="custom"] .delphi-grid .mud-table-head .mud-table-cell,
html[data-palette="custom"] .mud-simple-table thead th { background: var(--crm-thead); color: var(--crm-thead-ink, var(--crm-text)); border-bottom-color: var(--crm-border); }
html[data-palette="custom"] .mud-simple-table tbody td { border-bottom-color: var(--crm-line); }
html[data-palette="custom"] .mud-simple-table tbody tr:hover { background: var(--crm-hover); }
html[data-palette="custom"] .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: var(--crm-zebra); }

html[data-palette="custom"] .stat-card { background: var(--crm-card) !important; }
html[data-palette="custom"] .dash-hero { background: var(--crm-hero, var(--crm-primary)); color: var(--crm-hero-ink, var(--mud-palette-primary-text)); }
html[data-palette="custom"] .dash-hero .dash-hello,
html[data-palette="custom"] .dash-hero .dash-sub { color: var(--crm-hero-ink, var(--mud-palette-primary-text)); }
html[data-palette="custom"] .dash-hero .dash-hero-icon { color: var(--crm-hero-ink, var(--mud-palette-primary-text)); opacity: .3; }

html[data-palette="custom"] .filter-group,
html[data-palette="custom"] .checklist { border-color: var(--crm-border); background: var(--crm-card); }
html[data-palette="custom"] .filter-group-title { background: var(--crm-header); color: var(--crm-primary); }
html[data-palette="custom"] .checklist-item:hover,
html[data-palette="custom"] .hub-card-unread { background: var(--crm-hover); }
html[data-palette="custom"] .hub-panel { background: var(--crm-card); border-color: var(--crm-border); }
html[data-palette="custom"] .hub-settings { background: var(--crm-bg); }
html[data-palette="custom"] .card-header,
html[data-palette="custom"] .bg-light,
html[data-palette="custom"] code,
html[data-palette="custom"] kbd { background-color: var(--crm-header) !important; color: var(--crm-text); }
html[data-palette="custom"] .form-control,
html[data-palette="custom"] .form-select,
html[data-palette="custom"] .auth-card .form-control { background-color: var(--crm-field-bg); color: var(--crm-text); border-color: var(--crm-field-border); }
html[data-palette="custom"] .form-control::placeholder { color: var(--crm-muted); }
html[data-palette="custom"] .form-control:focus,
html[data-palette="custom"] .form-select:focus { background-color: var(--crm-field-bg); border-color: var(--crm-primary); box-shadow: 0 0 0 3px var(--crm-focus); }
html[data-palette="custom"] .auth-card { background: var(--crm-card); }
html[data-palette="custom"] .auth-btn { background: var(--crm-primary); color: var(--mud-palette-primary-text); }

html[data-palette="custom"] .tour-panel,
html[data-palette="custom"] .tour-ai { background: var(--crm-card); border-color: var(--crm-border); }
html[data-palette="custom"] .tour-head,
html[data-palette="custom"] .tour-tip,
html[data-palette="custom"] .tour-ai-head,
html[data-palette="custom"] .ai-md code,
html[data-palette="custom"] .ai-md pre.ai-code { background: var(--crm-header); border-color: var(--crm-border); }
html[data-palette="custom"] .tour-foot { border-color: var(--crm-border); }
html[data-palette="custom"] .tour-voice,
html[data-palette="custom"] .tour-ai-input { background: var(--crm-field-bg); border-color: var(--crm-border); }
html[data-palette="custom"] .usage-bar-track { background: var(--crm-line); }

html[data-palette="custom"] .disp-step:hover:not(:disabled),
html[data-palette="custom"] .disp-preset[aria-pressed="true"] { color: var(--mud-palette-primary-text); }

html[data-palette="custom"] .lp-cta { background: var(--crm-primary); color: var(--mud-palette-primary-text) !important; }
html[data-palette="custom"] .landing { --lp-muted: var(--crm-muted); }
html[data-palette="custom"] .lp-final { background: var(--crm-primary); }
html[data-palette="custom"] .lp-final h2,
html[data-palette="custom"] .lp-final p { color: var(--mud-palette-primary-text); }
html[data-palette="custom"] .lp-cta-ghost.lp-on-dark { background: transparent; color: var(--mud-palette-primary-text) !important; border-color: var(--mud-palette-primary-text); }
html[data-palette="custom"] .lp-final .lp-cta { background: var(--crm-card); color: var(--crm-primary) !important; }
html[data-palette="custom"] .lp-badge,
html[data-palette="custom"] .lp-feat .lp-ico,
html[data-palette="custom"] .lp-kpi { background: var(--crm-primary-soft); }

html[data-palette="custom"] .rbtn-summary::after { border-color: var(--crm-primary); }
html[data-palette="custom"] .rbtn-sub .rbtn { background: var(--crm-primary-soft); color: var(--crm-text); }
html[data-palette="custom"] .rbtn:hover { background: var(--crm-hover); color: var(--crm-primary); }

html[data-palette="custom"] .tour-ring {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 4px rgba(var(--mud-palette-primary-rgb), .35), 0 0 0 100vmax rgba(0, 0, 0, .35);

    animation-name: tour-pulse-custom;
}
@keyframes tour-pulse-custom {
    0%, 100% { box-shadow: 0 0 0 4px rgba(var(--mud-palette-primary-rgb), .35), 0 0 0 100vmax rgba(0, 0, 0, .35); }
    50%      { box-shadow: 0 0 0 12px rgba(var(--mud-palette-primary-rgb), .08), 0 0 0 100vmax rgba(0, 0, 0, .35); }
}
@media (prefers-reduced-motion: reduce) { html[data-palette="custom"] .tour-ring { animation: none; } }
html[data-palette="custom"] .tour-btn.ready { animation-name: tour-ready-custom; box-shadow: none; }
@keyframes tour-ready-custom {
    0%   { box-shadow: 0 0 0 0 rgba(var(--mud-palette-primary-rgb), .55); }
    100% { box-shadow: 0 0 0 10px rgba(var(--mud-palette-primary-rgb), 0); }
}
@media (prefers-reduced-motion: reduce) { html[data-palette="custom"] .tour-btn.ready { animation: none; } }
html[data-palette="custom"] .tour-arrow path { fill: var(--crm-primary); stroke: var(--mud-palette-primary-text); }
html[data-palette="custom"] .tour-btn { color: var(--crm-text); border-color: var(--crm-border); }
html[data-palette="custom"] .tour-btn.primary,
html[data-palette="custom"] .tour-btn.tour-play.on { background: var(--crm-primary); border-color: var(--crm-primary); color: var(--mud-palette-primary-text); }
html[data-palette="custom"] .tour-btn.ready { outline-color: var(--crm-primary); }
html[data-palette="custom"] .tour-panel,
html[data-palette="custom"] .tour-ai { color: var(--crm-text); }
html[data-palette="custom"] .tour-count,
html[data-palette="custom"] .tour-x,
html[data-palette="custom"] .tour-missed,
html[data-palette="custom"] .tour-ai-where { color: var(--crm-muted); }
html[data-palette="custom"] .tour-done,
html[data-palette="custom"] .tour-ai-note { color: var(--crm-primary); }
html[data-palette="custom"] .tour-dot { background: var(--crm-border); }
html[data-palette="custom"] .tour-dot.on,
html[data-palette="custom"] .tour-progress-bar { background: var(--crm-primary); }
html[data-palette="custom"] .tour-progress { background: var(--crm-line); }

.crm-style-dlg .sd-more { display: inline-block; margin-top: 8px; font-size: max(11px, .82rem); color: var(--crm-link, var(--crm-primary)); }
.ap-layout { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .ap-layout { grid-template-columns: 1fr; } }
.ap-h { font-size: 1rem; font-weight: 700; margin: 0 0 8px; }
.ap-note { font-size: max(11px, .8rem); color: var(--crm-muted); margin: 0 0 8px; }
.ap-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.ap-preset { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--crm-border); border-radius: 8px; background: transparent; color: var(--crm-text); cursor: pointer; font: inherit; font-size: max(11px, .78rem); }
.ap-preset:hover { border-color: var(--crm-primary); }
.ap-sw { position: relative; display: flex; align-items: center; height: 36px; padding: 4px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .12); }
.ap-sw > span { padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.ap-sw > i { position: absolute; right: 6px; bottom: 6px; width: 16px; height: 16px; border-radius: 50%; }
.ap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ap-row, .ap-obj { display: flex; align-items: center; gap: 8px; }
.ap-obj { justify-content: space-between; border-bottom: 1px solid var(--crm-line); padding: 2px 0; }
.ap-obj .mud-input-control { flex: 1 1 auto; margin: 0; }
.ap-auto { font-size: max(11px, .75rem); color: var(--crm-muted); min-width: 64px; text-align: end; }
.ap-controls input[type="color"] { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--crm-field-border); border-radius: 6px; background: var(--crm-field-bg); cursor: pointer; }
.ap-controls input[type="color"]:disabled { opacity: .4; cursor: not-allowed; }
.ap-mock { border: 1px solid var(--crm-border); border-radius: 10px; overflow: hidden; background: var(--crm-bg); color: var(--crm-text); font-size: 13px; }
.ap-bar { display: flex; gap: 12px; align-items: center; padding: 8px 12px; background: var(--crm-bar, var(--crm-card)); color: var(--crm-bar-muted, var(--crm-muted)); border-bottom: 2px solid var(--crm-primary); }
.ap-bar b { color: var(--crm-bar-accent, var(--crm-primary)); margin-right: auto; }
.ap-ribbon { background: var(--crm-ribbon, var(--crm-header)); border-bottom: 1px solid var(--crm-border); }
.ap-tabs { display: flex; gap: 12px; padding: 6px 12px 0; }
.ap-tabs span { padding-bottom: 4px; color: var(--crm-ribbon-muted, var(--crm-muted)); border-bottom: 2px solid transparent; }
.ap-tabs span.on { color: var(--crm-ribbon-accent, var(--crm-primary)); border-bottom-color: var(--crm-ribbon-accent, var(--crm-primary)); }
.ap-btns { display: flex; gap: 6px; padding: 8px 12px; }
.ap-rbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 10px; border-radius: 8px; color: var(--crm-ribbon-ink, var(--crm-text)); font-size: 12px; }
.ap-rbtn .ap-ico { width: 16px; height: 16px; border-radius: 4px; background: var(--crm-ribbon-accent, var(--crm-primary)); }
.ap-rbtn.on { background: var(--crm-primary); color: var(--mud-palette-primary-text); }
.ap-rbtn.on .ap-ico { background: var(--mud-palette-primary-text); }
.ap-body { padding: 12px; display: grid; gap: 10px; }
.ap-hero { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 10px; background: var(--crm-hero, var(--crm-primary)); color: var(--crm-hero-ink, var(--mud-palette-primary-text)); }
.ap-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ap-kpi { background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.ap-kpi small { color: var(--crm-muted); }
.ap-kpi b { font-size: 1.2rem; }
.ap-card { background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 10px; padding: 10px 12px; box-shadow: var(--crm-shadow); display: grid; gap: 8px; }
.ap-card-h { font-weight: 700; display: flex; justify-content: space-between; }
.ap-link { color: var(--crm-link, var(--crm-primary)); text-decoration: underline; font-weight: 400; }
.ap-muted { color: var(--crm-muted); }
.ap-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-chip { padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.ap-chip.s { background: var(--mud-palette-success); color: var(--mud-palette-success-text); }
.ap-chip.w { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.ap-chip.e { background: var(--mud-palette-error); color: var(--mud-palette-error-text); }
.ap-chip.a { background: var(--mud-palette-secondary); color: var(--mud-palette-secondary-text); }
.ap-alert { padding: 6px 10px; border-radius: 6px; background: var(--mud-palette-info-hover); color: var(--mud-palette-info-darken); border-left: 4px solid var(--mud-palette-info); }
.ap-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ap-btn { padding: 4px 12px; border-radius: 6px; font-weight: 600; }
.ap-btn.out { border: 1px solid var(--crm-primary); color: var(--crm-primary); }
.ap-btn.fill { background: var(--crm-primary); color: var(--mud-palette-primary-text); }
.ap-table { background: var(--crm-card); border: 1px solid var(--crm-border); border-radius: 10px; overflow: hidden; }
.ap-th, .ap-tr { display: grid; grid-template-columns: 1fr 1fr; padding: 4px 12px; }
.ap-th { background: var(--crm-thead); color: var(--crm-thead-ink, var(--crm-text)); font-weight: 700; }
.ap-tr { border-top: 1px solid var(--crm-line); }
.ap-tr.z { background: var(--crm-zebra); }
.ap-tr.sel { background: var(--crm-selected); }
.ap-status { display: flex; gap: 16px; padding: 4px 12px; font-size: 12px; background: var(--crm-bar, var(--crm-header)); color: var(--crm-bar-muted, var(--crm-muted)); border-top: 1px solid var(--crm-border); }

.ap-print { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
@media (max-width: 900px) { .ap-print { grid-template-columns: 1fr; } }
.ap-rt-series { font-size: max(11px, .75rem); font-weight: 700; color: var(--crm-muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 4px; }
.ap-rt-list { display: grid; gap: 4px; }
.ap-rt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 8px; border: 1px solid var(--crm-border); border-radius: 8px; background: transparent; color: var(--crm-text); cursor: pointer; font: inherit; text-align: start; }
.ap-rt:hover { border-color: var(--crm-primary); }
.ap-rt.on { border-color: var(--crm-primary); box-shadow: inset 0 0 0 1px var(--crm-primary); background: var(--crm-primary-soft); }
.ap-rt-sw { display: flex; flex: 0 0 auto; border-radius: 4px; overflow: hidden; border: 1px solid var(--crm-border); }
.ap-rt-sw > i { width: 16px; height: 24px; }
.ap-rt-text { display: flex; flex-direction: column; min-width: 0; }
.ap-rt-text small { color: var(--crm-muted); font-size: max(11px, .75rem); }
.ap-rt-tag { margin-inline-start: 6px; padding: 0 6px; border-radius: 8px; font-size: max(11px, .7rem); font-weight: 600; background: var(--crm-line); color: var(--crm-muted); }
.ap-rt-sample { border: 1px solid var(--crm-border); border-radius: 10px; padding: 16px 20px; box-shadow: var(--crm-shadow); }
.ap-rt-sample .rpt-title { font-size: 1.1rem; }
