/* ============================================
   SM360 ADMIN PORTAL - Design System
   ============================================ */

/* --- Theme-pack faces (self-hosted, SIL OFL; licence files sit beside the fonts in ../fonts).
   Declared here and fetched only when a rendered element actually uses the family, so a product
   on Cold Chain never downloads Fraunces or Atkinson. The latin subset covers Latin-1, so pt-BR
   and es accents are inside it. */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('../fonts/geist-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('../fonts/geist-mono-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/instrument-sans-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('../fonts/fraunces-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 100 700; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* --- CSS Variables (Design Tokens) --- */
:root {
    /* Brand Colors — overridden by tenant branding via --sm360-tenant-primary/secondary/accent */
    --sm360-navy: #1a2744;
    --sm360-navy-light: #243352;
    --sm360-navy-dark: #0f1829;
    --sm360-teal: var(--sm360-tenant-primary, #00a99d);
    --sm360-accent: var(--sm360-tenant-accent, #00c4b6);
    --sm360-teal-dark: #008a80;
    /* Dark ink clears WCAG AA on the classic teal action. Branded themes replace this together
       with their primary colour, while theme packs provide the stronger --sm360-action-ink role. */
    --sm360-tenant-on-brand: #0f172a;

    /* The shell brand name (the product name in the main layout). It follows the tenant's primary
       where one is set; the default is the nearest shade of the brand teal that clears WCAG AA
       for normal text on the light header (#ffffff) — the classic #00a99d is 2.93:1 (sm360-sdk#936). */
    --sm360-brand-name: var(--sm360-tenant-primary, #00857c);

    /* Neutral Palette */
    --sm360-white: #ffffff;
    --sm360-gray-50: #f8fafc;
    --sm360-gray-100: #f1f5f9;
    --sm360-gray-200: #e2e8f0;
    --sm360-gray-300: #cbd5e1;
    --sm360-gray-400: #94a3b8;
    --sm360-gray-500: #64748b;
    --sm360-gray-600: #475569;
    --sm360-gray-700: #334155;
    --sm360-gray-800: #1e293b;
    --sm360-gray-900: #0f172a;

    /* Semantic Colors. These are SM360's classic status values, the ones every product and tenant without
       a theme pack has always had. They are fixed: never read from --sm360-tenant-* (sm360-sdk#462), and
       --sm360-info never follows a tenant's secondary brand colour. A theme PACK brings the locked set
       (Themes/semantic.json, 13-theme-packs section 3) and the theme engine writes it over these; a
       tenant can never change it. -ink is the text on a fill, -text is the colour when the status is
       drawn AS text on a surface. */
    --sm360-success: #10b981;
    --sm360-success-ink: #ffffff;
    --sm360-success-text: #10b981;
    --sm360-success-light: #d1fae5;
    --sm360-success-wash: var(--sm360-success-light);
    --sm360-success-100: #d1fae5;
    --sm360-warning: #f59e0b;
    --sm360-warning-ink: #1e1503;
    --sm360-warning-text: #f59e0b;
    --sm360-warning-light: #fef3c7;
    --sm360-warning-wash: var(--sm360-warning-light);
    --sm360-warning-100: #fef3c7;
    --sm360-danger: #ef4444;
    --sm360-danger-ink: #ffffff;
    --sm360-danger-text: #ef4444;
    --sm360-danger-light: #fee2e2;
    --sm360-danger-wash: var(--sm360-danger-light);
    --sm360-danger-100: #fee2e2;
    --sm360-info: #3b82f6;
    --sm360-info-ink: #ffffff;
    --sm360-info-text: #1d4ed8;
    --sm360-info-light: #dbeafe;
    --sm360-info-wash: var(--sm360-info-light);
    --sm360-info-100: #dbeafe;
    /* Badge text on the light washes, so consumers can use the tokens without a fallback. Each clears
       WCAG AA 4.5:1 on white, on the page grey and on its own wash (warning is the tightest at 4.51:1
       on #fef3c7). These are the literal fallbacks of the .sm360-badge-* rules, so the rendered colour
       does not change. The dark block below restates the dark values. sm360-sdk#955. */
    --sm360-badge-success-text: #047857;
    --sm360-badge-warning-text: #b45309;
    --sm360-badge-danger-text: #b91c1c;
    --sm360-badge-info-text: #1d4ed8;
    /* The pack vocabulary for the same four roles. */
    --sm360-assist: var(--sm360-info);
    --sm360-assist-ink: var(--sm360-info-ink);
    --sm360-assist-text: var(--sm360-info-text);
    --sm360-assist-wash: var(--sm360-info-wash);
    /* A wash of the brand primary for icon chips and selected rows. Referenced across the DataHub
       and report sheets but never declared, so those backgrounds had no value. */
    --sm360-primary-subtle: color-mix(in srgb, var(--sm360-teal) 12%, transparent);

    /* Extended Color Palette */
    --sm360-blue: var(--sm360-tenant-secondary, #3b82f6);
    --sm360-blue-100: #dbeafe;
    --sm360-blue-light: rgba(59, 130, 246, 0.2);
    --sm360-green: #22c55e;
    --sm360-green-100: #dcfce7;
    --sm360-green-light: rgba(34, 197, 94, 0.2);
    --sm360-orange: #f97316;
    --sm360-orange-100: #ffedd5;
    --sm360-orange-light: rgba(249, 115, 22, 0.2);
    --sm360-red: #ef4444;
    --sm360-red-100: #fee2e2;
    --sm360-red-light: rgba(239, 68, 68, 0.2);
    --sm360-purple: #a855f7;
    --sm360-purple-100: #f3e8ff;
    --sm360-purple-light: rgba(168, 85, 247, 0.2);
    --sm360-teal-100: #ccfbf1;
    --sm360-teal-light: color-mix(in srgb, var(--sm360-teal) 20%, transparent);

    /* Typography */
    /* The platform's own faces. A tenant's saved body, heading and mono faces are read here, without a
       pack marker, so a product preset (data-sm360-preset) applies them too (sm360-sdk#1326). A pack adds
       the pack-only tokens below under its marker. */
    --sm360-font-sans: var(--sm360-tenant-font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    --sm360-font-mono: var(--sm360-tenant-font-mono, 'JetBrains Mono', 'Fira Code', monospace);
    /* Page titles only (a pack's display face); everything else is the UI face. */
    --sm360-font-display: var(--sm360-font-sans);
    /* Headings: the tenant's heading face, then the page-title face, then the UI face. */
    --sm360-font-heading: var(--sm360-tenant-font-heading, var(--sm360-font-display));

    /* Spacing Scale */
    --sm360-space-1: 0.25rem;
    --sm360-space-2: 0.5rem;
    /* The Portal's interactive floor, 44 x 44 CSS px (sm360-sdk#844). A denser pack may lower it knowingly. */
    --sm360-target-min: 44px;
    --sm360-space-3: 0.75rem;
    --sm360-space-4: 1rem;
    --sm360-space-5: 1.25rem;
    --sm360-space-6: 1.5rem;
    --sm360-space-8: 2rem;
    --sm360-space-10: 2.5rem;
    --sm360-space-12: 3rem;

    /* Border Radius */
    --sm360-radius-sm: var(--sm360-tenant-radius-sm, 0.375rem);
    --sm360-radius-md: var(--brand-radius-btn, 0.5rem);
    --sm360-radius-lg: var(--sm360-tenant-radius-lg, 0.75rem);
    --sm360-radius-xl: 1rem;
    /* Chips and badges: a pill unless the pack squares them. */
    --sm360-radius-chip: 9999px;
    /* The edge that bounds a control, and its width. A pack states a 3 : 1 control edge apart
       from its decorative hairline; without one, controls use the ordinary border. */
    --sm360-control-border: var(--sm360-border-primary);
    --sm360-border-width: 1px;
    --sm360-radius-full: 9999px;

    /* Shadows */
    --sm360-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --sm360-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    /* Large shadows belong to floating sheets (menus, dialogs, popovers): a pack's lift replaces them. */
    --sm360-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --sm360-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    /* A resting surface's depth: the pack's edge-light, or none in borders mode. Unset, the small shadow. */
    --sm360-depth: var(--sm360-shadow-sm);
    /* Live values only (a scale readout, a live site, a figure that just changed): the pack's glow. */
    --sm360-glow: none;

    /* Transitions */
    /* A pack's two beats and its easing. Unset, the platform's own. Zero is no motion. */
    --sm360-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --sm360-transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --sm360-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    /* 1 while a pack has motion, 0 when it has none: keeps a looping pulse off a pack that stands still. */
    --sm360-motion-on: 1;
    /* 1 when a changed live figure rolls. */
    --sm360-figure-roll: 0;
    /* Display-title tracking and weight, and the figure roll's beat: pack-only (see the pack rule). */
    --sm360-h1-tracking: -0.025em;
    --sm360-h1-weight: 600;
    --sm360-title-tracking: normal;
    --sm360-title-weight: 700;
    --sm360-roll-duration: 240ms;
    --sm360-roll-ease: ease-out;

    /* Sidebar — icon rail (collapsed default, expand on hover) */
    --sidebar-width: 232px;
    --sidebar-collapsed-width: 64px;
    --header-height: 56px;
    --footer-height: 40px;

    /* Theme-aware colors (Light Mode) — wired through brand variables */
    --sm360-bg-primary: var(--brand-bg-card, var(--sm360-white));
    --sm360-bg-secondary: var(--brand-bg-page, var(--sm360-gray-50));
    --sm360-bg-tertiary: var(--sm360-gray-100);
    --sm360-text-primary: var(--brand-text-primary, var(--sm360-gray-900));
    --sm360-text-secondary: var(--brand-text-secondary, var(--sm360-gray-700));
    --sm360-text-muted: var(--sm360-gray-500);
    --sm360-border-primary: var(--brand-border, var(--sm360-gray-200));
    --sm360-border-secondary: var(--sm360-gray-100);

    /* 7.02:1 on the light tertiary ground, 7.69:1 on white. See .sm360-tab-count. */
    --sm360-tab-count-ink: #485465;
}

/* A theme pack is in force: the marker is `data-sm360-pack`, on the theme <style> (or on <html>). The
   body font and the small and large radii are read by the base :root rule without a marker (sm360-sdk#1326);
   a pack adds the pack-only tokens below. `:has` is inside :is() so a browser without it drops only that
   alternative and the attribute form still works. */
:is(:root[data-sm360-pack], :root:has([data-sm360-pack])) {
    --sm360-border-width: var(--sm360-tenant-border-width, 1px);
    /* Pack-only: a tenant without a pack never emits these, and a "no pack" preview must not keep them. */
    --sm360-font-display: var(--sm360-tenant-font-display, var(--sm360-font-sans));
    --sm360-radius-chip: var(--sm360-tenant-radius-chip, 9999px);
    --sm360-glow: var(--sm360-tenant-glow, none);
    --sm360-font-mono: var(--sm360-tenant-font-mono, var(--sm360-tenant-font-figure, 'JetBrains Mono', 'Fira Code', monospace));
    --sm360-radius-xl: var(--sm360-tenant-radius-frame, 1rem);
    --sm360-control-border: var(--sm360-tenant-control-border, var(--sm360-border-primary));
    --sm360-shadow-lg: var(--sm360-tenant-lift, 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1));
    --sm360-shadow-xl: var(--sm360-tenant-lift, 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1));
    --sm360-depth: var(--sm360-tenant-depth-shadow, var(--sm360-shadow-sm));
    --sm360-transition-fast: var(--sm360-tenant-motion-fast, 150ms) var(--sm360-tenant-motion-ease, cubic-bezier(0.4, 0, 0.2, 1));
    --sm360-transition-normal: var(--sm360-tenant-motion-normal, 200ms) var(--sm360-tenant-motion-ease, cubic-bezier(0.4, 0, 0.2, 1));
    --sm360-transition-slow: var(--sm360-tenant-motion-slow, 300ms) var(--sm360-tenant-motion-ease, cubic-bezier(0.4, 0, 0.2, 1));
    --sm360-motion-on: var(--sm360-tenant-motion-on, 1);
    --sm360-figure-roll: var(--sm360-tenant-figure-roll, 0);
    --sm360-h1-tracking: var(--sm360-tenant-display-tracking, -0.025em);
    --sm360-h1-weight: var(--sm360-tenant-display-weight, 600);
    --sm360-title-tracking: var(--sm360-tenant-display-tracking, normal);
    --sm360-title-weight: var(--sm360-tenant-display-weight, 700);
    --sm360-roll-duration: var(--sm360-tenant-motion-normal, 240ms);
    --sm360-roll-ease: var(--sm360-tenant-motion-ease, ease-out);
}

/* The dark values of the pack-scoped shadows. They outrank the light restatement above, so a pack that states
   no lift or depth still gets the dark defaults in dark mode. */
:is(:root[data-sm360-pack], :root:has([data-sm360-pack]))[data-theme="dark"] {
    --sm360-shadow-lg: var(--sm360-tenant-lift, 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4));
    --sm360-shadow-xl: var(--sm360-tenant-lift, 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5));
    --sm360-depth: var(--sm360-tenant-depth-shadow, var(--sm360-shadow-sm));
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --sm360-bg-primary: var(--brand-bg-card, #0f172a);
    --sm360-bg-secondary: var(--brand-bg-page, #1e293b);
    --sm360-bg-tertiary: #334155;
    --sm360-text-primary: var(--brand-text-primary, #f1f5f9);
    --sm360-text-secondary: var(--brand-text-secondary, #cbd5e1);
    /* Was #94a3b8, which is 4.04:1 on --sm360-bg-tertiary (#334155) and so failed AA for
       normal text everywhere the two are paired — the login hint, the tab count, the widget
       and comparison "neutral" trends, and the inactive badge. Raised to the nearest shade
       of the same hue that clears AA on every dark ground it lands on, solved with
       Sm360Contrast.SuggestPassingAll rather than picked by eye: 4.76:1 on the tertiary,
       8.21:1 on the card, 6.73:1 on the page. Fixing the token fixes all five sites; fixing
       the five rules would have left the next pairing to fail on its own. */
    --sm360-text-muted: #a4b1c3;

    /* The dark header is #0f172a, where the classic teal is 6.09:1; the light-mode shade would be
       3.95:1 there, so the dark default keeps the original teal. */
    --sm360-brand-name: var(--sm360-tenant-primary, #00a99d);
    --sm360-border-primary: var(--brand-border, #334155);
    --sm360-border-secondary: #475569;

    /* 7.00:1 on the dark tertiary ground. See .sm360-tab-count. */
    --sm360-tab-count-ink: #ced5de;

    /* Classic status values, dark (a pack writes its locked dark set over these). */
    --sm360-success-light: rgba(16, 185, 129, 0.2);
    --sm360-warning-light: rgba(245, 158, 11, 0.2);
    --sm360-danger-light: rgba(239, 68, 68, 0.2);
    --sm360-info-light: rgba(59, 130, 246, 0.2);
    --sm360-info-text: #60a5fa;
    /* Aliases restated here: a var() is resolved where it is declared, so an alias left in :root would
       hand a descendant carrying data-theme="dark" the light value. */
    --sm360-success-wash: var(--sm360-success-light);
    --sm360-warning-wash: var(--sm360-warning-light);
    --sm360-danger-wash: var(--sm360-danger-light);
    --sm360-info-wash: var(--sm360-info-light);
    --sm360-assist: var(--sm360-info);
    --sm360-assist-ink: var(--sm360-info-ink);
    --sm360-assist-text: var(--sm360-info-text);
    --sm360-assist-wash: var(--sm360-info-wash);

    /* Override grays for dark mode */
    --sm360-gray-50: #1e293b;
    --sm360-gray-100: #334155;
    --sm360-gray-200: #475569;
    --sm360-gray-700: #cbd5e1;
    --sm360-gray-800: #e2e8f0;
    --sm360-gray-900: #f1f5f9;

    /* Override white for components using it directly */
    --sm360-white: #1e293b;

    /* Badge text colors for dark mode — lighter to be visible on dark backgrounds */
    --sm360-badge-success-text: #34d399;
    --sm360-badge-warning-text: #fbbf24;
    --sm360-badge-danger-text: #f87171;
    --sm360-badge-info-text: #60a5fa;

    /* Shadows for dark mode */
    --sm360-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --sm360-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --sm360-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --sm360-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5);
    --sm360-depth: var(--sm360-shadow-sm);
}

/* Dark mode logo switching */
[data-theme="dark"] .sm360-logo-img-dark {
    display: block;
}

[data-theme="dark"] .sm360-logo-img-light {
    display: none;
}

/* Dark mode table fixes */
[data-theme="dark"] .sm360-table thead th {
    background: var(--sm360-bg-tertiary);
    /* The header keeps its own colour in dark mode because --sm360-text-muted (#94a3b8) on
       --sm360-bg-tertiary (#334155) measures 4.04:1, and WCAG 2 AA asks 4.5:1 for 12px normal
       text. axe flags it "serious" (color-contrast, wcag143) and the consumer-template
       accessibility gate fails on it at 360px. --sm360-text-secondary is 6.97:1 on the same
       background and still reads as a header rather than body text. */
    color: var(--sm360-text-secondary);
}

[data-theme="dark"] .sm360-table tbody tr:hover {
    background: var(--sm360-bg-tertiary);
}

/* Dark mode modal backdrop */
[data-theme="dark"] .sm360-modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .sm360-modal {
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
}

/* Dark mode badge adjustments */
[data-theme="dark"] .sm360-badge-gray {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-secondary);
}

/* Dark mode form select */
[data-theme="dark"] .sm360-form-select,
[data-theme="dark"] .sm360-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

[data-theme="dark"] .sm360-form-select option,
[data-theme="dark"] .sm360-select option {
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-primary);
}

/* Dark mode native date/time inputs */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"] {
    color-scheme: dark;
}

/* Dark mode code elements */
[data-theme="dark"] code {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-secondary, #cbd5e1);
}

/* Dark mode checkbox */
[data-theme="dark"] input[type="checkbox"] {
    accent-color: var(--sm360-teal);
}

/* Dark mode login page */
[data-theme="dark"] .sm360-login-card {
    background: var(--sm360-bg-primary);
}

[data-theme="dark"] .sm360-login-title {
    color: var(--sm360-text-primary);
}

[data-theme="dark"] .sm360-login-hint {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-muted);
}

[data-theme="dark"] .sm360-login-hint code {
    background: var(--sm360-bg-secondary);
}

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Base Reset & Typography --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* Scroll margin for anchor targets (accounts for sticky header) */
[id] {
    scroll-margin-top: calc(var(--header-height) + var(--sm360-space-6));
}

body {
    font-family: var(--sm360-font-sans);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--sm360-text-secondary);
    background-color: var(--sm360-bg-secondary);
    margin: 0;
    padding: 0;
    transition: background-color var(--sm360-transition-slow), color var(--sm360-transition-slow);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--sm360-text-primary);
    line-height: 1.3;
    margin-bottom: 0.5em;
}

/* Only the page title takes the heading token. h2-h6 inherit from their container, so consumer CSS
   that sets a family on a panel still wins (sm360-sdk#1334). */
h1 { font-size: 1.875rem; letter-spacing: var(--sm360-h1-tracking); font-family: var(--sm360-font-heading); font-weight: var(--sm360-h1-weight); }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--sm360-teal);
    text-decoration: none;
    transition: color var(--sm360-transition-fast);
}

a:hover {
    color: var(--sm360-teal-dark);
}

code {
    font-family: var(--sm360-font-mono);
    font-size: 0.85em;
    padding: 0.125rem 0.375rem;
    background: var(--sm360-gray-100);
    border-radius: var(--sm360-radius-sm);
    color: var(--sm360-text-secondary);
}

/* --- Layout Structure: header-led "T" shell --- */
.sm360-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* dynamic viewport — keeps the footer in view under browser toolbars */
    overflow: hidden;
}

/* Body row: sidebar + workspace, sits BELOW the full-width header */
.sm360-body {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

.sm360-sidebar {
    position: relative;
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--brand-bg-sidebar, var(--sm360-bg-primary));
    border-right: 1px solid var(--sm360-border-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sm360-app[data-sidebar="collapsed"] .sm360-sidebar {
    width: var(--sidebar-collapsed-width);
}

.sm360-sidebar-top {
    padding: 10px 10px 2px;
    flex-shrink: 0;
}

/* Logo now lives in the full-width header (top-left) */
.sm360-logo {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    text-decoration: none;
    min-width: 0;
}

.sm360-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--sm360-teal);
    border-radius: var(--sm360-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

/* Collapse/expand the desktop rail */
.sm360-rail-toggle {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--sm360-text-muted);
    border-radius: var(--sm360-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 150ms, color 150ms;
}

.sm360-rail-toggle:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

.sm360-rail-toggle svg {
    width: 20px;
    height: 20px;
}

/* --- Navigation --- */
.sm360-nav {
    flex: 1;
    padding: 8px 8px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--sm360-border-secondary) transparent;
}

.sm360-nav::-webkit-scrollbar {
    width: 8px;
}

.sm360-nav::-webkit-scrollbar-thumb {
    background: var(--sm360-border-secondary);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.sm360-nav:hover::-webkit-scrollbar-thumb {
    background: var(--sm360-text-muted);
    background-clip: content-box;
}

/* Nav item: single links + accordion sub-items */
.sm360-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--sm360-radius-md);
    color: var(--sm360-sidebar-text, var(--sm360-text-muted));
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background 150ms, color 150ms;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
}

.sm360-nav-item:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-sidebar-hover, var(--sm360-text-primary));
}

.sm360-nav-item.active {
    background: color-mix(in srgb, var(--brand-primary, var(--sm360-teal)) 14%, transparent);
    color: var(--brand-primary, var(--sm360-teal-light));
    font-weight: 600;
}

.sm360-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 18px;
    width: 3px;
    background: var(--brand-primary, var(--sm360-teal));
    border-radius: 0 3px 3px 0;
}

.sm360-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sm360-nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Accordion group --- */
.sm360-nav-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.sm360-nav-group + .sm360-nav-group,
.sm360-nav-group + .sm360-nav-item,
.sm360-nav-item + .sm360-nav-group {
    margin-top: 2px;
}

.sm360-nav-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: var(--sm360-radius-md);
    color: var(--sm360-sidebar-text, var(--sm360-text-muted));
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 150ms, color 150ms;
}

.sm360-nav-group-header:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

.sm360-nav-group-header > svg:first-of-type {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sm360-nav-chevron {
    width: 14px !important;
    height: 14px !important;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sm360-nav-group.open > .sm360-nav-group-header .sm360-nav-chevron {
    transform: rotate(90deg);
}

/* Animated expand/collapse via grid rows (no JS height math) */
.sm360-nav-group-items {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sm360-nav-group.open > .sm360-nav-group-items {
    grid-template-rows: 1fr;
}

.sm360-nav-group-items-inner {
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-top: 1px;
}

.sm360-nav-subitem {
    padding-left: 40px;
    font-weight: 500;
}

/* sdk#624: a related shortcut to a screen homed in another group. Subordinate, and the home item
   keeps the active route when both point at the same screen. */
.sm360-nav-item-related {
    opacity: 0.72;
    font-size: 0.8125rem;
}

/* Flyout submenu — only rendered when the rail is collapsed (see collapsed mode) */
.sm360-nav-flyout {
    display: none;
}

.sm360-nav-badge,
.sm360-ml-nav-badge {
    margin-left: auto;
    background: var(--sm360-teal);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: var(--sm360-radius-full);
}

/* sdk#534: an optional, data-agnostic count (the Today "proposals waiting" pip). It uses the
   assist token, not the badge's teal, and is absent entirely for null/zero. */
.sm360-nav-count {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0.125rem 0.375rem;
    border-radius: var(--sm360-radius-full);
    background: var(--sm360-assist);
    color: var(--sm360-assist-ink);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
}

/* --- Sidebar Footer --- */
.sm360-sidebar-footer {
    padding: var(--sm360-space-4) var(--sm360-space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sm360-user-card {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-3);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--sm360-radius-md);
}

.sm360-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--sm360-radius-full);
    background: linear-gradient(135deg, var(--sm360-teal) 0%, var(--sm360-teal-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.sm360-user-info {
    flex: 1;
    min-width: 0;
}

.sm360-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm360-user-role {
    font-size: 0.75rem;
    color: var(--sm360-gray-400);
}

.sm360-user-profile-link {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    border-radius: var(--sm360-radius-sm);
    transition: opacity var(--sm360-transition-fast);
}

.sm360-user-profile-link:hover {
    opacity: 0.8;
}

/* --- Collapsed icon-rail mode (desktop) --- */
.sm360-app[data-sidebar="collapsed"] .sm360-sidebar { overflow: visible; }
.sm360-app[data-sidebar="collapsed"] .sm360-nav { overflow: visible; padding: 8px 8px 12px; }
.sm360-app[data-sidebar="collapsed"] .sm360-sidebar-top { display: none; }

.sm360-app[data-sidebar="collapsed"] .sm360-nav-label,
.sm360-app[data-sidebar="collapsed"] .sm360-nav-chevron,
.sm360-app[data-sidebar="collapsed"] .sm360-nav-badge,
.sm360-app[data-sidebar="collapsed"] .sm360-nav-count {
    display: none;
}

.sm360-app[data-sidebar="collapsed"] .sm360-nav-item,
.sm360-app[data-sidebar="collapsed"] .sm360-nav-group-header {
    justify-content: center;
    padding: 9px 0;
    gap: 0;
}

.sm360-app[data-sidebar="collapsed"] .sm360-nav-subitem { padding-left: 0; }

/* Hide inline accordion items — collapsed groups reveal via the flyout */
.sm360-app[data-sidebar="collapsed"] .sm360-nav-group-items { display: none; }

/* Tooltip for single items in the collapsed rail */
.sm360-app[data-sidebar="collapsed"] .sm360-nav > .sm360-nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sm360-gray-800);
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--sm360-radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1100;
    pointer-events: none;
    box-shadow: var(--sm360-shadow-md);
}

/* Flyout submenu for collapsed multi-item groups (hover) */
.sm360-app[data-sidebar="collapsed"] .sm360-nav-flyout {
    display: block;
    position: absolute;
    left: calc(100% + 6px);
    top: -6px;
    min-width: 210px;
    padding: 6px;
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.28));
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: opacity 140ms, transform 140ms, visibility 140ms;
    z-index: 1100;
}

.sm360-app[data-sidebar="collapsed"] .sm360-nav-group:hover .sm360-nav-flyout {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sm360-nav-flyout-title {
    padding: 4px 10px 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sm360-text-muted);
}

.sm360-nav-flyout-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--sm360-radius-sm);
    color: var(--sm360-text-secondary, var(--sm360-text-muted));
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.sm360-nav-flyout-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sm360-nav-flyout-item:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

.sm360-nav-flyout-item.active {
    color: var(--brand-primary, var(--sm360-teal));
    background: color-mix(in srgb, var(--brand-primary, var(--sm360-teal)) 12%, transparent);
}

/* --- Workspace (content column, right of the sidebar) --- */
.sm360-workspace {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--sm360-bg-secondary);
    transition: background-color var(--sm360-transition-slow);
}

.sm360-breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    flex-shrink: 0;
    padding: 0 var(--sm360-space-8);
    border-bottom: 1px solid var(--sm360-border-secondary);
    background: var(--sm360-bg-primary);
}

/* --- Footer (full-width "powered by" bar) --- */
.sm360-footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 var(--sm360-space-8);
    border-top: 1px solid var(--sm360-border-primary);
    background: var(--sm360-bg-primary);
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    letter-spacing: 0.02em;
}

.sm360-footer a {
    color: var(--sm360-text-secondary, var(--sm360-text-muted));
    text-decoration: none;
    transition: color 150ms;
}

.sm360-footer a:hover {
    color: var(--brand-primary, var(--sm360-teal));
}

.sm360-footer-logo {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--brand-primary, var(--sm360-teal));
    opacity: 0.85;
}

/* --- Header (full-width topbar, spans over the sidebar) --- */
.sm360-header {
    height: var(--header-height);
    flex-shrink: 0;
    background: var(--brand-bg-header, var(--sm360-bg-primary));
    border-bottom: 1px solid var(--sm360-border-primary);
    display: flex;
    align-items: center;
    gap: var(--sm360-space-4);
    padding: 0 16px;
    z-index: 200;
    transition: background-color var(--sm360-transition-slow), border-color var(--sm360-transition-slow);
}

.sm360-header-left {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    min-width: 0;
}

.sm360-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
}

.sm360-breadcrumb a {
    display: inline-flex;
    align-items: center;
    min-height: var(--sm360-target-min);
    color: var(--sm360-text-secondary);
    text-decoration: none;
    transition: color 150ms;
}

.sm360-breadcrumb a:hover {
    color: var(--sm360-text-primary);
}

.sm360-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    min-height: var(--sm360-target-min);
    color: var(--sm360-text-secondary);
}

.sm360-breadcrumb-item.active {
    color: var(--sm360-text-primary);
    font-weight: 500;
}

.sm360-breadcrumb-separator,
.sm360-breadcrumb-sep {
    color: var(--sm360-text-secondary);
    font-size: 0.6875rem;
}

/* Centered search trigger (wireframe style) */
.sm360-header-center {
    flex: 1;
    max-width: 480px;
    margin: 0 auto;
}

.sm360-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--sm360-bg-secondary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    color: var(--sm360-text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    width: 100%;
    transition: border-color 150ms;
    font-family: inherit;
}

.sm360-search-trigger:hover {
    border-color: var(--sm360-border-secondary);
}

.sm360-search-trigger svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--sm360-text-muted);
}

.sm360-search-trigger-hint {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sm360-search-ai-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sm360-teal);
}

.sm360-search-kbd {
    font-size: 0.6875rem;
    font-family: var(--sm360-font-mono);
    color: var(--sm360-text-secondary);
    background: var(--sm360-bg-tertiary);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--sm360-border-primary);
}

.sm360-header-right {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-4);
}

.sm360-header-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--sm360-radius-md);
    border: none;
    background: transparent;
    color: var(--sm360-gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sm360-transition-fast);
}

.sm360-header-btn:hover {
    background: var(--sm360-gray-100);
    color: var(--sm360-gray-700);
}

.sm360-header-btn svg {
    width: 20px;
    height: 20px;
}

.sm360-notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--sm360-danger);
    border-radius: 50%;
    border: 2px solid var(--sm360-white);
}

/* --- Profile Avatar (Header) --- */
.sm360-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--sm360-radius-full, 9999px);
    /* Keep initials at WCAG AA contrast even when tenant branding uses a light primary. */
    background: var(--sm360-navy-dark, #0f1829);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity var(--sm360-transition-fast, 0.15s);
    font-family: var(--sm360-font-sans, system-ui);
}

.sm360-profile-avatar:hover {
    opacity: 0.85;
}

/* Large header avatar for the shared Profile editor */
.sm360-profile-header-avatar {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: var(--sm360-radius-full, 9999px);
    background: var(--sm360-teal, #00a99d);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    overflow: hidden;
    font-family: var(--sm360-font-sans, system-ui);
}

.sm360-profile-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--sm360-radius-full, 9999px);
}

/* Read-only JSON / code display (shared Profile editor Products tab) */
.sm360-code-block {
    background: var(--sm360-bg-secondary, #f5f7fa);
    border: 1px solid var(--sm360-border-primary, #e2e8f0);
    border-radius: var(--sm360-radius-md, 8px);
    padding: var(--sm360-space-3, 12px);
    font-family: var(--sm360-font-mono, ui-monospace, monospace);
    font-size: 0.8rem;
    color: var(--sm360-text-secondary, #475569);
    overflow-x: auto;
}

/* --- Tenant Switcher (Sidebar) --- */
.sm360-tenant-switcher {
    padding: var(--sm360-space-2) var(--sm360-space-4);
    position: relative;
}

.sm360-tenant-btn {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    width: 100%;
    padding: var(--sm360-space-2) var(--sm360-space-3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--sm360-radius-md);
    background: rgba(255, 255, 255, 0.06);
    color: var(--sm360-sidebar-text, rgba(255, 255, 255, 0.85));
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: var(--sm360-font-sans, system-ui);
    transition: all var(--sm360-transition-fast, 0.15s);
}

.sm360-tenant-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.sm360-tenant-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm360-tenant-dropdown {
    position: absolute;
    top: 100%;
    left: var(--sm360-space-4);
    right: var(--sm360-space-4);
    background: var(--sm360-bg-primary, white);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    box-shadow: var(--sm360-shadow-lg, 0 10px 25px rgba(0,0,0,0.15));
    z-index: 100;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.sm360-tenant-option {
    display: block;
    width: 100%;
    padding: var(--sm360-space-2) var(--sm360-space-3);
    border: none;
    background: none;
    color: var(--sm360-text-primary);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
    font-family: var(--sm360-font-sans, system-ui);
    transition: background var(--sm360-transition-fast, 0.15s);
}

.sm360-tenant-option:hover {
    background: var(--sm360-bg-secondary);
}

.sm360-tenant-option.active {
    background: var(--sm360-teal-light, rgba(0, 169, 157, 0.1));
    color: var(--sm360-teal, #00a99d);
    font-weight: 500;
}

/* --- Content Area --- */
.sm360-content {
    flex: 1;
    padding: var(--sm360-space-8);
    overflow-y: auto;
}

/* --- Page Header --- */
/* The page stack.
 *
 * Every consumer writes <div class="sm360-page"> and this library defined
 * nothing for it, so its children stacked with ZERO gap: two cards in a row met
 * as a doubled hairline with no breathing room, on every page, in every product.
 * Reported from Tendora and reproduced by measurement — the gap between two
 * sibling cards was 0px.
 *
 * The gap lives here rather than as a margin on the card, because a card should
 * not decide what sits below it: one used alone would then carry a margin it
 * never needed. */
.sm360-page {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-6);
}

.sm360-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--sm360-space-8);
}

/* Inside the stack the gap already separates the header, so its own margin
 * would double the space. Scoped to a direct child so a header used on its own,
 * outside a page stack, keeps the spacing it has always had. */
.sm360-page > .sm360-page-header {
    margin-bottom: 0;
}

.sm360-page-title {
    font-family: var(--sm360-font-heading);
    letter-spacing: var(--sm360-title-tracking);
    font-size: 1.5rem;
    font-weight: var(--sm360-title-weight);
    color: var(--sm360-gray-900);
    margin: 0;
}

.sm360-page-subtitle {
    font-size: 0.875rem;
    color: var(--sm360-text-secondary);
    margin-top: var(--sm360-space-1);
}

/* --- Cards --- */
.sm360-card {
    background: var(--sm360-bg-primary);
    border-radius: var(--sm360-radius-lg);
    border: var(--sm360-border-width) solid var(--sm360-border-primary);
    box-shadow: var(--sm360-depth);
    overflow: hidden;
    transition: background-color var(--sm360-transition-slow), border-color var(--sm360-transition-slow);
}

.sm360-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-5) var(--sm360-space-6);
    border-bottom: 1px solid var(--sm360-border-secondary);
}

.sm360-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
    margin: 0;
}

.sm360-card-body {
    padding: var(--sm360-space-6);
}

.sm360-card-footer {
    padding: var(--sm360-space-4) var(--sm360-space-6);
    border-top: 1px solid var(--sm360-border-secondary);
    background: var(--sm360-bg-secondary);
}

/* --- Stat Cards --- */
.sm360-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sm360-space-6);
    margin-bottom: var(--sm360-space-8);
}

.sm360-stat-card {
    background: var(--sm360-bg-primary);
    border-radius: var(--sm360-radius-lg);
    border: 1px solid var(--sm360-border-primary);
    padding: var(--sm360-space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--sm360-space-4);
    transition: all var(--sm360-transition-fast);
}

.sm360-stat-card:hover {
    box-shadow: var(--sm360-shadow-md);
    border-color: var(--sm360-teal);
}

.sm360-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--sm360-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sm360-stat-icon svg {
    width: 24px;
    height: 24px;
}

.sm360-stat-icon.teal {
    background: rgba(0, 169, 157, 0.1);
    color: var(--sm360-teal);
}

.sm360-stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--sm360-info-text);
}

.sm360-stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--sm360-success-text);
}

.sm360-stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--sm360-warning-text);
}

.sm360-stat-content {
    flex: 1;
    min-width: 0;
}

.sm360-stat-label {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
    margin-bottom: var(--sm360-space-1);
}

.sm360-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sm360-text-primary);
    line-height: 1.2;
}

.sm360-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--sm360-space-1);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: var(--sm360-space-2);
    padding: 0.125rem 0.5rem;
    border-radius: var(--sm360-radius-full);
}

.sm360-stat-trend.up {
    background: var(--sm360-success-light);
    color: var(--sm360-success-text);
}

.sm360-stat-trend.down {
    background: var(--sm360-danger-light);
    color: var(--sm360-danger-text);
}

/* --- Buttons --- */
.sm360-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-2) var(--sm360-space-4);
    font-family: var(--sm360-font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--sm360-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--sm360-transition-fast);
    white-space: nowrap;
}

.sm360-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sm360-btn svg {
    width: 16px;
    height: 16px;
}

/* The primary action. In a theme pack it is the locked "go" with go-ink on it, on every surface: the accent is
   identity (focus, selection, the brand mark), and a client whose brand is red must never turn Save or
   Approve red. Without a pack, the brand colour as ever. */
.sm360-btn-primary {
    background: var(--sm360-action, var(--sm360-teal));
    color: var(--sm360-action-ink, var(--sm360-tenant-on-brand, #ffffff));
    border-color: var(--sm360-action, var(--sm360-teal));
}

.sm360-btn-primary:hover:not(:disabled) {
    background: var(--sm360-action-hover, var(--sm360-teal-dark));
    border-color: var(--sm360-action-hover, var(--sm360-teal-dark));
}

.sm360-btn-secondary {
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-secondary);
    border-color: var(--sm360-border-primary);
}

.sm360-btn-secondary:hover:not(:disabled) {
    background: var(--sm360-bg-secondary);
    border-color: var(--sm360-border-secondary);
}

.sm360-btn-ghost {
    background: transparent;
    color: var(--sm360-text-muted);
}

.sm360-btn-ghost:hover:not(:disabled) {
    background: var(--sm360-bg-tertiary);
}

.sm360-btn-danger {
    background: color-mix(in srgb, var(--sm360-danger) 82%, black);
    color: var(--sm360-danger-ink, white);
    border-color: color-mix(in srgb, var(--sm360-danger) 82%, black);
}

.sm360-btn-danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--sm360-danger) 70%, black);
    border-color: color-mix(in srgb, var(--sm360-danger) 70%, black);
}

.sm360-btn-sm {
    padding: var(--sm360-space-1) var(--sm360-space-3);
    font-size: 0.8125rem;
}

.sm360-btn-lg {
    padding: var(--sm360-space-3) var(--sm360-space-6);
    font-size: 0.9375rem;
}

.sm360-btn-outline {
    background: transparent;
    border: 1px solid var(--sm360-border-primary);
    color: var(--sm360-text-secondary);
}

.sm360-btn-outline:hover:not(:disabled) {
    background: var(--sm360-bg-secondary);
    border-color: var(--sm360-border-secondary);
}

.sm360-btn-danger-outline {
    background: transparent;
    border-color: var(--sm360-danger);
    color: var(--sm360-danger-text);
}

.sm360-btn-danger-outline:hover:not(:disabled) {
    background: var(--sm360-danger);
    color: white;
}

.sm360-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--sm360-radius-md);
    border: 1px solid var(--sm360-border-primary);
    background: transparent;
    color: var(--sm360-text-muted);
    cursor: pointer;
    transition: all var(--sm360-transition-fast);
}

.sm360-btn-icon:hover {
    background: var(--sm360-bg-secondary);
    color: var(--sm360-text-primary);
}

.sm360-btn-icon-danger:hover {
    background: var(--sm360-danger-light);
    color: var(--sm360-danger-text);
    border-color: var(--sm360-danger);
}

/* --- Tabs --- */
.sm360-tabs {
    display: flex;
    gap: var(--sm360-space-1);
    margin-bottom: var(--sm360-space-6);
    border-bottom: 2px solid var(--sm360-border-primary);
}

.sm360-tab {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-3) var(--sm360-space-5);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--sm360-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--sm360-font-sans);
    transition: all var(--sm360-transition-fast);
}

.sm360-tab:hover {
    color: var(--sm360-text-primary);
}

.sm360-tab.active {
    color: var(--sm360-teal);
    border-bottom-color: var(--sm360-teal);
}

.sm360-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--sm360-radius-full);
    background: var(--sm360-bg-tertiary);
    /* Its own ink, not --sm360-text-muted. At 0.7rem this is ~11.2px, well under the 18.66px
       that makes text "large", and the muted ink was 4.34:1 on the light tertiary ground —
       failing AA outright in light mode and only just clearing it in dark. Small text is the
       case where AA is the floor rather than the target, so both are solved to 7:1. */
    color: var(--sm360-tab-count-ink);
    font-size: 0.7rem;
    font-weight: 600;
}

.sm360-tab.active .sm360-tab-count {
    background: rgba(0, 169, 157, 0.1);
    color: var(--sm360-teal);
}

.sm360-tab-count-pending {
    background: var(--sm360-warning-light) !important;
    color: var(--sm360-warning-text) !important;
}

/* --- Tables --- */
.sm360-table-container {
    overflow-x: auto;
}

.sm360-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.sm360-table th {
    text-align: left;
    padding: var(--sm360-space-3) var(--sm360-space-4);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sm360-text-muted);
    background: var(--sm360-bg-secondary);
    border-bottom: 1px solid var(--sm360-border-primary);
}

.sm360-table td {
    padding: var(--sm360-space-4);
    border-bottom: 1px solid var(--sm360-border-secondary);
    color: var(--sm360-text-secondary);
}

.sm360-table tr:hover td {
    background: var(--sm360-bg-secondary);
}

.sm360-table-actions {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
}

/* --- Badges --- */
.sm360-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sm360-space-1);
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--sm360-radius-chip);
}

.sm360-badge-success {
    background: var(--sm360-success-light);
    color: var(--sm360-badge-success-text, #047857);
}

.sm360-badge-warning {
    background: var(--sm360-warning-light);
    color: var(--sm360-badge-warning-text, #b45309);
}

.sm360-badge-danger {
    background: var(--sm360-danger-light);
    color: var(--sm360-badge-danger-text, #b91c1c);
}

.sm360-badge-info {
    background: var(--sm360-info-light);
    color: var(--sm360-badge-info-text, #1d4ed8);
}

.sm360-badge-secondary {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-secondary);
}

.sm360-badge-gray {
    background: var(--sm360-gray-100);
    color: var(--sm360-gray-600);
}

/* --- Forms --- */
.sm360-form-group {
    margin-bottom: var(--sm360-space-5);
}

.sm360-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-text-secondary);
    margin-bottom: var(--sm360-space-2);
}

.sm360-form-input,
.sm360-input {
    width: 100%;
    padding: var(--sm360-space-2) var(--sm360-space-3);
    font-family: var(--sm360-font-sans);
    font-size: 0.875rem;
    color: var(--sm360-text-primary);
    background: var(--sm360-bg-primary);
    border: var(--sm360-border-width) solid var(--sm360-control-border);
    border-radius: var(--sm360-radius-md);
    transition: all var(--sm360-transition-fast);
}

.sm360-form-input:focus,
.sm360-input:focus {
    outline: none;
    border-color: var(--sm360-teal);
    box-shadow: 0 0 0 3px rgba(0, 169, 157, 0.1);
}

.sm360-form-input::placeholder,
.sm360-input::placeholder {
    color: var(--sm360-gray-400);
}

.sm360-form-select,
.sm360-select {
    width: 100%;
    padding: var(--sm360-space-2) var(--sm360-space-3);
    padding-right: 2.5rem;
    font-family: var(--sm360-font-sans);
    font-size: 0.875rem;
    color: var(--sm360-text-primary);
    background-color: var(--sm360-bg-primary);
    border: var(--sm360-border-width) solid var(--sm360-control-border);
    border-radius: var(--sm360-radius-md);
    transition: all var(--sm360-transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.sm360-form-select:focus,
.sm360-select:focus {
    outline: none;
    border-color: var(--sm360-teal);
    box-shadow: 0 0 0 3px rgba(0, 169, 157, 0.1);
}

.sm360-form-select[multiple],
.sm360-select[multiple] {
    padding-right: var(--sm360-space-3);
    background-image: none;
}

.sm360-form-textarea {
    min-height: 100px;
    resize: vertical;
}

.sm360-form-error {
    font-size: 0.8125rem;
    color: var(--sm360-danger-text);
    margin-top: var(--sm360-space-1);
}

/* --- Modal --- */
.sm360-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--sm360-space-4);
    animation: fadeIn 0.2s ease-out;
}

.sm360-modal {
    background: var(--sm360-bg-primary);
    border-radius: var(--sm360-radius-xl);
    box-shadow: var(--sm360-shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

.sm360-modal-lg {
    max-width: 700px;
}

.sm360-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-5) var(--sm360-space-6);
    border-bottom: 1px solid var(--sm360-border-secondary);
}

.sm360-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
    margin: 0;
}

.sm360-modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--sm360-radius-md);
    border: none;
    background: transparent;
    color: var(--sm360-gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sm360-transition-fast);
}

.sm360-modal-close:hover {
    background: var(--sm360-gray-100);
    color: var(--sm360-gray-600);
}

.sm360-modal-body {
    padding: var(--sm360-space-6);
    overflow-y: auto;
}

.sm360-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-4) var(--sm360-space-6);
    border-top: 1px solid var(--sm360-border-secondary);
    background: var(--sm360-bg-secondary);
}

.sm360-modal-sm {
    max-width: 420px !important;
}

/* --- Form Utilities --- */
.sm360-form-row-modal {
    display: flex;
    gap: var(--sm360-space-4);
}

.sm360-form-row-modal .sm360-form-group {
    flex: 1;
}

.sm360-validation-error {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--sm360-danger-text);
}

/* Template Picker */
.sm360-template-intro {
    font-size: 0.875rem;
    color: var(--sm360-text-muted);
    margin-bottom: var(--sm360-space-6);
}

.sm360-template-grid {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-6);
}

.sm360-template-category h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sm360-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--sm360-space-3);
}

.sm360-template-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--sm360-space-3);
}

.sm360-template-card {
    display: flex;
    align-items: flex-start;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-4);
    background: var(--sm360-bg-secondary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    cursor: pointer;
    text-align: left;
    transition: all var(--sm360-transition-fast);
}

.sm360-template-card:hover {
    border-color: var(--sm360-teal);
    background: var(--sm360-bg-tertiary);
}

.sm360-template-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--sm360-radius-sm);
    background: var(--sm360-teal-100);
    color: var(--sm360-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sm360-template-icon svg {
    width: 20px;
    height: 20px;
}

.sm360-template-info {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-1);
    min-width: 0;
}

.sm360-template-name {
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-template-desc {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    line-height: 1.4;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Search --- */
.sm360-search {
    position: relative;
    width: 280px;
}

.sm360-search-input {
    width: 100%;
    padding: var(--sm360-space-2) var(--sm360-space-3) var(--sm360-space-2) 2.5rem;
    font-size: 0.875rem;
    color: var(--sm360-text-primary);
    background: var(--sm360-bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--sm360-radius-md);
    transition: all var(--sm360-transition-fast);
}

.sm360-search-input:focus {
    background: var(--sm360-bg-primary);
    border-color: var(--sm360-border-primary);
    outline: none;
}

.sm360-search-input::placeholder {
    color: var(--sm360-text-muted);
}

.sm360-search-icon {
    position: absolute;
    left: var(--sm360-space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--sm360-gray-400);
    width: 16px;
    height: 16px;
}

/* --- Empty State --- */
.sm360-empty-state {
    text-align: center;
    padding: var(--sm360-space-12) var(--sm360-space-6);
}

.sm360-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--sm360-space-4);
    color: var(--sm360-gray-300);
}

.sm360-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sm360-gray-700);
    margin-bottom: var(--sm360-space-2);
}

.sm360-empty-text {
    font-size: 0.875rem;
    color: var(--sm360-text-secondary);
    margin-bottom: var(--sm360-space-6);
}

/* --- Loading --- */
.sm360-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sm360-space-8);
}

.sm360-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--sm360-gray-200);
    border-top-color: var(--sm360-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Pagination --- */
.sm360-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-4) 0;
}

.sm360-pagination-info {
    font-size: 0.875rem;
    color: var(--sm360-text-secondary);
}

.sm360-pagination-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--sm360-space-1);
}

.sm360-pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 var(--sm360-space-3);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-gray-600);
    background: var(--sm360-white);
    border: 1px solid var(--sm360-gray-200);
    border-radius: var(--sm360-radius-md);
    cursor: pointer;
    transition: all var(--sm360-transition-fast);
}

.sm360-pagination-btn:hover:not(:disabled) {
    background: var(--sm360-gray-50);
    border-color: var(--sm360-gray-300);
}

.sm360-pagination-btn.active {
    background: var(--sm360-teal);
    border-color: var(--sm360-teal);
    color: white;
}

.sm360-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Chart Placeholder --- */
.sm360-chart-container {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--sm360-gray-50) 0%, var(--sm360-white) 100%);
    border-radius: var(--sm360-radius-md);
    color: var(--sm360-gray-400);
    font-size: 0.875rem;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    /* Sidebar becomes an off-canvas drawer that slides in BELOW the header */
    .sm360-sidebar {
        position: fixed;
        top: var(--header-height);
        bottom: 0;
        left: 0;
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: var(--sm360-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.3));
    }

    .sm360-sidebar.open {
        transform: translateX(0);
    }

    /* On mobile always show the full expanded look, regardless of rail state */
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar { overflow-y: auto; }
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-nav-label,
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-nav-chevron,
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-nav-badge { display: flex; }
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-nav-group-items { display: grid; }
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-sidebar-top { display: block; }
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-nav-item,
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-nav-group-header {
        justify-content: flex-start;
        padding: 8px 12px;
        gap: 12px;
    }
    .sm360-app[data-sidebar="collapsed"] .sm360-sidebar .sm360-nav-subitem { padding-left: 40px; }

    .sm360-rail-toggle { display: none; }
    .sm360-mobile-toggle { display: flex; }

    .sm360-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .sm360-mobile-toggle { display: none; }
    .sm360-sidebar-overlay { display: none; }
}

@media (max-width: 640px) {
    .sm360-content {
        padding: var(--sm360-space-4);
    }

    .sm360-page-header {
        flex-direction: column;
        gap: var(--sm360-space-4);
    }

    .sm360-stat-grid {
        grid-template-columns: 1fr;
    }

    .sm360-header {
        padding: 0 var(--sm360-space-4);
    }

    .sm360-search {
        width: 100%;
    }
}

/* --- Utility Classes --- */
.text-muted { color: var(--sm360-gray-500); }
.text-success { color: var(--sm360-success-text); }
.text-warning { color: var(--sm360-warning-text); }
.text-danger { color: var(--sm360-danger-text); }
.text-info { color: var(--sm360-info-text); }

.font-mono { font-family: var(--sm360-font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-2 { margin-top: var(--sm360-space-2); }
.mt-4 { margin-top: var(--sm360-space-4); }
.mt-6 { margin-top: var(--sm360-space-6); }
.mb-2 { margin-bottom: var(--sm360-space-2); }
.mb-4 { margin-bottom: var(--sm360-space-4); }
.mb-6 { margin-bottom: var(--sm360-space-6); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sm360-space-2); }
.gap-4 { gap: var(--sm360-space-4); }

/* --- Blazor Specific --- */
h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--sm360-success);
}

.invalid {
    outline: 1px solid var(--sm360-danger);
}

.validation-message {
    color: var(--sm360-danger-text);
    font-size: 0.8125rem;
    margin-top: var(--sm360-space-1);
}

.blazor-error-boundary {
    background: var(--sm360-danger);
    padding: var(--sm360-space-4);
    color: white;
    border-radius: var(--sm360-radius-md);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--sm360-danger);
    color: white;
    padding: var(--sm360-space-4);
    text-align: center;
    z-index: 9999;
}

/* --- Additional Component Styles --- */

/* Stats Row */
.sm360-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sm360-space-4);
}

.sm360-stat-card {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-4);
    background: var(--sm360-bg-primary);
    padding: var(--sm360-space-4) var(--sm360-space-5);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-shadow-sm);
    border: 1px solid var(--sm360-border-primary);
}

.sm360-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--sm360-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sm360-stat-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.sm360-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sm360-gray-500);
    margin-bottom: 2px;
}

.sm360-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sm360-text-primary);
    line-height: 1.2;
}

/* Avatar */
.sm360-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--sm360-radius-full);
    background: linear-gradient(135deg, var(--sm360-teal) 0%, var(--sm360-teal-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sm360-avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 0.875rem;
}

/* Product Tag */
.sm360-product-tag {
    display: inline-block;
    padding: var(--sm360-space-1) var(--sm360-space-2);
    background: var(--sm360-gray-100);
    color: var(--sm360-gray-700);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--sm360-radius-sm);
}

.sm360-product-tag-sm {
    padding: 2px var(--sm360-space-2);
    font-size: 0.6875rem;
}

/* Filter Group */
.sm360-filter-group {
    display: flex;
    gap: var(--sm360-space-2);
    align-items: center;
}

/* Table Footer with Pagination */
.sm360-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-4);
    border-top: 1px solid var(--sm360-gray-100);
}

.sm360-pagination {
    display: flex;
    gap: var(--sm360-space-1);
}

.sm360-btn-active {
    background: var(--sm360-teal) !important;
    color: white !important;
}

/* Info Items for Tenant Cards */
.sm360-info-item {
    padding: var(--sm360-space-2);
    background: var(--sm360-gray-50);
    border-radius: var(--sm360-radius-sm);
}

.sm360-info-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sm360-gray-500);
    margin-bottom: 2px;
}

.sm360-info-value {
    font-size: 0.875rem;
    color: var(--sm360-gray-900);
    font-weight: 500;
}

/* Health Indicator */
.sm360-health-indicator {
    width: 8px;
    height: 8px;
    border-radius: var(--sm360-radius-full);
}

.sm360-health-good {
    background: var(--sm360-success);
}

.sm360-health-warning {
    background: var(--sm360-warning);
}

.sm360-health-danger {
    background: var(--sm360-danger);
}

/* Empty State */
.sm360-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sm360-space-12);
    text-align: center;
}

.sm360-empty-state h3 {
    margin: var(--sm360-space-4) 0 var(--sm360-space-2);
    color: var(--sm360-gray-700);
    font-size: 1rem;
}

.sm360-empty-state p {
    color: var(--sm360-text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Sync Status */
.sm360-sync-status {
    display: inline-flex;
    align-items: center;
    gap: var(--sm360-space-1);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px var(--sm360-space-2);
    border-radius: var(--sm360-radius-sm);
}

.sm360-sync-success {
    background: var(--sm360-success-light);
    color: #047857;
}

.sm360-sync-pending {
    background: var(--sm360-warning-light);
    color: #b45309;
}

/* Compact Table */
.sm360-table-compact {
    font-size: 0.8125rem;
}

.sm360-table-compact th,
.sm360-table-compact td {
    padding: var(--sm360-space-2) var(--sm360-space-3);
}

/* Small Input */
.sm360-form-input-sm {
    padding: var(--sm360-space-2) var(--sm360-space-3);
    font-size: 0.8125rem;
}

/* Integration Icon */
.sm360-integration-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--sm360-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Status Dot */
.sm360-status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--sm360-radius-full);
    display: inline-block;
}

.sm360-status-healthy {
    background: var(--sm360-success);
}

.sm360-status-error {
    background: var(--sm360-danger);
}

.sm360-status-warning {
    background: var(--sm360-warning);
}

/* Settings Navigation — mirrors main sidebar style */
/* --- Settings: in-page section nav (clean, always-labeled panel) --- */
.sm360-settings-layout {
    display: flex;
    gap: var(--sm360-space-6);
    align-items: flex-start;
}

.sm360-settings-nav {
    width: 236px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-shadow-sm);
    position: sticky;
    top: var(--sm360-space-2);
    align-self: flex-start;
}

.sm360-settings-nav-divider {
    border-top: 1px solid var(--sm360-border-secondary);
    margin: 6px 8px;
}

.sm360-settings-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--sm360-radius-md);
    color: var(--sm360-text-secondary, var(--sm360-text-muted));
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background 150ms, color 150ms;
    cursor: pointer;
    white-space: nowrap;
    border: none;
    background: none;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.sm360-settings-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sm360-settings-nav-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm360-settings-nav-item:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

.sm360-settings-nav-item.active {
    background: color-mix(in srgb, var(--brand-primary, var(--sm360-teal)) 14%, transparent);
    color: var(--brand-primary, var(--sm360-teal));
    font-weight: 600;
}

.sm360-settings-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 18px;
    width: 3px;
    background: var(--brand-primary, var(--sm360-teal));
    border-radius: 0 3px 3px 0;
}

@media (max-width: 768px) {
    .sm360-settings-layout { flex-direction: column; }
    .sm360-settings-nav {
        width: 100%;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sm360-settings-nav-item { width: auto; }
    .sm360-settings-nav-divider { display: none; }
}

.sm360-settings-content {
    flex: 1;
    min-width: 0;
    padding: var(--sm360-space-6);
}

/* Toggle Switch */
.sm360-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-4);
    border-bottom: 1px solid var(--sm360-gray-100);
}

.sm360-toggle-row:last-child {
    border-bottom: none;
}

.sm360-toggle-label {
    font-weight: 500;
    color: var(--sm360-gray-900);
    font-size: 0.875rem;
}

.sm360-toggle-description {
    font-size: 0.8125rem;
    color: var(--sm360-gray-500);
    margin-top: 2px;
}

.sm360-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.sm360-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sm360-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--sm360-gray-300);
    transition: var(--sm360-transition-fast);
    border-radius: var(--sm360-radius-full);
}

.sm360-toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--sm360-transition-fast);
    border-radius: var(--sm360-radius-full);
    box-shadow: var(--sm360-shadow-sm);
}

.sm360-toggle input:checked + .sm360-toggle-slider {
    background-color: var(--sm360-teal);
}

.sm360-toggle input:checked + .sm360-toggle-slider::before {
    transform: translateX(20px);
}

/* Card Footer */
.sm360-card-footer {
    padding: var(--sm360-space-4) var(--sm360-space-6);
    border-top: 1px solid var(--sm360-gray-100);
    display: flex;
    justify-content: flex-end;
    gap: var(--sm360-space-3);
}

/* Card Hover Effect */
.sm360-card-hover {
    transition: all var(--sm360-transition-normal);
}

.sm360-card-hover:hover {
    box-shadow: var(--sm360-shadow-lg);
    transform: translateY(-2px);
}

/* Form Hint */
.sm360-form-hint {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    margin-top: var(--sm360-space-1);
}

/* Gap utilities */
.gap-1 { gap: var(--sm360-space-1); }
.gap-3 { gap: var(--sm360-space-3); }

/* Small Form Select */
.sm360-form-select-sm {
    padding: var(--sm360-space-1) var(--sm360-space-2);
    padding-right: 2rem;
    font-size: 0.8125rem;
}

/* Badge Info */
.sm360-badge-info {
    background-color: var(--sm360-info-light);
    color: var(--sm360-badge-info-text, #1d4ed8);
}

/* --- Theme Toggle --- */
.sm360-theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--sm360-radius-md);
    border: none;
    background: transparent;
    color: var(--sm360-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sm360-transition-fast);
}

.sm360-theme-toggle:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

.sm360-theme-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--sm360-text-secondary, #475569);
    stroke: currentColor;
    fill: none;
    display: block;
}

[data-theme="dark"] .sm360-theme-toggle svg {
    color: var(--sm360-text-secondary, #94a3b8);
}

/* Theme icons visibility controlled by Blazor @if, not CSS */

/* --- Logo Image Styles --- */
.sm360-logo-img {
    height: 32px;
    width: auto;
}

.sm360-logo-img-dark {
    display: none;
}

.sm360-logo-img-light {
    display: block;
}

[data-theme="dark"] .sm360-logo-img-dark {
    display: block;
}

[data-theme="dark"] .sm360-logo-img-light {
    display: none;
}

/* Page Title for dark mode */
.sm360-page-title {
    color: var(--sm360-text-primary);
}

.sm360-page-subtitle {
    color: var(--sm360-text-secondary);
}

/* Secondary button dark mode fix */
.sm360-btn-secondary {
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-secondary);
    border-color: var(--sm360-border-primary);
}

.sm360-btn-secondary:hover:not(:disabled) {
    background: var(--sm360-bg-secondary);
    border-color: var(--sm360-border-secondary);
}

/* Pagination button dark mode */
.sm360-pagination-btn {
    color: var(--sm360-text-secondary);
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
}

.sm360-pagination-btn:hover:not(:disabled) {
    background: var(--sm360-bg-secondary);
    border-color: var(--sm360-border-secondary);
}

/* Header button dark mode */
.sm360-header-btn {
    color: var(--sm360-text-muted);
}

.sm360-header-btn:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

/* Notification dot border fix for dark mode */
.sm360-notification-dot {
    border-color: var(--sm360-bg-primary);
}

/* Info items dark mode */
.sm360-info-item {
    background: var(--sm360-bg-secondary);
}

.sm360-info-value {
    color: var(--sm360-text-primary);
}

/* Product tag dark mode */
.sm360-product-tag {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-secondary);
}

/* Toggle row dark mode */
.sm360-toggle-row {
    border-bottom-color: var(--sm360-border-secondary);
}

.sm360-toggle-label {
    color: var(--sm360-text-primary);
}

/* Settings nav uses sidebar colors in both themes — no override needed */

/* Chart container dark mode */
.sm360-chart-container {
    background: linear-gradient(180deg, var(--sm360-bg-secondary) 0%, var(--sm360-bg-primary) 100%);
    color: var(--sm360-text-muted);
}

/* Table footer dark mode */
.sm360-table-footer {
    border-top-color: var(--sm360-border-secondary);
}

/* --- Logout Button --- */
.sm360-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: var(--sm360-radius-md);
    transition: all var(--sm360-transition-fast);
    margin-left: auto;
}

.sm360-logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ef4444;
}

.sm360-user-card {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-3);
    border-radius: var(--sm360-radius-md);
    background: rgba(255, 255, 255, 0.05);
}

/* --- Toast Notifications --- */
.sm360-toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--sm360-space-4));
    right: var(--sm360-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-3);
    z-index: 3000;
    max-width: 400px;
}

.sm360-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-4);
    background: var(--sm360-bg-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-shadow-lg);
    border: 1px solid var(--sm360-border-primary);
    animation: slideInRight 0.3s ease-out;
}

.sm360-toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.sm360-toast-content {
    flex: 1;
    min-width: 0;
}

.sm360-toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--sm360-text-primary);
    margin-bottom: 2px;
}

.sm360-toast-message {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
}

.sm360-toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--sm360-text-muted);
    cursor: pointer;
    border-radius: var(--sm360-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--sm360-transition-fast);
}

.sm360-toast-close:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

.sm360-toast-success .sm360-toast-icon { color: var(--sm360-success-text); }
.sm360-toast-error .sm360-toast-icon { color: var(--sm360-danger-text); }
.sm360-toast-warning .sm360-toast-icon { color: var(--sm360-warning-text); }
.sm360-toast-info .sm360-toast-icon { color: var(--sm360-info-text); }

.sm360-toast-success { border-left: 3px solid var(--sm360-success); }
.sm360-toast-error { border-left: 3px solid var(--sm360-danger); }
.sm360-toast-warning { border-left: 3px solid var(--sm360-warning); }
.sm360-toast-info { border-left: 3px solid var(--sm360-info); }

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sm360-toast-exit {
    animation: slideOutRight 0.2s ease-in forwards;
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* --- Loading Container --- */
.sm360-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sm360-space-12);
    text-align: center;
    color: var(--sm360-text-muted);
}

.sm360-loading-container p {
    margin-top: var(--sm360-space-4);
}

/* --- Error Container --- */
.sm360-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sm360-space-12);
    text-align: center;
}

.sm360-error-container p {
    color: var(--sm360-danger-text);
    margin-bottom: var(--sm360-space-4);
}

/* --- Dropdown Menu --- */
.sm360-dropdown {
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

[data-theme="dark"] .sm360-dropdown {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.sm360-dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--sm360-transition-fast);
}

.sm360-dropdown-item:hover {
    background: var(--sm360-bg-secondary);
    color: var(--sm360-text-primary);
}

/* --- Mobile Toggle --- */
.sm360-mobile-toggle {
    display: none;
}

@media (max-width: 1024px) {
    .sm360-mobile-toggle {
        display: flex;
    }

    /* On mobile, disable collapse mode - use slide-out instead */
    .sm360-sidebar-toggle {
        display: none;
    }

}

/* ==========================================
   DASHBOARD WIDGETS
   ========================================== */

/* Dashboard Grid */
.sm360-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(140px, auto);
    gap: var(--sm360-space-6);
    padding: var(--sm360-space-6);
}

/* Ensure widgets in the same row stretch to equal height */
.sm360-dashboard-grid > .sm360-widget-container,
.sm360-dashboard-grid > .sm360-widget,
.sm360-dashboard-grid > .sm360-widget-cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sm360-dashboard-grid > .sm360-widget-container > .sm360-widget,
.sm360-dashboard-grid > .sm360-widget-cell > .sm360-widget {
    flex: 1;
    min-width: 0;
}

.sm360-dashboard-grid.sm360-grid-drag-active {
    background: rgba(0, 169, 157, 0.02);
    border-radius: var(--sm360-radius-lg);
}

/* Single-source dashboard page (Sm360DashboardPage) */
.sm360-dashboard-page {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sm360-dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-4) var(--sm360-space-6);
    border-bottom: 1px solid var(--sm360-border-primary);
    background: var(--sm360-bg-primary);
    gap: var(--sm360-space-4);
    flex-wrap: wrap;
}

.sm360-dashboard-canvas {
    position: relative;
    flex: 1;
    min-height: 0;
}

.sm360-dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sm360-space-4);
    height: 400px;
    color: var(--sm360-text-muted);
}

.sm360-dashboard-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    background: var(--sm360-bg-secondary);
    border: 2px dashed var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
}

.sm360-dashboard-status {
    margin: var(--sm360-space-3) var(--sm360-space-6) 0;
    padding: var(--sm360-space-2) var(--sm360-space-4);
    border-radius: var(--sm360-radius-md);
    font-size: 0.8125rem;
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-secondary);
}

.sm360-dashboard-status.error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--sm360-danger-text);
}

.sm360-dashboard-live-status {
    display: inline-flex;
    align-items: center;
    align-self: flex-end;
    gap: var(--sm360-space-2);
    margin: var(--sm360-space-2) var(--sm360-space-6) 0;
    color: var(--sm360-text-muted);
    font-size: 0.75rem;
}

.sm360-dashboard-live-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--sm360-success);
}

.sm360-dashboard-live-status.unavailable .sm360-dashboard-live-dot {
    background: var(--sm360-warning);
}

/* Drag-drop placeholder painted by sm360-dashboard-interop.js */
.sm360-drop-placeholder {
    border-radius: var(--sm360-radius-lg);
    transition: all var(--sm360-transition-fast);
    pointer-events: none;
    z-index: 10;
}

.sm360-drop-placeholder.sm360-drop-valid {
    background: rgba(0, 169, 157, 0.15);
    border: 2px dashed var(--sm360-teal);
}

.sm360-dashboard-grid.editing .sm360-widget-container {
    cursor: move;
}

.sm360-dashboard-grid.editing .sm360-widget-container:hover {
    outline: 2px dashed var(--sm360-teal);
    outline-offset: 2px;
}

.sm360-dashboard-grid .sm360-widget-container.sm360-widget-dragging {
    opacity: 0.5;
    outline: 2px solid var(--sm360-teal);
}

/* Widget catalog modal */
.sm360-widget-catalog {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-6);
}

.sm360-widget-category h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sm360-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--sm360-space-3);
}

.sm360-widget-category-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--sm360-space-3);
}

.sm360-widget-catalog-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sm360-space-1);
    padding: var(--sm360-space-3);
    background: var(--sm360-bg-secondary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    cursor: pointer;
    transition: all var(--sm360-transition-fast);
    text-align: left;
}

.sm360-widget-catalog-item:hover {
    border-color: var(--sm360-teal);
    background: var(--sm360-bg-tertiary);
}

.sm360-widget-catalog-item.deferred {
    opacity: 0.6;
}

.sm360-widget-catalog-name {
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-widget-catalog-desc {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-template-intro {
    color: var(--sm360-text-secondary);
    margin-bottom: var(--sm360-space-6);
}

/* Widget Base */
.sm360-widget {
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--sm360-transition-fast);
}

.sm360-widget:hover {
    box-shadow: var(--sm360-shadow-md);
}

.sm360-widget-dragging,
.ce-widget-dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: var(--sm360-shadow-lg);
}

.sm360-widget-placeholder,
.ce-drop-placeholder {
    background: rgba(0, 169, 157, 0.1);
    border: 2px dashed var(--sm360-teal);
    border-radius: var(--sm360-radius-lg);
}

/* Drop zone feedback during drag */
.ce-drop-placeholder.sm360-drop-valid {
    background: rgba(0, 169, 157, 0.15);
    border-color: var(--sm360-teal);
}

.ce-drop-placeholder.sm360-drop-invalid {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--sm360-danger);
    border-style: dashed;
}

/* Widget Sizes */
.sm360-widget-small { grid-column: span 1; grid-row: span 1; }
.sm360-widget-medium { grid-column: span 2; grid-row: span 1; }
.sm360-widget-large { grid-column: span 2; grid-row: span 2; }
.sm360-widget-wide { grid-column: span 4; grid-row: span 1; }
.sm360-widget-full { grid-column: span 4; grid-row: span 2; }

/* Widget Header */
.sm360-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    border-bottom: 1px solid var(--sm360-border-secondary);
    min-height: 44px;
}

/* The title takes the free space and truncates; the controls keep their size. Without this the
   two ran together and a widget read as "MRRRemove". */
.sm360-widget-header > .sm360-widget-label,
.sm360-widget-header > .sm360-widget-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0;
}

.sm360-widget-header > .sm360-widget-actions { flex: 0 0 auto; }

.sm360-widget-drag-handle {
    cursor: grab;
    color: var(--sm360-text-muted);
    padding: var(--sm360-space-1);
    border-radius: var(--sm360-radius-sm);
    transition: all var(--sm360-transition-fast);
}

.sm360-widget-drag-handle:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-secondary);
}

.sm360-widget-drag-handle:active {
    cursor: grabbing;
}

.sm360-widget-drag-handle svg {
    width: 16px;
    height: 16px;
}

.sm360-widget-title {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm360-widget-actions {
    display: flex;
    gap: var(--sm360-space-1);
}

.sm360-widget-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--sm360-radius-sm);
    color: var(--sm360-text-muted);
    cursor: pointer;
    transition: all var(--sm360-transition-fast);
}

.sm360-widget-btn:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-secondary);
}

.sm360-widget-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sm360-danger-text);
}

.sm360-widget-btn svg {
    width: 16px;
    height: 16px;
}

/* Widget Body */
.sm360-widget-body {
    flex: 1;
    min-width: 0;
    padding: var(--sm360-space-4);
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.sm360-widget-body.loading,
.sm360-widget-body.error {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm360-widget-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sm360-space-2);
    color: var(--sm360-text-muted);
}

.sm360-widget-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sm360-space-2);
    color: var(--sm360-text-muted);
    text-align: center;
}

.sm360-widget-error svg {
    width: 24px;
    height: 24px;
    color: var(--sm360-danger-text);
}

/* Widget KPI Value */
.sm360-widget-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sm360-text-primary);
    line-height: 1.2;
}

.sm360-widget-value.small {
    font-size: 1.25rem;
}

.sm360-widget-value.large {
    font-size: 2.5rem;
}

.sm360-widget-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--sm360-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--sm360-space-1);
}

.sm360-widget-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--sm360-space-1);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--sm360-radius-full);
    margin-top: var(--sm360-space-2);
}

.sm360-widget-trend.up {
    background: rgba(16, 185, 129, 0.1);
    color: var(--sm360-success-text);
}

.sm360-widget-trend.down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sm360-danger-text);
}

.sm360-widget-trend.neutral {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-muted);
}

.sm360-widget-trend svg {
    width: 12px;
    height: 12px;
}

/* Widget Chart Container */
.sm360-widget-chart {
    width: 100%;
    flex: 1;
    min-height: 200px;
    position: relative;
}

.sm360-widget-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Chart Panel (used by ChartPanel.razor) */
.sm360-chart-panel {
    flex: 1;
    position: relative;
    min-height: 200px;
    width: 100%;
}

.sm360-chart-panel canvas {
    width: 100% !important;
    height: 100% !important;
}


/* Widget List */
.sm360-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sm360-widget-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-2) 0;
    border-bottom: 1px solid var(--sm360-border-secondary);
}

.sm360-widget-list-item:last-child {
    border-bottom: none;
}

.sm360-widget-list-label {
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
}

.sm360-widget-list-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
}

/* Attention / actions widget */
.sm360-attention-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 var(--sm360-space-1);
    border-radius: 999px;
    background: var(--sm360-danger-wash);
    color: var(--sm360-danger-text);
    font-size: 0.6875rem;
    font-weight: 700;
}

.sm360-attention-list {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-1);
}

.sm360-attention-row {
    display: flex;
    align-items: flex-start;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-2);
    border-left: 3px solid var(--sm360-border-secondary);
    background: var(--sm360-bg-secondary);
    border-radius: var(--sm360-radius-sm);
}

.sm360-attention-row--critical {
    border-left-color: var(--sm360-danger);
    background: var(--sm360-danger-wash);
}

.sm360-attention-row--warning {
    border-left-color: var(--sm360-warning);
    background: var(--sm360-warning-wash);
}

.sm360-attention-row--info {
    border-left-color: var(--sm360-primary);
}

.sm360-attention-severity {
    width: 0.5rem;
    height: 0.5rem;
    margin-top: 0.375rem;
    border-radius: 999px;
    background: var(--sm360-text-muted);
    flex: none;
}

.sm360-attention-row--critical .sm360-attention-severity {
    background: var(--sm360-danger);
}

.sm360-attention-row--warning .sm360-attention-severity {
    background: var(--sm360-warning);
}

.sm360-attention-row--info .sm360-attention-severity {
    background: var(--sm360-primary);
}

.sm360-attention-content {
    flex: 1 1 auto;
    min-width: 0;
}

.sm360-attention-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-attention-link {
    color: inherit;
    text-decoration: underline;
}

.sm360-attention-meta {
    font-size: 0.6875rem;
    color: var(--sm360-text-muted);
}

.sm360-attention-figure {
    flex: none;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--sm360-text-primary);
    white-space: nowrap;
}

.sm360-attention-figure--withheld {
    font-weight: 600;
    color: var(--sm360-text-muted);
}

/* Widget Table */
.sm360-widget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.sm360-widget-table th {
    text-align: left;
    padding: var(--sm360-space-2);
    font-weight: 600;
    color: var(--sm360-text-muted);
    border-bottom: 1px solid var(--sm360-border-primary);
}

.sm360-widget-table td {
    padding: var(--sm360-space-2);
    color: var(--sm360-text-secondary);
    border-bottom: 1px solid var(--sm360-border-secondary);
}

.sm360-widget-table tr:last-child td {
    border-bottom: none;
}

.sm360-widget-table tr:hover td {
    background: var(--sm360-bg-secondary);
}

/* Widget Progress */
.sm360-widget-progress {
    width: 100%;
    height: 8px;
    background: var(--sm360-bg-tertiary);
    border-radius: var(--sm360-radius-full);
    overflow: hidden;
}

.sm360-widget-progress-bar {
    height: 100%;
    background: var(--sm360-teal);
    border-radius: var(--sm360-radius-full);
    transition: width var(--sm360-transition-normal);
}

.sm360-widget-progress-bar.success { background: var(--sm360-success); }
.sm360-widget-progress-bar.warning { background: var(--sm360-warning); }
.sm360-widget-progress-bar.danger { background: var(--sm360-danger); }
.sm360-widget-progress-bar.teal { background: var(--sm360-teal); }
.sm360-widget-progress-bar.blue { background: var(--sm360-blue); }
.sm360-widget-progress-bar.green { background: var(--sm360-green); }
.sm360-widget-progress-bar.orange { background: var(--sm360-orange); }

/* Widget Empty State */
.sm360-widget-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 80px;
    color: var(--sm360-text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* Widget List (Enhanced) */
.sm360-widget-list-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--sm360-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--sm360-text-secondary);
}

.sm360-widget-list-content {
    flex: 1;
    min-width: 0;
}

.sm360-widget-list-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-text-primary);
}

.sm360-widget-list-subtitle {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

/* Widget Stat List */
.sm360-widget-stat-list {
    display: flex;
    flex-direction: column;
}

.sm360-widget-stat-row {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-3) 0;
    border-bottom: 1px solid var(--sm360-border-primary);
}

.sm360-widget-stat-row:last-child {
    border-bottom: none;
}

.sm360-widget-stat-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sm360-widget-stat-info {
    flex: 1;
    min-width: 0;
}

.sm360-widget-stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-text-primary);
}

.sm360-widget-stat-sublabel {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-widget-stat-value-wrapper {
    text-align: right;
}

.sm360-widget-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-widget-stat-change {
    font-size: 0.75rem;
    font-weight: 500;
}

.sm360-widget-stat-change.up {
    color: var(--sm360-success-text);
}

.sm360-widget-stat-change.down {
    color: var(--sm360-danger-text);
}

/* Widget Table Container */
.sm360-widget-table-container {
    overflow-x: auto;
    max-height: 100%;
}

.sm360-widget-table th.sorted {
    color: var(--sm360-teal);
}

.sm360-widget-table th .sort-icon {
    margin-left: var(--sm360-space-1);
    font-size: 0.75rem;
}

.sm360-widget-table th {
    cursor: pointer;
}

.sm360-widget-table th:hover {
    color: var(--sm360-text-primary);
}

.sm360-widget-table td.text-right {
    text-align: right;
}

/* Widget Progress List (shared Sm360ProgressWidget) */
.sm360-widget-progress-list {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-4);
}

.sm360-widget-progress-item {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-2);
}

.sm360-widget-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sm360-widget-progress-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-text-primary);
}

.sm360-widget-progress-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sm360-text-secondary);
}

.sm360-widget-progress-sublabel {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

/* Widget Gauge (shared Sm360GaugeWidget — inline SVG, no Chart.js) */
.sm360-gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: var(--sm360-space-2);
}

.sm360-gauge-svg {
    width: 100%;
    max-width: 160px;
    height: auto;
}

.sm360-gauge-value {
    font-size: 14px;
    font-weight: 700;
    fill: var(--sm360-text-primary);
}

.sm360-gauge-label {
    font-size: 6px;
    fill: var(--sm360-text-muted);
}

.sm360-gauge-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sm360-space-1);
    margin-top: var(--sm360-space-2);
}

.sm360-gauge-target {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-gauge-target-value {
    font-weight: 600;
    color: var(--sm360-text-secondary);
}

.sm360-gauge-status {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-gauge-status.success {
    color: var(--sm360-success-text);
    font-weight: 500;
}

/* Widget Scorecard (shared Sm360ScorecardWidget) */
.sm360-scorecard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--sm360-space-4);
    height: 100%;
    align-items: start;
}

.sm360-scorecard-item {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-1);
    padding: var(--sm360-space-2) 0;
    border-right: 1px solid var(--sm360-border-secondary);
}

.sm360-scorecard-item:last-child {
    border-right: none;
}

.sm360-scorecard-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--sm360-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sm360-scorecard-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sm360-text-primary);
    line-height: 1.2;
}

.sm360-scorecard-value.highlight {
    color: var(--sm360-teal);
}

/* Widget Comparison Card (shared Sm360ComparisonWidget) */
.sm360-comparison-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: var(--sm360-space-2);
}

.sm360-comparison-side {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-1);
    flex: 1;
}

.sm360-comparison-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--sm360-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sm360-comparison-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--sm360-text-primary);
    line-height: 1.2;
}

.sm360-comparison-value.previous {
    color: var(--sm360-text-muted);
    font-weight: 500;
}

.sm360-comparison-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 var(--sm360-space-2);
}

.sm360-comparison-change {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--sm360-radius-full);
}

.sm360-comparison-change.up {
    background: rgba(16, 185, 129, 0.1);
    color: var(--sm360-success-text);
}

.sm360-comparison-change.down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sm360-danger-text);
}

.sm360-comparison-change.neutral {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-muted);
}

/* Dashboard Selector (Tabs) */
.sm360-dashboard-tabs {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-4) var(--sm360-space-6);
    border-bottom: 1px solid var(--sm360-border-primary);
    overflow-x: auto;
}

.sm360-dashboard-tab {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-2) var(--sm360-space-4);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--sm360-radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--sm360-transition-fast);
}

.sm360-dashboard-tab:hover {
    background: var(--sm360-bg-secondary);
    color: var(--sm360-text-primary);
}

.sm360-dashboard-tab.active {
    background: var(--sm360-teal);
    color: var(--sm360-tenant-on-brand, #ffffff);
}

.sm360-dashboard-tab-add {
    padding: var(--sm360-space-2);
    color: var(--sm360-text-muted);
}

.sm360-dashboard-tab-add:hover {
    background: var(--sm360-bg-secondary);
    color: var(--sm360-teal);
}

/* Dashboard Actions */
.sm360-dashboard-actions {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    margin-left: auto;
}

/* Responsive Grid */
@media (max-width: 1200px) {
    .sm360-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .sm360-widget-wide,
    .sm360-widget-full {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .sm360-dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
        padding: var(--sm360-space-4);
    }
    .sm360-widget-small,
    .sm360-widget-medium,
    .sm360-widget-large,
    .sm360-widget-wide,
    .sm360-widget-full {
        grid-column: span 1;
    }
}

/* ============================================
   AI Chat Panel
   ============================================ */

.sm360-ai-fab {
    position: fixed;
    bottom: calc(var(--footer-height, 28px) + 16px);
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: var(--sm360-radius-full);
    background: var(--sm360-teal);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--sm360-shadow-lg);
    transition: all var(--sm360-transition-normal) ease;
    /* Above .sm360-modal-backdrop (2000), like the chat panel: while a dialog is open the launcher
       must still be the launcher. Beneath the backdrop, a click on it closed the dialog instead,
       which ended a walkthrough's step by removing the thing it was pointing at. */
    z-index: 2001;
}
.sm360-ai-fab:hover {
    background: var(--sm360-teal-dark);
    transform: scale(1.05);
}
.sm360-ai-fab.hidden {
    display: none;
}
/* Open chat: the launcher steps aside rather than vanishing.

   The panel is a full-height drawer pinned to the right edge, so a launcher left where it was
   would sit underneath it. Hiding it was the easy answer and the wrong one: the control the user
   just pressed disappears under their cursor, and the only way back is a Close link at the far
   top of the panel. Docking it beside the drawer keeps one affordance in one place for both
   opening and closing. */
.sm360-ai-fab.docked {
    right: calc(var(--sm360-ai-chat-width, 400px) + 24px);
}
@media (max-width: 640px) {
    /* The drawer takes the whole width on a phone, so there is nowhere beside it to dock to. */
    .sm360-ai-fab.docked {
        display: none;
    }
}

.sm360-ai-chat {
    position: fixed;
    top: 0;
    /* One source for the drawer's width: the launcher docks against it, and two literals that
       drift apart put the launcher on top of the panel or floating away from it. */
    right: calc(var(--sm360-ai-chat-width, 400px) * -1);
    width: var(--sm360-ai-chat-width, 400px);
    height: 100vh;
    background: var(--sm360-bg-primary);
    border-left: 1px solid var(--sm360-border-primary);
    display: flex;
    flex-direction: column;
    z-index: 2001; /* above .sm360-modal-backdrop (2000): an open dialog never covers or dims the chat */
    transition: right var(--sm360-transition-slow) ease;
    box-shadow: var(--sm360-shadow-xl);
}
.sm360-ai-chat.open {
    right: 0;
}

.sm360-ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sm360-border-primary);
    background: var(--sm360-bg-secondary);
    flex-shrink: 0;
}
.sm360-ai-chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sm360-ai-chat-title {
    font-weight: 600;
    font-size: 0.875rem;
}
.sm360-ai-chat-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}
.sm360-ai-chat-header-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--sm360-radius-sm);
    color: var(--sm360-text-muted);
    display: flex;
    align-items: center;
    transition: all var(--sm360-transition-fast);
}
.sm360-ai-chat-header-btn:hover {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-primary);
}

/* Messages area */
.sm360-ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Welcome screen */
.sm360-ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    flex: 1;
}
.sm360-ai-welcome-icon {
    margin-bottom: 16px;
    opacity: 0.8;
}
.sm360-ai-welcome-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.sm360-ai-welcome-subtitle {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
    line-height: 1.5;
    max-width: 280px;
}
.sm360-ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    justify-content: center;
}
.sm360-ai-quick-action {
    padding: 6px 12px;
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-full);
    background: var(--sm360-bg-secondary);
    color: var(--sm360-text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--sm360-transition-fast);
}
.sm360-ai-quick-action:hover {
    border-color: var(--sm360-teal);
    color: var(--sm360-teal);
    background: var(--sm360-bg-primary);
}

/* Message bubbles */
.sm360-ai-message {
    display: flex;
    gap: 8px;
    max-width: 100%;
}
.sm360-ai-message.user {
    flex-direction: row-reverse;
}
.sm360-ai-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--sm360-radius-full);
    background: var(--sm360-teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sm360-ai-message-content {
    max-width: 85%;
}
.sm360-ai-message-text {
    padding: 10px 14px;
    border-radius: var(--sm360-radius-lg);
    font-size: 0.8125rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.sm360-ai-message.assistant .sm360-ai-message-text {
    background: var(--sm360-bg-secondary);
    border: 1px solid var(--sm360-border-primary);
}
.sm360-ai-message.user .sm360-ai-message-text {
    background: var(--sm360-teal);
    color: white;
}
.sm360-ai-message-text code {
    background: rgba(0,0,0,0.1);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-family: var(--sm360-font-mono);
}
.sm360-ai-message-text ul,
.sm360-ai-message-text ol {
    margin: 4px 0;
    padding-left: 20px;
}
.sm360-ai-message-text ul { list-style: disc; }
.sm360-ai-message-text ol { list-style: decimal; }
.sm360-ai-message-text li {
    margin: 2px 0;
}
.sm360-ai-message-text strong {
    font-weight: 600;
}
.sm360-ai-report-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin: 4px 0;
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-teal);
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity var(--sm360-transition-fast);
}
.sm360-ai-report-link:hover {
    opacity: 0.85;
    color: white;
}

/* Inline chart in chat */
.sm360-ai-chart-container {
    margin: 8px 0;
    padding: 8px;
    border-radius: 8px;
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
}
.sm360-ai-chart-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sm360-text-secondary);
    margin-bottom: 6px;
}
.sm360-ai-chart-wrapper {
    position: relative;
    height: 220px;
}
.sm360-ai-chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--sm360-text-secondary);
    font-size: 0.8rem;
    border: 1px dashed var(--sm360-border-primary);
    border-radius: 8px;
    margin: 8px 0;
}

/* Typing indicator */
.sm360-ai-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
}
.sm360-ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sm360-teal);
    animation: sm360-ai-bounce 1.4s ease-in-out infinite;
}
.sm360-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.sm360-ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sm360-ai-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.sm360-ai-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--sm360-border-primary);
    background: var(--sm360-bg-secondary);
    flex-shrink: 0;
}
.sm360-ai-input {
    flex: 1;
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: 10px 12px;
    font-size: 0.8125rem;
    font-family: var(--sm360-font-sans);
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-primary);
    resize: none;
    max-height: 120px;
    line-height: 1.4;
}
.sm360-ai-input:focus {
    outline: none;
    border-color: var(--sm360-teal);
    box-shadow: 0 0 0 2px rgba(0, 169, 157, 0.15);
}
.sm360-ai-input::placeholder {
    color: var(--sm360-text-muted);
}
.sm360-ai-send-btn {
    /* Text labels (Send, Cancel) need room; an icon still gets a square button. */
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    white-space: nowrap;
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-teal);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--sm360-transition-fast);
}
.sm360-ai-send-btn:hover:not(:disabled) {
    background: var(--sm360-teal-dark);
}
.sm360-ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Session list */
.sm360-ai-session-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sm360-ai-session-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--sm360-border-primary);
}
.sm360-ai-session-loading,
.sm360-ai-session-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--sm360-text-muted);
    font-size: 0.8125rem;
}
.sm360-ai-session-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid var(--sm360-border-primary);
    background: transparent;
    cursor: pointer;
    transition: background var(--sm360-transition-fast);
    color: var(--sm360-text-primary);
}
.sm360-ai-session-item:hover {
    background: var(--sm360-bg-secondary);
}
.sm360-ai-session-item.active {
    background: var(--sm360-bg-tertiary);
    border-left: 3px solid var(--sm360-teal);
}
.sm360-ai-session-item-title {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sm360-ai-session-item-meta {
    font-size: 0.6875rem;
    color: var(--sm360-text-muted);
    margin-top: 2px;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .sm360-ai-chat {
        width: 100%;
        right: -100%;
    }
    .sm360-ai-fab {
        bottom: 16px;
        right: 16px;
    }
}

/* ========== Analytics Page ========== */

.sm360-analytics-section {
    margin-bottom: var(--sm360-space-8);
}

.sm360-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
    margin-bottom: var(--sm360-space-4);
}

.sm360-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sm360-space-4);
}

@media (max-width: 1024px) {
    .sm360-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .sm360-kpi-row {
        grid-template-columns: 1fr;
    }
}

.sm360-card-compact {
    padding: var(--sm360-space-4);
}

/* Cohort retention heatmap table */
.sm360-cohort-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.sm360-cohort-table th {
    padding: var(--sm360-space-2) var(--sm360-space-3);
    text-align: center;
    font-weight: 600;
    color: var(--sm360-text-secondary);
    border-bottom: 2px solid var(--sm360-border-primary);
    white-space: nowrap;
}

.sm360-cohort-table th:first-child,
.sm360-cohort-table th:nth-child(2) {
    text-align: left;
}

.sm360-cohort-table td {
    padding: var(--sm360-space-2) var(--sm360-space-3);
    text-align: center;
    border-bottom: 1px solid var(--sm360-border-primary);
}

.sm360-cohort-label {
    font-weight: 500;
    white-space: nowrap;
    text-align: left !important;
}

.sm360-cohort-size {
    color: var(--sm360-text-muted);
    text-align: left !important;
}

.sm360-cohort-cell {
    font-weight: 500;
    border-radius: var(--sm360-radius-sm);
    min-width: 48px;
}

.sm360-cohort-cell-high {
    background-color: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.sm360-cohort-cell-medium {
    background-color: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.sm360-cohort-cell-low {
    background-color: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.sm360-cohort-cell-empty {
    background-color: var(--sm360-bg-secondary);
}

/* ========== Walkthrough Overlay ========== */

.sm360-wt-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
}

.sm360-wt-overlay::before {
    content: '';
    position: fixed;
    inset: 0;
    /* Spotlight cutout using box-shadow — CSS custom properties set by JS */
    clip-path: polygon(
        0% 0%, 0% 100%, 100% 100%, 100% 0%, 0% 0%,
        var(--wt-x) var(--wt-y),
        var(--wt-x) calc(var(--wt-y) + var(--wt-h)),
        calc(var(--wt-x) + var(--wt-w)) calc(var(--wt-y) + var(--wt-h)),
        calc(var(--wt-x) + var(--wt-w)) var(--wt-y),
        var(--wt-x) var(--wt-y)
    );
    background: rgba(0, 0, 0, 0.5);
    transition: clip-path 0.3s ease;
}

.sm360-wt-tooltip {
    position: fixed;
    z-index: 10002;
    width: 320px;
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-shadow-lg);
    pointer-events: auto;
    animation: sm360-wt-fade-in 0.25s ease;
}

@keyframes sm360-wt-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sm360-wt-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-3) var(--sm360-space-4);
    border-bottom: 1px solid var(--sm360-border-primary);
}

.sm360-wt-tooltip-step {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sm360-accent);
}

.sm360-wt-tooltip-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-wt-tooltip-close {
    background: none;
    border: none;
    color: var(--sm360-text-muted);
    cursor: pointer;
    font-size: 1.125rem;
    padding: 0;
    line-height: 1;
}

.sm360-wt-tooltip-close:hover {
    color: var(--sm360-text-primary);
}

.sm360-wt-tooltip-body {
    padding: var(--sm360-space-4);
    font-size: 0.875rem;
    color: var(--sm360-text-secondary);
    line-height: 1.5;
}

.sm360-wt-tooltip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sm360-space-3) var(--sm360-space-4);
    border-top: 1px solid var(--sm360-border-primary);
}

.sm360-wt-btn {
    padding: var(--sm360-space-1) var(--sm360-space-3);
    border-radius: var(--sm360-radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--sm360-border-primary);
    background: var(--sm360-bg-secondary);
    color: var(--sm360-text-primary);
    transition: background 0.15s;
}

.sm360-wt-btn:hover {
    background: var(--sm360-bg-tertiary);
}

.sm360-wt-btn-primary {
    background: var(--sm360-accent);
    color: white;
    border-color: var(--sm360-accent);
}

.sm360-wt-btn-primary:hover {
    opacity: 0.9;
    background: var(--sm360-accent);
}

.sm360-wt-click-indicator {
    position: fixed;
    z-index: 10001;
    width: 24px;
    height: 24px;
    margin-left: -12px;
    margin-top: -12px;
    border-radius: 50%;
    background: var(--sm360-accent);
    opacity: 0.6;
    animation: sm360-wt-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes sm360-wt-pulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    50%  { transform: scale(2.2); opacity: 0; }
    100% { transform: scale(1);   opacity: 0.6; }
}

/* Walkthrough "Start Tour" card in AI chat messages */
.sm360-ai-walkthrough-card {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    margin-top: var(--sm360-space-3);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    background: rgba(0, 169, 157, 0.08);
    border: 1px solid rgba(0, 169, 157, 0.25);
    border-radius: var(--sm360-radius-md);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.sm360-ai-walkthrough-card:hover {
    background: rgba(0, 169, 157, 0.14);
    border-color: rgba(0, 169, 157, 0.4);
}

.sm360-ai-walkthrough-card-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sm360-ai-walkthrough-card-text {
    flex: 1;
    min-width: 0;
}

.sm360-ai-walkthrough-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-ai-walkthrough-card-desc {
    font-size: 0.75rem;
    color: var(--sm360-text-secondary);
    margin-top: 2px;
}

.sm360-ai-walkthrough-card-btn {
    flex-shrink: 0;
    padding: var(--sm360-space-1) var(--sm360-space-3);
    background: var(--sm360-accent);
    color: white;
    border: none;
    border-radius: var(--sm360-radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.sm360-ai-walkthrough-card-btn:hover {
    opacity: 0.9;
}

/* --- AI Message Feedback --- */

.sm360-ai-message-feedback {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.sm360-ai-feedback-btn {
    background: none;
    border: 1px solid var(--sm360-border-primary);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    color: var(--sm360-text-muted);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
}

.sm360-ai-feedback-btn:hover {
    border-color: var(--sm360-teal);
    color: var(--sm360-teal);
}

.sm360-ai-feedback-btn.active-helpful {
    background: rgba(20, 184, 166, 0.1);
    border-color: var(--sm360-teal);
    color: var(--sm360-teal);
}

.sm360-ai-feedback-btn.active-unhelpful {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--sm360-red, #ef4444);
    color: var(--sm360-red, #ef4444);
}

/* --- AI Analytics Page --- */

.sm360-ai-analytics-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sm360-space-4);
    margin-top: var(--sm360-space-4);
}

@media (max-width: 768px) {
    .sm360-ai-analytics-charts {
        grid-template-columns: 1fr;
    }
}

.sm360-ai-analytics-period {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
}

.sm360-ai-analytics-period select {
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: var(--sm360-space-1) var(--sm360-space-2);
    color: var(--sm360-text-primary);
    font-size: 0.85rem;
}


/* --- Print Styles (Export as PDF via browser print) --- */
@media print {
    /* Hide non-content elements */
    .sm360-sidebar,
    .sm360-header,
    .sm360-ai-fab,
    .sm360-ai-chat-panel,
    .sm360-dashboard-actions,
    .sm360-page-header .sm360-btn,
    .sm360-page-header select,
    [data-walkthrough],
    .sm360-walkthrough-overlay {
        display: none !important;
    }

    /* Full-width content without sidebar margin */
    .sm360-layout {
        grid-template-columns: 1fr !important;
    }

    .sm360-main {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .sm360-content {
        padding: 8px !important;
    }

    /* Remove shadows and borders for cleaner print */
    .sm360-card {
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        break-inside: avoid;
    }

    /* Ensure charts and canvases print */
    canvas {
        max-width: 100% !important;
    }

    /* Page settings */
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* --- PDF Export: hide UI controls during html2pdf capture --- */
body.pdf-exporting .sm360-dashboard-actions,
body.pdf-exporting .sm360-dashboard-tabs,
body.pdf-exporting .sm360-page-header button,
body.pdf-exporting .sm360-page-header select,
body.pdf-exporting .sm360-widget-header button,
body.pdf-exporting .sm360-ai-fab {
    visibility: hidden !important;
}

/* Hide report filter panel and expand results to full width */
body.pdf-exporting [style*="grid-template-columns:340px"] {
    grid-template-columns: 1fr !important;
}

body.pdf-exporting [style*="grid-template-columns:340px"] > .sm360-card:first-child {
    display: none !important;
}

/* Expand data tables to show all rows (remove scroll container height limit) */
body.pdf-exporting .sm360-datagrid-container {
    max-height: none !important;
    overflow: visible !important;
}

/* --- Dashboard Filter Bar --- */
.sm360-filter-bar {
    display: flex;
    align-items: end;
    gap: 16px;
    padding: 12px 16px;
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sm360-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sm360-filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--sm360-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sm360-btn-group {
    display: flex;
    gap: 0;
}

.sm360-btn-group .sm360-btn {
    border-radius: 0;
}

.sm360-btn-group .sm360-btn:first-child {
    border-radius: var(--sm360-radius-md) 0 0 var(--sm360-radius-md);
}

.sm360-btn-group .sm360-btn:last-child {
    border-radius: 0 var(--sm360-radius-md) var(--sm360-radius-md) 0;
}

.sm360-btn-group .sm360-btn + .sm360-btn {
    margin-left: -1px;
}

.sm360-input-sm, .sm360-select-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
    height: 32px;
}

/* Filter bar form controls — compact, subtle style matching search box */
.sm360-filter-bar .sm360-form-select,
.sm360-filter-bar .sm360-select,
.sm360-filter-bar .sm360-form-input,
.sm360-filter-bar .sm360-input {
    width: auto;
    min-height: 32px;
    height: 32px;
    padding: 4px 2rem 4px 8px;
    font-size: 0.8125rem;
    background-color: var(--sm360-bg-tertiary);
    border-color: transparent;
}

.sm360-filter-bar .sm360-form-input,
.sm360-filter-bar .sm360-input {
    padding-right: 8px;
}

.sm360-filter-bar .sm360-form-select:focus,
.sm360-filter-bar .sm360-select:focus,
.sm360-filter-bar .sm360-form-input:focus,
.sm360-filter-bar .sm360-input:focus {
    background-color: var(--sm360-bg-primary);
    border-color: var(--sm360-teal);
}

.sm360-filter-bar .sm360-form-select:hover:not(:focus),
.sm360-filter-bar .sm360-select:hover:not(:focus),
.sm360-filter-bar .sm360-form-input:hover:not(:focus),
.sm360-filter-bar .sm360-input:hover:not(:focus) {
    border-color: var(--sm360-gray-400);
    background-color: var(--sm360-bg-secondary);
}

/* ============================================
   Layer 3: Page Component Enhancements
   Cards, Tables, Forms, Buttons, Badges,
   Page Headers, Transitions
   ============================================ */

/* --- Enhanced Cards --- */
.sm360-card {
    transition: box-shadow var(--sm360-transition-normal),
                border-color var(--sm360-transition-normal),
                background-color var(--sm360-transition-slow);
}

.sm360-card:hover {
    box-shadow: var(--sm360-shadow-md);
    border-color: var(--sm360-gray-300);
}

.sm360-card-header {
    transition: background-color var(--sm360-transition-normal);
}

.sm360-card-header h2,
.sm360-card-header h3,
.sm360-card-header .sm360-card-title {
    letter-spacing: -0.01em;
}

.sm360-card-body:not(:last-child) {
    padding-bottom: var(--sm360-space-4);
}

/* Clickable card variant */
.sm360-card[role="button"],
.sm360-card[onclick],
a.sm360-card {
    cursor: pointer;
}

.sm360-card[role="button"]:hover,
.sm360-card[onclick]:hover,
a.sm360-card:hover {
    box-shadow: var(--sm360-shadow-lg);
    border-color: var(--sm360-teal);
    transform: translateY(-1px);
}

.sm360-card[role="button"]:active,
.sm360-card[onclick]:active,
a.sm360-card:active {
    transform: translateY(0);
    box-shadow: var(--sm360-shadow-sm);
}

/* Stat card transition refinement */
.sm360-stat-card {
    transition: box-shadow var(--sm360-transition-normal),
                border-color var(--sm360-transition-normal),
                transform var(--sm360-transition-normal);
}

.sm360-stat-card:hover {
    transform: translateY(-1px);
}

/* --- Enhanced Tables --- */
.sm360-table-container {
    border-radius: var(--sm360-radius-lg);
    border: 1px solid var(--sm360-border-primary);
}

.sm360-table-container .sm360-table {
    margin-bottom: 0;
}

.sm360-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: var(--sm360-space-3) var(--sm360-space-4);
    white-space: nowrap;
}

.sm360-table td {
    padding: var(--sm360-space-3) var(--sm360-space-4);
    vertical-align: middle;
    transition: background-color var(--sm360-transition-fast);
}

.sm360-table tbody tr {
    transition: background-color var(--sm360-transition-fast);
}

/* Striped rows variant */
.sm360-table-striped tbody tr:nth-child(even) td {
    background: var(--sm360-bg-secondary);
}

.sm360-table-striped tbody tr:nth-child(even):hover td {
    background: var(--sm360-bg-tertiary);
}

/* Last row no border */
.sm360-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table cell text helpers */
.sm360-table td.sm360-cell-primary {
    color: var(--sm360-text-primary);
    font-weight: 500;
}

.sm360-table td.sm360-cell-mono {
    font-family: var(--sm360-font-mono);
    font-size: 0.8125rem;
}

/* Sortable header indicator */
.sm360-table th[data-sortable] {
    cursor: pointer;
    user-select: none;
}

.sm360-table th[data-sortable]:hover {
    color: var(--sm360-text-primary);
    background: var(--sm360-bg-tertiary);
}

/* Compact table variant */
.sm360-table-compact th,
.sm360-table-compact td {
    padding: var(--sm360-space-2) var(--sm360-space-3);
    font-size: 0.8125rem;
}

/* --- Enhanced Forms --- */
.sm360-form-group {
    position: relative;
}

.sm360-form-label {
    letter-spacing: 0.01em;
    transition: color var(--sm360-transition-fast);
}

/* Required field indicator */
.sm360-form-label.required::after {
    content: " *";
    color: var(--sm360-danger-text);
    font-weight: 400;
}

.sm360-form-input,
.sm360-input,
.sm360-form-select,
.sm360-select,
textarea.sm360-form-input,
.sm360-form-textarea {
    line-height: 1.5;
    min-height: 38px;
    transition: border-color var(--sm360-transition-fast),
                box-shadow var(--sm360-transition-fast),
                background-color var(--sm360-transition-fast);
}

.sm360-form-input:hover:not(:focus):not(:disabled),
.sm360-input:hover:not(:focus):not(:disabled),
.sm360-form-select:hover:not(:focus):not(:disabled),
.sm360-select:hover:not(:focus):not(:disabled),
textarea.sm360-form-input:hover:not(:focus):not(:disabled) {
    border-color: var(--sm360-gray-400);
}

.sm360-form-input:disabled,
.sm360-input:disabled,
.sm360-form-select:disabled,
.sm360-select:disabled,
textarea.sm360-form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--sm360-bg-secondary);
}

/* Input with validation states */
.sm360-form-input.is-invalid,
.sm360-form-select.is-invalid {
    border-color: var(--sm360-danger);
}

.sm360-form-input.is-invalid:focus,
.sm360-form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    border-color: var(--sm360-danger);
}

.sm360-form-input.is-valid,
.sm360-form-select.is-valid {
    border-color: var(--sm360-success);
}

.sm360-form-input.is-valid:focus,
.sm360-form-select.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    border-color: var(--sm360-success);
}

/* Help text */
.sm360-form-hint {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
    margin-top: var(--sm360-space-1);
    line-height: 1.4;
}

/* Inline form layout */
.sm360-form-row {
    display: flex;
    gap: var(--sm360-space-4);
    align-items: flex-start;
}

.sm360-form-row > .sm360-form-group {
    flex: 1;
    min-width: 0;
}

/* Checkbox and radio improvements */
.sm360-form-check {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--sm360-text-secondary);
}

.sm360-form-check input[type="checkbox"],
.sm360-form-check input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--sm360-teal);
    cursor: pointer;
}

/* --- Enhanced Buttons --- */
.sm360-btn {
    position: relative;
    font-weight: 500;
    user-select: none;
    transition: background-color var(--sm360-transition-fast),
                border-color var(--sm360-transition-fast),
                color var(--sm360-transition-fast),
                box-shadow var(--sm360-transition-fast),
                transform var(--sm360-transition-fast);
}

.sm360-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.sm360-btn:focus-visible {
    outline: 2px solid var(--sm360-teal);
    outline-offset: 2px;
}

/* Primary button active */
.sm360-btn-primary:active:not(:disabled) {
    background: var(--sm360-action-hover, var(--sm360-teal-dark));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Secondary button active */
.sm360-btn-secondary:active:not(:disabled) {
    background: var(--sm360-bg-tertiary);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Danger button active */
.sm360-btn-danger:active:not(:disabled) {
    background: #b91c1c;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ghost button active */
.sm360-btn-ghost:active:not(:disabled) {
    background: var(--sm360-bg-tertiary);
}

/* Outline button active */
.sm360-btn-outline:active:not(:disabled) {
    background: var(--sm360-bg-tertiary);
}

/* Danger outline active */
.sm360-btn-danger-outline:active:not(:disabled) {
    background: #b91c1c;
}

/* Icon alignment in buttons */
.sm360-btn svg,
.sm360-btn i {
    flex-shrink: 0;
}

/* Loading state */
.sm360-btn.is-loading {
    color: transparent;
    pointer-events: none;
    position: relative;
}

.sm360-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: var(--sm360-radius-full);
    animation: sm360-spin 0.6s linear infinite;
    left: 50%;
    top: 50%;
    margin-left: -8px;
    margin-top: -8px;
    color: var(--sm360-text-muted);
}

.sm360-btn-primary.is-loading::after {
    color: var(--sm360-tenant-on-brand, #ffffff);
}

.sm360-btn-danger.is-loading::after {
    color: white;
}

@keyframes sm360-spin {
    to { transform: rotate(360deg); }
}

/* Button group spacing */
.sm360-btn + .sm360-btn {
    margin-left: var(--sm360-space-2);
}

/* --- Enhanced Badges / Status Pills --- */
.sm360-badge {
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: background-color var(--sm360-transition-fast),
                color var(--sm360-transition-fast);
}

/* Status dot indicator */
.sm360-badge-dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: var(--sm360-radius-full);
    background: currentColor;
    flex-shrink: 0;
}

/* Named status badges for semantic clarity */
.sm360-badge-active {
    background: var(--sm360-success-light);
    color: var(--sm360-badge-success-text, #047857);
}

.sm360-badge-inactive {
    background: var(--sm360-gray-100);
    color: var(--sm360-gray-600);
}

.sm360-badge-pending {
    background: var(--sm360-warning-light);
    color: var(--sm360-badge-warning-text, #b45309);
}

.sm360-badge-error {
    background: var(--sm360-danger-light);
    color: var(--sm360-badge-danger-text, #b91c1c);
}

/* Larger badge variant */
.sm360-badge-lg {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
}

/* --- Enhanced Page Headers --- */
.sm360-page-header {
    flex-wrap: wrap;
    gap: var(--sm360-space-4);
    align-items: center;
    padding-bottom: var(--sm360-space-6);
    border-bottom: 1px solid var(--sm360-border-secondary);
}

.sm360-page-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-1);
    min-width: 0;
    flex: 1;
}

.sm360-page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    flex-shrink: 0;
}

.sm360-page-title {
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--sm360-text-primary);
}

.sm360-page-subtitle {
    line-height: 1.4;
    color: var(--sm360-text-secondary);
}

/* Breadcrumb support */
.sm360-page-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
    margin-bottom: var(--sm360-space-2);
}

.sm360-page-breadcrumb a {
    color: var(--sm360-text-secondary);
    text-decoration: none;
    transition: color var(--sm360-transition-fast);
}

.sm360-page-breadcrumb a:hover {
    color: var(--sm360-teal);
}

.sm360-page-breadcrumb .separator {
    font-size: 0.625rem;
    opacity: 0.5;
}

/* --- Global Transition Enhancements --- */

/* Smooth transitions on all interactive elements */
a:not([class]) {
    transition: color var(--sm360-transition-fast);
}

/* Tabs transition */
.sm360-tab {
    transition: color var(--sm360-transition-normal),
                border-color var(--sm360-transition-normal),
                background-color var(--sm360-transition-normal);
}

.sm360-tab:hover {
    background: var(--sm360-bg-secondary);
    border-radius: var(--sm360-radius-md) var(--sm360-radius-md) 0 0;
}

/* Tab count transition */
.sm360-tab-count {
    transition: background-color var(--sm360-transition-fast),
                color var(--sm360-transition-fast);
}

/* Pagination link transitions */
.sm360-pagination button,
.sm360-pagination a {
    transition: background-color var(--sm360-transition-fast),
                color var(--sm360-transition-fast),
                border-color var(--sm360-transition-fast);
}

/* Icon button transition */
.sm360-btn-icon {
    transition: background-color var(--sm360-transition-fast),
                color var(--sm360-transition-fast),
                border-color var(--sm360-transition-fast),
                transform var(--sm360-transition-fast);
}

.sm360-btn-icon:active {
    transform: scale(0.95);
}

/* Dropdown transition */
.sm360-dropdown-menu {
    transition: opacity var(--sm360-transition-fast),
                transform var(--sm360-transition-fast);
}

/* Search input transition */
.sm360-search-input {
    transition: border-color var(--sm360-transition-fast),
                box-shadow var(--sm360-transition-fast),
                width var(--sm360-transition-slow);
}

/* --- Dark Mode: Layer 3 Adjustments --- */
[data-theme="dark"] .sm360-card:hover {
    border-color: var(--sm360-gray-400);
}

[data-theme="dark"] .sm360-card[role="button"]:hover,
[data-theme="dark"] .sm360-card[onclick]:hover,
[data-theme="dark"] a.sm360-card:hover {
    border-color: var(--sm360-teal);
}

[data-theme="dark"] .sm360-badge-inactive {
    background: var(--sm360-bg-tertiary);
    color: var(--sm360-text-muted);
}

[data-theme="dark"] .sm360-table-striped tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .sm360-table-striped tbody tr:nth-child(even):hover td {
    background: var(--sm360-bg-tertiary);
}

[data-theme="dark"] .sm360-form-input:hover:not(:focus):not(:disabled),
[data-theme="dark"] .sm360-input:hover:not(:focus):not(:disabled),
[data-theme="dark"] .sm360-form-select:hover:not(:focus):not(:disabled),
[data-theme="dark"] .sm360-select:hover:not(:focus):not(:disabled) {
    border-color: var(--sm360-gray-400);
}

[data-theme="dark"] .sm360-page-header {
    border-bottom-color: var(--sm360-border-primary);
}

/* ============================================
   LAYER 4: POLISH
   Animations, transitions, responsive, a11y
   ============================================ */

/* --- Smooth Scroll --- */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Skip to Content (Accessibility) --- */
.sm360-skip-link {
    position: absolute;
    top: -100%;
    left: var(--sm360-space-4);
    z-index: 10000;
    padding: var(--sm360-space-3) var(--sm360-space-6);
    background: #006d65;
    color: var(--sm360-white);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0 0 var(--sm360-radius-md) var(--sm360-radius-md);
    text-decoration: none;
    transition: top var(--sm360-transition-fast);
}

.sm360-skip-link:focus {
    /* The header contains real controls at mobile widths. Keep the focused
       skip link visible without placing its high z-index hit target over a
       language/theme/profile control a keyboard user may next choose to click. */
    top: calc(var(--header-height) + var(--sm360-space-1));
    outline: 2px solid #006d65;
    outline-offset: 2px;
}

/* --- Focus-within Enhancements --- */
.sm360-card:focus-within {
    border-color: var(--sm360-teal);
    box-shadow: var(--sm360-shadow-md), 0 0 0 2px rgba(0, 169, 157, 0.15);
}

.sm360-form-group:focus-within .sm360-form-label {
    color: var(--sm360-teal);
}

.sm360-nav-item:focus-visible {
    outline: 2px solid var(--sm360-teal);
    outline-offset: -2px;
    border-radius: var(--sm360-radius-md);
}

/* --- Skeleton Loading --- */
/* sm360-sdk#461: grid placeholder rows keep the table's shape while data loads. */
.sm360-grid-skeleton-row {
    height: 2.25rem;
}

.sm360-grid-skeleton-cell {
    height: 0.85rem;
    min-width: 2rem;
}

.sm360-skeleton {
    position: relative;
    overflow: hidden;
    background: var(--sm360-bg-tertiary);
    border-radius: var(--sm360-radius-md);
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

.sm360-skeleton * {
    visibility: hidden;
}

.sm360-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 40%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.08) 60%,
        transparent 100%
    );
    animation: sm360-shimmer 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    /* No shimmer at all: the placeholder still marks the shape without movement. */
    .sm360-skeleton::after {
        animation: none;
        background: none;
    }
}

[data-theme="dark"] .sm360-skeleton::after {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.04) 40%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 60%,
        transparent 100%
    );
}

@keyframes sm360-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.sm360-skeleton-text {
    height: 0.875rem;
    margin-bottom: var(--sm360-space-2);
    border-radius: var(--sm360-radius-sm);
}

.sm360-skeleton-text:last-child {
    width: 60%;
}

.sm360-skeleton-heading {
    height: 1.5rem;
    width: 40%;
    margin-bottom: var(--sm360-space-4);
    border-radius: var(--sm360-radius-sm);
}

.sm360-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--sm360-radius-full);
}

.sm360-skeleton-btn {
    height: 36px;
    width: 100px;
    border-radius: var(--sm360-radius-md);
}

/* --- Fade-in Animation --- */
.sm360-fade-in {
    animation: sm360-fade-in 300ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.sm360-fade-in-up {
    animation: sm360-fade-in-up 300ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.sm360-fade-in-delay-1 { animation-delay: 50ms; }
.sm360-fade-in-delay-2 { animation-delay: 100ms; }
.sm360-fade-in-delay-3 { animation-delay: 150ms; }
.sm360-fade-in-delay-4 { animation-delay: 200ms; }

@keyframes sm360-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes sm360-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Enhanced Sidebar Transitions --- */
.sm360-sidebar {
    transition: transform var(--sm360-transition-slow),
                width var(--sm360-transition-slow);
}

.sm360-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--sm360-transition-normal),
                visibility var(--sm360-transition-normal);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sm360-sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* --- Responsive: Cards Grid --- */
@media (max-width: 768px) {
    .sm360-card-grid,
    .sm360-dashboard-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .sm360-widget {
        min-height: auto;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .sm360-card-grid,
    .sm360-dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* --- Responsive: Table Scroll Wrapper --- */
.sm360-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--sm360-radius-lg);
    border: 1px solid var(--sm360-border-primary);
}

.sm360-table-responsive .sm360-table {
    margin-bottom: 0;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .sm360-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-inline: calc(-1 * var(--sm360-space-4));
        padding-inline: var(--sm360-space-4);
    }

    .sm360-table-container .sm360-table {
        white-space: nowrap;
        min-width: 600px;
    }
}

/* --- Responsive: Page Headers --- */
@media (max-width: 480px) {
    .sm360-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sm360-space-3);
        padding-bottom: var(--sm360-space-4);
    }

    .sm360-page-header h1,
    .sm360-page-header h2 {
        font-size: 1.25rem;
    }

    .sm360-page-header .sm360-btn {
        width: 100%;
        justify-content: center;
    }
}

/* --- Responsive: Sidebar Transition Enhancement --- */
@media (max-width: 1024px) {
    .sm360-sidebar {
        transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
        will-change: transform;
    }

    .sm360-sidebar.open {
        box-shadow: var(--sm360-shadow-xl);
    }
}

/* --- Responsive: Filter Bar --- */
@media (max-width: 640px) {
    .sm360-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .sm360-filter-bar .sm360-btn {
        width: 100%;
        justify-content: center;
    }
}

/* --- Responsive: Header Actions --- */
@media (max-width: 480px) {
    .sm360-header {
        gap: var(--sm360-space-2);
    }

    .sm360-header-actions {
        gap: var(--sm360-space-1);
    }

    .sm360-header-actions .sm360-btn span {
        display: none;
    }
}

/* --- Print Styles Enhancement --- */
@media print {
    .sm360-sidebar,
    .sm360-sidebar-overlay,
    .sm360-header,
    .sm360-ai-fab,
    .sm360-ai-chat-panel,
    .sm360-mobile-toggle,
    .sm360-skip-link,
    .sm360-sidebar-toggle,
    .sm360-toast-container,
    .sm360-modal-overlay {
        display: none !important;
    }

    .sm360-main {
        margin-left: 0 !important;
    }

    .sm360-fade-in,
    .sm360-fade-in-up {
        animation: none !important;
        opacity: 1 !important;
    }

    .sm360-skeleton {
        background: var(--sm360-gray-100) !important;
    }

    .sm360-skeleton::after {
        animation: none !important;
        display: none !important;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.75rem;
        color: var(--sm360-gray-500);
    }

    .sm360-btn a[href]::after,
    .sm360-nav a[href]::after {
        content: none;
    }
}

/* ──────────────────────────────────────────────────────────────────────────
   Shared dashboard custom-chart widgets (funnel / waterfall / gantt / bullet /
   event-stream / timeline). Relocated from the Portal so consumer products get
   the exotic visualisations from the single-source SM360.UI dashboard.
   ────────────────────────────────────────────────────────────────────────── */

/* SVG chart widgets (funnel / waterfall / gantt) fill their widget body. */
.sm360-widget-svg {
    width: 100%;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Bullet / benchmark widget */
.sm360-bullet-chart {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-3);
    height: 100%;
    justify-content: center;
}

.sm360-bullet-item {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-1);
}

.sm360-bullet-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.sm360-bullet-name {
    color: var(--sm360-text-secondary);
    font-weight: 500;
}

.sm360-bullet-value {
    color: var(--sm360-text-primary);
    font-weight: 600;
}

.sm360-bullet-track {
    position: relative;
    height: 20px;
    background: var(--sm360-bg-secondary);
    border-radius: var(--sm360-radius-sm);
    overflow: hidden;
}

.sm360-bullet-range {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
}

.sm360-bullet-range.poor { background: var(--sm360-bg-tertiary); opacity: 0.3; }
.sm360-bullet-range.fair { background: var(--sm360-bg-tertiary); opacity: 0.2; }
.sm360-bullet-range.good { background: var(--sm360-bg-tertiary); opacity: 0.1; }

.sm360-bullet-bar {
    position: absolute;
    top: 4px;
    left: 0;
    height: 12px;
    background: var(--sm360-teal);
    border-radius: var(--sm360-radius-sm);
    transition: width 0.3s ease;
}

.sm360-bullet-marker {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--sm360-text-primary);
    border-radius: 1px;
    transform: translateX(-50%);
}

/* Event-stream widget */
.sm360-event-stream {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-1);
    overflow-y: auto;
    max-height: 100%;
}

.sm360-event-item {
    display: flex;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-2);
    border-radius: var(--sm360-radius-sm);
    transition: background-color var(--sm360-transition-fast);
}

.sm360-event-item:hover { background: var(--sm360-bg-tertiary); }

.sm360-event-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sm360-event-icon svg { width: 14px; height: 14px; }
.sm360-event-icon.success { background: var(--sm360-success-100); color: var(--sm360-success-text); }
.sm360-event-icon.info { background: var(--sm360-info-100); color: var(--sm360-info-text); }
.sm360-event-icon.warning { background: var(--sm360-warning-100); color: var(--sm360-warning-text); }
.sm360-event-icon.danger { background: var(--sm360-danger-100); color: var(--sm360-danger-text); }
.sm360-event-icon.neutral { background: var(--sm360-bg-tertiary); color: var(--sm360-text-muted); }

.sm360-event-content { flex: 1; min-width: 0; }

.sm360-event-message {
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
    line-height: 1.4;
}

.sm360-event-actor,
.sm360-event-target {
    font-weight: 500;
    color: var(--sm360-text-primary);
}

.sm360-event-time {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    margin-top: 2px;
}

/* Timeline widget */
.sm360-timeline {
    display: flex;
    flex-direction: column;
    padding-left: var(--sm360-space-4);
}

.sm360-timeline-item {
    display: flex;
    gap: var(--sm360-space-3);
    position: relative;
    padding-bottom: var(--sm360-space-4);
}

.sm360-timeline-item:last-child { padding-bottom: 0; }

.sm360-timeline-item::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 16px;
    bottom: 0;
    width: 2px;
    background: var(--sm360-border-primary);
}

.sm360-timeline-item:last-child::before { display: none; }

.sm360-timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.sm360-timeline-marker.success { background: var(--sm360-success); }
.sm360-timeline-marker.info { background: var(--sm360-info); }
.sm360-timeline-marker.warning { background: var(--sm360-warning); }
.sm360-timeline-marker.pending { background: var(--sm360-bg-secondary); border: 2px solid var(--sm360-border-secondary); }
.sm360-timeline-marker.neutral { background: var(--sm360-text-muted); }

.sm360-timeline-content { flex: 1; min-width: 0; }

.sm360-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sm360-space-2);
}

.sm360-timeline-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-text-primary);
}

.sm360-timeline-date {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    white-space: nowrap;
}

.sm360-timeline-description {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
    margin-top: 2px;
}

/* ============================================================
   Analytics surface (single-source Sm360AnalyticsDashboard /
   Sm360AnalyticsViewEditor / Sm360AnalyticsViewRenderer).
   Ported from the Portal's inline analytics page styles.
   ============================================================ */
.sm360-analytics-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--sm360-border-primary);
    flex-wrap: wrap;
}
.sm360-analytics-export {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sm360-analytics-export-label {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
}
.sm360-analytics-tab {
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--sm360-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.sm360-analytics-tab:hover {
    color: var(--sm360-text-primary);
}
.sm360-analytics-tab.active {
    color: var(--sm360-teal);
    border-bottom-color: var(--sm360-teal);
    font-weight: 600;
}

.sm360-analytics-section {
    margin-bottom: var(--sm360-space-6);
}

.sm360-analytics-view-grid,
.sm360-analytics-editor-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.sm360-analytics-editor-panel {
    border: 1px solid var(--sm360-border-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sm360-analytics-editor-panel-active {
    border-color: var(--sm360-teal);
    box-shadow: 0 0 0 1px var(--sm360-teal);
}

.sm360-analytics-metric-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sm360-analytics-metric-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--sm360-border-primary);
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.sm360-analytics-metric-tag:hover {
    border-color: var(--sm360-teal);
    color: var(--sm360-text-primary);
}
.sm360-analytics-metric-tag.selected {
    background: var(--sm360-teal);
    border-color: var(--sm360-teal);
    color: white;
}

/* ── DataHub surfaces ──────────────────────────────────────────────────────
   Shared by the source, measure and KPI lists rather than scoped to one of
   them, so every consumer's DataHub screens look the same.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-empty {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
    margin: 0;
}

.sm360-measure-note {
    display: block;
    font-size: 0.6875rem;
    color: var(--sm360-text-muted);
}
.sm360-measure-caution {
    color: var(--sm360-warning-text, #b45309);
}


.sm360-pill {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid var(--sm360-border-secondary);
    border-radius: 999px;
    padding: 0.125rem 0.5rem;
    color: var(--sm360-text-muted);
}

.sm360-pill-live {
    border-color: var(--sm360-success);
    color: var(--sm360-success-text);
}

.sm360-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: var(--sm360-space-3);
}

.sm360-kpi {
    border: 1px solid var(--sm360-border-primary);
    border-left-width: 3px;
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-surface);
    padding: var(--sm360-space-3);
    min-width: 0;
}

.sm360-kpi h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sm360-text-muted);
    margin: 0;
}

.sm360-kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: 0.25rem 0 0;
}

.sm360-kpi-target {
    font-size: 0.6875rem;
    color: var(--sm360-text-muted);
    margin: 0;
}

/*
    The verdict is the border, not the number. A KPI with no target stays neutral rather than
    borrowing the colour of a passing one — looking healthy without being measured is the failure
    this avoids.
*/
.sm360-kpi-good { border-left-color: var(--sm360-success); }
.sm360-kpi-watch { border-left-color: var(--sm360-warning); }
.sm360-kpi-bad { border-left-color: var(--sm360-danger); }
.sm360-kpi-notarget { border-left-color: var(--sm360-border-secondary); }

/* ── Moving a widget without a mouse ───────────────────────────────────────
   Dragging rearranges a dashboard quickly; these arrows do the same thing from
   the keyboard. They sit inside the cell so they travel with the widget.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-widget-move {
    display: flex;
    justify-content: flex-end;
    gap: 0.125rem;
    margin-bottom: 0.25rem;
}

.sm360-widget-move-btn {
    font: inherit;
    font-size: 0.75rem;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--sm360-radius-sm);
    background: transparent;
    color: var(--sm360-text-muted);
    padding: 0.1875rem 0.375rem;
    cursor: pointer;
}

.sm360-widget-move-btn:hover:not(:disabled) {
    border-color: var(--sm360-border-secondary);
    color: var(--sm360-text-primary);
}

.sm360-widget-move-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.sm360-widget-move-btn:focus-visible {
    outline: 2px solid var(--sm360-primary);
    outline-offset: 1px;
}

/* ── Alerts ───────────────────────────────────────────────────────────────
   Shared surfaces already ask for .sm360-alert when something fails; until now
   nothing defined it, so those messages rendered as unstyled paragraphs. One
   definition here reaches every component using it.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-alert {
    padding: var(--sm360-space-3) var(--sm360-space-4);
    border: 1px solid var(--sm360-border-primary);
    border-left-width: 3px;
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-primary);
    font-size: 0.875rem;
    margin-bottom: var(--sm360-space-4);
}

.sm360-alert-error { border-left-color: var(--sm360-danger); }
.sm360-alert-warning { border-left-color: var(--sm360-warning); }
.sm360-alert-success { border-left-color: var(--sm360-success); }

/* ── Choosing a report's views ─────────────────────────────────────────────
   The tools sit under the views themselves, so adding one shows up directly
   above where it lands.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-rb-view-tools {
    margin-top: var(--sm360-space-4);
    padding: var(--sm360-space-4);
}

.sm360-rb-view-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sm360-space-2);
}

/* ── A list that can be added to ───────────────────────────────────────────
   The action sits above the list, where the new row will appear.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-list-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--sm360-space-3);
}

.sm360-source-form {
    max-width: 32rem;
    margin-bottom: var(--sm360-space-5);
}

.sm360-source-form .sm360-form-hint {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    margin-top: var(--sm360-space-1);
}

.sm360-source-form__api {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sm360-space-4);
    max-width: 40rem;
    padding: var(--sm360-space-4);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    background: var(--sm360-bg-secondary);
}

.sm360-source-form__api p {
    margin: var(--sm360-space-1) 0 0;
    color: var(--sm360-text-muted);
    font-size: 0.875rem;
}

.sm360-form-actions {
    display: flex;
    gap: var(--sm360-space-2);
    margin-top: var(--sm360-space-4);
}

/* ── Importing a spreadsheet ───────────────────────────────────────────────
   Three states somebody can tell apart: choosing, reading, checking. The
   sample grid is the one place a horizontal scrollbar is right — a sheet is
   wider than the page and pretending otherwise would hide the columns being
   checked.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-import-busy {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-5);
    color: var(--sm360-text-secondary);
}

.sm360-import-choose {
    max-width: 32rem;
}

.sm360-import-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-2);
    margin-bottom: var(--sm360-space-3);
}

.sm360-import-note,
.sm360-import-count {
    color: var(--sm360-text-secondary);
    margin-bottom: var(--sm360-space-3);
}

.sm360-import-corrections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--sm360-space-3);
    margin-bottom: var(--sm360-space-4);
}

.sm360-import-sample {
    font-size: 0.8125rem;
}

.sm360-import-sample td,
.sm360-import-sample th {
    white-space: nowrap;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm360-import-rownum {
    color: var(--sm360-text-muted);
    font-weight: 500;
    text-align: right;
    background: var(--sm360-bg-secondary);
}

/* The row we read the periods from. A left edge in the accent rather than a wash behind it: the
   chips already name the row, so this only has to make it findable while scanning the grid. */
.sm360-import-headerrow th,
.sm360-import-headerrow td {
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--sm360-teal);
}

.sm360-linkish {
    font: inherit;
    background: none;
    border: none;
    padding: 0;
    color: var(--sm360-teal);
    cursor: pointer;
    text-decoration: underline;
}

.sm360-linkish:focus-visible {
    outline: 2px solid var(--sm360-teal);
    outline-offset: 2px;
}

/* A list item that opens a disclosure. It is a button, not a link: it turns a panel over in
   place rather than leaving the page, so it reads as the row's own title and the chevron says
   which way it will go. The chevron's turn follows the sidebar accordion's, without borrowing
   the sidebar's scoped colours or its nowrap/flyout rules. */
.sm360-disclosure {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    width: 100%;
    padding: var(--sm360-space-1) 0;
    border: none;
    background: none;
    color: var(--sm360-text-primary);
    font: inherit;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    transition: background var(--sm360-transition-fast), color var(--sm360-transition-fast);
}

.sm360-disclosure:hover {
    color: var(--sm360-teal);
}

.sm360-disclosure:focus-visible {
    outline: 2px solid var(--sm360-teal);
    outline-offset: 2px;
}

.sm360-disclosure-chevron {
    width: 14px;
    height: 14px;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform var(--sm360-transition-normal);
}

.sm360-disclosure[aria-expanded="true"] .sm360-disclosure-chevron {
    transform: rotate(90deg);
}

/* The shared help and knowledge surfaces are shipped with a class on each root and region, so a
   host can target the surface without reaching into an unstyled hook. They add no paint of their
   own beyond the block layout a div already has. */
.sm360-file-browser,
.sm360-help-article,
.sm360-knowledge-manager {
    display: block;
}

.sm360-file-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sm360-form-grid {
    display: grid;
    gap: var(--sm360-space-3);
}

/* ── Design-system burn-down ───────────────────────────────────────────────
   Classes and hooks that components used but no shipped sheet ever declared.
   The guard test fails on any sm360-* class a component uses that is neither
   defined below nor recorded as a hook, so this is the one place a deliberate
   hook is listed.
   ────────────────────────────────────────────────────────────────────────── */

/* Hooks — pure root or region names a host or test targets. They paint nothing
   of their own: the children carry the styling, or the markup supplies it
   inline. Do not remove one a host may target. This is a real rule the browser
   parses, but its body is empty, so a hook counts as shipped without painting
   anything. The guard reads this selector list as the hook definitions. */
.sm360-component,
.sm360-ai-assistant,
.sm360-metric-builder,
.sm360-tenant-benchmark-panel,
.sm360-user-management,
.sm360-impersonation-banner,
.sm360-claim-editor,
.sm360-brand-held-meaning,
.sm360-tag,
.sm360-tag-card,
.sm360-uq,
.sm360-uq-card,
.sm360-gm,
.sm360-td,
.sm360-catalog-browser,
.sm360-datahub-explorer,
.sm360-import,
.sm360-grid-skeleton-announce,
.sm360-local,
.sm360-source-value-preview,
.sm360-tenant-subscriptions-list,
.sm360-governed-widget,
.sm360-governed-analytics-widget,
.sm360-integration-manager,
.sm360-integrations-list,
.sm360-watch-inbox,
.sm360-where-are-we,
.sm360-expectation-calendar,
.sm360-persisted-ai-chat,
.sm360-ai-activity,
.sm360-ai-context-suggestions,
.sm360-search-dropdown,
.sm360-search-category,
.sm360-search-icon-sm,
.sm360-audit-digest-panel,
.sm360-kpi-grid,
.sm360-watch-toolbar,
.sm360-watch-overview,
.sm360-watch-resources,
.sm360-watch-alerts,
.sm360-watch-slos,
.sm360-watch-logs,
.sm360-watch-insights,
.sm360-watch-explore,
.sm360-watch-explore-results,
.sm360-watch-kql-ref,
.sm360-watch-kql-ref-item,
.sm360-billing-panel,
.sm360-bp-detail,
.sm360-tenant-language-manager,
.sm360-la,
.sm360-la-detail,
.sm360-analytics-custom-view,
.sm360-picker,
.sm360-shared-report,
.sm360-report-page,
.sm360-report-builder,
.sm360-saved-reports-grid,
.sm360-timeline--empty,
.sm360-watch-inbox--failed,
.sm360-watch-inbox--empty,
.sm360-where-are-we--empty,
.sm360-custom-fields-error,
.sm360-custom-fields-loading,
.sm360-custom-field-manager,
.sm360-custom-fields-status,
.sm360-custom-field-table,
.sm360-custom-field-editor,
.sm360-custom-field-actions,
.sm360-custom-field-group,
.sm360-custom-field-money,
.sm360-custom-field-address,
.sm360-custom-field-unsupported,
.sm360-custom-field-list-source {
}

/* A generic form/field label. Used by the Watch, Analytics and report forms as
   well as the status lines in the Watch-process views, so it is a shared utility
   rather than one component's. */
.sm360-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sm360-text-secondary);
    margin-bottom: var(--sm360-space-2);
}

/* The "Target:" caption beside the gauge's target value. */
.sm360-gauge-target-label {
    color: var(--sm360-text-muted);
    font-size: 0.75rem;
}

/* Monospace for the semantic field code, and a narrow column for the unit beside
   it. Both sit on top of .sm360-form-input in the import and local-resource
   wizards. */
.sm360-measure-code {
    font-family: var(--sm360-font-mono);
}

.sm360-measure-unit {
    max-width: 9rem;
}

/* The persisted AI chat's status line, "load earlier" control, citation list and
   the change confirmation. The chat's other surfaces live in the AI block above;
   these were referenced but never declared. */
.sm360-ai-chat-status {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-ai-load-earlier {
    display: block;
    margin: 0 auto var(--sm360-space-3);
    padding: var(--sm360-space-1) var(--sm360-space-3);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-full);
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-secondary);
    font-family: var(--sm360-font-sans);
    font-size: 0.75rem;
    cursor: pointer;
}

.sm360-ai-load-earlier:hover {
    border-color: var(--sm360-teal);
    color: var(--sm360-teal);
}

.sm360-ai-message-citations {
    margin-top: var(--sm360-space-2);
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-ai-message-citations ul {
    margin: var(--sm360-space-1) 0 0;
    padding-left: var(--sm360-space-4);
}

.sm360-ai-confirm {
    margin: var(--sm360-space-3);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    border: 1px solid var(--sm360-warning);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-warning-light);
    color: var(--sm360-text-secondary);
    font-size: 0.8125rem;
}

.sm360-ai-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--sm360-space-2);
    margin-top: var(--sm360-space-2);
}

.sm360-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── A report as a document ────────────────────────────────────────────────
   The one rendering the page, the export and a share link all use. It prints:
   the page breaks are here rather than in a separate print stylesheet, because
   a second stylesheet is a second thing to drift.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-doc {
    background: var(--sm360-bg-primary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: var(--sm360-space-6);
}

/* Frozen reports carry absolute, fingerprinted light and dark palettes. These aliases keep all
   existing report views on the shared semantic slots while isolating the document from later host
   brand changes. */
.sm360-doc-themed {
    --sm360-primary: var(--sm360-report-light-primary);
    --sm360-tenant-primary: var(--sm360-report-light-primary);
    --sm360-tenant-secondary: var(--sm360-report-light-secondary);
    --sm360-blue: var(--sm360-report-light-secondary);
    --sm360-accent: var(--sm360-report-light-accent);
    --sm360-bg-primary: var(--sm360-report-light-background);
    --sm360-bg-secondary: var(--sm360-report-light-surface);
    --sm360-bg-surface: var(--sm360-report-light-surface);
    --sm360-bg-tertiary: var(--sm360-report-light-surface);
    --sm360-border-primary: var(--sm360-report-light-border);
    --sm360-border-secondary: var(--sm360-report-light-border);
    --sm360-text-primary: var(--sm360-report-light-text);
    --sm360-text-secondary: var(--sm360-report-light-text-secondary);
    --sm360-text-muted: var(--sm360-report-light-text-muted);
    --sm360-teal: var(--sm360-report-light-accent);
    --sm360-teal-light: var(--sm360-report-light-chart-1);
    --sm360-teal-dark: var(--sm360-report-light-chart-2);
    --sm360-success: var(--sm360-report-light-success);
    --sm360-warning: var(--sm360-report-light-warning);
    --sm360-danger: var(--sm360-report-light-danger);
    --sm360-info: var(--sm360-report-light-info);
    --sm360-tenant-chart-1: var(--sm360-report-light-chart-1);
    --sm360-tenant-chart-2: var(--sm360-report-light-chart-2);
    --sm360-tenant-chart-3: var(--sm360-report-light-chart-3);
    --sm360-tenant-chart-4: var(--sm360-report-light-chart-4);
    --sm360-tenant-chart-5: var(--sm360-report-light-chart-5);
    --sm360-tenant-chart-6: var(--sm360-report-light-chart-6);
    --sm360-tenant-chart-7: var(--sm360-report-light-chart-7);
    --sm360-tenant-chart-8: var(--sm360-report-light-chart-8);
    font-family: var(--sm360-report-body-font);
}

[data-theme="dark"] .sm360-doc-themed {
    --sm360-primary: var(--sm360-report-dark-primary);
    --sm360-tenant-primary: var(--sm360-report-dark-primary);
    --sm360-tenant-secondary: var(--sm360-report-dark-secondary);
    --sm360-blue: var(--sm360-report-dark-secondary);
    --sm360-accent: var(--sm360-report-dark-accent);
    --sm360-bg-primary: var(--sm360-report-dark-background);
    --sm360-bg-secondary: var(--sm360-report-dark-surface);
    --sm360-bg-surface: var(--sm360-report-dark-surface);
    --sm360-bg-tertiary: var(--sm360-report-dark-surface);
    --sm360-border-primary: var(--sm360-report-dark-border);
    --sm360-border-secondary: var(--sm360-report-dark-border);
    --sm360-text-primary: var(--sm360-report-dark-text);
    --sm360-text-secondary: var(--sm360-report-dark-text-secondary);
    --sm360-text-muted: var(--sm360-report-dark-text-muted);
    --sm360-teal: var(--sm360-report-dark-accent);
    --sm360-teal-light: var(--sm360-report-dark-chart-1);
    --sm360-teal-dark: var(--sm360-report-dark-chart-2);
    --sm360-success: var(--sm360-report-dark-success);
    --sm360-warning: var(--sm360-report-dark-warning);
    --sm360-danger: var(--sm360-report-dark-danger);
    --sm360-info: var(--sm360-report-dark-info);
    --sm360-tenant-chart-1: var(--sm360-report-dark-chart-1);
    --sm360-tenant-chart-2: var(--sm360-report-dark-chart-2);
    --sm360-tenant-chart-3: var(--sm360-report-dark-chart-3);
    --sm360-tenant-chart-4: var(--sm360-report-dark-chart-4);
    --sm360-tenant-chart-5: var(--sm360-report-dark-chart-5);
    --sm360-tenant-chart-6: var(--sm360-report-dark-chart-6);
    --sm360-tenant-chart-7: var(--sm360-report-dark-chart-7);
    --sm360-tenant-chart-8: var(--sm360-report-dark-chart-8);
}

.sm360-doc-themed :is(h1, h2, h3, h4, h5, h6) {
    font-family: var(--sm360-report-heading-font);
}

.sm360-doc-density-compact { padding: var(--sm360-space-4); }
.sm360-doc-density-comfortable { padding: var(--sm360-space-8); }

.sm360-doc-theme-error {
    padding: var(--sm360-space-4);
    border: 1px solid var(--sm360-danger);
    border-radius: var(--sm360-radius-md);
    color: var(--sm360-danger-text);
    background: var(--sm360-danger-light);
}

.sm360-doc-head {
    border-bottom: 2px solid var(--sm360-teal);
    padding-bottom: var(--sm360-space-4);
    margin-bottom: var(--sm360-space-5);
}

.sm360-doc-marks {
    display: flex;
    justify-content: space-between;
    gap: var(--sm360-space-4);
    margin-bottom: var(--sm360-space-3);
}

.sm360-doc-mark {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sm360-text-secondary);
}

.sm360-doc-mark-right { text-align: right; }

.sm360-doc-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--sm360-space-1);
    color: var(--sm360-text-primary);
}

.sm360-doc-subtitle {
    margin: 0 0 var(--sm360-space-3);
    color: var(--sm360-text-secondary);
}

/* Small, and deliberately not hidden behind a disclosure: a person should not have to
   go looking for what the numbers were filtered to. */
.sm360-doc-provenance {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-1) var(--sm360-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-doc-foot {
    display: flex;
    justify-content: space-between;
    gap: var(--sm360-space-4);
    flex-wrap: wrap;
    margin-top: var(--sm360-space-5);
    padding-top: var(--sm360-space-3);
    border-top: 1px solid var(--sm360-border-primary);
    font-size: 0.6875rem;
    color: var(--sm360-text-muted);
}

@media print {
    /* Everything that is chrome rather than the document goes, so what prints is what was read. */
    .sm360-topbar,
    .sm360-sidebar,
    .sm360-page-header,
    .sm360-doc-actions,
    .sm360-ai-launcher { display: none !important; }

    .sm360-doc {
        border: none;
        padding: 0;
    }

    /* Paper has its own margins, so screen breathing room is halved rather than doubled. */
    .sm360-doc .sm360-doc-head {
        padding-bottom: var(--sm360-space-2);
        margin-bottom: var(--sm360-space-2);
        break-after: avoid;
        break-inside: avoid;
    }

    .sm360-doc .sm360-doc-subtitle { margin-bottom: var(--sm360-space-2); }

    /* Component-scoped rules carry an attribute selector, so these name the document as well. */
    .sm360-doc .sm360-report-views:has(> .sm360-view) { gap: var(--sm360-space-1); }

    .sm360-doc .sm360-report-views > .sm360-view {
        padding: var(--sm360-space-1) var(--sm360-space-3);
        break-inside: avoid;
    }

    /* A table may continue on the next page, but its heading never stays behind on this one,
       its column headers repeat, and no single row is cut in half. */
    .sm360-doc .sm360-report-views > .sm360-view:has(table) { break-inside: auto; }

    .sm360-doc .sm360-report-views .sm360-view-head {
        margin-bottom: var(--sm360-space-1);
        break-after: avoid;
        break-inside: avoid;
    }

    .sm360-doc .sm360-report-views .sm360-figures { gap: var(--sm360-space-1); }

    .sm360-doc .sm360-report-views .sm360-table-frame {
        overflow: visible;
    }

    .sm360-doc table thead { display: table-header-group; }

    .sm360-doc table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .sm360-doc .sm360-table th {
        position: static;
        padding: var(--sm360-space-1) var(--sm360-space-2);
    }

    .sm360-doc .sm360-table td {
        padding: var(--sm360-space-1) var(--sm360-space-2);
    }

    .sm360-doc .sm360-report-views .sm360-view-note { margin-top: var(--sm360-space-1); }

    .sm360-doc .sm360-doc-foot {
        margin-top: var(--sm360-space-2);
        padding-top: var(--sm360-space-1);
        break-inside: avoid;
    }
}

.sm360-doc-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--sm360-space-2);
    margin-bottom: var(--sm360-space-3);
}

.sm360-doc-loading {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-6);
    color: var(--sm360-text-secondary);
}

/* ── Sharing a report ──────────────────────────────────────────────────────
   Who can open it, what they get, and what they may do with it — in that
   order, because the middle one is the one people do not expect.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-share { max-width: 30rem; }

.sm360-share-fact {
    background: var(--sm360-bg-secondary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    margin-bottom: var(--sm360-space-4);
}

.sm360-share-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sm360-text-muted);
    margin-bottom: 0.125rem;
}

.sm360-share-value {
    display: block;
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-share-why {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    margin: var(--sm360-space-2) 0 0;
}

.sm360-share-formats {
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    margin: 0 0 var(--sm360-space-4);
}

.sm360-share-format {
    display: flex;
    align-items: baseline;
    gap: var(--sm360-space-2);
    padding: 0.25rem 0;
    cursor: pointer;
}

/* A format the report forbids stays visible, dimmed, carrying its reason — the same rule the
   add-a-view picker follows, so an absence is never left to be guessed at. */
.sm360-share-format-off {
    opacity: 0.55;
    cursor: not-allowed;
}

.sm360-share-format-why {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-share-made {
    background: var(--sm360-bg-secondary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: var(--sm360-space-3) var(--sm360-space-4);
}

.sm360-share-link {
    display: block;
    font-size: 0.75rem;
    word-break: break-all;
    margin-bottom: var(--sm360-space-3);
    color: var(--sm360-text-primary);
}

.sm360-share-made .sm360-share-link:last-child { margin-bottom: 0; }

/* ── What a report may be exported as ─────────────────────────────────────── */

.sm360-exports {
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    margin: 0 0 var(--sm360-space-4);
}

.sm360-exports-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-2);
}

.sm360-export-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-full);
    cursor: pointer;
    font-size: 0.8125rem;
}

.sm360-export-on {
    border-color: var(--sm360-teal);
    background: var(--sm360-bg-secondary);
}

.sm360-export-state {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sm360-text-muted);
}

.sm360-export-on .sm360-export-state {
    color: var(--sm360-text-primary);
    font-weight: 600;
}

.sm360-export-off {
    color: var(--sm360-text-muted);
    cursor: not-allowed;
}

.sm360-export-why {
    color: var(--sm360-text-muted);
    font-size: 0.6875rem;
}

/* ── The five questions an import asks ────────────────────────────────────── */

.sm360-steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-2);
    list-style: none;
    margin: 0 0 var(--sm360-space-5);
    padding: 0;
}

.sm360-step {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex: 1 1 9rem;
    min-width: 9rem;
    padding: var(--sm360-space-2) var(--sm360-space-3);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-primary);
}

.sm360-step-num {
    flex: none;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid var(--sm360-border-secondary);
    color: var(--sm360-text-muted);
}

.sm360-step-text { display: flex; flex-direction: column; min-width: 0; }

.sm360-step-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sm360-text-primary);
}

.sm360-step-hint {
    font-size: 0.6875rem;
    color: var(--sm360-text-muted);
}

.sm360-step-now {
    border-color: var(--sm360-teal);
    background: var(--sm360-bg-secondary);
}

.sm360-step-now .sm360-step-num {
    border-color: var(--sm360-teal);
    color: var(--sm360-teal);
}

.sm360-step-done .sm360-step-num {
    border-color: var(--sm360-teal);
    background: var(--sm360-teal);
    color: var(--sm360-bg-primary);
}

/* A step not yet reached is quiet, but not invisible: seeing what is still to come is the point. */
.sm360-step-later .sm360-step-name { color: var(--sm360-text-muted); font-weight: 500; }

/* ── The sheet, as it was written ─────────────────────────────────────────────
   The spreadsheet's own coordinates, so checking our reading against the file
   means comparing "column B" with "column B". This is the one place a
   horizontal scrollbar is right: a sheet is wider than the page, and hiding
   that would hide the columns being checked.
   ────────────────────────────────────────────────────────────────────────── */

.sm360-sheet-frame {
    overflow-x: auto;
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-primary);
    margin-bottom: var(--sm360-space-4);
}

.sm360-sheet {
    border-collapse: collapse;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sm360-sheet th,
.sm360-sheet td {
    border: 1px solid var(--sm360-border-primary);
    padding: 0.25rem 0.5rem;
    text-align: left;
    max-width: 13rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The spreadsheet's own furniture: letters across, numbers down, both quiet. */
.sm360-sheet thead th,
.sm360-sheet-rownum,
.sm360-sheet-corner {
    background: var(--sm360-bg-secondary);
    color: var(--sm360-text-muted);
    font-weight: 500;
    font-size: 0.6875rem;
    text-align: center;
    position: sticky;
    left: 0;
}

.sm360-sheet thead th { position: static; }
.sm360-sheet-corner { position: sticky; left: 0; }

/* Where the periods were read from, and the two columns the chips name. */
.sm360-sheet-headerrow td,
.sm360-sheet-headerrow th {
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--sm360-teal);
}

.sm360-sheet-names { background: var(--sm360-bg-secondary); }
.sm360-sheet-units { background: var(--sm360-bg-tertiary); }

.sm360-import-table-preview thead th:not(.sm360-sheet-corner) {
    min-width: 8rem;
    text-align: left;
}

.sm360-import-source-column,
.sm360-import-field-coordinate {
    display: inline-block;
    margin-right: var(--sm360-space-2);
    color: var(--sm360-text-muted);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}

.sm360-import-fields {
    max-height: 24rem;
    overflow: auto;
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-primary);
    margin-bottom: var(--sm360-space-4);
}

.sm360-import-field {
    display: grid;
    grid-template-columns: minmax(2rem, auto) minmax(10rem, 1fr) auto;
    align-items: center;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-2) var(--sm360-space-3);
    border-bottom: 1px solid var(--sm360-border-primary);
}

.sm360-import-field:last-child { border-bottom: 0; }
.sm360-import-field-name { overflow-wrap: anywhere; }

/* ── The import, as five questions ────────────────────────────────────────── */

.sm360-import-q {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 var(--sm360-space-2);
    color: var(--sm360-text-primary);
}

.sm360-sheet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem;
    margin-bottom: var(--sm360-space-3);
    border-bottom: 1px solid var(--sm360-border-primary);
}

.sm360-sheet-tab {
    font: inherit;
    font-size: 0.8125rem;
    background: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--sm360-radius-sm) var(--sm360-radius-sm) 0 0;
    padding: 0.375rem 0.75rem;
    margin-bottom: -1px;
    color: var(--sm360-text-muted);
    cursor: pointer;
}

.sm360-sheet-tab-on {
    border-color: var(--sm360-border-primary);
    background: var(--sm360-bg-primary);
    color: var(--sm360-text-primary);
    font-weight: 600;
}

.sm360-import-group {
    background: var(--sm360-bg-secondary);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    margin-bottom: var(--sm360-space-3);
}

/* Corrections read as things somebody might say, so the common case — every guess right —
   stays a page with no form on it at all. */
.sm360-fixes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sm360-space-2);
    margin-bottom: var(--sm360-space-3);
}

.sm360-fixes-label {
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
}

.sm360-fix {
    font: inherit;
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border: 1px dashed var(--sm360-border-secondary);
    border-radius: var(--sm360-radius-full);
    background: none;
    color: var(--sm360-text-secondary);
    cursor: pointer;
}

.sm360-fix:hover { border-color: var(--sm360-teal); color: var(--sm360-teal); }

.sm360-fix-open {
    border-style: solid;
    border-color: var(--sm360-teal);
    color: var(--sm360-teal);
    background: var(--sm360-bg-secondary);
}

.sm360-fix-panel {
    max-width: 22rem;
    margin-bottom: var(--sm360-space-4);
}

.sm360-check {
    display: flex;
    align-items: flex-start;
    gap: var(--sm360-space-2);
    margin-bottom: var(--sm360-space-3);
    cursor: pointer;
}

.sm360-measures {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-2);
    margin-bottom: var(--sm360-space-4);
}

.sm360-measure-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) 7rem minmax(12rem, 1.2fr);
    gap: var(--sm360-space-2);
    align-items: center;
}

@media (max-width: 40rem) {
    .sm360-measure-row { grid-template-columns: 1fr; }
}

.sm360-measure-name { font-weight: 600; }

/* A chart with nothing to plot says so. An empty grid reads as "the value is zero", which is a
   different and much worse claim than "there is nothing here". */
.sm360-view-empty {
    color: var(--sm360-text-muted);
    font-size: 0.875rem;
    padding: var(--sm360-space-4) 0;
    margin: 0;
}

/* ── Views that are not charts ────────────────────────────────────────────── */

.sm360-num { text-align: right; font-variant-numeric: tabular-nums; }
.sm360-up { color: var(--sm360-success-text); }
.sm360-down { color: var(--sm360-danger-text); }

.sm360-changed-headline {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 var(--sm360-space-1);
    color: var(--sm360-text-primary);
}

.sm360-changed-narrative {
    margin: 0 0 var(--sm360-space-3);
    color: var(--sm360-text-secondary);
}

/* A refusal is the common answer here, so it reads as an explanation rather than an error. */
.sm360-forecast-refusal {
    padding: var(--sm360-space-3) var(--sm360-space-4);
    border: 1px solid var(--sm360-border-primary);
    border-left: 3px solid var(--sm360-warning);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-secondary);
    color: var(--sm360-text-secondary);
    margin: 0;
}

.sm360-forecast-method {
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
    margin: 0 0 var(--sm360-space-3);
}

.sm360-matrix-rule { color: var(--sm360-text-muted); font-size: 0.8125rem; }

/* A figure with its trend beneath it: the number is read, the line only says whether it has been
   going that way for a while. */
.sm360-spark {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-2);
    color: var(--sm360-teal);
}

.sm360-spark-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sm360-text-primary);
    font-variant-numeric: tabular-nums;
}

.sm360-spark-line { width: 100%; height: 2.25rem; display: block; }

.sm360-multiples {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: var(--sm360-space-2);
}

.sm360-multiple {
    display: flex;
    flex-direction: column;
    padding: var(--sm360-space-3);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-secondary);
}

.sm360-multiple-name {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sm360-text-muted);
}

.sm360-multiple-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--sm360-text-primary);
}

.sm360-multiple-unit { font-size: 0.75rem; color: var(--sm360-text-muted); }

.sm360-limit { display: flex; flex-direction: column; gap: var(--sm360-space-2); }

.sm360-limit-figures { display: flex; align-items: baseline; gap: var(--sm360-space-2); }

.sm360-limit-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--sm360-text-primary);
}

.sm360-limit-of { color: var(--sm360-text-muted); font-size: 0.8125rem; }

.sm360-limit-track {
    height: 0.5rem;
    border-radius: var(--sm360-radius-full);
    background: var(--sm360-bg-tertiary);
    overflow: hidden;
}

.sm360-limit-fill { height: 100%; background: var(--sm360-teal); }

.sm360-limit-note { font-size: 0.75rem; color: var(--sm360-text-muted); }

/* ── Allowing this product's own data ─────────────────────────────────────── */

.sm360-kinds {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--sm360-space-2);
    margin-bottom: var(--sm360-space-4);
}

.sm360-kind {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    text-align: left;
    font: inherit;
    padding: var(--sm360-space-3);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-primary);
    cursor: pointer;
}

.sm360-kind-on { border-color: var(--sm360-teal); background: var(--sm360-bg-secondary); }
.sm360-kind-name { font-weight: 600; color: var(--sm360-text-primary); }
.sm360-kind-desc { font-size: 0.75rem; color: var(--sm360-text-muted); }

.sm360-sql {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre;
    overflow-x: auto;
}

/* The rules as they are met, so somebody satisfies them while typing rather than after a save. */
.sm360-checks {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin: var(--sm360-space-3) 0;
    font-size: 0.8125rem;
}

.sm360-check-met { color: var(--sm360-success-text); }
.sm360-check-unmet { color: var(--sm360-text-muted); }

.sm360-complaints {
    margin: 0 0 var(--sm360-space-3);
    padding-left: 1.25rem;
    color: var(--sm360-danger-text);
    font-size: 0.8125rem;
}

.sm360-params {
    padding: var(--sm360-space-3);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-secondary);
    margin-bottom: var(--sm360-space-4);
}

.sm360-param {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    margin-right: 0.25rem;
    border-radius: var(--sm360-radius-sm);
    background: var(--sm360-bg-tertiary);
}

/* ── Waterfall, treemap, funnel, strip, calendar ──────────────────────────── */

.sm360-waterfall { display: flex; flex-direction: column; gap: 0.25rem; }

.sm360-fall {
    display: grid;
    grid-template-columns: minmax(6rem, 1fr) 2fr auto;
    gap: var(--sm360-space-2);
    align-items: center;
    font-size: 0.8125rem;
}

.sm360-fall-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sm360-fall-track {
    height: 0.75rem;
    background: var(--sm360-bg-tertiary);
    border-radius: var(--sm360-radius-sm);
    overflow: hidden;
}

.sm360-fall-bar { display: block; height: 100%; }
.sm360-fall-up { background: var(--sm360-success); }
.sm360-fall-down { background: var(--sm360-danger); }

.sm360-fall-total {
    border-top: 1px solid var(--sm360-border-primary);
    margin-top: 0.25rem;
    padding-top: 0.375rem;
    font-weight: 600;
}

/* Rows rather than squarified: order is what makes a treemap legible at a glance. */
.sm360-treemap {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    min-height: 9rem;
}

.sm360-tile {
    flex-basis: 6rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--sm360-space-2);
    border-radius: var(--sm360-radius-sm);
    background: var(--sm360-teal);
    color: var(--sm360-bg-primary);
    overflow: hidden;
}

.sm360-tile:nth-child(2n) { background: var(--sm360-teal-dark); }
.sm360-tile:nth-child(3n) { background: var(--sm360-blue, var(--sm360-teal)); }

.sm360-tile-name {
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm360-tile-share { font-size: 0.6875rem; opacity: 0.85; }

.sm360-funnel { display: flex; flex-direction: column; gap: 0.375rem; }

.sm360-funnel-stage {
    display: grid;
    grid-template-columns: minmax(6rem, 1fr) 2fr auto auto;
    gap: var(--sm360-space-2);
    align-items: center;
    font-size: 0.8125rem;
}

.sm360-funnel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sm360-funnel-track {
    height: 1rem;
    background: var(--sm360-bg-tertiary);
    border-radius: var(--sm360-radius-sm);
    overflow: hidden;
}

.sm360-funnel-bar { display: block; height: 100%; background: var(--sm360-teal); }
.sm360-funnel-drop { color: var(--sm360-text-muted); font-size: 0.75rem; white-space: nowrap; }

.sm360-strip { display: flex; flex-wrap: wrap; gap: 2px; }

.sm360-strip-cell {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
    display: inline-block;
    background: var(--sm360-bg-tertiary);
}

.sm360-strip-low { background: var(--sm360-bg-tertiary); }
.sm360-strip-mid-low { background: var(--sm360-teal-light, var(--sm360-teal)); opacity: 0.45; }
.sm360-strip-mid-high { background: var(--sm360-teal); opacity: 0.7; }
.sm360-strip-high { background: var(--sm360-teal); }

.sm360-strip-legend {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--sm360-text-muted);
    margin: var(--sm360-space-2) 0 0;
}

.sm360-calendar { width: 100%; border-collapse: collapse; }

.sm360-calendar th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sm360-text-muted);
    font-weight: 500;
    padding-bottom: 0.25rem;
}

.sm360-calendar td { text-align: center; padding: 0.125rem; }

.sm360-cal-cell {
    display: block;
    height: 2rem;
    border-radius: var(--sm360-radius-sm);
    background: var(--sm360-teal);
}

.sm360-cal-figure { font-size: 0.6875rem; color: var(--sm360-text-muted); }

/* A view whose data is genuinely absent says which, rather than rendering an empty panel. */
.sm360-needs {
    padding: var(--sm360-space-4);
    border: 1px dashed var(--sm360-border-secondary);
    border-radius: var(--sm360-radius-md);
}

.sm360-needs-what { margin: 0 0 0.25rem; font-weight: 600; color: var(--sm360-text-primary); }
.sm360-needs-why { margin: 0; font-size: 0.8125rem; color: var(--sm360-text-muted); }

.sm360-refresh { max-width: 20rem; }

.sm360-share-panel { padding: var(--sm360-space-5); margin-bottom: var(--sm360-space-4); }

/* ── The filters a reader can change without editing the report ───────────── */

.sm360-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-3) var(--sm360-space-4);
    margin-bottom: var(--sm360-space-3);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-secondary);
}

.sm360-filter { display: flex; flex-direction: column; gap: 0.125rem; }

.sm360-filter-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sm360-text-muted);
}

.sm360-filter-reset { font-size: 0.8125rem; align-self: center; }

@media print {
    /* The filters print as the provenance line, not as controls nobody can use on paper. */
    .sm360-filters { display: none !important; }
}

.sm360-schedule { max-width: 30rem; }

/* ── Inviting people to a share ───────────────────────────────────────────── */

.sm360-invite {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: var(--sm360-space-2);
    align-items: center;
}

@media (max-width: 34rem) {
    .sm360-invite { grid-template-columns: 1fr; }
}

.sm360-recipients {
    list-style: none;
    margin: var(--sm360-space-2) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sm360-recipients li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sm360-space-2);
    padding: 0.25rem var(--sm360-space-2);
    border-radius: var(--sm360-radius-sm);
    background: var(--sm360-bg-secondary);
    font-size: 0.8125rem;
}

/* ── A share being prepared ───────────────────────────────────────────────── */

.sm360-share-preparing {
    padding: var(--sm360-space-3) var(--sm360-space-4);
    border: 1px solid var(--sm360-border-primary);
    border-left: 3px solid var(--sm360-teal);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-secondary);
    margin: 0 0 var(--sm360-space-4);
}

.sm360-share-url {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    margin-bottom: 0.25rem;
}

.sm360-share-url code {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    padding: 0.375rem var(--sm360-space-2);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-sm);
    background: var(--sm360-bg-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
}

.sm360-share-states {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-4);
    margin: var(--sm360-space-3) 0 0;
}

.sm360-share-states dt {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sm360-text-muted);
}

.sm360-share-states dd { margin: 0; font-weight: 600; }

/* Floating chat window (sm360-chat-window.js): a small window above its launcher that the user drags by
   the header or launcher and resizes from the top and left edges. Position and size are set inline. */
html[data-sm360-chat-window] .sm360-ai-chat {
    top: auto;
    left: auto;
    right: 24px;
    bottom: 108px;
    width: 380px;
    height: 560px;
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-xl);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity var(--sm360-transition-normal) ease, transform var(--sm360-transition-normal) ease,
        visibility 0s linear var(--sm360-transition-normal);
}

html[data-sm360-chat-window] .sm360-ai-chat.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: opacity var(--sm360-transition-normal) ease, transform var(--sm360-transition-normal) ease;
}

html[data-sm360-chat-window] .sm360-ai-chat-header {
    cursor: move;
    touch-action: none;
    user-select: none;
}

html[data-sm360-chat-window] .sm360-ai-chat-header button {
    cursor: pointer;
}

.sm360-ai-chat-resize {
    position: absolute;
    z-index: 1;
    touch-action: none;
}

.sm360-ai-chat-resize[data-edge="top"] { top: 0; left: 20px; right: 0; height: 8px; cursor: ns-resize; }
.sm360-ai-chat-resize[data-edge="left"] { top: 20px; left: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.sm360-ai-chat-resize[data-edge="corner"] { top: 0; left: 0; width: 20px; height: 20px; cursor: nwse-resize; }

html[data-sm360-chat-moving] .sm360-ai-chat,
html[data-sm360-chat-moving] .sm360-ai-chat *,
html[data-sm360-chat-moving] .sm360-ai-fab {
    transition: none !important;
    user-select: none;
}

html[data-sm360-chat-moving] .sm360-ai-fab {
    cursor: grabbing;
}

html[data-sm360-chat-window] .sm360-ai-fab,
html[data-sm360-chat-window] .sm360-ai-fab:hover {
    cursor: grab;
    transform: none;
}

/* Guided walkthrough (sm360-guide.js): above modal backdrops (2000) so a dialog step stays visible;
   the bubble is positioned outside an open AI chat panel, never over it. */
.sm360-guide-pointer {
    position: fixed;
    width: 22px;
    height: 22px;
    margin: -4px 0 0 -4px;
    z-index: 2002;
    pointer-events: none;
    opacity: 0;
    transition-property: left, top, opacity;
    transition-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
    background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l15 9-6.5 1.5L9 19z' fill='white' stroke='%23111827' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E");
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.sm360-guide-pointer.visible {
    opacity: 1;
}

.sm360-guide-target {
    outline: 3px solid var(--sm360-primary, #0d9488);
    outline-offset: 4px;
    border-radius: 0.5rem;
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--sm360-primary, #0d9488) 22%, transparent);
    position: relative;
    z-index: 2001;
}

.sm360-guide-bubble {
    position: fixed;
    z-index: 2002;
    max-width: 320px;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: var(--sm360-bg-primary, #111827);
    color: var(--sm360-text-primary, #f9fafb);
    border: 1px solid var(--sm360-border-primary, rgba(255, 255, 255, 0.12));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

.sm360-guide-bubble.visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.sm360-guide-progress {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.sm360-guide-tip {
    margin: 0 0 0.75rem;
    line-height: 1.45;
}

.sm360-guide-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.sm360-guide-hint {
    font-size: 0.8125rem;
    opacity: 0.8;
    margin-left: auto;
}

.sm360-guide-button {
    border: 1px solid var(--sm360-border-primary, rgba(255, 255, 255, 0.2));
    background: transparent;
    color: inherit;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
}

.sm360-guide-button-primary {
    background: var(--sm360-primary, #0d9488);
    border-color: var(--sm360-primary, #0d9488);
    color: #fff;
}

/* Record mode's indicator, drawn by sm360-guide.js on every page so a recording survives a
   navigation the Blazor layout never re-renders. */
.sm360-guide-recording {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2002;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: var(--sm360-bg-primary, #111827);
    color: var(--sm360-text-primary, #f9fafb);
    border: 1px solid var(--sm360-border-primary, rgba(255, 255, 255, 0.12));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.sm360-guide-recording-label {
    font-size: 0.875rem;
    white-space: nowrap;
}

/* A lightweight recording message, drawn by sm360-guide.js without touching a running walkthrough:
   it sits clear of the guide bubble and the indicator, and a click on it is never recorded. */
.sm360-guide-recording-notice {
    position: fixed;
    left: 50%;
    bottom: 5rem;
    transform: translateX(-50%);
    z-index: 2003;
    max-width: min(32rem, calc(100vw - 2rem));
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--sm360-bg-primary, #111827);
    color: var(--sm360-text-primary, #f9fafb);
    border: 1px solid var(--sm360-border-primary, rgba(255, 255, 255, 0.12));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    font-size: 0.875rem;
}

@media (prefers-reduced-motion: reduce) {
    .sm360-guide-pointer,
    .sm360-guide-bubble {
        transition: none;
    }
}

/* Incomplete results, shown above the data rather than replacing it. */
.sm360-partial-results {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(234, 179, 8, 0.10);
    border: 1px solid rgba(234, 179, 8, 0.35);
    color: #a16207;
    font-size: 0.8125rem;
    margin-bottom: 16px;
}

.sm360-partial-results-icon { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.sm360-partial-results-retry { margin-left: 10px; padding: 2px 10px; font-size: 0.75rem; }

/* A page-level figure: label, value, optional icon. Not a dashboard widget. */
.sm360-stat-card { display: flex; align-items: center; gap: var(--sm360-space-3); padding: var(--sm360-space-4); border-radius: var(--sm360-radius-md); background: var(--sm360-bg-primary); border: 1px solid var(--sm360-border-primary); }
.sm360-stat-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.sm360-stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm360-stat-label { font-size: 0.75rem; color: var(--sm360-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sm360-stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.sm360-stat-caption { font-size: 0.75rem; color: var(--sm360-text-muted); }

/* A grid's totals row, rendered from the rows currently on screen. */
.sm360-grid-totals td { font-weight: 600; border-top: 2px solid var(--sm360-border-primary); }

/* ============================================
   Theme-pack utilities (theme packs, rule 5: glow and motion belong to live values only)
   ============================================ */

/* Figures — money, weight, quantity, time, codes — are set in the pack's figure face with tabular
   numerals so a column of them lines up and a changing one does not jitter. */
.sm360-figure {
    font-family: var(--sm360-font-mono);
    font-variant-numeric: tabular-nums;
}

/* A figure bound to a live value: glows while it is live and rolls when it changes. Remove the
   class (or add .is-stale) when the value is stale; show "as of 14:02" instead of a spinner.
   Set data-changed="true" for one beat when the value changes to roll it. */
.sm360-live {
    font-family: var(--sm360-font-mono);
    font-variant-numeric: tabular-nums;
    text-shadow: var(--sm360-glow);
}

.sm360-live.is-stale {
    text-shadow: none;
}

.sm360-live[data-changed="true"] {
    display: inline-block;
    animation: sm360-figure-roll calc(var(--sm360-figure-roll) * var(--sm360-roll-duration)) var(--sm360-roll-ease);
}

@keyframes sm360-figure-roll {
    from { transform: translateY(45%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* The assistant is working on, or has proposed something for, this surface: a 2 px assist edge.
   Steady with a proposal waiting; pulsing while working, and only in a pack that has motion. */
.sm360-assist-edge {
    border-inline-start: 2px solid var(--sm360-assist);
}

.sm360-assist-edge[data-state="working"] {
    animation: sm360-assist-pulse calc(var(--sm360-motion-on) * 2400ms) ease-in-out infinite;
}

@keyframes sm360-assist-pulse {
    0%, 100% { border-inline-start-color: var(--sm360-assist); }
    50% { border-inline-start-color: var(--sm360-assist-wash); }
}

/* prefers-reduced-motion removes all motion and all glow. */
@media (prefers-reduced-motion: reduce) {
    .sm360-live {
        text-shadow: none;
    }

    .sm360-live[data-changed="true"],
    .sm360-assist-edge[data-state="working"] {
        animation: none;
    }
}

/* --- Proposal family (Sm360Proposal, Sm360ExplainLine, Sm360AutonomyDial, Sm360LiveFigure, Sm360ComingSoon) ---
   Same anatomy in every pack; the pack changes tokens only. The primary action is the locked go
   (.sm360-btn-primary) and is never repainted here. "Needs your OK" is assist-text (the system's voice
   asking); "Can undo" is ink-dim. Amber and red are not used: amber means money changed automatically and
   red means a decision is blocking. */
.sm360-explain {
    display: block;
    font-family: var(--sm360-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sm360-live-asof {
    margin-inline-start: var(--sm360-space-2);
    font-family: var(--sm360-font-mono);
    font-size: 0.75rem;
    color: var(--sm360-text-secondary);
}

.sm360-proposal {
    display: grid;
    gap: var(--sm360-space-3);
    padding: var(--sm360-space-4) var(--sm360-space-5);
    background: var(--sm360-bg-primary);
    border: var(--sm360-border-width) solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-depth);
    color: var(--sm360-text-primary);
    min-width: 0;
}

.sm360-proposal-title {
    margin: 0;
    font-family: var(--sm360-font-sans);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
}

.sm360-proposal-explain {
    min-width: 0;
}

.sm360-proposal-figure {
    font-size: 1.375rem;
    font-weight: 600;
}

.sm360-proposal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-2);
    align-items: center;
}

.sm360-proposal-dial {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--sm360-space-2);
}

.sm360-proposal-consequence {
    font-size: 0.8125rem;
    font-weight: 600;
}

.sm360-proposal-consequence[data-consequence="needs-ok"] {
    color: var(--sm360-assist-text);
}

.sm360-proposal-consequence[data-consequence="can-undo"] {
    color: var(--sm360-text-secondary);
}

.sm360-proposal-done {
    display: flex;
    gap: var(--sm360-space-2);
    align-items: baseline;
    font-family: var(--sm360-font-mono);
    font-size: 0.8125rem;
    color: var(--sm360-text-muted);
}

.sm360-proposal-undo {
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: var(--sm360-text-secondary);
    text-decoration: underline;
    cursor: pointer;
}

.sm360-autonomy {
    display: grid;
    gap: var(--sm360-space-2);
    min-width: 0;
}

.sm360-autonomy-group {
    display: inline-flex;
    border: var(--sm360-border-width) solid var(--sm360-control-border);
    border-radius: var(--sm360-radius-md);
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
}

.sm360-autonomy-option {
    padding: var(--sm360-space-1) var(--sm360-space-3);
    background: transparent;
    border: 0;
    border-inline-end: var(--sm360-border-width) solid var(--sm360-border-primary);
    font: inherit;
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
    cursor: pointer;
}

.sm360-autonomy-option:last-child {
    border-inline-end: 0;
}

.sm360-autonomy-option[aria-checked="true"] {
    background: var(--sm360-assist-wash);
    color: var(--sm360-assist-text);
    font-weight: 600;
}

.sm360-autonomy-option[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}

.sm360-autonomy-reason {
    font-size: 0.75rem;
    color: var(--sm360-text-secondary);
}

.sm360-autonomy-confirm {
    display: grid;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-3);
    background: var(--sm360-bg-secondary);
    border: var(--sm360-border-width) solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    font-size: 0.8125rem;
}

.sm360-autonomy-prompt {
    color: var(--sm360-text-primary);
}

.sm360-autonomy-limit {
    font-family: var(--sm360-font-mono);
    color: var(--sm360-text-secondary);
}

.sm360-autonomy-confirm-actions {
    display: flex;
    gap: var(--sm360-space-2);
}

.sm360-preview-chip {
    display: inline-block;
    padding: 0 var(--sm360-space-2);
    border: var(--sm360-border-width) solid var(--sm360-assist);
    border-radius: var(--sm360-radius-chip);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--sm360-assist-text);
}

.sm360-coming-soon {
    display: grid;
    gap: var(--sm360-space-3);
    max-width: 32rem;
    padding: var(--sm360-space-5);
    background: var(--sm360-bg-primary);
    border: var(--sm360-border-width) solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-depth);
    color: var(--sm360-text-primary);
}

.sm360-coming-soon-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sm360-space-3);
}

.sm360-coming-soon-title {
    margin: 0;
    font-family: var(--sm360-font-heading);
    font-size: 1.25rem;
}

.sm360-coming-soon-delivery {
    font-family: var(--sm360-font-mono);
    font-size: 0.75rem;
    color: var(--sm360-text-secondary);
}

.sm360-coming-soon-line {
    margin: 0;
    color: var(--sm360-text-secondary);
}

.sm360-coming-soon-actions {
    display: flex;
    gap: var(--sm360-space-2);
    flex-wrap: wrap;
}

.sm360-coming-soon-recorded {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
}

/* Compact autonomy: one quiet ink-dim line whose level word is a button; the segmented control opens below. */
.sm360-autonomy-line {
    display: flex;
    gap: var(--sm360-space-1);
    align-items: baseline;
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
}

.sm360-autonomy-toggle {
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: var(--sm360-text-secondary);
    text-decoration: underline;
    text-decoration-style: dotted;
    cursor: pointer;
}

.sm360-autonomy-changed {
    display: flex;
    gap: var(--sm360-space-2);
    align-items: baseline;
    font-size: 0.8125rem;
    color: var(--sm360-text-secondary);
}

.sm360-autonomy-undo {
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: var(--sm360-text-secondary);
    text-decoration: underline;
    cursor: pointer;
}

/* The drop-down cue is drawn, not typed: a font without the glyph would show a dot. */
.sm360-autonomy-toggle::after {
    content: "";
    display: inline-block;
    margin-inline-start: var(--sm360-space-1);
    border-inline: 4px solid transparent;
    border-top: 5px solid currentColor;
    vertical-align: middle;
}

/* --- Touch target floor (sm360-sdk#844) ---
   The Portal's interactive floor is 44 x 44 CSS px. Applied as a minimum hit area on the shared
   primitives; the control's own padding, type and colours are unchanged, and a denser pack may
   lower --sm360-target-min knowingly. */
.sm360-btn,
.sm360-form-input,
.sm360-input,
.sm360-form-select,
.sm360-select,
.sm360-search-input {
    min-height: var(--sm360-target-min);
}

.sm360-pagination-btn,
.sm360-modal-close {
    min-width: var(--sm360-target-min);
    min-height: var(--sm360-target-min);
}

/* The customer portal's orders and points sections (sm360-sdk issue 1341). Shared by both panels so one
   set of tokens and spacing holds across the portal. */
.sm360-portal-orders,
.sm360-portal-points {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-3);
    color: var(--sm360-text-primary);
}

.sm360-portal-title {
    margin: 0;
    font-size: 1.25rem;
}

.sm360-portal-table {
    width: 100%;
    border-collapse: collapse;
}

.sm360-portal-table th,
.sm360-portal-table td {
    padding: 0.375rem 0.5rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--sm360-border-secondary);
}

.sm360-portal-table thead th {
    color: var(--sm360-text-secondary);
    font-size: 0.8125rem;
}

.sm360-portal-reference {
    font-family: var(--sm360-font-mono);
    font-weight: 600;
}

.sm360-portal-muted {
    color: var(--sm360-text-secondary);
}

.sm360-portal-empty,
.sm360-portal-notice {
    margin: 0;
    color: var(--sm360-text-secondary);
}

.sm360-portal-notice {
    display: flex;
    flex-direction: column;
    gap: var(--sm360-space-2);
    padding: var(--sm360-space-3);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-secondary);
}

.sm360-portal-freshness {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-3);
    color: var(--sm360-text-muted);
    font-size: 0.8125rem;
}

.sm360-portal-stale {
    color: var(--sm360-warning-text);
}

.sm360-portal-balance {
    display: flex;
    align-items: baseline;
    gap: var(--sm360-space-2);
}

.sm360-portal-balance-label {
    color: var(--sm360-text-secondary);
}

.sm360-portal-balance-value {
    font-family: var(--sm360-font-mono);
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
}

.sm360-portal-points-change {
    font-family: var(--sm360-font-mono);
    font-variant-numeric: tabular-nums;
}

/* A capability read that failed is an alert, never the Off/not-found state (sm360-sdk#1382). */
.sm360-capability-unavailable {
    padding: var(--sm360-space-3);
    color: var(--sm360-danger-text);
    border: 1px solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-md);
    background: var(--sm360-bg-secondary);
}

/* --- Network map (Sm360NetworkMap) ---
   Data-agnostic: five semantic roles, drawn from pack tokens only. Points are real buttons laid
   over a decorative SVG (the bundled outline and the hover links). The pulse is a one-shot ring that
   exists only in a pack with glow, and reduced motion removes it. */
.sm360-map {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sm360-space-3);
    min-width: 0;
    color: var(--sm360-text-primary);
    /* sm360-sdk issue 567: the map is a size container so a narrow placement (a phone, a side panel) can
       change how it names points without the host passing a width. */
    container-type: inline-size;
    container-name: sm360-map;
}

.sm360-map-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sm360-space-2) var(--sm360-space-3);
}

.sm360-map-regions,
.sm360-map-tools {
    display: flex;
    align-items: center;
    gap: var(--sm360-space-2);
    min-width: 0;
}

.sm360-map-regions {
    flex: 1 1 auto;
    overflow-x: auto;
}

.sm360-map-chip {
    min-height: 2rem;
    padding: 0.25rem 0.75rem;
    border: var(--sm360-border-width) solid var(--sm360-control-border);
    border-radius: var(--sm360-radius-chip);
    background: transparent;
    color: var(--sm360-text-secondary);
    font: inherit;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
}

.sm360-map-chip:hover {
    color: var(--sm360-text-primary);
    background: var(--sm360-bg-tertiary);
}

.sm360-map-chip[aria-pressed="true"] {
    color: var(--sm360-text-primary);
    border-color: var(--sm360-teal);
    background: var(--sm360-bg-tertiary);
}

.sm360-map-chip:focus-visible,
.sm360-map-hit:focus-visible,
.sm360-map-row-btn:focus-visible {
    outline: 2px solid var(--sm360-text-primary);
    outline-offset: 2px;
}

.sm360-map-asof.is-stale {
    color: var(--sm360-warning-text);
}

.sm360-map-canvas {
    position: relative;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--sm360-bg-primary);
    border: var(--sm360-border-width) solid var(--sm360-border-primary);
    border-radius: var(--sm360-radius-lg);
    box-shadow: var(--sm360-depth);
}

.sm360-map-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.sm360-map-land {
    fill: var(--sm360-bg-tertiary);
    stroke: var(--sm360-border-primary);
    stroke-width: 1;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.sm360-map-link {
    fill: none;
    stroke: var(--sm360-text-secondary);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.sm360-map-link[data-kind="report"] {
    stroke: var(--sm360-assist);
}

.sm360-map-link[data-dashed="true"] {
    stroke-dasharray: 5 4;
}

.sm360-map-points {
    position: absolute;
    inset: 0;
}

.sm360-map-pt {
    --sm360-map-c: var(--sm360-text-primary);
    --sm360-map-ink: var(--sm360-bg-primary);
    position: absolute;
    display: grid;
    place-items: center;
    width: max(var(--sm360-map-d), 1.5rem);
    height: max(var(--sm360-map-d), 1.5rem);
    transform: translate(-50%, -50%);
    z-index: var(--sm360-map-z, 1);
}

.sm360-map-pt[data-role="faint"] { --sm360-map-c: var(--sm360-text-muted); }
.sm360-map-pt[data-role="warn"] { --sm360-map-c: var(--sm360-warning); --sm360-map-ink: var(--sm360-warning-ink); }
.sm360-map-pt[data-role="alert"] { --sm360-map-c: var(--sm360-danger); --sm360-map-ink: var(--sm360-danger-ink); }
.sm360-map-pt[data-role="assist"] { --sm360-map-c: var(--sm360-assist); --sm360-map-ink: var(--sm360-assist-ink); }

.sm360-map-hit {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.sm360-map-dot {
    width: var(--sm360-map-d);
    height: var(--sm360-map-d);
    border-radius: 50%;
    background: var(--sm360-map-c);
    box-shadow: var(--sm360-glow);
}

.sm360-map-pt[data-role="faint"] .sm360-map-dot {
    background: transparent;
    border: 2px solid var(--sm360-map-c);
    box-shadow: none;
}

.sm360-map-pt[data-selected="true"] .sm360-map-dot {
    box-shadow: 0 0 0 2px var(--sm360-bg-primary), 0 0 0 4px var(--sm360-map-c);
}

.sm360-map-pt:hover,
.sm360-map-pt:focus-within,
.sm360-map-pt[data-selected="true"] {
    z-index: 200;
}

.sm360-map-pt[data-label-side="start"] .sm360-map-label {
    inset-inline-start: auto;
    inset-inline-end: 100%;
    padding-inline: 0 0.125rem;
}

/* Above or below, centred on the point: where a crowded site has no room on either side. */
.sm360-map-pt[data-label-side="top"] .sm360-map-label,
.sm360-map-pt[data-label-side="bottom"] .sm360-map-label {
    inset-inline: auto;
    left: 50%;
    padding: 0;
}

.sm360-map-pt[data-label-side="top"] .sm360-map-label {
    top: auto;
    bottom: calc(50% + var(--sm360-map-d) / 2);
    transform: translateX(-50%);
}

.sm360-map-pt[data-label-side="bottom"] .sm360-map-label {
    top: calc(50% + var(--sm360-map-d) / 2);
    transform: translateX(-50%);
}

.sm360-map-badge {
    position: absolute;
    top: -0.125rem;
    inset-inline-end: -0.25rem;
    min-width: 0.875rem;
    height: 0.875rem;
    padding: 0 0.1875rem;
    border-radius: 0.4375rem;
    background: var(--sm360-map-c);
    color: var(--sm360-map-ink);
    font-size: 0.625rem;
    line-height: 0.875rem;
    text-align: center;
    pointer-events: none;
}

.sm360-map-label {
    position: absolute;
    top: 50%;
    inset-inline-start: 100%;
    transform: translateY(-50%);
    padding-inline-start: 0.125rem;
    font-size: 0.6875rem;
    line-height: 1;
    white-space: nowrap;
    color: var(--sm360-text-primary);
    text-shadow: 0 0 3px var(--sm360-bg-primary), 0 0 3px var(--sm360-bg-primary), 0 0 6px var(--sm360-bg-primary);
    pointer-events: none;
}

/* One halo, once, when a point's pulse token changes. It fails closed: the ring has no border or fill
   of its own and is drawn only by the pack's glow, so a product with no pack (glow is none), or a
   browser that ignores anything newer, shows nothing at all. */
.sm360-map-pulse {
    position: absolute;
    width: var(--sm360-map-d);
    height: var(--sm360-map-d);
    border-radius: 50%;
    border: 0;
    background: transparent;
    box-shadow: var(--sm360-glow);
    opacity: 0;
    pointer-events: none;
    animation: sm360-map-pulse calc(var(--sm360-motion-on) * 1100ms) ease-out 1 both;
}

@keyframes sm360-map-pulse {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(3); opacity: 0; }
}

/* prefers-reduced-motion: no pulse at all. */
@media (prefers-reduced-motion: reduce) {
    .sm360-map-pulse {
        animation: none;
        display: none;
    }
}

.sm360-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm360-space-1) var(--sm360-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
    color: var(--sm360-text-secondary);
}

.sm360-map-legend li {
    --sm360-map-c: var(--sm360-text-primary);
    display: inline-flex;
    align-items: center;
    gap: var(--sm360-space-2);
}

.sm360-map-legend li[data-role="faint"] { --sm360-map-c: var(--sm360-text-muted); }
.sm360-map-legend li[data-role="warn"] { --sm360-map-c: var(--sm360-warning); }
.sm360-map-legend li[data-role="alert"] { --sm360-map-c: var(--sm360-danger); }
.sm360-map-legend li[data-role="assist"] { --sm360-map-c: var(--sm360-assist); }

.sm360-map-key {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: var(--sm360-map-c);
}

.sm360-map-legend li[data-role="faint"] .sm360-map-key {
    background: transparent;
    border: 2px solid var(--sm360-map-c);
}

.sm360-map-key-link {
    width: 1.25rem;
    border-top: 2px dashed var(--sm360-text-secondary);
}

.sm360-map-legend li[data-link="report"] .sm360-map-key-link {
    border-top-color: var(--sm360-assist);
}

/* sm360-sdk issue 567: the list scrolls inside its own frame at phone width; the page never scrolls sideways. */
.sm360-map-table-wrap {
    overflow-x: auto;
    max-width: 100%;
}

.sm360-map-table td {
    overflow-wrap: anywhere;
}

/* sm360-sdk issue 567: placement is computed for a ~760 px canvas while the 11 px names stay fixed, so below
   560 px names would crowd the dots. There, exactly one point keeps its name: the one pointed at now (hover, else focus, else the selection);
   every dot keeps its accessible name, and the list view names them all. */
@container sm360-map (max-width: 560px) {
    .sm360-map-pt[data-labelled]:not([data-active]) .sm360-map-label {
        display: none;
    }
}

.sm360-map-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.sm360-map-table caption {
    padding-bottom: var(--sm360-space-2);
    text-align: start;
    font-size: 0.75rem;
    color: var(--sm360-text-secondary);
}

.sm360-map-table th,
.sm360-map-table td {
    padding: var(--sm360-space-2) var(--sm360-space-3);
    text-align: start;
    border-bottom: var(--sm360-border-width) solid var(--sm360-border-primary);
}

.sm360-map-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sm360-text-secondary);
}

.sm360-map-table tr[aria-current="true"] {
    background: var(--sm360-bg-tertiary);
}

.sm360-map-row-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--sm360-text-primary);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

