@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&display=swap');

/* ====================================================================== *
 * Bundled fonts — Schibsted Grotesk and JetBrains Mono (SIL OFL 1.1,
 * licences in fonts/). Served from `fonts/` next to this file, so a page
 * that bundles the library never calls a font CDN. @font-face costs
 * nothing until a theme's font stack names the family (e.g. the
 * Community theme). Latin + Latin Extended, variable weight, roman + italic.
 * ====================================================================== */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: italic;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/jetbrains-mono-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: italic;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/jetbrains-mono-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/jetbrains-mono-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/jetbrains-mono-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ====================================================================== *
 * SlopKit UI — base stylesheet
 *
 * Link this FIRST in your <head>, synchronously, to prevent FOUC:
 *
 *   <link rel="stylesheet" href="@slopkit/slopkit-ui.css">
 *
 * Because a stylesheet <link> is render-blocking, the design tokens below
 * are available on the very first paint (correct background / text / fonts),
 * and tiered `:not(:defined)` rules keep content readable while hiding
 * interactive components until their custom-element definitions upgrade.
 *
 * The token values here are the single source of truth and mirror the
 * runtime injection in core/vk-theme.js (which is skipped when this file
 * is present, via the --vk-css sentinel below).
 * ====================================================================== */

:root {
  /* Sentinel so vk-theme.js can detect this stylesheet and skip re-injecting */
  --vk-css: 1;

  color-scheme: light;

  /* Neutral scale — cool, slightly blue-tinted slate */
  --vk-neutral-0:   #ffffff;
  --vk-neutral-50:  #f8fafc;
  --vk-neutral-100: #f1f4f9;
  --vk-neutral-150: #e9edf3;
  --vk-neutral-200: #e2e8f0;
  --vk-neutral-300: #cdd5e0;
  --vk-neutral-400: #97a3b6;
  --vk-neutral-500: #64748b;
  --vk-neutral-600: #475569;
  --vk-neutral-700: #334155;
  --vk-neutral-800: #1d2738;
  --vk-neutral-900: #111827;
  --vk-neutral-950: #0a0f1a;

  /* Brand — refined indigo */
  --vk-color-primary:        #5b5bd6;
  --vk-color-primary-hover:  #5151c9;
  --vk-color-primary-active: #4646b8;
  --vk-color-primary-light:  #ecedfb;
  --vk-color-primary-subtle: #f5f5fd;
  --vk-color-on-primary:     #ffffff;
  --vk-color-accent:         #8b5cf6;

  /* Brand gradients — primary → accent for visible multi-color presets */
  --vk-gradient-brand-end: var(--vk-color-accent);
  --vk-gradient-display: linear-gradient(120deg, var(--vk-color-primary), var(--vk-color-accent));
  --vk-gradient-display-vertical: linear-gradient(180deg, var(--vk-color-primary), var(--vk-color-accent));
  --vk-gradient-display-diagonal: linear-gradient(135deg, var(--vk-color-primary), var(--vk-color-accent));

  /* Theme behavior flags (apply to both light & dark; 1 = on, 0 = off) */
  --vk-theme-atmosphere: 1; /* ambient brand glow behind the page */
  --vk-theme-grid: 1;       /* subtle grid texture overlay */
  --vk-theme-glass: 1;      /* translucent blurred chrome (navbars/headers) */

  /* Semantic surfaces & text */
  --vk-color-surface:        var(--vk-neutral-0);
  --vk-color-surface-alt:    var(--vk-neutral-50);
  --vk-color-surface-sunken: var(--vk-neutral-100);
  --vk-color-surface-hover:  var(--vk-neutral-100);
  --vk-color-text:           var(--vk-neutral-900);
  --vk-color-text-secondary: var(--vk-neutral-600);
  --vk-color-text-muted:     var(--vk-neutral-400);
  --vk-color-border:         var(--vk-neutral-200);
  --vk-color-border-strong:  var(--vk-neutral-300);

  /* Status colors */
  --vk-color-success:        #16a34a;
  --vk-color-success-light:  #dcfce7;
  --vk-color-success-text:   #14803a;
  --vk-color-warning:        #d97706;
  --vk-color-warning-light:  #fef0c7;
  --vk-color-warning-text:   #b45309;
  --vk-color-danger:         #e5484d;
  --vk-color-danger-hover:   #d63a3f;
  --vk-color-danger-light:   #ffe5e7;
  --vk-color-danger-text:    #c62a2f;
  --vk-color-info:           #0a8acb;
  --vk-color-info-light:     #d6f0fd;
  --vk-color-info-text:      #0773aa;

  /* Focus ring + overlays */
  --vk-ring:                 color-mix(in srgb, var(--vk-color-primary) 38%, transparent);
  --vk-ring-width:           3px;
  --vk-color-overlay:        rgba(15, 23, 42, 0.45);

  /* Typography */
  --vk-font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --vk-font-display: 'Bricolage Grotesque', var(--vk-font-family);
  --vk-font-mono: 'Geist Mono', 'SF Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  --vk-font-size-xs:   0.75rem;
  --vk-font-size-sm:   0.8125rem;
  --vk-font-size-base: 0.9375rem;
  --vk-font-size-lg:   1.0625rem;
  --vk-font-size-xl:   1.25rem;
  --vk-font-size-2xl:  1.5rem;
  --vk-font-size-3xl:  1.875rem;
  --vk-font-size-4xl:  2.5rem;

  --vk-font-weight-normal:   400;
  --vk-font-weight-medium:   500;
  --vk-font-weight-semibold: 600;
  --vk-font-weight-bold:     700;
  --vk-font-weight-heading:  var(--vk-font-weight-bold);

  --vk-line-height:       1.6;
  --vk-line-height-tight: 1.2;

  --vk-tracking-tight:  -0.02em;
  --vk-tracking-snug:   -0.011em;
  --vk-tracking-normal: 0;
  --vk-tracking-wide:   0.02em;

  /* Spacing */
  --vk-spacing-2xs: 0.125rem;
  --vk-spacing-xs:  0.25rem;
  --vk-spacing-sm:  0.5rem;
  --vk-spacing-md:  1rem;
  --vk-spacing-lg:  1.5rem;
  --vk-spacing-xl:  2rem;
  --vk-spacing-2xl: 3rem;
  --vk-spacing-3xl: 4rem;

  /* Radius — corner style overrides these wholesale via theme config */
  --vk-radius-xs:   0.25rem;
  --vk-radius-sm:   0.375rem;
  --vk-radius-md:   0.5rem;
  --vk-radius-lg:   0.75rem;
  --vk-radius-xl:   1rem;
  --vk-radius-2xl:  1.25rem;
  --vk-radius-full: 9999px;

  /* Elevation */
  --vk-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --vk-shadow-sm:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 1px 3px rgba(15, 23, 42, 0.08);
  --vk-shadow-md:
    0 2px 4px -1px rgba(15, 23, 42, 0.06),
    0 4px 12px -2px rgba(15, 23, 42, 0.10);
  --vk-shadow-lg:
    0 4px 8px -2px rgba(15, 23, 42, 0.08),
    0 12px 28px -6px rgba(15, 23, 42, 0.14);
  --vk-shadow-xl:
    0 8px 16px -4px rgba(15, 23, 42, 0.10),
    0 24px 48px -12px rgba(15, 23, 42, 0.22);
  --vk-shadow-focus: 0 0 0 var(--vk-ring-width) var(--vk-ring);
  --vk-shadow-inner: inset 0 1px 2px rgba(15, 23, 42, 0.06);

  /* Motion */
  --vk-ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --vk-ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --vk-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --vk-transition-fast: 130ms var(--vk-ease);
  --vk-transition-base: 220ms var(--vk-ease);
  --vk-transition-slow: 360ms var(--vk-ease-out);
  --vk-duration-fast: 130ms;
  --vk-duration-base: 220ms;
  --vk-duration-slow: 360ms;

  /* Layout */
  --vk-breakpoint-xs: 480px;
  --vk-breakpoint-sm: 640px;
  --vk-breakpoint-md: 768px;
  --vk-breakpoint-lg: 1024px;
  --vk-breakpoint-xl: 1280px;
  --vk-breakpoint-sidebar: 880px;

  --vk-container-max-sm: var(--vk-breakpoint-sm);
  --vk-container-max-md: var(--vk-breakpoint-md);
  --vk-container-max-lg: var(--vk-breakpoint-lg);
  --vk-container-max-xl: var(--vk-breakpoint-xl);
}

/* ---------------------------------------------------------------------- *
 * Dark theme — explicit opt-in (setTheme('dark') -> [data-vk-theme])
 * ---------------------------------------------------------------------- */
[data-vk-theme="dark"] {
  color-scheme: dark;

  --vk-color-primary:        #7b7bf0;
  --vk-color-primary-hover:  #8c8cf4;
  --vk-color-primary-active: #9d9df7;
  --vk-color-primary-light:  #24244a;
  --vk-color-primary-subtle: #1a1a33;
  --vk-color-on-primary:     #ffffff;
  --vk-color-accent:         #a78bfa;
  --vk-gradient-brand-end: var(--vk-color-accent);
  --vk-gradient-display: linear-gradient(120deg, var(--vk-color-primary), var(--vk-color-accent));
  --vk-gradient-display-vertical: linear-gradient(180deg, var(--vk-color-primary), var(--vk-color-accent));
  --vk-gradient-display-diagonal: linear-gradient(135deg, var(--vk-color-primary), var(--vk-color-accent));

  --vk-color-surface:        #14181f;
  --vk-color-surface-alt:    #1a1f29;
  --vk-color-surface-sunken: #0e1117;
  --vk-color-surface-hover:  #222834;
  --vk-color-text:           #f1f4f9;
  --vk-color-text-secondary: #aab4c5;
  --vk-color-text-muted:     #6b7688;
  --vk-color-border:         #2a313e;
  --vk-color-border-strong:  #3a4250;

  --vk-color-success:        #3dd68c;
  --vk-color-success-light:  #0c2b1e;
  --vk-color-success-text:   #4ade80;
  --vk-color-warning:        #f0a830;
  --vk-color-warning-light:  #2e2410;
  --vk-color-warning-text:   #fbbf45;
  --vk-color-danger:         #f2555a;
  --vk-color-danger-hover:   #f4696e;
  --vk-color-danger-light:   #2e1416;
  --vk-color-danger-text:    #ff7b80;
  --vk-color-info:           #3bb6ed;
  --vk-color-info-light:     #0c2733;
  --vk-color-info-text:      #5ac8f5;

  --vk-color-overlay:        rgba(2, 6, 16, 0.6);

  --vk-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --vk-shadow-sm:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.5);
  --vk-shadow-md:
    0 2px 4px -1px rgba(0, 0, 0, 0.4),
    0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --vk-shadow-lg:
    0 4px 8px -2px rgba(0, 0, 0, 0.45),
    0 12px 28px -6px rgba(0, 0, 0, 0.6);
  --vk-shadow-xl:
    0 8px 16px -4px rgba(0, 0, 0, 0.5),
    0 24px 48px -12px rgba(0, 0, 0, 0.7);
  --vk-shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* System preference (unless the user has forced light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-vk-theme="light"]) {
    color-scheme: dark;

    --vk-color-primary:        #7b7bf0;
    --vk-color-primary-hover:  #8c8cf4;
    --vk-color-primary-active: #9d9df7;
    --vk-color-primary-light:  #24244a;
    --vk-color-primary-subtle: #1a1a33;
    --vk-color-on-primary:     #ffffff;
    --vk-color-accent:         #a78bfa;
    --vk-gradient-brand-end: var(--vk-color-accent);
    --vk-gradient-display: linear-gradient(120deg, var(--vk-color-primary), var(--vk-color-accent));
    --vk-gradient-display-vertical: linear-gradient(180deg, var(--vk-color-primary), var(--vk-color-accent));
    --vk-gradient-display-diagonal: linear-gradient(135deg, var(--vk-color-primary), var(--vk-color-accent));

    --vk-color-surface:        #14181f;
    --vk-color-surface-alt:    #1a1f29;
    --vk-color-surface-sunken: #0e1117;
    --vk-color-surface-hover:  #222834;
    --vk-color-text:           #f1f4f9;
    --vk-color-text-secondary: #aab4c5;
    --vk-color-text-muted:     #6b7688;
    --vk-color-border:         #2a313e;
    --vk-color-border-strong:  #3a4250;

    --vk-color-success:        #3dd68c;
    --vk-color-success-light:  #0c2b1e;
    --vk-color-success-text:   #4ade80;
    --vk-color-warning:        #f0a830;
    --vk-color-warning-light:  #2e2410;
    --vk-color-warning-text:   #fbbf45;
    --vk-color-danger:         #f2555a;
    --vk-color-danger-hover:   #f4696e;
    --vk-color-danger-light:   #2e1416;
    --vk-color-danger-text:    #ff7b80;
    --vk-color-info:           #3bb6ed;
    --vk-color-info-light:     #0c2733;
    --vk-color-info-text:      #5ac8f5;

    --vk-color-overlay:        rgba(2, 6, 16, 0.6);

    --vk-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --vk-shadow-sm:
      0 1px 2px rgba(0, 0, 0, 0.4),
      0 1px 3px rgba(0, 0, 0, 0.5);
    --vk-shadow-md:
      0 2px 4px -1px rgba(0, 0, 0, 0.4),
      0 4px 12px -2px rgba(0, 0, 0, 0.5);
    --vk-shadow-lg:
      0 4px 8px -2px rgba(0, 0, 0, 0.45),
      0 12px 28px -6px rgba(0, 0, 0, 0.6);
    --vk-shadow-xl:
      0 8px 16px -4px rgba(0, 0, 0, 0.5),
      0 24px 48px -12px rgba(0, 0, 0, 0.7);
    --vk-shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --vk-transition-fast: 0ms;
    --vk-transition-base: 0ms;
    --vk-transition-slow: 0ms;
    --vk-duration-fast: 0ms;
    --vk-duration-base: 0ms;
    --vk-duration-slow: 0ms;
  }
}

/* ====================================================================== *
 * Site chrome (internal — demo / docs / editor)
 *
 * Reserve header height before the custom element upgrades so the layout
 * never collapses to zero and jumps when the shadow bar paints. Paired with
 * `view-transition-name` on `<vk-site-header>` for stable MPA navigation.
 * ====================================================================== */

vk-site-header:not(:defined) {
  display: block;
  min-height: 3.25rem;
}

/* ====================================================================== *
 * Anti-FOUC cloak (tiered)
 *
 * Content-bearing components stay readable when undefined (no JS yet) —
 * slotted text inherits design tokens from :root. Interactive controls and
 * overlays stay hidden until upgraded so broken UI never flashes.
 *
 * Authors may set `class="no-js"` on `<html>` server-side (or use the
 * `<noscript>` override in getting-started) for the same content-visible
 * tier without relying on `:not(:defined)`.
 *
 * `:where()` keeps specificity at 0 so your own styles win once defined.
 * ====================================================================== */

/* --- Tier 1: content-visible (undefined + html.no-js) ----------------- */
:where(
  vk-container, vk-row, vk-col, vk-stack, vk-divider, vk-scroll-strip,
  vk-page-header, vk-split, vk-toolbar, vk-filter-bar, vk-divider-grid, vk-divider-stack, vk-inset-cell, vk-dashboard, vk-dashboard-tile,
  vk-text, vk-heading, vk-code, vk-blockquote, vk-source-code,
  vk-markdown, vk-citation, vk-link, vk-highlight, vk-diff,
  vk-card, vk-list, vk-stat, vk-timeline, vk-empty, vk-description-list,
  vk-json, vk-comparison, vk-pinboard, vk-metric-row, vk-metric-grid, vk-metric-cell, vk-metric-stack, vk-metric-capacity, vk-panel,
  vk-alert, vk-badge, vk-callout, vk-tag, vk-log, vk-meter, vk-progress,
  vk-chat-bubble, vk-chat-history,
  vk-room-message, vk-reactions, vk-comment-thread, vk-comment
):not(:defined),
html.no-js :where(
  vk-container, vk-row, vk-col, vk-stack, vk-divider, vk-scroll-strip,
  vk-page-header, vk-split, vk-toolbar, vk-filter-bar, vk-divider-grid, vk-divider-stack, vk-inset-cell, vk-dashboard, vk-dashboard-tile,
  vk-text, vk-heading, vk-code, vk-blockquote, vk-source-code,
  vk-markdown, vk-citation, vk-link, vk-highlight, vk-diff,
  vk-card, vk-list, vk-stat, vk-timeline, vk-empty, vk-description-list,
  vk-json, vk-comparison, vk-pinboard, vk-metric-row, vk-metric-grid, vk-metric-cell, vk-metric-stack, vk-metric-capacity, vk-panel,
  vk-alert, vk-badge, vk-callout, vk-tag, vk-log, vk-meter, vk-progress,
  vk-chat-bubble, vk-chat-history,
  vk-room-message, vk-reactions, vk-comment-thread, vk-comment
) {
  visibility: visible;
  color: var(--vk-color-text);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-base);
  line-height: var(--vk-line-height);
}

/* Readable fallbacks for common content tags (undefined / no-js only) */
:where(vk-text, vk-heading, vk-code, vk-blockquote, vk-link, vk-citation):not(:defined),
html.no-js :where(vk-text, vk-heading, vk-code, vk-blockquote, vk-link, vk-citation) {
  display: block;
}

:where(vk-heading):not(:defined),
html.no-js vk-heading {
  font-family: var(--vk-font-display);
  font-weight: var(--vk-font-weight-heading);
  line-height: var(--vk-line-height-tight);
  letter-spacing: var(--vk-tracking-tight);
  margin: 0 0 var(--vk-spacing-sm);
}
:where(vk-heading[level="1"]):not(:defined), html.no-js vk-heading[level="1"] { font-size: var(--vk-font-size-4xl); }
:where(vk-heading[level="2"]):not(:defined), html.no-js vk-heading[level="2"] { font-size: var(--vk-font-size-3xl); }
:where(vk-heading[level="3"]):not(:defined), html.no-js vk-heading[level="3"] { font-size: var(--vk-font-size-2xl); }
:where(vk-heading[level="4"]):not(:defined), html.no-js vk-heading[level="4"] { font-size: var(--vk-font-size-xl); }
:where(vk-heading[level="5"]):not(:defined), html.no-js vk-heading[level="5"] { font-size: var(--vk-font-size-lg); }
:where(vk-heading[level="6"]):not(:defined), html.no-js vk-heading[level="6"] {
  font-size: var(--vk-font-size-base);
  text-transform: uppercase;
  letter-spacing: var(--vk-tracking-wide);
}
:where(vk-heading:not([level])):not(:defined), html.no-js vk-heading:not([level]) { font-size: var(--vk-font-size-3xl); }

:where(vk-text):not(:defined), html.no-js vk-text { margin-bottom: var(--vk-spacing-md); }
:where(vk-text[color="secondary"], vk-text[color="muted"]):not(:defined),
html.no-js vk-text[color="secondary"], html.no-js vk-text[color="muted"] {
  color: var(--vk-color-text-secondary);
}
:where(vk-link):not(:defined), html.no-js vk-link {
  display: inline;
  color: var(--vk-color-primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

:where(vk-code):not(:defined), html.no-js vk-code {
  display: inline;
  font-family: var(--vk-font-mono);
  font-size: 0.92em;
  padding: 0.12em 0.35em;
  border-radius: var(--vk-radius-sm);
  background: var(--vk-color-surface-sunken);
  border: 1px solid var(--vk-color-border);
}

:where(vk-blockquote):not(:defined), html.no-js vk-blockquote {
  margin: 0 0 var(--vk-spacing-md);
  padding: var(--vk-spacing-sm) var(--vk-spacing-md);
  border-left: 3px solid var(--vk-color-primary);
  color: var(--vk-color-text-secondary);
}

:where(vk-card):not(:defined), html.no-js vk-card {
  display: block;
  padding: var(--vk-spacing-lg);
  background: var(--vk-color-surface);
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-lg);
  box-shadow: var(--vk-shadow-xs);
  color: var(--vk-color-text-secondary);
}

:where(vk-alert):not(:defined), html.no-js vk-alert {
  display: block;
  padding: 0.875rem 1rem;
  border-radius: var(--vk-radius-md);
  font-size: var(--vk-font-size-sm);
  background: var(--vk-color-info-light);
  color: var(--vk-color-info-text);
  border: 1px solid color-mix(in srgb, var(--vk-color-info) 30%, transparent);
}
:where(vk-alert[variant="success"]):not(:defined), html.no-js vk-alert[variant="success"] {
  background: var(--vk-color-success-light);
  color: var(--vk-color-success-text);
  border-color: color-mix(in srgb, var(--vk-color-success) 30%, transparent);
}
:where(vk-alert[variant="warning"]):not(:defined), html.no-js vk-alert[variant="warning"] {
  background: var(--vk-color-warning-light);
  color: var(--vk-color-warning-text);
  border-color: color-mix(in srgb, var(--vk-color-warning) 30%, transparent);
}
:where(vk-alert[variant="danger"]):not(:defined), html.no-js vk-alert[variant="danger"] {
  background: var(--vk-color-danger-light);
  color: var(--vk-color-danger-text);
  border-color: color-mix(in srgb, var(--vk-color-danger) 30%, transparent);
}

:where(vk-badge, vk-tag):not(:defined), html.no-js vk-badge, html.no-js vk-tag {
  display: inline;
  font-size: var(--vk-font-size-xs);
  font-weight: var(--vk-font-weight-medium);
  padding: 0.32em 0.6em;
  border-radius: var(--vk-radius-full);
  background: var(--vk-color-primary-light);
  color: var(--vk-color-primary);
}

:where(vk-container):not(:defined), html.no-js vk-container {
  display: block;
  width: 100%;
  max-width: var(--vk-container-max-lg, var(--vk-breakpoint-lg));
  margin-inline: auto;
  padding-inline: var(--vk-spacing-md);
}

:where(vk-row):not(:defined), html.no-js vk-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vk-spacing-md);
}
:where(vk-col):not(:defined), html.no-js vk-col {
  display: block;
  flex: 1 1 0;
  min-width: 0;
}
:where(vk-stack):not(:defined), html.no-js vk-stack {
  display: flex;
  flex-direction: column;
  gap: var(--vk-spacing-md);
}
:where(vk-stack[direction="row"]):not(:defined), html.no-js vk-stack[direction="row"] {
  flex-direction: row;
}
:where(vk-divider):not(:defined), html.no-js vk-divider {
  display: block;
  border: none;
  border-top: 1px solid var(--vk-color-border);
  margin: var(--vk-spacing-md) 0;
}

/* --- Tier 2: interactive — hidden until defined ----------------------- */
:where(
  vk-accordion, vk-collapse, vk-carousel, vk-kanban, vk-skeleton, vk-tree,
  vk-breadcrumb, vk-pagination, vk-steps, vk-menu,
  vk-toggle-button, vk-radio, vk-switch,
  vk-form, vk-rating, vk-fieldset, vk-item-group,
  vk-search, vk-slider, vk-copy,
  vk-color-picker,
  vk-icon, vk-image, vk-avatar, vk-system-logo, vk-audio, vk-map, vk-chart, vk-chart-map, vk-mermaid, vk-gauge, vk-sparkline,
  vk-calendar, vk-date-range, vk-heatmap, vk-editable, vk-resize-handle,
  vk-spinner
):not(:defined) {
  display: none !important;
}

/* Navigation that can be server-rendered as light-DOM <a href> links
 * (vk-navbar, vk-sidebar, vk-tabs / vk-segmented link mode) stays visible;
 * without links (panels, options) it is hidden until defined. Fallback
 * looks live in the "Navigation link modes" section below. */
:where(vk-tabs, vk-navbar, vk-sidebar, vk-segmented):not(:defined):not(:has(> a)) {
  display: none !important;
}

/* --- Tier 2b: form controls — hidden until defined, unless they wrap a
 * native control. `<vk-input><input name="email"></vk-input>` (and the same
 * for vk-textarea, vk-select, vk-checkbox, vk-otp, and vk-button around a
 * <button>/<a>) is the server-rendered path: the native element is the
 * control, so it must stay visible and usable before (or without) JS.
 * Only `:not(:defined)` here, never `html.no-js`: once defined, the
 * component's ::slotted() styles take over and page rules would fight them.
 */
:where(vk-button, vk-input, vk-select, vk-checkbox, vk-textarea, vk-otp):not(:defined):not(:has(> input, > textarea, > select, > button, > a)) {
  display: none !important;
}

:where(vk-input, vk-select, vk-textarea, vk-otp):not(:defined) {
  display: block;
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  color: var(--vk-color-text);
}
:where(vk-input, vk-select, vk-textarea, vk-otp)[label]:not(:defined):not(:has(> label))::before {
  content: attr(label);
}
:where(vk-input, vk-select, vk-textarea, vk-otp):not(:defined)::before,
:where(vk-input, vk-select, vk-textarea, vk-otp):not(:defined) > label {
  display: block;
  margin-bottom: var(--vk-spacing-xs);
  font-weight: var(--vk-font-weight-medium);
}
:where(vk-input, vk-select, vk-textarea, vk-otp)[hint]:not(:defined)::after {
  content: attr(hint);
}
:where(vk-input, vk-select, vk-textarea, vk-otp)[error]:not([error=""]):not(:defined)::after {
  content: attr(error);
  color: var(--vk-color-danger-text);
}
:where(vk-input, vk-select, vk-textarea, vk-otp):not(:defined)::after {
  display: block;
  margin-top: var(--vk-spacing-xs);
  font-size: var(--vk-font-size-xs);
  color: var(--vk-color-text-muted);
}
:where(vk-input, vk-select, vk-textarea, vk-otp):not(:defined) > :is(input, select, textarea) {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--vk-color-border-strong);
  border-radius: var(--vk-radius-md);
  background: var(--vk-color-surface);
  color: var(--vk-color-text);
  font: inherit;
  font-size: var(--vk-font-size-base);
}
:where(vk-input, vk-select, vk-textarea, vk-otp)[error]:not(:defined) > :is(input, select, textarea) {
  border-color: var(--vk-color-danger);
}
:where(vk-otp):not(:defined) > input {
  width: 12em;
  max-width: 100%;
  font-family: var(--vk-font-mono, ui-monospace, monospace);
  font-size: var(--vk-font-size-xl);
  letter-spacing: 0.5em;
}
:where(vk-checkbox):not(:defined) {
  display: inline-flex;
  align-items: center;
  gap: var(--vk-spacing-sm);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-base);
  color: var(--vk-color-text);
}
:where(vk-checkbox):not(:defined) > input {
  margin: 0;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--vk-color-primary);
}
:where(vk-button):not(:defined) {
  display: inline-flex;
  vertical-align: middle;
}
:where(vk-button):not(:defined) > :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  margin: 0;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--vk-color-border-strong);
  border-radius: var(--vk-radius-md);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  font-weight: var(--vk-font-weight-medium);
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  background: var(--vk-color-surface);
  color: var(--vk-color-text);
}
:where(vk-button[variant="primary"]):not(:defined) > :is(button, a) {
  background: var(--vk-color-primary);
  color: var(--vk-color-on-primary);
}
:where(vk-button[variant="danger"]):not(:defined) > :is(button, a) {
  background: var(--vk-color-danger);
  border-color: transparent;
  color: #fff;
}
:where(vk-button[variant="ghost"], vk-button[variant="subtle"]):not(:defined) > :is(button, a) {
  background: transparent;
  border-color: transparent;
}

/* vk-file-input / vk-markdown-editor: shown before upgrade only around their
 * native control (`<input type="file">` / `<textarea>`), which posts as-is. */
:where(vk-file-input):not(:defined):not(:has(> input[type="file"])),
:where(vk-markdown-editor):not(:defined):not(:has(> textarea)) {
  display: none !important;
}
:where(vk-file-input, vk-markdown-editor):not(:defined) {
  display: block;
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  color: var(--vk-color-text);
}
:where(vk-file-input):not(:defined) > input[type="file"] {
  box-sizing: border-box;
  width: 100%;
  padding: var(--vk-spacing-md);
  border: 1px dashed var(--vk-color-border-strong);
  border-radius: var(--vk-radius-md);
  background: var(--vk-color-surface-sunken);
  color: var(--vk-color-text-secondary);
  font: inherit;
}
:where(vk-markdown-editor)[label]:not(:defined):not(:has(> label))::before {
  content: attr(label);
}
:where(vk-markdown-editor):not(:defined)::before,
:where(vk-markdown-editor):not(:defined) > label {
  display: block;
  margin-bottom: var(--vk-spacing-xs);
  font-weight: var(--vk-font-weight-semibold, 600);
}
:where(vk-markdown-editor)[hint]:not(:defined)::after {
  content: attr(hint);
  display: block;
  margin-top: var(--vk-spacing-xs);
  font-size: var(--vk-font-size-xs);
  color: var(--vk-color-text-muted);
}
:where(vk-markdown-editor):not(:defined) > textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 8rem;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--vk-color-border-strong);
  border-radius: var(--vk-radius-sm);
  background: var(--vk-color-surface-sunken);
  color: var(--vk-color-text);
  font: var(--vk-font-size-sm)/1.7 var(--vk-font-mono, ui-monospace, monospace);
  resize: vertical;
}

/* vk-vote / vk-score: server-rendered native <button>s (or a guest <a>)
 * keep their look before (or without) JS. The vote button's text is the
 * count; icons are drawn with masks so no vk-icon is needed. */
:where(vk-vote, vk-score):not(:defined):not(:has(> button, > a)) {
  display: none !important;
}
:where(vk-vote):not(:defined) {
  display: inline-flex;
  flex: none;
  vertical-align: top;
}
:where(vk-vote):not(:defined) > :is(button, a) {
  box-sizing: border-box;
  width: 52px;
  min-height: 56px;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--vk-color-border-strong);
  border-radius: var(--vk-radius-sm);
  background: var(--vk-color-surface);
  color: var(--vk-color-text);
  font-family: var(--vk-font-mono, ui-monospace, monospace);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}
:where(vk-vote):not(:defined) > :is(button, a)::before {
  content: "";
  width: 16px;
  height: 16px;
  background: var(--vk-color-text-secondary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
:where(vk-vote):not(:defined) > [aria-pressed="true"] {
  background: var(--vk-color-primary);
  border-color: var(--vk-color-primary);
  color: var(--vk-color-on-primary);
}
:where(vk-vote):not(:defined) > [aria-pressed="true"]::before { background: currentColor; }
:where(vk-vote[closed]):not(:defined) > :is(button, a),
:where(vk-vote):not(:defined) > :disabled {
  background: transparent;
  border-style: dashed;
  color: var(--vk-color-text-muted);
  cursor: default;
}
:where(vk-vote[closed]):not(:defined) > :is(button, a)::before,
:where(vk-vote):not(:defined) > :disabled::before {
  background: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}
:where(vk-vote[size="lg"]):not(:defined) > :is(button, a) {
  width: 64px;
  min-height: 68px;
  font-size: var(--vk-font-size-lg);
}
html[data-vk-bp-sm] :where(vk-vote:not([size="lg"])):not(:defined) > :is(button, a) {
  width: 44px;
  min-height: 52px;
}
html[data-vk-bp-sm] :where(vk-vote[size="lg"]):not(:defined) > :is(button, a) {
  flex-direction: row;
  width: auto;
  min-height: 44px;
  padding: 0 var(--vk-spacing-md);
  gap: 10px;
}
:where(vk-score):not(:defined) {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
}
:where(vk-score):not(:defined)::after {
  content: attr(score);
  order: 1;
  min-width: 2ch;
  text-align: center;
  font-family: var(--vk-font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  color: var(--vk-color-text-secondary);
}
:where(vk-score):not(:defined) > button {
  order: 0;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--vk-radius-xs, var(--vk-radius-sm));
  background: none;
  color: var(--vk-color-text-muted);
  font-size: 0;
  cursor: pointer;
}
:where(vk-score):not(:defined) > button::before {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
:where(vk-score):not(:defined) > :is([slot="down"], button:not([slot]) ~ button:not([slot])) { order: 2; }
:where(vk-score):not(:defined) > :is([slot="down"], button:not([slot]) ~ button:not([slot]))::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
:where(vk-score):not(:defined) > [aria-pressed="true"] { color: var(--vk-color-primary); }
:where(vk-score):not(:defined) > :is([slot="down"], button:not([slot]) ~ button:not([slot]))[aria-pressed="true"] {
  color: var(--vk-color-danger-text, var(--vk-color-danger));
}

/* --- vk-table with a slotted <table> ----------------------------------
 * `<vk-table><table>…</table></vk-table>` is the server-rendered path: the
 * author's table (cells with tags, buttons, avatars, forms) is the content,
 * so it stays visible before (and without) JS. ::slotted() cannot reach
 * cells, so these rules style it in every state, mirroring the JSON-mode
 * shadow table. `data-stacked` (stack-sm) is set by the component's JS;
 * without JS the table scrolls sideways instead.
 */
:where(vk-table):not(:defined):not(:has(> table)) {
  display: none !important;
}
:where(vk-table:has(> table)) {
  display: block;
  width: 100%;
  overflow-x: auto;
  color: var(--vk-color-text);
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-sm);
  box-shadow: var(--vk-shadow-xs);
}
:where(vk-table) > table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  line-height: var(--vk-line-height);
}
:where(vk-table) > table > caption {
  text-align: left;
  padding: 0.75rem var(--vk-spacing-md);
  font-weight: var(--vk-font-weight-medium);
  color: var(--vk-color-text-secondary);
  border-bottom: 1px solid var(--vk-color-border);
}
:where(vk-table) > table > thead > tr > th {
  background: var(--vk-color-surface-sunken);
  color: var(--vk-color-text);
  font-weight: var(--vk-font-weight-semibold);
  font-size: var(--vk-font-size-xs);
  letter-spacing: var(--vk-tracking-wide);
  text-transform: uppercase;
  text-align: left;
  padding: 0.8rem var(--vk-spacing-md);
  border-bottom: 1px solid var(--vk-color-border-strong);
  white-space: nowrap;
}
:where(vk-table) > table > tbody > tr > :is(td, th) {
  padding: 0.75rem var(--vk-spacing-md);
  border-bottom: 1px solid var(--vk-color-border);
  color: var(--vk-color-text);
  text-align: left;
  vertical-align: middle;
  transition: background var(--vk-transition-fast);
}
:where(vk-table) > table > tbody > tr > th { font-weight: var(--vk-font-weight-semibold); }
:where(vk-table > table > tbody > tr > :is(td, th) a:not([class])) {
  color: var(--vk-color-primary);
  text-underline-offset: 0.2em;
}
:where(vk-table) > table > tbody:last-child > tr:last-child > :is(td, th) { border-bottom: none; }
:where(vk-table[striped]) > table > tbody > tr:nth-child(even) > :is(td, th) {
  background: color-mix(in srgb, var(--vk-color-surface-alt) 38%, var(--vk-color-surface));
}
:where(vk-table[striped-cols]) > table > thead > tr > th:nth-child(even) {
  background: color-mix(in srgb, var(--vk-color-surface-alt) 50%, var(--vk-color-surface-sunken));
}
:where(vk-table[striped-cols]) > table > tbody > tr > :is(td, th):nth-child(even) {
  background: color-mix(in srgb, var(--vk-color-surface-alt) 30%, var(--vk-color-surface));
}
:where(vk-table[hover]) > table > tbody > tr:hover > :is(td, th) {
  background: var(--vk-color-surface-hover);
}
:where(vk-table) > table > tbody > tr:is([aria-selected="true"], [aria-current]:not([aria-current="false"])) > :is(td, th) {
  background: var(--vk-color-primary-subtle);
}
:where(vk-table) > table > tbody > tr:is([aria-selected="true"], [aria-current]:not([aria-current="false"])) > :first-child {
  box-shadow: inset 2px 0 0 var(--vk-color-primary);
}
/* Stacked (stack-sm below --vk-table-stack-bp): each row is a labeled card. */
:where(vk-table[stack-sm][data-stacked]:has(> table)) {
  overflow-x: visible;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
:where(vk-table[stack-sm][data-stacked]) > table,
:where(vk-table[stack-sm][data-stacked]) > table > tbody {
  display: block;
}
:where(vk-table[stack-sm][data-stacked]) > table > thead { display: none; }
:where(vk-table[stack-sm][data-stacked]) > table > tbody + tbody { margin-top: var(--vk-spacing-md); }
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr {
  display: block;
  margin-bottom: var(--vk-spacing-md);
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-sm);
  background: var(--vk-color-surface);
  overflow: hidden;
}
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr:last-child { margin-bottom: 0; }
/* Cells hold arbitrary markup, so the label floats into a left padding
 * gutter instead of a grid track (a grid would split the cell's children). */
:where(vk-table[stack-sm][data-stacked]) > table > caption {
  display: block;
  padding-inline: 0;
  border-bottom: none;
}
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr > :is(td, th) {
  display: flow-root;
  padding: 0.5rem var(--vk-spacing-md) 0.5rem calc(var(--vk-spacing-md) + var(--vk-table-stack-label-size, 7.5rem) + 0.65rem);
  border-bottom: 1px solid var(--vk-color-border);
  white-space: normal;
  background: transparent;
  text-align: left;
}
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr > :is(td, th):last-child { border-bottom: none; }
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr > :is(td, th)::before {
  content: attr(data-label);
  float: left;
  box-sizing: border-box;
  width: var(--vk-table-stack-label-size, 7.5rem);
  margin-left: calc(-1 * (var(--vk-table-stack-label-size, 7.5rem) + 0.65rem));
  padding-right: 0.25rem;
  font-weight: var(--vk-font-weight-semibold);
  font-size: var(--vk-font-size-xs);
  line-height: 1.6rem;
  letter-spacing: var(--vk-tracking-wide);
  text-transform: uppercase;
  color: var(--vk-color-text-muted);
}
/* Unlabeled cells (grip, actions) span the card instead of a blank label. */
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr > :is(td, th):is(:not([data-label]), [data-label=""]) {
  padding-left: var(--vk-spacing-md);
}
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr > :is(td, th):is(:not([data-label]), [data-label=""])::before {
  content: none;
}
:where(vk-table[stack-sm][data-stacked][hover]) > table > tbody > tr:hover > :is(td, th) {
  background: var(--vk-color-surface-hover);
}
:where(vk-table[stack-sm][data-stacked]) > table > tbody > tr:is([aria-selected="true"], [aria-current]:not([aria-current="false"])) {
  border-color: var(--vk-color-primary);
  background: var(--vk-color-primary-subtle);
}

/* --- vk-board / vk-board-column (read-only board of link cards) -------
 * Light-DOM cards are always styled here (::slotted() cannot reach a card's
 * title). Before upgrade (and so without JS) the columns wrap in a row and the
 * heading + count sit on one line; once defined the shadow layout takes over.
 */
:where(vk-board):not(:defined) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--vk-board-gap, var(--vk-spacing-lg));
}
:where(vk-board):not(:defined) > * {
  flex: 1 1 var(--vk-board-column-min, 12rem);
  min-width: 0;
}
:where(vk-board-column):not(:defined) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  row-gap: var(--vk-spacing-sm);
  font-family: var(--vk-font-family);
  color: var(--vk-color-text);
}
:where(vk-board-column):not(:defined) > * { grid-column: 1 / -1; }
:where(vk-board-column):not(:defined) > :is([slot="heading"], [slot="count"]) {
  grid-row: 1;
  display: flex;
  align-items: center;
  min-height: 2rem;
  margin: 0 0 var(--vk-spacing-xs);
  padding-bottom: var(--vk-spacing-sm);
  border-bottom: 1px solid var(--vk-color-border-strong);
}
:where(vk-board-column):not(:defined) > [slot="heading"] {
  grid-column: 1;
  flex-wrap: wrap;
  gap: var(--vk-spacing-sm);
  font-size: var(--vk-font-size-sm);
  font-weight: var(--vk-font-weight-semibold);
  line-height: var(--vk-line-height-tight);
}
:where(vk-board-column):not(:defined) > [slot="count"] {
  grid-column: 2;
  justify-content: flex-end;
  padding-left: var(--vk-spacing-sm);
  font-family: var(--vk-font-mono);
  font-size: var(--vk-font-size-sm);
  color: var(--vk-color-text-muted);
}
:where(vk-board-column) > a {
  display: block;
  padding: 0.75rem 0.875rem;
  background: var(--vk-color-surface);
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-sm);
  color: var(--vk-color-text);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  line-height: var(--vk-line-height);
  text-decoration: none;
  transition:
    transform var(--vk-transition-base),
    border-color var(--vk-transition-base),
    box-shadow var(--vk-transition-base);
}
@media (hover: hover) and (pointer: fine) {
  :where(vk-board-column) > a:hover {
    transform: translateY(-2px);
    border-color: var(--vk-color-border-strong);
  }
}
/* Inset ring: the board scrolls sideways, which would clip an outer one. */
:where(vk-board-column) > a:focus-visible {
  outline: 2px solid var(--vk-color-primary);
  outline-offset: -2px;
  border-color: var(--vk-color-primary);
}
@media (prefers-reduced-motion: reduce) {
  :where(vk-board-column) > a { transition: none; }
  :where(vk-board-column) > a:hover { transform: none; }
}
:where(vk-board-column) > a :where(h2, h3, h4) {
  margin: 0;
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  font-weight: var(--vk-font-weight-semibold);
  line-height: var(--vk-line-height-tight);
  letter-spacing: normal;
  color: var(--vk-color-text);
}
:where(vk-board-column) > a :where(p) {
  margin: var(--vk-spacing-xs) 0 0;
  color: var(--vk-color-text-secondary);
}

/* --- Messages & comments: vk-room-message, vk-reactions, vk-comment ----
 * Message / comment bodies are server-SANITISED HTML in light DOM (Matrix
 * formatted_body, rendered Markdown). The components never sanitise; these
 * rules style the allowed tags in every state, defined or not. They skip
 * slotted helpers (reply quote, thread link, actions row, …) so the
 * components' ::slotted() styles still apply — except nested vk-comment
 * replies, whose bodies are styled the same way.
 */
:where(vk-room-message, vk-comment) :where(p, ul, ol, pre, blockquote, table, details, h1, h2, h3, h4, h5, h6):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment), :where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  margin: 0;
}
:where(vk-room-message, vk-comment) :where(p, ul, ol, pre, blockquote, table, details, h1, h2, h3, h4, h5, h6) + :where(p, ul, ol, pre, blockquote, table, details, h1, h2, h3, h4, h5, h6):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment), :where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  margin-top: 0.5em;
}
:where(vk-room-message, vk-comment) :where(a):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment), :where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  color: var(--vk-color-primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}
:where(vk-room-message, vk-comment) :where(code):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *, pre *)) {
  padding: 0.0625rem 0.25rem;
  border-radius: var(--vk-radius-xs);
  background: var(--vk-color-surface-alt);
  color: var(--vk-color-text);
  font-family: var(--vk-font-mono);
  font-size: 0.875em;
}
:where(vk-room-message, vk-comment) :where(pre):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment), :where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  max-width: 100%;
  overflow-x: auto;
  padding: var(--vk-spacing-sm) var(--vk-spacing-md);
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-sm);
  background: var(--vk-color-surface-alt);
  color: var(--vk-color-text);
  font-family: var(--vk-font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-wrap: normal;
  white-space: pre;
}
:where(vk-room-message, vk-comment) :where(pre code) {
  padding: 0;
  background: none;
  font-size: inherit;
}
:where(vk-room-message, vk-comment) :where(blockquote):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment), :where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  padding: 0.125rem 0 0.125rem 0.75rem;
  border-left: 2px solid var(--vk-color-border-strong);
  color: var(--vk-color-text-muted);
}
:where(vk-room-message, vk-comment) :where(ul, ol):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment), :where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  padding-left: 1.5em;
}
:where(vk-room-message, vk-comment) :where(li + li) { margin-top: 0.125em; }
:where(vk-room-message, vk-comment) :where(img):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment), :where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  max-width: 100%;
  max-height: 20rem;
  height: auto;
  border-radius: var(--vk-radius-sm);
  vertical-align: middle;
}
:where(vk-room-message, vk-comment) :where(img[data-mx-emoticon]) {
  width: auto;
  height: 1.5em;
  border-radius: 0;
}
:where(vk-room-message, vk-comment) :where(del, s, strike) { color: var(--vk-color-text-muted); }
:where(vk-room-message, vk-comment) :where(strong, b):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  color: var(--vk-color-text);
  font-weight: var(--vk-font-weight-semibold);
}
:where(vk-room-message, vk-comment) :where(h1, h2, h3, h4, h5, h6):not(:where(:where(vk-room-message, vk-comment) > [slot]:not(vk-comment) *)) {
  color: var(--vk-color-text);
  font-weight: var(--vk-font-weight-semibold);
  line-height: var(--vk-line-height-tight);
}
:where(vk-room-message, vk-comment) :where(h1) { font-size: 1.25em; }
:where(vk-room-message, vk-comment) :where(h2) { font-size: 1.125em; }
:where(vk-room-message, vk-comment) :where(h3, h4, h5, h6) { font-size: 1em; }
:where(vk-room-message, vk-comment) :where(hr) {
  border: 0;
  border-top: 1px solid var(--vk-color-border);
  margin: 0.75em 0;
}
:where(vk-room-message, vk-comment) :where(table) { border-collapse: collapse; display: block; max-width: 100%; overflow-x: auto; }
:where(vk-room-message, vk-comment) :where(th, td) {
  padding: 0.25em 0.5em;
  border: 1px solid var(--vk-color-border);
  text-align: left;
}
/* Plain links in a comment's actions row (e.g. Reply) read as quiet actions. */
:where(vk-comment) > :where([slot="actions"]) :where(a:not([class])),
:where(vk-comment) > :where(a[slot="actions"]:not([class])) {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.75rem;
  padding: 0 0.375rem;
  border-radius: var(--vk-radius-sm);
  color: var(--vk-color-text-muted);
  font-size: var(--vk-font-size-sm);
  text-decoration: none;
  --vk-icon-size: 0.875rem;
}
:where(vk-comment) > :where([slot="actions"]) :where(a:not([class])):hover,
:where(vk-comment) > :where(a[slot="actions"]:not([class])):hover {
  background: var(--vk-color-surface-hover);
  color: var(--vk-color-text);
}
:where(vk-comment) > :where([slot="actions"]) :where(a:not([class])):focus-visible,
:where(vk-comment) > :where(a[slot="actions"]:not([class])):focus-visible {
  outline: 2px solid var(--vk-color-primary);
  outline-offset: 2px;
}
/* vk-page-header before upgrade / without JS: its title and description
 * live in attributes, so show them from there, with slotted actions on the
 * right as the shadow layout puts them. */
:where(vk-page-header):not(:defined) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--vk-spacing-lg);
  align-items: start;
  padding: var(--vk-spacing-xl) 0 var(--vk-spacing-lg);
}
:where(vk-page-header[title]):not(:defined)::before {
  content: attr(title);
  grid-column: 1;
  margin: 0 0 var(--vk-spacing-xs);
  font-family: var(--vk-font-display);
  font-size: var(--vk-font-size-2xl);
  font-weight: var(--vk-font-weight-heading);
  letter-spacing: var(--vk-tracking-tight);
  line-height: var(--vk-line-height-tight);
  color: var(--vk-color-text);
}
:where(vk-page-header[description]):not(:defined)::after {
  content: attr(description);
  grid-column: 1;
  max-width: 42rem;
  font-size: var(--vk-font-size-base);
  line-height: var(--vk-line-height);
  color: var(--vk-color-text-secondary);
}
:where(vk-page-header):not(:defined) > [slot="actions"] { grid-column: 2; grid-row: 1 / span 2; }
:where(vk-page-header):not(:defined) > [slot="breadcrumb"] { grid-column: 1 / -1; order: -1; }

/* Matrix reply fallbacks duplicate the quote; vk-room-message has slot="reply". */
:where(vk-room-message, vk-comment) :where(mx-reply) { display: none; }

/* Before upgrade / without JS: header from attributes, indented replies. */
:where(vk-room-message, vk-comment-thread, vk-comment):not(:defined) {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--vk-color-text-secondary);
}
:where(vk-room-message):not(:defined) { padding: 0.625rem 0; }
:where(vk-room-message, vk-comment):not(:defined)::before {
  content: attr(author) "\2003" attr(time);
  display: block;
  margin-bottom: 0.125rem;
  white-space: pre-wrap;
  font-size: var(--vk-font-size-sm);
  font-weight: var(--vk-font-weight-semibold);
  color: var(--vk-color-text);
}
:where(vk-room-message[day]):not(:defined)::before {
  content: attr(day) "\A" attr(author) "\2003" attr(time);
}
:where(vk-room-message[continuation]):not(:defined) { padding-top: 0; }
:where(vk-room-message[continuation]):not(:defined)::before { content: none; }
:where(vk-room-message[edited]):not(:defined)::after {
  content: "(edited)";
  display: block;
  font-size: var(--vk-font-size-xs);
  color: var(--vk-color-text-muted);
}
:where(vk-room-message):not(:defined) > [slot="reply"] {
  display: block;
  margin-bottom: 0.375rem;
  padding-left: 0.625rem;
  border-left: 2px solid var(--vk-color-border-strong);
  font-size: var(--vk-font-size-sm);
  color: var(--vk-color-text-muted);
}
:where(vk-room-message):not(:defined) > [slot="thread"] {
  display: inline-block;
  margin-top: 0.375rem;
  font-size: var(--vk-font-size-sm);
  color: var(--vk-color-primary);
}
:where(vk-room-message, vk-comment):not(:defined) > [slot="avatar"] { display: none; }
:where(vk-reactions):not(:defined) {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vk-spacing-xs);
  margin-top: 0.375rem;
}
:where(vk-reactions):not(:defined) > * {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--vk-color-border);
  font-family: var(--vk-font-mono);
  font-size: var(--vk-font-size-xs);
  color: var(--vk-color-text-secondary);
}
:where(vk-reactions):not(:defined) > [data-count]::after { content: attr(data-count); }
:where(vk-reactions):not(:defined) > [data-mine] { border-color: var(--vk-color-primary); }
:where(vk-reactions):not(:defined) img { width: 1rem; height: 1rem; }
:where(vk-comment):not(:defined) { padding-top: var(--vk-spacing-md); }
:where(vk-comment):not(:defined)::before {
  content: attr(author) "\2003" attr(role-tag) "\2003" attr(time);
}
:where(vk-comment[edited]):not(:defined)::before {
  content: attr(author) "\2003" attr(role-tag) "\2003" attr(time) "\2003" "edited";
}
:where(vk-comment[deleted]):not(:defined)::before {
  content: "Deleted member\2003" attr(time);
  font-style: italic;
  color: var(--vk-color-text-muted);
}
:where(vk-comment[removed]):not(:defined)::before {
  content: attr(author) "\2003" attr(time) "\A" "This comment was removed";
}
:where(vk-comment[removed]):not(:defined) > :not([slot], vk-comment) { display: none; }
:where(vk-comment):not(:defined) > [slot="actions"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vk-spacing-xs);
  margin-top: 0.375rem;
  font-size: var(--vk-font-size-sm);
}
:where(vk-comment vk-comment):not(:defined) {
  margin-left: 0.6875rem;
  padding-left: 0.875rem;
  border-left: 1px solid var(--vk-color-border);
}
/* Indent cap: depth 4 and deeper stay at depth 3. */
:where(vk-comment vk-comment vk-comment vk-comment vk-comment):not(:defined) {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

/* --- Navigation link modes + status tones (server-rendered, no JS) -----
 * vk-navbar, vk-sidebar, vk-tabs and vk-segmented with light-DOM <a href>
 * children are real navigation before (or without) JS: links stay visible
 * and usable, the current one (aria-current) is marked the same way the
 * upgraded component marks it. vk-badge / vk-callout tones get their
 * colours too. Only `:not(:defined)`, so the shadow styles win once defined.
 */
:where(vk-navbar):not(:defined) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--vk-spacing-md);
  min-height: 60px;
  padding: 0 var(--vk-spacing-lg);
  box-sizing: border-box;
  background: var(--vk-color-surface);
  border-bottom: 1px solid var(--vk-color-border);
  font-family: var(--vk-font-family);
}
:where(vk-navbar[sticky]):not(:defined) { position: sticky; top: 0; z-index: 500; }
:where(vk-navbar):not(:defined) > [slot="brand"] {
  display: inline-flex;
  align-items: center;
  gap: var(--vk-spacing-sm);
  margin-right: var(--vk-spacing-sm);
  font-family: var(--vk-font-display);
  font-size: var(--vk-font-size-lg);
  font-weight: var(--vk-font-weight-semibold);
  color: var(--vk-color-text);
  text-decoration: none;
}
:where(vk-navbar):not(:defined) > a:not([slot]) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--vk-color-text-secondary);
  font-size: var(--vk-font-size-sm);
  font-weight: var(--vk-font-weight-medium);
  text-decoration: none;
}
:where(vk-navbar):not(:defined) > a:not([slot])[aria-current]:not([aria-current="false"]) {
  color: var(--vk-color-text);
  box-shadow: inset 0 -2px 0 0 var(--vk-color-primary);
}
:where(vk-navbar):not(:defined) > [slot="actions"] { display: inline-flex; align-items: center; gap: var(--vk-spacing-sm); }
:where(vk-navbar):not(:defined) > [slot="actions"]:not([slot="actions"] ~ [slot="actions"]) { margin-left: auto; }

:where(vk-sidebar):not(:defined) {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--vk-spacing-sm);
  box-sizing: border-box;
  background: var(--vk-color-surface);
  border-right: 1px solid var(--vk-color-border);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
}
:where(vk-sidebar[heading]):not(:defined)::before { content: attr(heading); }
:where(vk-sidebar[heading]):not(:defined)::before,
:where(vk-sidebar):not(:defined) > :is(h2, h3, h4) {
  margin: 0;
  padding: var(--vk-spacing-sm) var(--vk-spacing-sm) var(--vk-spacing-xs);
  font-size: var(--vk-font-size-xs);
  font-weight: var(--vk-font-weight-semibold);
  color: var(--vk-color-text-muted);
}
:where(vk-sidebar):not(:defined) > a {
  display: flex;
  align-items: center;
  gap: var(--vk-spacing-sm);
  min-height: 34px;
  padding: var(--vk-spacing-xs) var(--vk-spacing-sm);
  box-sizing: border-box;
  border-radius: var(--vk-radius-sm);
  color: var(--vk-color-text-secondary);
  font-weight: var(--vk-font-weight-medium);
  text-decoration: none;
}
:where(vk-sidebar):not(:defined) > a[aria-current]:not([aria-current="false"]) {
  background: var(--vk-color-surface-alt);
  color: var(--vk-color-text);
  box-shadow: inset 2px 0 0 0 var(--vk-color-primary);
}
/* Phone strip without JS: below the strip breakpoint (see vk-sidebar.js
 * STRIP_FALLBACKS) the links scroll in one row, as the upgraded strip does. */
@media (max-width: 1024px) {
  :where(vk-sidebar[strip="lg"]):not(:defined) {
    flex-direction: row; width: 100%; min-width: 0; overflow-x: auto; height: auto;
    padding: var(--vk-spacing-xs); border-right: 0; border-bottom: 1px solid var(--vk-color-border);
  }
  :where(vk-sidebar[strip="lg"]):not(:defined)::before,
  :where(vk-sidebar[strip="lg"]):not(:defined) > :is(h2, h3, h4, hr) { display: none; }
  :where(vk-sidebar[strip="lg"]):not(:defined) > a { flex: none; }
  :where(vk-sidebar[strip="lg"]):not(:defined) > a[aria-current]:not([aria-current="false"]) { box-shadow: inset 0 -2px 0 0 var(--vk-color-primary); }
}
@media (max-width: 880px) {
  :where(vk-sidebar:not([strip]), vk-sidebar[strip="sidebar"]):not(:defined) {
    flex-direction: row; width: 100%; min-width: 0; overflow-x: auto; height: auto;
    padding: var(--vk-spacing-xs); border-right: 0; border-bottom: 1px solid var(--vk-color-border);
  }
  :where(vk-sidebar:not([strip]), vk-sidebar[strip="sidebar"]):not(:defined)::before,
  :where(vk-sidebar:not([strip]), vk-sidebar[strip="sidebar"]):not(:defined) > :is(h2, h3, h4, hr) { display: none; }
  :where(vk-sidebar:not([strip]), vk-sidebar[strip="sidebar"]):not(:defined) > a { flex: none; }
  :where(vk-sidebar:not([strip]), vk-sidebar[strip="sidebar"]):not(:defined) > a[aria-current]:not([aria-current="false"]) { box-shadow: inset 0 -2px 0 0 var(--vk-color-primary); }
}
@media (max-width: 768px) {
  :where(vk-sidebar[strip="md"]):not(:defined) {
    flex-direction: row; width: 100%; min-width: 0; overflow-x: auto; height: auto;
    padding: var(--vk-spacing-xs); border-right: 0; border-bottom: 1px solid var(--vk-color-border);
  }
  :where(vk-sidebar[strip="md"]):not(:defined)::before,
  :where(vk-sidebar[strip="md"]):not(:defined) > :is(h2, h3, h4, hr) { display: none; }
  :where(vk-sidebar[strip="md"]):not(:defined) > a { flex: none; }
  :where(vk-sidebar[strip="md"]):not(:defined) > a[aria-current]:not([aria-current="false"]) { box-shadow: inset 0 -2px 0 0 var(--vk-color-primary); }
}
@media (max-width: 640px) {
  :where(vk-sidebar[strip="sm"]):not(:defined) {
    flex-direction: row; width: 100%; min-width: 0; overflow-x: auto; height: auto;
    padding: var(--vk-spacing-xs); border-right: 0; border-bottom: 1px solid var(--vk-color-border);
  }
  :where(vk-sidebar[strip="sm"]):not(:defined)::before,
  :where(vk-sidebar[strip="sm"]):not(:defined) > :is(h2, h3, h4, hr) { display: none; }
  :where(vk-sidebar[strip="sm"]):not(:defined) > a { flex: none; }
  :where(vk-sidebar[strip="sm"]):not(:defined) > a[aria-current]:not([aria-current="false"]) { box-shadow: inset 0 -2px 0 0 var(--vk-color-primary); }
}
@media (max-width: 480px) {
  :where(vk-sidebar[strip="xs"]):not(:defined) {
    flex-direction: row; width: 100%; min-width: 0; overflow-x: auto; height: auto;
    padding: var(--vk-spacing-xs); border-right: 0; border-bottom: 1px solid var(--vk-color-border);
  }
  :where(vk-sidebar[strip="xs"]):not(:defined)::before,
  :where(vk-sidebar[strip="xs"]):not(:defined) > :is(h2, h3, h4, hr) { display: none; }
  :where(vk-sidebar[strip="xs"]):not(:defined) > a { flex: none; }
  :where(vk-sidebar[strip="xs"]):not(:defined) > a[aria-current]:not([aria-current="false"]) { box-shadow: inset 0 -2px 0 0 var(--vk-color-primary); }
}
/* Collapsed rail (upgraded): a link's <span> label stays for screen readers only. */
:where(vk-sidebar[collapsed]:defined:not([data-strip])) > a > :where(span) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:where(vk-tabs):not(:defined) {
  display: flex;
  gap: var(--vk-spacing-lg);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--vk-color-border);
  font-family: var(--vk-font-family);
}
:where(vk-tabs):not(:defined) > a {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--vk-spacing-sm);
  padding: 0.6rem 0;
  color: var(--vk-color-text-secondary);
  font-size: var(--vk-font-size-sm);
  font-weight: var(--vk-font-weight-medium);
  text-decoration: none;
  white-space: nowrap;
}
:where(vk-tabs):not(:defined) > a[aria-current]:not([aria-current="false"]) {
  color: var(--vk-color-text);
  box-shadow: inset 0 -2px 0 0 var(--vk-color-primary);
}
:where(vk-tabs):not(:defined) > a[data-count]::after {
  content: attr(data-count);
  font-family: var(--vk-font-mono);
  font-size: var(--vk-font-size-xs);
  color: var(--vk-color-text-secondary);
}
:where(vk-tabs[variant="pills"]):not(:defined) {
  gap: var(--vk-spacing-xs);
  padding: 0.25rem;
  border-bottom: 0;
  border-radius: var(--vk-radius-lg);
  background: var(--vk-color-surface-sunken);
}
:where(vk-tabs[variant="pills"]):not(:defined) > a { padding: 0.4rem var(--vk-spacing-md); border-radius: var(--vk-radius-md); }
:where(vk-tabs[variant="pills"]):not(:defined) > a[aria-current]:not([aria-current="false"]) {
  background: var(--vk-color-surface);
  box-shadow: var(--vk-shadow-sm);
}

:where(vk-segmented):not(:defined) {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--vk-color-border-strong);
  border-radius: var(--vk-radius-md);
  overflow: hidden;
  background: var(--vk-color-surface-sunken);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
}
:where(vk-segmented):not(:defined) > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  border-right: 1px solid var(--vk-color-border);
  color: var(--vk-color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
:where(vk-segmented):not(:defined) > a:last-child { border-right: 0; }
:where(vk-segmented):not(:defined) > a[aria-current]:not([aria-current="false"]) {
  background: var(--vk-color-surface);
  color: var(--vk-color-text);
  font-weight: var(--vk-font-weight-medium);
}
:where(vk-segmented[full]):not(:defined) { display: flex; width: 100%; }
:where(vk-segmented[full]):not(:defined) > a { flex: 1; min-height: 36px; }
:where(vk-segmented[wrap]):not(:defined) {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vk-spacing-xs);
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: none;
}
:where(vk-segmented[wrap]):not(:defined) > a,
:where(vk-segmented[wrap]):not(:defined) > a:last-child {
  min-height: 30px;
  padding: 0 0.65rem;
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-sm);
  color: var(--vk-color-text-secondary);
}
:where(vk-segmented[wrap]):not(:defined) > a[aria-current]:not([aria-current="false"]) {
  border-color: var(--vk-color-primary);
  background: var(--vk-color-primary-subtle, var(--vk-color-primary-light));
  color: var(--vk-color-text);
}

:where(vk-badge):not(:defined) {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  border-radius: calc(var(--vk-radius-sm) * 100);
}
:where(vk-badge[variant="success"]):not(:defined) { background: var(--vk-color-success-light); color: var(--vk-color-success-text); }
:where(vk-badge[variant="warning"]):not(:defined) { background: var(--vk-color-warning-light); color: var(--vk-color-warning-text); }
:where(vk-badge[variant="danger"]):not(:defined) { background: var(--vk-color-danger-light); color: var(--vk-color-danger-text); }
:where(vk-badge[variant="info"]):not(:defined) { background: var(--vk-color-info-light); color: var(--vk-color-info-text); }
:where(vk-badge[variant="neutral"]):not(:defined) { background: var(--vk-color-surface-sunken); color: var(--vk-color-text-secondary); border-color: var(--vk-color-border-strong); }
:where(vk-badge[variant="muted"]):not(:defined) { background: transparent; color: var(--vk-color-text-secondary); border: 1px dashed var(--vk-color-border-strong); }

:where(vk-callout):not(:defined) {
  display: block;
  padding: var(--vk-spacing-md) var(--vk-spacing-lg);
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-md);
  box-shadow: inset 3px 0 0 0 var(--vk-accent, var(--vk-color-info));
  background: var(--vk-color-surface-alt);
  font-size: var(--vk-font-size-sm);
  line-height: 1.55;
}
:where(vk-callout[title]):not(:defined)::before {
  content: attr(title);
  display: block;
  margin-bottom: var(--vk-spacing-xs);
  font-weight: var(--vk-font-weight-semibold);
}
:where(vk-callout):not(:defined) > p { margin: 0; }
:where(vk-callout[variant="note"]):not(:defined) { --vk-accent: var(--vk-color-info); background: var(--vk-color-info-light); }
:where(vk-callout[variant="tip"]):not(:defined) { --vk-accent: var(--vk-color-success); background: var(--vk-color-success-light); }
:where(vk-callout[variant="important"]):not(:defined) { --vk-accent: var(--vk-color-warning); background: var(--vk-color-warning-light); }
:where(vk-callout:is([variant="neutral"], [variant="accent"], [variant="success"], [variant="muted"], [variant="danger"])):not(:defined) { background: var(--vk-color-surface); }
:where(vk-callout[variant="neutral"]):not(:defined) { --vk-accent: var(--vk-color-border-strong); }
:where(vk-callout[variant="accent"]):not(:defined) { --vk-accent: var(--vk-color-primary); }
:where(vk-callout[variant="success"]):not(:defined) { --vk-accent: var(--vk-color-success); }
:where(vk-callout[variant="muted"]):not(:defined) { --vk-accent: var(--vk-color-text-muted); }
:where(vk-callout[variant="danger"]):not(:defined) { --vk-accent: var(--vk-color-danger); }

/* --- Pickers: vk-chip-select, vk-combobox, vk-sortable ----------------
 * vk-chip-select: a native checkbox inside each <label>; before upgrade
 * (and with JS off) the labels are chips and the checkboxes post natively.
 * The defined component adopts the same chip rules into light DOM.
 * vk-combobox: hidden until defined unless it wraps a no-JS fallback
 * (a native <select> or radio <label>s), shown as a plain radio list.
 * vk-sortable: the wrapped table / list is plain content; author-provided
 * `data-sort-fallback` move buttons work with JS off.
 */
:where(vk-chip-select):not(:defined):not(:has(> label)),
:where(vk-combobox):not(:defined):not(:has(> select, > label)) {
  display: none !important;
}
:where(vk-chip-select, vk-combobox):not(:defined) {
  display: block;
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  color: var(--vk-color-text);
}
:where(vk-chip-select, vk-combobox)[label]:not(:defined)::before {
  content: attr(label);
  display: block;
  margin-bottom: var(--vk-spacing-xs);
  font-weight: var(--vk-font-weight-medium);
}
:where(vk-chip-select)[hint]:not(:defined)::after {
  content: attr(hint);
  display: block;
  margin-top: var(--vk-spacing-xs);
  font-size: var(--vk-font-size-xs);
  color: var(--vk-color-text-muted);
}
:where(vk-chip-select):not(:defined) > label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  box-sizing: border-box;
  min-height: 2rem;
  margin: 0 var(--vk-spacing-xs) var(--vk-spacing-xs) 0;
  vertical-align: top;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--vk-color-border-strong);
  border-radius: var(--vk-radius-sm);
  color: var(--vk-color-text-secondary);
  font-family: var(--vk-font-mono, ui-monospace, monospace);
  font-size: 0.8125rem;
  font-weight: var(--vk-font-weight-medium);
  line-height: 1.2;
  cursor: pointer;
}
:where(vk-chip-select):not(:defined) > label > input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
:where(vk-chip-select):not(:defined) > label:has(> input:checked) {
  border-color: var(--vk-color-primary);
  background: var(--vk-color-primary-subtle);
  color: var(--vk-color-text);
}
:where(vk-chip-select):not(:defined) > label:has(> input:checked)::before {
  content: '';
  width: 0.6em;
  height: 0.35em;
  margin: 0 0.1em 0.2em;
  border-left: 2px solid var(--vk-color-primary);
  border-bottom: 2px solid var(--vk-color-primary);
  transform: rotate(-45deg);
}
:where(vk-chip-select):not(:defined) > label:has(> input:focus-visible) {
  box-shadow: var(--vk-shadow-focus);
  border-color: var(--vk-color-primary);
}
:where(vk-combobox):not(:defined) > select {
  box-sizing: border-box;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--vk-color-border-strong);
  border-radius: var(--vk-radius-md);
  background: var(--vk-color-surface);
  color: var(--vk-color-text);
  font: inherit;
  font-size: var(--vk-font-size-base);
}
:where(vk-combobox):not(:defined) > label {
  display: flex;
  align-items: baseline;
  gap: var(--vk-spacing-sm);
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--vk-color-border);
  border-bottom-width: 0;
  background: var(--vk-color-surface-sunken);
  cursor: pointer;
}
:where(vk-combobox):not(:defined) > label:last-of-type { border-bottom-width: 1px; }
:where(vk-combobox):not(:defined) > label:has(> input:checked) { background: var(--vk-color-primary-subtle); }
:where(vk-combobox):not(:defined) > label > input { margin: 0; accent-color: var(--vk-color-primary); align-self: center; }
:where(vk-combobox):not(:defined) [data-meta] {
  font-family: var(--vk-font-mono, ui-monospace, monospace);
  font-size: var(--vk-font-size-xs);
  color: var(--vk-color-text-muted);
}
:where(vk-sortable):not(:defined) { display: block; }

/* --- Tier 3: overlays — no space, never reveal slotted content -------- */
:where(
  vk-modal, vk-drawer, vk-drawer-sidebar, vk-popover, vk-dock,
  vk-tooltip, vk-toast, vk-confirm, vk-lightbox, vk-command-palette, vk-form-dialog
):not(:defined) {
  display: none !important;
}

/* ====================================================================== *
 * Static CSS primitives (optional progressive enhancement)
 *
 * Class-based styling that mirrors presentational components — readable
 * without JS. Pair with vk-* tags when modules load, or use classes alone.
 * ====================================================================== */

.vk-text {
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-base);
  line-height: var(--vk-line-height);
  color: var(--vk-color-text);
  margin: 0 0 var(--vk-spacing-md);
}
.vk-text--secondary { color: var(--vk-color-text-secondary); }
.vk-text--muted { color: var(--vk-color-text-muted); }
.vk-text--sm { font-size: var(--vk-font-size-sm); }
.vk-text--lg { font-size: var(--vk-font-size-lg); }

.vk-heading {
  font-family: var(--vk-font-display);
  font-weight: var(--vk-font-weight-heading);
  line-height: var(--vk-line-height-tight);
  letter-spacing: var(--vk-tracking-tight);
  color: var(--vk-color-text);
  margin: 0 0 var(--vk-spacing-sm);
}
.vk-heading[data-level="1"], .vk-heading--1 { font-size: var(--vk-font-size-4xl); }
.vk-heading[data-level="2"], .vk-heading--2 { font-size: var(--vk-font-size-3xl); }
.vk-heading[data-level="3"], .vk-heading--3 { font-size: var(--vk-font-size-2xl); }
.vk-heading[data-level="4"], .vk-heading--4 { font-size: var(--vk-font-size-xl); }
.vk-heading[data-level="5"], .vk-heading--5 { font-size: var(--vk-font-size-lg); }
.vk-heading[data-level="6"], .vk-heading--6 {
  font-size: var(--vk-font-size-base);
  text-transform: uppercase;
  letter-spacing: var(--vk-tracking-wide);
}

.vk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.5rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--vk-radius-md);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  font-weight: var(--vk-font-weight-medium);
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  background: var(--vk-color-primary);
  color: var(--vk-color-on-primary);
  box-shadow: var(--vk-shadow-xs);
  transition:
    background var(--vk-transition-fast),
    border-color var(--vk-transition-fast),
    box-shadow var(--vk-transition-fast);
}
.vk-btn:hover { background: var(--vk-color-primary-hover); }
.vk-btn:focus-visible {
  outline: none;
  box-shadow: var(--vk-shadow-focus);
}
.vk-btn--secondary {
  background: var(--vk-color-surface);
  color: var(--vk-color-text);
  border-color: var(--vk-color-border-strong);
}
.vk-btn--secondary:hover { background: var(--vk-color-surface-hover); }
.vk-btn--ghost {
  background: transparent;
  color: var(--vk-color-text);
  border-color: transparent;
  box-shadow: none;
}
.vk-btn--ghost:hover { background: var(--vk-color-surface-hover); }
.vk-btn--danger {
  background: var(--vk-color-danger);
  color: #fff;
  border-color: transparent;
}
.vk-btn--danger:hover { background: var(--vk-color-danger-hover); }
.vk-btn--sm { padding: 0.3rem 0.7rem; font-size: var(--vk-font-size-xs); }
.vk-btn--lg { padding: 0.7rem 1.35rem; font-size: var(--vk-font-size-base); }

.vk-card {
  display: block;
  background: var(--vk-color-surface);
  border: 1px solid var(--vk-color-border);
  border-radius: var(--vk-radius-lg);
  box-shadow: var(--vk-shadow-xs);
  overflow: clip;
}
.vk-card__body {
  padding: var(--vk-spacing-lg);
  color: var(--vk-color-text-secondary);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-base);
  line-height: var(--vk-line-height);
}
.vk-card__header {
  padding: var(--vk-spacing-lg) var(--vk-spacing-lg) var(--vk-spacing-sm);
  font-family: var(--vk-font-display);
  font-weight: var(--vk-font-weight-semibold);
  font-size: var(--vk-font-size-lg);
  color: var(--vk-color-text);
}

.vk-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-xs);
  font-weight: var(--vk-font-weight-medium);
  letter-spacing: var(--vk-tracking-wide);
  line-height: 1;
  padding: 0.32em 0.6em;
  border-radius: var(--vk-radius-full);
  background: var(--vk-color-primary-light);
  color: var(--vk-color-primary);
  white-space: nowrap;
}
.vk-badge--success { background: var(--vk-color-success-light); color: var(--vk-color-success-text); }
.vk-badge--warning { background: var(--vk-color-warning-light); color: var(--vk-color-warning-text); }
.vk-badge--danger { background: var(--vk-color-danger-light); color: var(--vk-color-danger-text); }
.vk-badge--neutral {
  background: var(--vk-color-surface-sunken);
  color: var(--vk-color-text-secondary);
  border: 1px solid var(--vk-color-border);
}

.vk-alert {
  display: flex;
  gap: var(--vk-spacing-sm);
  padding: 0.875rem 1rem;
  border-radius: var(--vk-radius-md);
  font-family: var(--vk-font-family);
  font-size: var(--vk-font-size-sm);
  line-height: 1.55;
  background: var(--vk-color-info-light);
  color: var(--vk-color-info-text);
  border: 1px solid color-mix(in srgb, var(--vk-color-info) 30%, transparent);
  box-shadow: inset 3px 0 0 0 var(--vk-color-info);
}
.vk-alert--success {
  background: var(--vk-color-success-light);
  color: var(--vk-color-success-text);
  border-color: color-mix(in srgb, var(--vk-color-success) 30%, transparent);
  box-shadow: inset 3px 0 0 0 var(--vk-color-success);
}
.vk-alert--warning {
  background: var(--vk-color-warning-light);
  color: var(--vk-color-warning-text);
  border-color: color-mix(in srgb, var(--vk-color-warning) 30%, transparent);
  box-shadow: inset 3px 0 0 0 var(--vk-color-warning);
}
.vk-alert--danger {
  background: var(--vk-color-danger-light);
  color: var(--vk-color-danger-text);
  border-color: color-mix(in srgb, var(--vk-color-danger) 30%, transparent);
  box-shadow: inset 3px 0 0 0 var(--vk-color-danger);
}

.vk-stack {
  display: flex;
  flex-direction: column;
  gap: var(--vk-spacing-md);
}
.vk-stack--row { flex-direction: row; flex-wrap: wrap; }
.vk-stack--sm { gap: var(--vk-spacing-sm); }
.vk-stack--lg { gap: var(--vk-spacing-lg); }

.vk-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vk-spacing-md);
  width: 100%;
}
.vk-col {
  flex: 1 1 0;
  min-width: 0;
}

/* ====================================================================== *
 * Page transitions (anti-blink)
 *
 * Custom elements upgrade only after the page's module runs, so a naive load
 * paints the raw layout first and components pop in a frame later — a visible
 * blink, worst for buttons against a dark surface. The fix is two-fold and
 * needs no JS cloak:
 *
 *   1. Pages that need blink-free chrome render-block only the shared header
 *      (`<script type="module" src=".../vk-site-chrome.js" blocking="render">`,
 *      before any catalog import). `<vk-site-header>` uses
 *      `view-transition-name: vk-site-header` so MPA navigation keeps the bar
 *      stable while the page body cross-fades.
 *
 *   2. `@view-transition` opts every same-origin navigation into a native
 *      cross-document View Transition (a smooth cross-fade by default) in
 *      supporting browsers. Browsers without support simply fall back to the
 *      paint-holding behavior from step 1 — still blink-free.
 * ====================================================================== */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* While the page first renders, `core/vk-theme-boot.js` adds `.vk-preload` so
 * nothing animates as the theme settles (a transition firing on the first
 * frame reads as a blink). Zeroing the motion tokens reaches into component
 * shadow DOM (they all transition via these tokens); the universal rule covers
 * light-DOM transitions/animations. The class is removed after the first
 * painted frame. */
html.vk-preload {
  --vk-transition-fast: 0ms;
  --vk-transition-base: 0ms;
  --vk-transition-slow: 0ms;
  --vk-duration-fast: 0ms;
  --vk-duration-base: 0ms;
  --vk-duration-slow: 0ms;
}

html.vk-preload *,
html.vk-preload *::before,
html.vk-preload *::after {
  transition-duration: 0s !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
}

/* vk-dock push layout — applied to push-target (html or custom selector) */
html.vk-dock-push,
body.vk-dock-push,
.vk-dock-push {
  transition:
    margin-right var(--vk-duration-base) var(--vk-ease),
    margin-left var(--vk-duration-base) var(--vk-ease);
}

html.vk-dock-push[data-vk-dock-placement="right"],
body.vk-dock-push[data-vk-dock-placement="right"],
.vk-dock-push[data-vk-dock-placement="right"] {
  margin-right: var(--vk-dock-width, 400px);
}

html.vk-dock-push[data-vk-dock-placement="left"],
body.vk-dock-push[data-vk-dock-placement="left"],
.vk-dock-push[data-vk-dock-placement="left"] {
  margin-left: var(--vk-dock-width, 400px);
}
