/* ==========================================================================
   sd.css — SpeakData design system (NLP v24)
   --------------------------------------------------------------------------
   Loaded on every signed-in page by includes/sidebar.php (after the page's
   own CSS and css/modern.css), and in <head> by sd_head() on migrated pages.

   1. Tokens          colors, type, space, radius, shadow (tenant brand aware)
   2. App shell       sidebar, phone top bar, drawer — on every page now
   3. Legacy fixes    small, safe corrections for all existing pages
   4. Base            body.sd-app: pages that have moved to the system
   5. Components      sd-* classes — opt-in, nothing legacy uses them
   6. Utilities, motion, print

   Rules: use tokens, not raw colors. New colors are added to section 1 only
   (tools/ui_lint.sh enforces this in CI). No inline style="" in markup.
   The look comes from the Projects pages (v22/v23) and replaces their
   --pj-* tokens over time.
   ========================================================================== */


/* ==========================================================================
   1. TOKENS
   ========================================================================== */
:root {
    /* Brand — the tenant's colors (tenantBrandCss() sets --primary etc.) */
    --sd-accent:        var(--primary, #2563eb);
    --sd-accent-ink:    #1d4ed8;
    --sd-accent-soft:   #eff6ff;
    --sd-accent-line:   #bfdbfe;
    --sd-on-accent:     #ffffff;

    /* Neutrals (slate). --sd-muted is the lightest text that passes WCAG AA on white. */
    --sd-ink:           #0f172a;
    --sd-ink-2:         #334155;
    --sd-ink-3:         #475569;
    --sd-muted:         #64748b;
    --sd-faint:         #94a3b8;   /* icons, disabled, placeholders only — never body text */
    --sd-line:          #e8ecf2;
    --sd-line-strong:   #d7dee8;
    --sd-surface:       #ffffff;
    --sd-sunken:        #f8fafc;
    --sd-canvas:        #f6f8fb;
    --sd-hover:         #f1f5f9;

    /* Status: text / background / border */
    --sd-good:  #047857;  --sd-good-bg: #ecfdf5;  --sd-good-line: #a7f3d0;
    --sd-warn:  #b45309;  --sd-warn-bg: #fffbeb;  --sd-warn-line: #fde68a;
    --sd-bad:   #b91c1c;  --sd-bad-bg:  #fef2f2;  --sd-bad-line:  #fecaca;
    --sd-info:  #1d4ed8;  --sd-info-bg: #eff6ff;  --sd-info-line: #bfdbfe;
    --sd-warn-solid: #f59e0b;
    --sd-bad-solid:  #dc2626;
    --sd-good-solid: #10b981;

    /* Type */
    --sd-font: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --sd-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    --sd-text-xs: 12px;
    --sd-text-sm: 13px;
    --sd-text-base: 14px;
    --sd-text-md: 15px;
    --sd-text-lg: 17px;
    --sd-text-xl: 20px;
    --sd-text-2xl: 24px;
    --sd-text-3xl: 30px;

    /* Space (4px grid) */
    --sd-1: 4px;  --sd-2: 8px;  --sd-3: 12px; --sd-4: 16px;
    --sd-5: 20px; --sd-6: 24px; --sd-8: 32px; --sd-10: 40px; --sd-12: 48px;

    /* Shape & depth */
    --sd-radius-sm: 8px;
    --sd-radius:    10px;
    --sd-radius-lg: 14px;
    --sd-radius-xl: 18px;
    --sd-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .02);
    --sd-shadow:    0 4px 12px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --sd-shadow-lg: 0 16px 40px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
    --sd-ring:      0 0 0 3px var(--sd-accent-soft);

    /* Motion */
    --sd-fast: .12s ease;
    --sd-med:  .2s ease;

    /* Shell */
    --sidebar-width: 248px;
    --sd-bar-h: 56px;
    --sd-side-bg:     var(--sidebar-bg, #151b26);
    --sd-side-fg:     var(--sidebar-text, #e2e8f0);
    --sd-side-muted:  #aab4c5;
    --sd-side-faint:  #7d8ba1;
    --sd-side-hover:  rgba(255, 255, 255, .06);
    --sd-side-active: rgba(255, 255, 255, .10);
    --sd-side-line:   rgba(255, 255, 255, .08);
    --sd-side-accent: #93c5fd;
}

/* Derive the brand tints from the tenant color where the browser can mix. */
@supports (color: color-mix(in srgb, red 50%, white)) {
    :root {
        --sd-accent-ink:   color-mix(in srgb, var(--sd-accent) 80%, black);
        --sd-accent-soft:  color-mix(in srgb, var(--sd-accent) 10%, white);
        --sd-accent-line:  color-mix(in srgb, var(--sd-accent) 30%, white);
        --sd-ring:         0 0 0 3px color-mix(in srgb, var(--sd-accent) 22%, transparent);
        --sd-side-muted:   color-mix(in srgb, var(--sd-side-fg) 72%, var(--sd-side-bg));
        --sd-side-faint:   color-mix(in srgb, var(--sd-side-fg) 50%, var(--sd-side-bg));
        --sd-side-hover:   color-mix(in srgb, var(--sd-side-fg) 7%, transparent);
        --sd-side-active:  color-mix(in srgb, var(--sd-side-fg) 11%, transparent);
        --sd-side-line:    color-mix(in srgb, var(--sd-side-fg) 10%, transparent);
        --sd-side-accent:  color-mix(in srgb, var(--sd-accent) 55%, white);
    }
}


/* ==========================================================================
   2. APP SHELL — sidebar (aside.sidebar.sd-shell), phone bar, drawer
   The aside keeps the old "sidebar" class so page scripts and print rules
   still find it; every rule here is scoped to aside.sd-shell so the old
   sidebar styles in each page's CSS can't leak in.
   ========================================================================== */

/* Skip link: first thing a keyboard user reaches */
.sd-skip {
    position: fixed; top: 8px; left: 8px; z-index: 2000;
    transform: translateY(-160%);
    background: var(--sd-ink); color: #fff; font: 600 13px/1 var(--sd-font);
    padding: 12px 16px; border-radius: var(--sd-radius); text-decoration: none;
    transition: transform var(--sd-fast);
}
.sd-skip:focus { transform: translateY(0); outline: 2px solid var(--sd-accent); outline-offset: 2px; }

aside.sidebar.sd-shell {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width); height: 100vh; height: 100dvh;
    margin: 0; padding: 0;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--sd-side-bg); color: var(--sd-side-fg);
    border-right: 1px solid var(--sd-side-line); box-shadow: none;
    transform: none; transition: none; z-index: 1000;
    font-family: var(--sd-font); font-size: var(--sd-text-base); line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}
aside.sidebar.sd-shell[data-tone="light"] { border-right-color: var(--sd-line); --sd-side-accent: var(--sd-accent); }

/* Neutralise whatever the page stylesheets do to links/buttons inside the shell */
aside.sd-shell :is(a, button, summary) {
    all: unset; box-sizing: border-box; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
aside.sd-shell :is(p, span, div, nav, form, img, i) { box-sizing: border-box; }
aside.sd-shell :is(a, button, summary):focus-visible {
    outline: 2px solid var(--sd-side-accent); outline-offset: -2px; border-radius: var(--sd-radius-sm);
}

/* Brand row */
aside.sd-shell .sd-shell-top {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 16px 14px 12px 16px; min-height: 60px;
}
aside.sd-shell .sd-brand {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    color: var(--sd-side-fg); text-decoration: none;
}
.sd-brand-mark {
    width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px;
    display: grid; place-items: center;
    background: var(--sd-accent); color: var(--sd-on-accent); font-size: 14px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.sd-brand-name {
    font-size: var(--sd-text-md); font-weight: 600; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sd-brand-logo { display: block; max-height: 30px; max-width: 176px; width: auto; object-fit: contain; }
aside.sd-shell .sd-shell-close {
    display: none; width: 36px; height: 36px; border-radius: var(--sd-radius-sm);
    align-items: center; justify-content: center; color: var(--sd-side-muted); font-size: 17px;
}
aside.sd-shell .sd-shell-close:hover { background: var(--sd-side-hover); color: var(--sd-side-fg); }

/* Entity switcher */
aside.sd-shell .sd-entity { padding: 0 10px 10px; }
aside.sd-shell .sd-entity-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: var(--sd-radius);
    border: 1px solid var(--sd-side-line); background: var(--sd-side-hover);
    color: var(--sd-side-fg); text-decoration: none;
    transition: background-color var(--sd-fast), border-color var(--sd-fast);
}
aside.sd-shell a.sd-entity-btn:hover { background: var(--sd-side-active); }
aside.sd-shell .sd-entity-avatar {
    width: 26px; height: 26px; flex: 0 0 auto; border-radius: 7px;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
    background: var(--sd-side-active); color: var(--sd-side-fg);
}
aside.sd-shell .sd-entity-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
aside.sd-shell .sd-entity-label {
    font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--sd-side-muted);   /* NLP v54: faint failed contrast (WCAG AA) */
}
aside.sd-shell .sd-entity-name {
    font-size: var(--sd-text-sm); font-weight: 600; color: var(--sd-side-fg);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
aside.sd-shell .sd-entity-icon { font-size: 12px; color: var(--sd-side-faint); flex: 0 0 auto; }

/* Nav */
aside.sd-shell .sd-nav {
    display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 2px 10px 12px;
    scrollbar-width: thin; scrollbar-color: var(--sd-side-line) transparent;
}
aside.sd-shell .sd-nav::-webkit-scrollbar { width: 6px; }
aside.sd-shell .sd-nav::-webkit-scrollbar-thumb { background: var(--sd-side-line); border-radius: 3px; }
aside.sd-shell .sd-nav-group + .sd-nav-group { margin-top: 14px; }
aside.sd-shell .sd-nav-label {
    margin: 10px 10px 6px; padding: 0;
    font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--sd-side-faint);
}
aside.sd-shell .sd-nav-item {
    position: relative; display: flex; align-items: center; gap: 11px;
    height: 36px; padding: 0 10px; margin: 1px 0; border-radius: var(--sd-radius-sm);
    color: var(--sd-side-muted); font-size: 13.5px; font-weight: 500; text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background-color var(--sd-fast), color var(--sd-fast);
}
aside.sd-shell .sd-nav-item > span { overflow: hidden; text-overflow: ellipsis; }
aside.sd-shell .sd-nav-item i {
    width: 18px; flex: 0 0 auto; text-align: center; font-size: 14.5px;
    color: var(--sd-side-faint); transition: color var(--sd-fast);
}
aside.sd-shell a.sd-nav-item:hover { background: var(--sd-side-hover); color: var(--sd-side-fg); }
aside.sd-shell a.sd-nav-item:hover i { color: var(--sd-side-muted); }
aside.sd-shell .sd-nav-item.is-active { background: var(--sd-side-active); color: var(--sd-side-fg); font-weight: 600; }
aside.sd-shell .sd-nav-item.is-active i { color: var(--sd-side-accent); }
aside.sd-shell .sd-nav-item.is-active::before {
    content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--sd-side-accent);
}
aside.sd-shell .sd-nav-item.is-locked { opacity: .55; cursor: not-allowed; }
aside.sd-shell[data-tone="light"] .sd-nav-item.is-active { background: var(--sd-accent-soft); color: var(--sd-accent-ink); }

/* Footer: admin/help links + account */
aside.sd-shell .sd-shell-foot { flex: 0 0 auto; border-top: 1px solid var(--sd-side-line); padding: 8px 10px 10px; }
aside.sd-shell .sd-nav-foot { flex: none; overflow: visible; padding: 0 0 6px; }
aside.sd-shell .sd-user { position: relative; display: block; }
aside.sd-shell .sd-user-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 8px; border-radius: var(--sd-radius); list-style: none;
    transition: background-color var(--sd-fast);
}
aside.sd-shell .sd-user-btn::-webkit-details-marker { display: none; }
aside.sd-shell .sd-user-btn:hover,
aside.sd-shell .sd-user[open] > .sd-user-btn { background: var(--sd-side-hover); }
aside.sd-shell .sd-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
aside.sd-shell .sd-user-name {
    font-size: var(--sd-text-sm); font-weight: 600; color: var(--sd-side-fg);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
aside.sd-shell .sd-user-role { font-size: 11.5px; color: var(--sd-side-faint); }
aside.sd-shell .sd-user-more { color: var(--sd-side-faint); font-size: 14px; flex: 0 0 auto; }
aside.sd-shell[data-tone="dark"] .sd-avatar { background: hsl(var(--sd-h) 38% 30%); color: hsl(var(--sd-h) 85% 90%); }

/* Account menu (opens upward, light panel on any sidebar color) */
aside.sd-shell .sd-menu {
    position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 5;
    background: var(--sd-surface); color: var(--sd-ink);
    border: 1px solid var(--sd-line); border-radius: var(--sd-radius-lg);
    box-shadow: var(--sd-shadow-lg); padding: 6px;
    animation: sd-pop .14s ease-out;
}
aside.sd-shell .sd-menu-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--sd-line); }
aside.sd-shell .sd-menu-name { font-size: var(--sd-text-sm); font-weight: 600; color: var(--sd-ink); }
aside.sd-shell .sd-menu-sub {
    font-size: var(--sd-text-xs); color: var(--sd-muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
aside.sd-shell .sd-menu-form { margin: 0; }
aside.sd-shell .sd-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border-radius: var(--sd-radius-sm);
    font-size: 13.5px; font-weight: 500; color: var(--sd-ink-2); text-decoration: none;
}
aside.sd-shell .sd-menu-item i { width: 16px; text-align: center; color: var(--sd-muted); font-size: 13px; }
aside.sd-shell .sd-menu-item:hover { background: var(--sd-hover); color: var(--sd-ink); }
aside.sd-shell .sd-menu-item.is-danger,
aside.sd-shell .sd-menu-item.is-danger i { color: var(--sd-bad); }
aside.sd-shell .sd-menu-item.is-danger:hover { background: var(--sd-bad-bg); }
aside.sd-shell .sd-menu-item:focus-visible { outline: 2px solid var(--sd-accent); outline-offset: -2px; }

/* Phone top bar + drawer scrim (hidden on desktop) */
.sd-mobilebar { display: none; }
.sd-scrim[hidden] { display: none; }

@media (max-width: 768px) {
    .sd-mobilebar {
        display: flex; align-items: center; gap: 8px;
        position: fixed; top: 0; left: 0; right: 0; z-index: 990;
        height: var(--sd-bar-h); padding: 0 12px;
        padding-top: env(safe-area-inset-top, 0px);
        background: rgba(255, 255, 255, .94);
        -webkit-backdrop-filter: saturate(1.6) blur(10px); backdrop-filter: saturate(1.6) blur(10px);
        border-bottom: 1px solid var(--sd-line);
        font-family: var(--sd-font);
    }
    .sd-mobilebar .sd-mobilebar-btn {
        all: unset; box-sizing: border-box; cursor: pointer;
        width: 44px; height: 44px; border-radius: var(--sd-radius);
        display: grid; place-items: center; color: var(--sd-ink); font-size: 18px;
    }
    .sd-mobilebar .sd-mobilebar-btn:hover { background: var(--sd-hover); }
    .sd-mobilebar .sd-mobilebar-btn:focus-visible { outline: 2px solid var(--sd-accent); outline-offset: 0; }
    .sd-mobilebar .sd-mobilebar-brand {
        display: flex; align-items: center; gap: 10px; min-width: 0;
        color: var(--sd-ink); text-decoration: none;
    }
    .sd-mobilebar .sd-brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
    .sd-mobilebar .sd-brand-logo { max-height: 26px; max-width: 150px; }

    .sd-scrim {
        position: fixed; inset: 0; z-index: 1150;
        background: rgba(15, 23, 42, .45);
        animation: sd-fade .2s ease-out;
    }

    aside.sidebar.sd-shell {
        width: min(304px, 86vw); z-index: 1200;
        transform: translateX(-102%); visibility: hidden;
        transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .24s;
    }
    aside.sidebar.sd-shell.expanded {
        transform: translateX(0); visibility: visible;
        transition: transform .24s cubic-bezier(.2, .8, .2, 1);
        box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
    }
    aside.sd-shell .sd-shell-close { display: inline-flex; }
    aside.sd-shell .sd-nav-item { height: 44px; font-size: 14.5px; }     /* touch targets */
    aside.sd-shell .sd-user-btn { min-height: 48px; }
    aside.sd-shell .sd-menu-item { min-height: 44px; }

    /* Room for the bar, full width for the page */
    body:has(aside.sd-shell) .main-content {
        margin-left: 0 !important;
        margin-top: var(--sd-bar-h);
        padding: 20px 16px 40px;
    }
    /* Pages' own hamburger buttons/overlays are replaced by the bar */
    body:has(aside.sd-shell) .sidebar-toggle,
    body:has(aside.sd-shell) .sidebar-overlay { display: none !important; }
    body:has(aside.sd-shell) .sidebar.expanded ~ .main-content { filter: none; }
    body.sd-nav-open { overflow: hidden; }
}


/* ==========================================================================
   3. LEGACY FIXES — apply to every page that includes the sidebar
   ========================================================================== */

/* css/sidebar.css still carries a design-demo "body { display: grid;
   padding: 20px }" block that every page inherited. Undo it. */
body:has(aside.sd-shell) { display: block; padding: 0; gap: 0; }
body:has(aside.sd-shell) .app-container { min-height: 100vh; }
body:has(aside.sd-shell) .main-content { min-width: 0; }
@media (min-width: 769px) {
    body:has(aside.sd-shell) .main-content { margin-left: var(--sidebar-width); padding: 28px 36px 56px; }
}
.main-content:focus { outline: none; }


/* ==========================================================================
   4. BASE — body.sd-app (pages that load sd.css in <head> via sd_head())
   ========================================================================== */
body.sd-app {
    margin: 0; background: var(--sd-canvas); color: var(--sd-ink-2);
    font-family: var(--sd-font); font-size: var(--sd-text-base); line-height: 1.55;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.sd-app *, body.sd-app *::before, body.sd-app *::after { box-sizing: border-box; }
body.sd-app .app-container { display: flex; min-height: 100vh; }
body.sd-app .main-content { flex: 1; background: transparent; }
/* :where() keeps these defaults at zero weight so every sd-* component overrides them */
:where(body.sd-app) :where(h1, h2, h3, h4) { color: var(--sd-ink); margin: 0; letter-spacing: -.01em; line-height: 1.25; }
:where(body.sd-app) :where(p) { margin: 0; }
:where(body.sd-app) :where(a) { color: var(--sd-accent); }
:where(body.sd-app) :where(:focus-visible) { outline: 2px solid var(--sd-accent); outline-offset: 2px; }
body.sd-app [hidden] { display: none !important; }

/* Centered single-card pages: sign out now; sign in / reset password in phase 2 */
body.sd-center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.sd-signout { width: 100%; max-width: 420px; text-align: center; padding: 36px 32px 32px; }
.sd-signout-actions { justify-content: center; }


/* ==========================================================================
   5. COMPONENTS (opt-in; all prefixed sd-)
   ========================================================================== */

/* ---- Page header ------------------------------------------------------ */
.sd-page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
    flex-wrap: wrap; margin: 0 0 24px;
}
.sd-page-head-main { min-width: 0; }
.sd-crumbs ol { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--sd-text-sm); }
.sd-crumbs li { display: inline-flex; align-items: center; gap: 6px; color: var(--sd-ink-3); }   /* NLP v54: muted was 4.4:1 on the page background, under AA's 4.5 */
.sd-crumbs li + li::before { content: "/"; color: var(--sd-faint); }
.sd-crumbs a { color: var(--sd-ink-3); text-decoration: none; font-weight: 500; }
.sd-crumbs a:hover { color: var(--sd-ink); text-decoration: underline; text-underline-offset: 3px; }
.sd-page-title { margin: 0; font-size: var(--sd-text-2xl); font-weight: 600; color: var(--sd-ink); letter-spacing: -.02em; line-height: 1.2; }
.sd-page-sub { margin: 6px 0 0; font-size: var(--sd-text-base); color: var(--sd-ink-3); }
.sd-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Buttons ----------------------------------------------------------- */
.sd-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; margin: 0;
    border: 1px solid transparent; border-radius: var(--sd-radius);
    font: 600 var(--sd-text-base)/1 var(--sd-font); letter-spacing: 0; text-decoration: none; white-space: nowrap;
    cursor: pointer; user-select: none;
    transition: background-color var(--sd-fast), border-color var(--sd-fast), color var(--sd-fast), box-shadow var(--sd-fast);
    background: var(--sd-surface); color: var(--sd-ink); border-color: var(--sd-line-strong); box-shadow: var(--sd-shadow-sm);
}
.sd-btn i { font-size: .95em; }
.sd-btn:hover { background: var(--sd-sunken); border-color: #c5cfdc; }
.sd-btn:focus-visible { outline: none; box-shadow: var(--sd-ring); border-color: var(--sd-accent); }
.sd-btn--primary { background: var(--sd-accent); color: var(--sd-on-accent); border-color: var(--sd-accent); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.sd-btn--primary:hover { background: var(--sd-accent-ink); border-color: var(--sd-accent-ink); }
.sd-btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--sd-ink-2); }
.sd-btn--ghost:hover { background: var(--sd-hover); border-color: transparent; color: var(--sd-ink); }
.sd-btn--danger { background: var(--sd-bad-solid); color: #fff; border-color: var(--sd-bad-solid); }
.sd-btn--danger:hover { background: var(--sd-bad); border-color: var(--sd-bad); }
.sd-btn--quiet-danger { background: var(--sd-surface); color: var(--sd-bad); border-color: var(--sd-line-strong); }
.sd-btn--quiet-danger:hover { background: var(--sd-bad-bg); border-color: var(--sd-bad-line); }
.sd-btn--sm { height: 32px; padding: 0 12px; font-size: var(--sd-text-sm); border-radius: var(--sd-radius-sm); }
.sd-btn--lg { height: 46px; padding: 0 22px; font-size: var(--sd-text-md); }
.sd-btn--block { display: flex; width: 100%; }
.sd-btn[disabled], .sd-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.sd-btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.sd-btn.is-loading::after {
    content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-color: var(--sd-muted) transparent var(--sd-muted) transparent;
    animation: sd-spin .7s linear infinite;
}
.sd-btn--primary.is-loading::after { border-color: #fff transparent #fff transparent; }
.sd-icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; margin: 0;
    border: 1px solid transparent; border-radius: var(--sd-radius-sm); background: transparent;
    color: var(--sd-muted); font-size: 15px; cursor: pointer; transition: background-color var(--sd-fast), color var(--sd-fast);
}
.sd-icon-btn:hover { background: var(--sd-hover); color: var(--sd-ink); }
.sd-icon-btn:focus-visible { outline: 2px solid var(--sd-accent); outline-offset: 1px; }
.sd-link { color: var(--sd-accent); font-weight: 600; text-decoration: none; }
.sd-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- Cards ------------------------------------------------------------- */
.sd-card {
    background: var(--sd-surface); border: 1px solid var(--sd-line); border-radius: var(--sd-radius-lg);
    box-shadow: var(--sd-shadow-sm); padding: 20px 22px;
}
.sd-card + .sd-card { margin-top: 16px; }
.sd-card--flush { padding: 0; overflow: hidden; }
.sd-card--interactive { transition: box-shadow var(--sd-fast), border-color var(--sd-fast), transform var(--sd-fast); }
.sd-card--interactive:hover { box-shadow: var(--sd-shadow); border-color: var(--sd-line-strong); transform: translateY(-1px); }
.sd-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sd-card--flush .sd-card-head { padding: 18px 22px 0; }
.sd-card-title { margin: 0; font-size: var(--sd-text-md); font-weight: 600; color: var(--sd-ink); letter-spacing: -.01em; }
.sd-card-title i { color: var(--sd-muted); margin-right: 8px; font-size: .92em; }
.sd-card-sub { margin: 3px 0 0; font-size: var(--sd-text-sm); color: var(--sd-muted); }
.sd-card-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--sd-line); }
.sd-eyebrow { margin: 0; font-size: var(--sd-text-xs); font-weight: 600; color: var(--sd-muted); text-transform: uppercase; letter-spacing: .07em; }

/* ---- Layout helpers ------------------------------------------------------ */
.sd-stack { display: flex; flex-direction: column; gap: 16px; }
.sd-stack--sm { gap: 8px; }
.sd-stack--lg { gap: 24px; }
.sd-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sd-row--between { justify-content: space-between; }
.sd-spacer { flex: 1; }
.sd-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.sd-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sd-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sd-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sd-grid--main-side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 1100px) { .sd-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sd-grid--main-side { grid-template-columns: 1fr; } }
@media (max-width: 720px)  { .sd-grid--2, .sd-grid--3, .sd-grid--4 { grid-template-columns: 1fr; } }

/* ---- Forms ------------------------------------------------------------- */
.sd-field { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; }
.sd-field + .sd-field { margin-top: 16px; }
.sd-label { font-size: var(--sd-text-sm); font-weight: 600; color: var(--sd-ink-2); }
.sd-label .sd-optional { font-weight: 400; color: var(--sd-muted); margin-left: 4px; }
.sd-hint { font-size: var(--sd-text-xs); color: var(--sd-muted); line-height: 1.45; }
.sd-error-text { font-size: var(--sd-text-xs); color: var(--sd-bad); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.sd-input, .sd-select, .sd-textarea {
    display: block; width: 100%; margin: 0;
    height: 40px; padding: 0 12px;
    font: 400 var(--sd-text-base)/1.4 var(--sd-font); color: var(--sd-ink);
    background: var(--sd-surface); border: 1px solid var(--sd-line-strong); border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow-sm); transition: border-color var(--sd-fast), box-shadow var(--sd-fast);
    -webkit-appearance: none; appearance: none;
}
.sd-textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.sd-select {
    padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.sd-input::placeholder, .sd-textarea::placeholder { color: var(--sd-faint); }
.sd-input:hover, .sd-select:hover, .sd-textarea:hover { border-color: #c5cfdc; }
.sd-input:focus, .sd-select:focus, .sd-textarea:focus { outline: none; border-color: var(--sd-accent); box-shadow: var(--sd-ring); }
.sd-input[disabled], .sd-select[disabled], .sd-textarea[disabled] { background: var(--sd-sunken); color: var(--sd-muted); cursor: not-allowed; }
.sd-input.is-invalid, .sd-select.is-invalid, .sd-textarea.is-invalid,
.sd-input[aria-invalid="true"], .sd-textarea[aria-invalid="true"] { border-color: var(--sd-bad-solid); }
.sd-input.is-invalid:focus, .sd-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--sd-bad-bg); }
.sd-input-icon { position: relative; display: flex; align-items: center; }
.sd-input-icon > i { position: absolute; left: 12px; color: var(--sd-faint); font-size: 13px; pointer-events: none; }
.sd-input-icon > .sd-input { padding-left: 36px; }
.sd-check { display: inline-flex; align-items: flex-start; gap: 10px; font-size: var(--sd-text-base); color: var(--sd-ink-2); cursor: pointer; line-height: 1.4; }
.sd-check input { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--sd-accent); cursor: pointer; }
.sd-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--sd-text-base); color: var(--sd-ink-2); }
.sd-switch input {
    -webkit-appearance: none; appearance: none; margin: 0; flex: 0 0 auto; cursor: pointer;
    width: 38px; height: 22px; border-radius: 999px; background: var(--sd-line-strong); position: relative;
    transition: background-color var(--sd-med);
}
.sd-switch input::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .25); transition: transform var(--sd-med);
}
.sd-switch input:checked { background: var(--sd-accent); }
.sd-switch input:checked::after { transform: translateX(16px); }
.sd-switch input:focus-visible { outline: none; box-shadow: var(--sd-ring); }
.sd-form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }

/* ---- Segmented control & search ------------------------------------------- */
.sd-segmented { display: inline-flex; gap: 2px; padding: 4px; background: #eef2f6; border-radius: 12px; }
.sd-segmented button {
    border: 0; background: none; margin: 0; cursor: pointer;
    font: 500 var(--sd-text-sm)/1 var(--sd-font); color: var(--sd-ink-3);
    height: 32px; padding: 0 12px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px;
}
.sd-segmented button:hover { color: var(--sd-ink); }
.sd-segmented button[aria-pressed="true"], .sd-segmented button[aria-selected="true"] {
    background: var(--sd-surface); color: var(--sd-ink); font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px rgba(15, 23, 42, .04);
}
.sd-segmented button:focus-visible { outline: 2px solid var(--sd-accent); outline-offset: 1px; }
.sd-count { font-size: var(--sd-text-xs); color: var(--sd-muted); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---- Tables ------------------------------------------------------------ */
.sd-table-wrap { overflow-x: auto; border: 1px solid var(--sd-line); border-radius: var(--sd-radius-lg); background: var(--sd-surface); box-shadow: var(--sd-shadow-sm); }
.sd-card--flush .sd-table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.sd-table { width: 100%; border-collapse: collapse; font-size: var(--sd-text-base); color: var(--sd-ink-2); }
.sd-table th {
    position: sticky; top: 0; z-index: 1; text-align: left; white-space: nowrap;
    padding: 10px 16px; background: var(--sd-sunken); border-bottom: 1px solid var(--sd-line);
    font-size: var(--sd-text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--sd-muted);
}
.sd-table td { padding: 12px 16px; border-bottom: 1px solid var(--sd-line); vertical-align: middle; }
.sd-table tbody tr:last-child td { border-bottom: 0; }
.sd-table tbody tr { transition: background-color var(--sd-fast); }
.sd-table tbody tr:hover { background: var(--sd-sunken); }
.sd-table .sd-num, .sd-table th.sd-num { text-align: right; font-variant-numeric: tabular-nums; }
.sd-table .sd-cell-main { font-weight: 600; color: var(--sd-ink); }
.sd-table .sd-cell-sub { display: block; font-size: var(--sd-text-xs); color: var(--sd-muted); font-weight: 400; margin-top: 2px; }
.sd-table--compact td { padding: 8px 14px; }

/* ---- Badges & status ----------------------------------------------------- */
.sd-badge {
    display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
    border-radius: 999px; border: 1px solid var(--sd-line); background: var(--sd-sunken);
    font: 600 var(--sd-text-xs)/1 var(--sd-font); color: var(--sd-ink-3); white-space: nowrap;
}
.sd-badge--accent { background: var(--sd-accent-soft); border-color: var(--sd-accent-line); color: var(--sd-accent-ink); }
.sd-badge--good   { background: var(--sd-good-bg); border-color: var(--sd-good-line); color: var(--sd-good); }
.sd-badge--warn   { background: var(--sd-warn-bg); border-color: var(--sd-warn-line); color: var(--sd-warn); }
.sd-badge--bad    { background: var(--sd-bad-bg);  border-color: var(--sd-bad-line);  color: var(--sd-bad); }
.sd-badge--info   { background: var(--sd-info-bg); border-color: var(--sd-info-line); color: var(--sd-info); }
.sd-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

/* ---- Avatars (color from sd_hue_class(); no inline styles) ----------------- */
.sd-avatar {
    --sd-h: 215;
    width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%;
    display: inline-grid; place-items: center;
    font: 600 12px/1 var(--sd-font); letter-spacing: .02em;
    background: hsl(var(--sd-h) 70% 93%); color: hsl(var(--sd-h) 55% 30%);
}
.sd-avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.sd-avatar--lg { width: 44px; height: 44px; font-size: 15px; }
.sd-hue-0 { --sd-h: 215; } .sd-hue-1 { --sd-h: 250; } .sd-hue-2 { --sd-h: 280; } .sd-hue-3 { --sd-h: 330; }
.sd-hue-4 { --sd-h: 12; }  .sd-hue-5 { --sd-h: 35; }  .sd-hue-6 { --sd-h: 152; } .sd-hue-7 { --sd-h: 188; }

/* ---- Tabs (markup: role=tablist > button role=tab aria-selected) ---------- */
.sd-tabs {
    display: flex; gap: 4px; margin: 0 0 20px; border-bottom: 1px solid var(--sd-line);
    overflow-x: auto; scrollbar-width: none;
}
.sd-tabs::-webkit-scrollbar { display: none; }
.sd-tab {
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    margin: 0 0 -1px; padding: 10px 14px; background: none; border: 0; border-bottom: 2px solid transparent;
    font: 500 var(--sd-text-base)/1.2 var(--sd-font); color: var(--sd-muted); cursor: pointer; text-decoration: none;
}
.sd-tab i { font-size: 13px; color: var(--sd-faint); }
.sd-tab:hover { color: var(--sd-ink); }
.sd-tab[aria-selected="true"], .sd-tab[aria-current="page"] { color: var(--sd-ink); border-bottom-color: var(--sd-accent); font-weight: 600; }
.sd-tab[aria-selected="true"] i, .sd-tab[aria-current="page"] i { color: var(--sd-accent); }
.sd-tab:focus-visible { outline: 2px solid var(--sd-accent); outline-offset: -2px; border-radius: 6px; }
.sd-tab .sd-count { background: var(--sd-hover); border-radius: 999px; padding: 2px 8px; }
.sd-tab[aria-selected="true"] .sd-count { background: var(--sd-accent-soft); color: var(--sd-accent-ink); }

/* ---- KPI tiles (label · value · change vs a named period · sparkline) ------ */
.sd-kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 24px; }
.sd-kpi {
    background: var(--sd-surface); border: 1px solid var(--sd-line); border-radius: var(--sd-radius-lg);
    box-shadow: var(--sd-shadow-sm); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.sd-kpi-label { font-size: var(--sd-text-sm); font-weight: 500; color: var(--sd-ink-3); display: flex; align-items: center; gap: 8px; }
.sd-kpi-label i { color: var(--sd-muted); font-size: 12px; }
.sd-kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sd-kpi-value { font-size: 28px; font-weight: 600; color: var(--sd-ink); letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sd-kpi-foot { font-size: var(--sd-text-xs); color: var(--sd-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sd-delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sd-delta.is-good { color: var(--sd-good); }
.sd-delta.is-bad  { color: var(--sd-bad); }
.sd-delta.is-flat { color: var(--sd-muted); }
.sd-spark { display: block; flex: 0 0 auto; }
.sd-spark rect { fill: var(--sd-line-strong); }
.sd-spark rect.is-current { fill: var(--sd-accent); }

/* ---- Alerts & toasts ------------------------------------------------------ */
.sd-alert {
    display: flex; align-items: flex-start; gap: 12px; margin: 0 0 16px;
    padding: 12px 14px; border-radius: var(--sd-radius); border: 1px solid var(--sd-info-line);
    background: var(--sd-info-bg); color: var(--sd-ink-2); font-size: var(--sd-text-base); line-height: 1.5;
}
.sd-alert > i { margin-top: 3px; color: var(--sd-info); flex: 0 0 auto; }
.sd-alert-body { flex: 1; min-width: 0; }
.sd-alert-title { font-weight: 600; color: var(--sd-ink); }
.sd-alert--good { background: var(--sd-good-bg); border-color: var(--sd-good-line); }
.sd-alert--good > i { color: var(--sd-good); }
.sd-alert--warn { background: var(--sd-warn-bg); border-color: var(--sd-warn-line); }
.sd-alert--warn > i { color: var(--sd-warn); }
.sd-alert--bad  { background: var(--sd-bad-bg);  border-color: var(--sd-bad-line); }
.sd-alert--bad > i { color: var(--sd-bad); }

.sd-toasts {
    position: fixed; right: 20px; bottom: 20px; z-index: 3000;
    display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none;
}
.sd-toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 32px));
    padding: 12px 16px; border-radius: var(--sd-radius); background: var(--sd-ink); color: #fff;
    font: 500 var(--sd-text-base)/1.4 var(--sd-font); box-shadow: var(--sd-shadow-lg);
    animation: sd-rise .2s ease-out;
}
.sd-toast i { color: #86efac; }
.sd-toast.is-bad i { color: #fca5a5; }
.sd-toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@media (max-width: 768px) { .sd-toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; } }

/* ---- Empty state ---------------------------------------------------------- */
.sd-empty { text-align: center; padding: 48px 24px; max-width: 520px; margin: 0 auto; }
.sd-empty-icon {
    width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px;
    display: grid; place-items: center; font-size: 22px;
    background: var(--sd-accent-soft); color: var(--sd-accent);
}
.sd-empty-title { margin: 0 0 6px; font-size: var(--sd-text-lg); font-weight: 600; color: var(--sd-ink); }
.sd-empty-text { margin: 0 auto 20px; max-width: 420px; color: var(--sd-ink-3); font-size: var(--sd-text-base); line-height: 1.55; }

/* ---- Modal (native <dialog class="sd-modal">) ------------------------------ */
.sd-modal {
    width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
    border: 0; border-radius: var(--sd-radius-xl); background: var(--sd-surface); color: var(--sd-ink-2);
    box-shadow: 0 30px 80px rgba(15, 23, 42, .3); font-family: var(--sd-font);
}
.sd-modal[open] { display: flex; flex-direction: column; animation: sd-pop .16s ease-out; }
.sd-modal::backdrop { background: rgba(15, 23, 42, .5); }
.sd-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.sd-modal-title { margin: 0; font-size: var(--sd-text-lg); font-weight: 600; color: var(--sd-ink); }
.sd-modal-body { padding: 14px 22px 4px; overflow-y: auto; font-size: var(--sd-text-base); line-height: 1.55; }
.sd-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px 20px; }

/* ---- Progress & skeleton --------------------------------------------------- */
.sd-progress { height: 8px; border-radius: 999px; background: var(--sd-hover); overflow: hidden; }
.sd-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--sd-accent); transition: width .3s ease; }
.sd-skeleton {
    border-radius: 6px; min-height: 12px;
    background: linear-gradient(90deg, var(--sd-hover) 25%, #e9eef4 50%, var(--sd-hover) 75%);
    background-size: 200% 100%; animation: sd-shimmer 1.3s linear infinite;
}


/* ==========================================================================
   6. UTILITIES, MOTION, PRINT
   ========================================================================== */
.sd-muted { color: var(--sd-muted); }
.sd-small { font-size: var(--sd-text-sm); }
.sd-num { font-variant-numeric: tabular-nums; }
.sd-mono { font-family: var(--sd-mono); font-size: .92em; }
.sd-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-divider { height: 1px; background: var(--sd-line); border: 0; margin: 20px 0; }
.sd-visually-hidden {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
}

@keyframes sd-spin    { to { transform: rotate(360deg); } }
@keyframes sd-fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes sd-pop     { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sd-rise    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sd-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
    .sd-skip, .sd-btn, .sd-card--interactive, .sd-toast, .sd-modal[open], .sd-scrim, .sd-skeleton,
    aside.sd-shell *, aside.sidebar.sd-shell, aside.sidebar.sd-shell.expanded {
        animation: none !important; transition: none !important;
    }
}

/* ---- Print (NLP v35): every page prints as a clean document ---------------------- */
.sd-print-only { display: none; }
@media print {
    @page { margin: 14mm 12mm; }
    html, body { background: #fff !important; }
    body { font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .sd-mobilebar, .sd-scrim, .sd-skip, .sd-toasts, aside.sd-shell,
    .sd-page-actions, .sd-btn, .sd-icon-btn, dialog, .sd-no-print,
    form[role="search"], .sd-tab:not([aria-current="page"]):not([aria-selected="true"]) { display: none !important; }
    body:has(aside.sd-shell) .main-content { margin: 0 !important; padding: 0 !important; max-width: none !important; }
    .sd-print-only { display: block !important; }
    .sd-page-head { margin-bottom: 12pt; padding-bottom: 8pt; border-bottom: 1px solid #cbd5e1; }
    .sd-page-title { font-size: 18pt; }
    .sd-card, .sd-kpi, .sd-alert, .sd-table-wrap { box-shadow: none !important; border-color: #cbd5e1 !important; }
    .sd-card, .sd-kpi, .sd-alert { break-inside: avoid; }
    .sd-card--flush { break-inside: auto; }
    .sd-table-wrap { overflow: visible !important; }
    .sd-table thead { display: table-header-group; }
    .sd-table th { position: static !important; }
    .sd-table tr { break-inside: avoid; }
    .sd-badge { border-color: #94a3b8 !important; }
    h1, h2, h3, .sd-card-title { break-after: avoid; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* NLP v48: branding preview notice in the sidebar (Tenant Manager › Preview) */
aside.sd-shell .sd-preview-bar {
    display: flex; align-items: center; gap: 8px; margin: 0 10px 10px; padding: 8px 10px;
    border-radius: 10px; background: var(--sd-warn-bg); color: var(--sd-warn); font-size: var(--sd-text-xs); line-height: 1.3;
}
aside.sd-shell .sd-preview-bar span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
aside.sd-shell .sd-preview-bar a { color: inherit; font-weight: 700; text-decoration: underline; }
