/* Shared DSI identity. Loaded after each complete layout's existing styles.
   Only presentation tokens and component finishes are shared: workspace sizing,
   grids, menus and application behaviour remain owned by their original styles. */
body.dsi-brand-theme {
    --dsi-ink: #20223f;
    --dsi-muted: #62647c;
    --dsi-brand: #5840d7;
    --dsi-accent: #00a593;
    --dsi-line: #e7e6f3;
    --dsi-soft: #f6f6ff;
    --dsi-white: #fff;
    --dsi-radius: 1.5rem;
    --dsi-gradient: linear-gradient(115deg, #6442e8 0%, #3d65e8 52%, #009f9f 100%);
    --dsi-action-gradient: linear-gradient(115deg, #5840d7, #4257cc 70%, #226f8f);
    --dsi-bg: #fff;
    --dsi-surface: #fff;
    --dsi-surface-alt: #f6f6ff;
    --dsi-surface-raised: #fff;
    --dsi-sidebar-surface: #f8f7ff;
    --dsi-text: #20223f;
    --dsi-text-muted: #62647c;
    --dsi-border: #e7e6f3;
    --dsi-border-strong: #d0cbe9;
    --dsi-primary: #5840d7;
    --dsi-primary-hover: #4630b8;
    --dsi-primary-soft: #f0edff;
    --dsi-primary-ink: #4f36be;
    --dsi-primary-line: #dcd5fa;
    --dsi-primary-contrast: #fff;
    --dsi-focus: #8065e6;
    --dsi-shadow: 0 12px 35px rgba(32, 34, 63, .055);
    --dsi-shadow-soft: 0 4px 14px rgba(32, 34, 63, .045);
    background-color: var(--dsi-bg);
    color: var(--dsi-text);
}

/* Explicit dark mode remains authoritative; never force white surfaces over it. */
html[data-theme="dark"] body.dsi-brand-theme,
html[data-bs-theme="dark"] body.dsi-brand-theme,
body.dsi-brand-theme.dark-version {
    color-scheme: dark;
    --dsi-ink: #f0edf9;
    --dsi-muted: #b9b5cd;
    --dsi-brand: #b7a6ff;
    --dsi-accent: #5dd7c3;
    --dsi-line: #3b3654;
    --dsi-soft: #262238;
    --dsi-white: #211e30;
    --dsi-bg: #171522;
    --dsi-surface: #211e30;
    --dsi-surface-alt: #29243b;
    --dsi-surface-raised: #2d2841;
    --dsi-sidebar-surface: #1d1a2c;
    --dsi-text: #f0edf9;
    --dsi-text-muted: #b9b5cd;
    --dsi-border: #3b3654;
    --dsi-border-strong: #57506e;
    --dsi-primary: #b7a6ff;
    --dsi-primary-hover: #d0c5ff;
    --dsi-primary-soft: #352d52;
    --dsi-primary-ink: #cfbfff;
    --dsi-primary-line: #5d4d87;
    --dsi-primary-contrast: #211733;
    --dsi-focus: #c0adff;
    --dsi-shadow: 0 12px 35px rgba(0, 0, 0, .13);
    --dsi-shadow-soft: 0 4px 14px rgba(0, 0, 0, .11);
}

/* Public catalogue and shared brand header. */
.dsi-brand-theme.dsi-site :is(h1, h2, h3, h4, .module-card h3 a, .brand) { color: var(--dsi-text); }
.dsi-brand-theme.dsi-site :is(p, .small-note, small, .public-breadcrumb, .nav-links a) { color: var(--dsi-text-muted); }
.dsi-brand-theme.dsi-site :is(a.text-link, .eyebrow, .step-number, .nav-links a[aria-current="page"]) { color: var(--dsi-primary-ink); }
.dsi-brand-theme.dsi-site .site-header {
    background: color-mix(in srgb, var(--dsi-surface) 94%, transparent);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.dsi-site .brand { gap: 12px; }
.dsi-brand-theme.dsi-site .brand img { width: 42px; height: 42px; object-fit: contain; }
.dsi-brand-theme.dsi-site .brand-word { font-size: 1.1rem; line-height: 1.2; font-weight: 750; letter-spacing: -.035em; }
.dsi-brand-theme.dsi-site .brand small { font-size: .66rem; letter-spacing: .015em; line-height: 1.5; margin-top: 4px; }
.dsi-brand-theme.dsi-site :is(.prototype-bar, .notice:not(.warning)) {
    background: var(--dsi-primary-soft);
    color: var(--dsi-text-muted);
    border-color: var(--dsi-primary-line);
}
.dsi-brand-theme.dsi-site :is(.page-hero, .section-soft) {
    background: linear-gradient(125deg, var(--dsi-surface-alt), var(--dsi-surface) 80%);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.dsi-site :is(.cta-block, .bridge-card) {
    background: var(--dsi-surface-alt);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.dsi-site :is(.icon-box, .badge-blue) { background: var(--dsi-primary-soft); color: var(--dsi-primary-ink); }
.dsi-brand-theme.dsi-site .badge-gray { background: var(--dsi-surface-alt); color: var(--dsi-text-muted); }
.dsi-brand-theme.dsi-site :is(.back-top, .icon-btn, .menu-toggle, .field input, .field select, .field textarea) {
    background-color: var(--dsi-surface);
    color: var(--dsi-text);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.dsi-site :is(.table th, .table td) { border-color: var(--dsi-border); color: var(--dsi-text); }
.dsi-brand-theme.dsi-site .table th { background: var(--dsi-surface-alt); }
.dsi-brand-theme.dsi-site .site-footer { background: var(--dsi-surface-alt); color: var(--dsi-text); border-color: var(--dsi-border); }
.dsi-brand-theme.dsi-site .site-footer :is(a, p, small) { color: var(--dsi-text-muted); }

/* Consistent component finishes without overriding widths, padding or layout. */
.dsi-brand-theme :is(.soft-card, .module-card, .price-card, .av-card, .av-hero, .auth-card, .account-card, .card) {
    border-color: var(--dsi-border);
    border-radius: var(--dsi-radius);
    box-shadow: var(--dsi-shadow);
}
.dsi-brand-theme :is(.soft-card, .module-card, .price-card, .auth-card, .account-card) {
    background-color: var(--dsi-surface);
    color: var(--dsi-text);
}
.dsi-brand-theme :is(.btn, .av-btn, .auth-submit, .auth-button, .btn-account-primary, .mx-button) { border-radius: 999px; }
.dsi-brand-theme :is(.btn-primary, .av-btn--primary, .auth-submit, .btn-account-primary, .mx-button--primary) {
    background: var(--dsi-action-gradient);
    color: #fff !important;
    border-color: #5840d7;
    box-shadow: 0 5px 16px rgba(88, 64, 215, .15);
}
.dsi-brand-theme :is(.btn-primary, .av-btn--primary, .auth-submit, .btn-account-primary, .mx-button--primary):hover {
    background: #4630b8;
    border-color: #4630b8;
    color: #fff;
}
.dsi-brand-theme :is(.btn-light, .btn-outline-primary, .mx-button:not(.mx-button--primary):not(.mx-button--danger)) {
    background-color: var(--dsi-surface);
    border-color: var(--dsi-border-strong);
    color: var(--dsi-primary-ink);
}
.dsi-brand-theme :is(.av-navigation a, .dsi-nav-link, .dsi-context-trigger, .dsi-account-mobile-links a) { border-radius: 999px; }
.dsi-brand-theme :is(.av-hero::before, .dsi-workspace-dot) { background: var(--dsi-gradient); }
.dsi-brand-theme :is(.dsi-sidebar, .dsi-context-panel) { border-radius: var(--dsi-radius); }
.dsi-brand-theme :is(a, button, input, select, textarea, summary):focus-visible {
    outline-color: var(--dsi-focus);
}

/* Older dashboard shells keep their Bootstrap grid and sizing. */
.dsi-brand-theme.bg-gray-100 { background-color: var(--dsi-bg) !important; }
.dsi-brand-theme.g-sidenav-show:not(.dsi-account-site) :is(.card, .navbar-main, .sidenav) {
    background-color: var(--dsi-surface);
    color: var(--dsi-text);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.g-sidenav-show:not(.dsi-account-site) :is(h1, h2, h3, h4, h5, h6, .pageTitle, .breadcrumb-item) { color: var(--dsi-text); }
.dsi-brand-theme.g-sidenav-show:not(.dsi-account-site) :is(.form-control, .form-select) {
    background-color: var(--dsi-surface);
    color: var(--dsi-text);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.g-sidenav-show .bg-gradient-primary { background-image: var(--dsi-action-gradient); }
.dsi-brand-theme.g-sidenav-show .sidenav .nav-link.active { background-color: var(--dsi-primary-soft); color: var(--dsi-primary-ink); }
html[data-theme="dark"] .dsi-brand-theme.g-sidenav-show :is(.text-dark, .text-body) { color: var(--dsi-text) !important; }
html[data-theme="dark"] .dsi-brand-theme.g-sidenav-show .text-secondary { color: var(--dsi-text-muted) !important; }

/* Meetings uses its own full-height grid; only its surfaces and accents change. */
.dsi-brand-theme.mx-body :is(.mx-topbar, .mx-inbox, .mx-chat-header, .mx-composer, .mx-calendar-content, .mx-day, .mx-agenda-item, .mx-dialog, .mx-message-bubble, .mx-load-older) {
    background-color: var(--dsi-surface);
    color: var(--dsi-text);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.mx-body :is(.mx-search, .mx-chat, .mx-composer textarea, .mx-calendar-tip, .mx-support-card) {
    background-color: var(--dsi-surface-alt);
    color: var(--dsi-text);
    border-color: var(--dsi-border);
}
.dsi-brand-theme.mx-body :is(.mx-brand strong, .mx-chat-welcome h2, .mx-conversation, .mx-search input, .mx-field input, .mx-field textarea, .mx-field select) { color: var(--dsi-text); }
.dsi-brand-theme.mx-body :is(.mx-field input, .mx-field textarea, .mx-field select) { background-color: var(--dsi-surface); border-color: var(--dsi-border); }
.dsi-brand-theme.mx-body :is(.mx-topbar-caption, .mx-eyebrow, .mx-list-heading, .mx-conversation-bottom p, .mx-chat-welcome > p, .mx-brand > span > span) { color: var(--dsi-text-muted); }
.dsi-brand-theme.mx-body .mx-rail { background: linear-gradient(180deg, #453199, #253c6e 70%, #225b66); }
.dsi-brand-theme.mx-body .mx-rail-item.is-active { background: rgba(255, 255, 255, .14); color: #fff; }
.dsi-brand-theme.mx-body .mx-rail-item.is-active::before { background: #68decb; }
.dsi-brand-theme.mx-body :is(.mx-conversation.is-selected, .mx-message-row.is-mine .mx-message-bubble, .mx-calendar-filter.is-selected, .mx-welcome-art) {
    background-color: var(--dsi-primary-soft);
    color: var(--dsi-primary-ink);
    border-color: var(--dsi-primary-line);
}
.dsi-brand-theme.mx-body :is(.mx-icon-button--accent, .mx-count, .mx-day.is-today > span:first-child) { background: var(--dsi-primary); color: var(--dsi-primary-contrast); }
.dsi-brand-theme.mx-body .mx-welcome-art > svg { color: var(--dsi-primary-ink); }

/* Long product and service pages: compact anchor pills, then readable chapters. */
.dsi-brand-theme .product-nav { display: flex; flex-wrap: wrap; gap: .65rem; margin-block: 1.5rem 2.5rem; }
.dsi-brand-theme .product-nav a {
    display: inline-flex;
    align-items: center;
    padding: .65rem 1.1rem;
    border: 1px solid var(--dsi-border);
    border-radius: 999px;
    background: var(--dsi-surface);
    color: var(--dsi-text-muted);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
}
.dsi-brand-theme .product-nav a:is(:hover, :focus-visible, [aria-current="true"]) { color: var(--dsi-primary-ink); background: var(--dsi-primary-soft); border-color: var(--dsi-primary-line); }
.dsi-brand-theme .product-chapter {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
    align-items: start;
    gap: clamp(1.5rem, 5vw, 4.5rem);
    padding-block: clamp(2.25rem, 4vw, 4rem);
    border-top: 1px solid var(--dsi-border);
    scroll-margin-top: 7rem;
}
.dsi-brand-theme .product-chapter > * { min-width: 0; }
.dsi-brand-theme .product-chapter h2 { font-size: clamp(1.55rem, 3vw, 2.3rem); letter-spacing: -.04em; line-height: 1.18; }
.dsi-brand-theme .product-chapter p { max-width: 68ch; line-height: 1.8; }
.dsi-brand-theme .product-chapter > .soft-card { background: var(--dsi-surface-alt); }
.dsi-brand-theme .product-chapter :is(ol, ul) { padding-left: 1.35rem; }
.dsi-brand-theme .product-chapter li { margin-block: .7rem; color: var(--dsi-text-muted); line-height: 1.7; }
.dsi-brand-theme .product-chapter li::marker { color: var(--dsi-primary-ink); font-weight: 700; }
.dsi-brand-theme .product-chapter .notice { margin-bottom: 0; }
.dsi-brand-theme .product-price-section {
    padding: clamp(1.5rem, 4vw, 3.5rem);
    margin-block: 2rem 4rem;
    border: 1px solid var(--dsi-primary-line);
    border-radius: var(--dsi-radius);
    background: linear-gradient(125deg, var(--dsi-primary-soft), var(--dsi-surface));
    scroll-margin-top: 7rem;
}
.dsi-brand-theme .product-price-section h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.dsi-brand-theme .product-price-section .hero-actions { margin-top: 1.5rem; }
@media (max-width: 767px) {
    .dsi-brand-theme .product-chapter { grid-template-columns: minmax(0, 1fr); }
    .dsi-brand-theme .product-nav { gap: .5rem; }
    .dsi-brand-theme .product-nav a { padding: .6rem .9rem; }
}
@media print {
    .dsi-brand-theme .product-nav { display: none; }
    .dsi-brand-theme .product-chapter { display: block; break-inside: avoid; }
    .dsi-brand-theme :is(.product-price-section, .product-chapter > .soft-card) { box-shadow: none; }
}
