/* ============================================================
   Baseline Labs — Global Stylesheet
   baseline.css
   
   This is the single source of truth for all site styling.
   Changes here reflect everywhere — the design system page,
   the product, the blog, everywhere.
   ============================================================ */

/* ============================================================
     SCSS-STYLE DESIGN TOKENS (CSS Custom Properties)
     ============================================================ */

  :root {
    /* — Colour: Warm Neutrals (Anthropic DNA) — */
    --c-bg:           #faf8f5;
    --c-bg-raised:    #ffffff;
    --c-bg-sunken:    #f2efe9;
    --c-bg-hover:     #edeae3;
    --c-border:       #e0ddd4;
    --c-border-subtle:#ece9e1;
    --c-text:         #1a1916;
    --c-text-secondary:#6b6860;
    --c-text-tertiary:#9e9a90;

    /* — Accents — */
    --c-accent:       #c8553a;
    --c-accent-hover: #b34830;
    --c-accent-soft:  rgba(200, 85, 58, 0.08);
    --c-blue:         #5a8fb4;
    --c-blue-soft:    rgba(90, 143, 180, 0.08);
    --c-green:        #6b8f5c;
    --c-green-soft:   rgba(107, 143, 92, 0.08);
    --c-amber:        #e09430;
    --c-amber-soft:   rgba(224, 148, 48, 0.08);

    /* — Typography Scale (Major Third — 1.25) — */
    --fs-xs:    0.694rem;  /* 11.1px */
    --fs-sm:    0.833rem;  /* 13.3px */
    --fs-base:  1rem;      /* 16px   */
    --fs-md:    1.125rem;  /* 18px   */
    --fs-lg:    1.25rem;   /* 20px   */
    --fs-xl:    1.563rem;  /* 25px   */
    --fs-2xl:   1.953rem;  /* 31.3px */
    --fs-3xl:   2.441rem;  /* 39px   */

    --ff-sans:  'DM Sans', -apple-system, sans-serif;
    --ff-product: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --ff-serif: 'DM Serif Display', Georgia, serif;
    --ff-mono:  'JetBrains Mono', monospace;

    --lh-tight:   1.25;
    --lh-normal:  1.5;
    --lh-relaxed: 1.7;

    --fw-light:   300;
    --fw-regular: 400;
    --fw-medium:  500;
    --fw-semi:    600;

    /* — Spacing (8px base grid) — */
    --sp-1:  0.25rem;  /* 4px  */
    --sp-2:  0.5rem;   /* 8px  */
    --sp-3:  0.75rem;  /* 12px */
    --sp-4:  1rem;     /* 16px */
    --sp-5:  1.5rem;   /* 24px */
    --sp-6:  2rem;     /* 32px */
    --sp-7:  2.5rem;   /* 40px */
    --sp-8:  3rem;     /* 48px */
    --sp-9:  4rem;     /* 64px */
    --sp-10: 5rem;     /* 80px */
    --sp-12: 6rem;     /* 96px */

    /* — Radii — */
    --r-sm:  4px;
    --r-md:  8px;
    --r-lg:  12px;
    --r-xl:  16px;
    --r-pill:9999px;

    /* — Shadows — */
    --shadow-sm:  0 1px 2px rgba(26,25,22,0.04);
    --shadow-md:  0 2px 8px rgba(26,25,22,0.06), 0 1px 2px rgba(26,25,22,0.04);
    --shadow-lg:  0 8px 24px rgba(26,25,22,0.08), 0 2px 6px rgba(26,25,22,0.04);
    --shadow-inset: inset 0 1px 3px rgba(26,25,22,0.06);

    /* — Transitions — */
    --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out:cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast:   120ms;
    --dur-normal: 200ms;
    --dur-slow:   400ms;
  }

  /* ============================================================
     DARK MODE
     ============================================================ */
  [data-theme="dark"] {
    --c-bg:           #141413;
    --c-bg-raised:    #1e1d1b;
    --c-bg-sunken:    #0e0e0d;
    --c-bg-hover:     #2a2926;
    --c-border:       #2e2d2a;
    --c-border-subtle:#242320;
    --c-text:         #f0ede6;
    --c-text-secondary:#a09c92;
    --c-text-tertiary:#706c63;

    --c-accent-soft:  rgba(200, 85, 58, 0.12);
    --c-blue-soft:    rgba(90, 143, 180, 0.12);
    --c-green-soft:   rgba(107, 143, 92, 0.12);
    --c-amber-soft:   rgba(224, 148, 48, 0.12);

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.2);
    --shadow-md:  0 2px 8px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.2);
    --shadow-inset: inset 0 1px 3px rgba(0,0,0,0.3);
  }

  /* ============================================================
     RESET & BASE
     ============================================================ */
  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

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

  body {
    font-family: var(--ff-sans);
    font-weight: var(--fw-regular);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: var(--lh-normal);
    transition: background var(--dur-slow) var(--ease-out),
                color var(--dur-slow) var(--ease-out);
  }

  /* ============================================================
     LAYOUT SHELL
     ============================================================ */
  .shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--sp-8) var(--sp-5);
  }

  .masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-9);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--c-border);
  }

  .masthead-left {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-3);
  }

  .masthead-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--r-md);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
  }

  .masthead-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--dur-slow) var(--ease-out);
  }

  .masthead-logo .logo-dark {
    position: absolute;
    top: 0; left: 0;
    opacity: 0;
  }
  [data-theme="dark"] .masthead-logo .logo-light { opacity: 0; }
  [data-theme="dark"] .masthead-logo .logo-dark { opacity: 1; }

  .masthead-text {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    line-height: 1;
  }

  .masthead-title {
    font-family: var(--ff-sans);
    font-size: var(--fs-lg);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    letter-spacing: -0.02em;
    line-height: 1;
  }

  .masthead-sub {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    font-weight: var(--fw-medium);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 4px;
    line-height: 1;
  }

  .theme-toggle {
    appearance: none;
    border: none;
    background: none;
    color: var(--c-text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 18px;
    transition: all var(--dur-normal) var(--ease-out);
  }
  .theme-toggle:hover {
    background: var(--c-bg-hover);
    color: var(--c-text);
  }


/* ============================================================
   TOPBAR + SIDEBAR NAVIGATION
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border-subtle);
  transition: background var(--dur-slow) var(--ease-out),
              border-color var(--dur-slow) var(--ease-out);
}

[data-theme="dark"] .topbar {
  background: rgba(20, 20, 19, 0.85);
}

.topbar-inner {
  padding: 0 var(--sp-3);
  display: flex;
  align-items: center;
  height: 52px;
  gap: var(--sp-3);
}

/* Hamburger — two lines that animate to X */
.hamburger {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  border-radius: var(--r-md);
  transition: background var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}
.hamburger:hover { background: var(--c-bg-hover); }
.hamburger:active { transform: scale(0.93); }

.hamburger-line {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--c-text);
  border-radius: 1px;
  transition: transform 0.3s var(--ease-out), opacity 0.2s var(--ease-out);
  transform-origin: center;
}

/* X state */
.hamburger.is-open .hamburger-line:first-child {
  transform: translateY(3.25px) rotate(45deg);
}
.hamburger.is-open .hamburger-line:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-brand-logo {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
}
.topbar-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--dur-slow) var(--ease-out);
}
.topbar-brand-logo .logo-dark {
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
}
[data-theme="dark"] .topbar-brand-logo .logo-light { opacity: 0; }
[data-theme="dark"] .topbar-brand-logo .logo-dark { opacity: 1; }

.topbar-brand-name {
  font-family: var(--ff-product);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--c-text);
  letter-spacing: -0.02em;
}

.topbar-spacer { flex: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-family: var(--ff-product);
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease-out);
  letter-spacing: -0.02em;
}
.topbar-avatar:hover {
  box-shadow: 0 0 0 2px var(--c-accent-soft);
}

/* Sidebar overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 25, 22, 0.3);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
[data-theme="dark"] .sidebar-overlay {
  background: rgba(0, 0, 0, 0.4);
}
.sidebar-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar panel */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--c-bg-raised);
  border-right: 1px solid var(--c-border-subtle);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.35s var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border-subtle);
  flex-shrink: 0;
}

.sidebar-header-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
}
.sidebar-header-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--dur-slow) var(--ease-out);
}
.sidebar-header-logo .logo-dark {
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
}
[data-theme="dark"] .sidebar-header-logo .logo-light { opacity: 0; }
[data-theme="dark"] .sidebar-header-logo .logo-dark { opacity: 1; }

.sidebar-header-name {
  font-family: var(--ff-product);
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--c-text);
  letter-spacing: -0.02em;
}

.sidebar-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--c-text-tertiary);
  font-size: 20px;
  cursor: pointer;
  padding: var(--sp-1);
  border-radius: var(--r-md);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  display: grid;
  place-items: center;
}
.sidebar-close:hover { color: var(--c-text); background: var(--c-bg-hover); }

.sidebar-nav {
  padding: var(--sp-3);
  flex: 1;
}

.sidebar-section-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--ff-product);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-secondary);
  text-decoration: none;
  border-radius: var(--r-md);
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  letter-spacing: -0.01em;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  line-height: 1.4;
}
.sidebar-link:hover {
  color: var(--c-text);
  background: var(--c-bg-hover);
}
.sidebar-link:active { transform: scale(0.98); }
.sidebar-link--active {
  color: var(--c-text);
  background: var(--c-bg-sunken);
}
.sidebar-link i { font-size: 18px; color: var(--c-text-tertiary); flex-shrink: 0; }
.sidebar-link--active i { color: var(--c-accent); }

.sidebar-footer {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-border-subtle);
  flex-shrink: 0;
}

  /* ============================================================
     ANIMATION LANGUAGE
     ============================================================ */

  /* Slide in from right */
  @keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
  }

  /* Slide in from left */
  @keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
  }

  /* Slide in from bottom (modals, sheets) */
  @keyframes slideInUp {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }

  /* Scale in (modals, popups) */
  @keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }

  /* Fade in */
  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* Overlay backdrop */
  @keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* Animation demo classes */
  .anim-demo-area {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
  }

  .anim-demo {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    align-items: center;
  }

  .anim-demo-box {
    width: 100px;
    height: 64px;
    border-radius: var(--r-lg);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    display: grid;
    place-items: center;
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    font-family: var(--ff-mono);
    overflow: hidden;
    position: relative;
  }

  .anim-trigger {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    cursor: pointer;
    border: none;
    background: var(--c-bg-sunken);
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-family: var(--ff-mono);
    transition: all var(--dur-fast) var(--ease-out);
  }
  .anim-trigger:hover { background: var(--c-border); color: var(--c-text); }
  .anim-trigger:active { transform: scale(0.95); }

  .anim-target {
    width: 100%;
    height: 100%;
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
  }


/* ── Reusable animation utility classes ── */
.anim-fade-in       { animation: fadeIn 0.4s var(--ease-out) both; }
.anim-slide-up      { animation: slideInUp 0.4s var(--ease-out) both; }
.anim-slide-right   { animation: slideInRight 0.4s var(--ease-out) both; }
.anim-slide-left    { animation: slideInLeft 0.4s var(--ease-out) both; }
.anim-scale-in      { animation: scaleIn 0.3s var(--ease-out) both; }
.anim-fade-up       { animation: fadeUp 0.5s var(--ease-out) both; }

/* Stagger delays — apply to children */
.anim-stagger > :nth-child(1)  { animation-delay: 0.05s; }
.anim-stagger > :nth-child(2)  { animation-delay: 0.1s; }
.anim-stagger > :nth-child(3)  { animation-delay: 0.15s; }
.anim-stagger > :nth-child(4)  { animation-delay: 0.2s; }
.anim-stagger > :nth-child(5)  { animation-delay: 0.25s; }
.anim-stagger > :nth-child(6)  { animation-delay: 0.3s; }
.anim-stagger > :nth-child(7)  { animation-delay: 0.35s; }
.anim-stagger > :nth-child(8)  { animation-delay: 0.4s; }
.anim-stagger > :nth-child(9)  { animation-delay: 0.45s; }
.anim-stagger > :nth-child(10) { animation-delay: 0.5s; }
.anim-stagger > :nth-child(11) { animation-delay: 0.55s; }
.anim-stagger > :nth-child(12) { animation-delay: 0.6s; }

  /* Modal demo */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 25, 22, 0.4);
    z-index: 200;
    display: grid;
    place-items: center;
    animation: overlayIn 0.2s var(--ease-out);
    cursor: pointer;
  }
  [data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
  }

  .modal-panel {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    padding: var(--sp-6);
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s var(--ease-out);
    cursor: default;
  }

  .modal-panel-title {
    font-family: var(--ff-product);
    font-weight: 600;
    font-size: var(--fs-lg);
    color: var(--c-text);
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-2);
  }

  .modal-panel-text {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    line-height: var(--lh-relaxed);
    margin-bottom: var(--sp-5);
  }

  .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
  }

  /* ============================================================
     SECTION STRUCTURE
     ============================================================ */
  .section {
    margin-bottom: var(--sp-10);
  }

  .section-header {
    margin-bottom: var(--sp-5);
  }

  .section-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semi);
    color: var(--c-accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--sp-1);
  }

  .section-title {
    font-family: var(--ff-serif);
    font-size: var(--fs-2xl);
    line-height: var(--lh-tight);
    color: var(--c-text);
    letter-spacing: -0.02em;
  }

  .section-desc {
    color: var(--c-text-secondary);
    font-size: var(--fs-base);
    line-height: var(--lh-relaxed);
    max-width: 560px;
    margin-top: var(--sp-2);
  }

  /* ============================================================
     COLOUR PALETTE
     ============================================================ */
  .palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--sp-3);
  }

  .swatch {
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--c-border-subtle);
    background: var(--c-bg-raised);
    transition: transform var(--dur-normal) var(--ease-out),
                box-shadow var(--dur-normal) var(--ease-out);
  }
  .swatch:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }

  .swatch-color {
    height: 72px;
    position: relative;
  }

  .swatch-info {
    padding: var(--sp-2) var(--sp-3);
  }

  .swatch-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-text);
    margin-bottom: 2px;
  }

  .swatch-hex {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
  }

  /* ============================================================
     TYPOGRAPHY SPECIMENS
     ============================================================ */
  .type-stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
  }

  .type-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: baseline;
    gap: var(--sp-4);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--c-border-subtle);
  }

  .type-label {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    flex-shrink: 0;
  }

  .type-specimen {
    color: var(--c-text);
    letter-spacing: -0.01em;
  }

  /* ============================================================
     SPACING VISUALISER
     ============================================================ */
  .spacing-row {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-2);
  }

  .spacing-bar {
    height: 28px;
    background: var(--c-accent-soft);
    border-left: 3px solid var(--c-accent);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    transition: width var(--dur-slow) var(--ease-out);
  }

  .spacing-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 120px;
    flex-shrink: 0;
  }

  .spacing-token {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    min-width: 50px;
  }

  .spacing-value {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-secondary);
    background: var(--c-bg-sunken);
    padding: 2px 6px;
    border-radius: var(--r-sm);
  }

  /* ============================================================
     ICONS SHOWCASE
     ============================================================ */
  .icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--sp-3);
  }

  .icon-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-2);
    border-radius: var(--r-lg);
    border: 1px solid transparent;
    cursor: default;
    transition: all var(--dur-normal) var(--ease-out);
  }
  .icon-tile:hover {
    background: var(--c-bg-raised);
    border-color: var(--c-border);
    box-shadow: var(--shadow-sm);
  }

  .icon-tile i {
    font-size: 24px;
    color: var(--c-text);
    transition: color var(--dur-fast) var(--ease-out);
  }
  .icon-tile:hover i {
    color: var(--c-accent);
  }

  .icon-tile span {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    font-family: var(--ff-mono);
    text-align: center;
  }

  .icon-weights {
    display: flex;
    gap: var(--sp-6);
    align-items: center;
    padding: var(--sp-4);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-5);
  }

  .icon-weight-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-1);
  }

  .icon-weight-item i {
    font-size: 28px;
    color: var(--c-text);
  }

  .icon-weight-item span {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
  }

  /* ============================================================
     LOADING BARS
     ============================================================ */
  .loaders-grid {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
  }

  .loader-demo {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .loader-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
  }

  .loader-label i {
    font-size: 16px;
    color: var(--c-text-tertiary);
  }

  /* Determinate progress bar */
  .progress-track {
    height: 10px;
    background: var(--c-border);
    border-radius: var(--r-pill);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-inset);
  }

  .progress-fill {
    height: 100%;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    position: relative;
    transition: width 1.2s var(--ease-out);
  }

  /* Complete state — no pulse */
  .progress-fill--complete::after {
    display: none;
  }

  .progress-fill--blue  { background: var(--c-blue); }
  .progress-fill--green { background: var(--c-green); }
  .progress-fill--amber { background: var(--c-amber); }

  /* Indeterminate shimmer */
  .progress-shimmer .progress-fill {
    width: 35% !important;
    animation: shimmer 2s var(--ease-in-out) infinite;
  }
  @keyframes shimmer {
    0%   { transform: translateX(-140%); }
    100% { transform: translateX(380%); }
  }

  /* Header row: label left, percentage right, same line */
  .progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
  }

  .progress-status {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    letter-spacing: 0.02em;
  }

  .progress-pct {
    font-family: var(--ff-mono);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    letter-spacing: -0.01em;
  }

  /* Skeleton loader */
  .skeleton {
    background: var(--c-bg-sunken);
    border-radius: var(--r-md);
    position: relative;
    overflow: hidden;
  }
  .skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      var(--c-bg-hover) 50%,
      transparent 100%
    );
    animation: skeleton-sweep 1.6s var(--ease-in-out) infinite;
  }
  @keyframes skeleton-sweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
  }

  .skeleton-card {
    padding: var(--sp-5);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    background: var(--c-bg-raised);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

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

  .skeleton-line {
    height: 12px;
  }
  .skeleton-line--short { width: 60%; }
  .skeleton-line--med   { width: 85%; }
  .skeleton-line--full  { width: 100%; }

  .skeleton-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
  }

  /* Spinner */
  .spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--c-border);
    border-top-color: var(--c-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }
  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  .spinner--lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }

  /* Pulse dot */
  .pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c-green);
    box-shadow: 0 0 0 0 rgba(107, 143, 92, 0.4);
    animation: pulse-ring 2s var(--ease-out) infinite;
  }
  @keyframes pulse-ring {
    0%       { box-shadow: 0 0 0 0 rgba(107, 143, 92, 0.4); }
    70%      { box-shadow: 0 0 0 8px rgba(107, 143, 92, 0); }
    100%     { box-shadow: 0 0 0 0 rgba(107, 143, 92, 0); }
  }

  .loader-inline {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
  }

  /* ============================================================
     COMPONENT DEMOS
     ============================================================ */
  .component-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
  }

  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    font-family: var(--ff-sans);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    border-radius: var(--r-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--dur-normal) var(--ease-out);
    text-decoration: none;
    line-height: 1.4;
  }
  .btn i { font-size: 16px; }

  .btn--primary {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
  }
  .btn--primary:hover {
    background: var(--c-accent-hover);
    border-color: var(--c-accent-hover);
    box-shadow: var(--shadow-sm);
  }
  .btn--primary:active {
    transform: scale(0.97);
    box-shadow: none;
    background: #9a3e28;
  }

  .btn--secondary {
    background: var(--c-bg-raised);
    color: var(--c-text);
    border-color: var(--c-border);
  }
  .btn--secondary:hover {
    background: var(--c-bg-hover);
    border-color: var(--c-text-tertiary);
  }
  .btn--secondary:active {
    transform: scale(0.97);
    background: var(--c-bg-sunken);
  }

  .btn--ghost {
    background: transparent;
    color: var(--c-text-secondary);
    border-color: transparent;
  }
  .btn--ghost:hover {
    background: var(--c-bg-hover);
    color: var(--c-text);
  }
  .btn--ghost:active {
    transform: scale(0.97);
    background: var(--c-border);
  }

  .btn--sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--fs-xs);
  }

  /* Toggle switch */
  .toggle-wrap {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
  }

  .toggle {
    position: relative;
    width: 40px;
    height: 22px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--c-border);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: background var(--dur-normal) var(--ease-out);
    border: none;
    outline: none;
    flex-shrink: 0;
  }

  .toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--c-bg-raised);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform var(--dur-normal) var(--ease-out);
  }

  .toggle:checked {
    background: var(--c-accent);
  }

  .toggle:checked::after {
    transform: translateX(18px);
  }

  .toggle:focus-visible {
    box-shadow: 0 0 0 3px var(--c-accent-soft);
  }

  .toggle-label {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    cursor: pointer;
    user-select: none;
  }

  /* Tags / Badges */
  .tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    border-radius: var(--r-pill);
    line-height: 1.4;
  }

  .tag--accent  { background: var(--c-accent-soft); color: var(--c-accent); }
  .tag--blue    { background: var(--c-blue-soft);   color: var(--c-blue); }
  .tag--green   { background: var(--c-green-soft);  color: var(--c-green); }
  .tag--amber   { background: var(--c-amber-soft);  color: var(--c-amber); }
  .tag--neutral {
    background: var(--c-bg-sunken);
    color: var(--c-text-secondary);
  }

  /* Input */
  .input {
    padding: var(--sp-2) var(--sp-3);
    font-family: var(--ff-sans);
    font-size: var(--fs-sm);
    color: var(--c-text);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--dur-normal) var(--ease-out),
                box-shadow var(--dur-normal) var(--ease-out);
    width: 240px;
  }
  .input::placeholder { color: var(--c-text-tertiary); }
  .input:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
  }

  /* Card */
  .card {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    transition: box-shadow var(--dur-normal) var(--ease-out),
                border-color var(--dur-normal) var(--ease-out);
  }
  .card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--c-border);
  }

  .card-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
  }

  .card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    font-size: 18px;
  }

  .card-title {
    font-weight: var(--fw-medium);
    font-size: var(--fs-base);
    color: var(--c-text);
  }

  .card-text {
    color: var(--c-text-secondary);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
  }

  .cards-grid,
  .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-4);
  }

  /* Divider */
  .divider {
    height: 1px;
    background: var(--c-border);
    border: none;
    margin: var(--sp-6) 0;
  }

  /* Stat widget */
  .stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--sp-4);
  }

  .stat-card {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    padding: var(--sp-4) var(--sp-5);
  }

  .stat-card-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--sp-1);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
  }

  .stat-card-label i { font-size: 14px; }

  .stat-card-value {
    font-family: var(--ff-serif);
    font-size: var(--fs-2xl);
    color: var(--c-text);
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
  }

  .stat-card-delta {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    margin-top: var(--sp-1);
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .stat-card-delta--up   { color: var(--c-green); }
  .stat-card-delta--down { color: var(--c-accent); }

  /* Toast / notification */
  .toast {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--fs-sm);
    color: var(--c-text);
    max-width: 380px;
  }
  .toast i {
    font-size: 20px;
    flex-shrink: 0;
  }
  .toast--success i { color: var(--c-green); }
  .toast--error   i { color: var(--c-accent); }
  .toast--info    i { color: var(--c-blue); }

  /* ============================================================
     RADIUS DEMO
     ============================================================ */
  .radius-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
  }

  .radius-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
  }

  .radius-box {
    width: 56px;
    height: 56px;
    border: 2px solid var(--c-accent);
    background: var(--c-accent-soft);
  }

  .radius-item span {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
  }

  /* ============================================================
     SHADOW DEMO
     ============================================================ */
  .shadow-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-5);
  }

  .shadow-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
  }

  .shadow-box {
    width: 80px;
    height: 80px;
    background: var(--c-bg-raised);
    border-radius: var(--r-lg);
    border: 1px solid var(--c-border-subtle);
  }

  .shadow-item span {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
  }

  /* ============================================================
     CHARTS
     ============================================================ */
  .chart-container {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    transition: box-shadow var(--dur-normal) var(--ease-out);
  }
  .chart-container:hover {
    box-shadow: var(--shadow-md);
  }

  .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--sp-5);
  }

  .chart-title {
    font-weight: var(--fw-medium);
    font-size: var(--fs-base);
    color: var(--c-text);
  }

  .chart-subtitle {
    font-size: var(--fs-sm);
    color: var(--c-text-tertiary);
    margin-top: 2px;
  }

  .chart-value {
    font-family: var(--ff-serif);
    font-size: var(--fs-xl);
    color: var(--c-text);
    letter-spacing: -0.02em;
    text-align: right;
  }

  .chart-delta {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    text-align: right;
    margin-top: 2px;
  }

  .charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--sp-4);
  }

  /* Bar chart */
  .bar-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-2);
    height: 140px;
    padding-top: var(--sp-2);
  }

  .bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: var(--sp-1);
  }

  .bar {
    width: 100%;
    max-width: 36px;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    transition: height 0.8s var(--ease-out), opacity var(--dur-normal) var(--ease-out);
    position: relative;
    cursor: default;
  }
  .bar:hover { opacity: 0.8; }

  .bar--accent { background: var(--c-accent); }
  .bar--blue   { background: var(--c-blue); }
  .bar--green  { background: var(--c-green); }
  .bar--saffron{ background: var(--c-amber); }
  .bar--muted  { background: var(--c-border); }

  .bar-label {
    font-family: var(--ff-mono);
    font-size: 9px;
    color: var(--c-text-tertiary);
    text-align: center;
    letter-spacing: 0.02em;
  }

  /* Sparkline (SVG) */
  .sparkline-wrap {
    position: relative;
    height: 100px;
    margin-top: var(--sp-2);
  }

  .sparkline-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
  }

  .sparkline-axis {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--c-border-subtle);
  }

  /* Donut chart */
  .donut-wrap {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
  }

  .donut-chart {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
  }

  .donut-chart svg {
    transform: rotate(-90deg);
  }

  .donut-legend {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .donut-legend-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
  }

  .donut-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .donut-legend-value {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    margin-left: auto;
    padding-left: var(--sp-3);
  }

  /* Chart axis labels */
  .chart-axis-row {
    display: flex;
    justify-content: space-between;
    margin-top: var(--sp-1);
    padding: 0 2px;
  }

  .chart-axis-label {
    font-family: var(--ff-mono);
    font-size: 9px;
    color: var(--c-text-tertiary);
  }

  /* ============================================================
     NOTIFICATIONS
     ============================================================ */
  .notif-stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

  /* Inline banner notifications */
  .notif-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--r-lg);
    border: 1px solid;
    position: relative;
  }

  .notif-banner i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
  }

  .notif-body {
    flex: 1;
    min-width: 0;
  }

  .notif-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    margin-bottom: 2px;
  }

  .notif-text {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    line-height: var(--lh-relaxed);
  }

  .notif-time {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    flex-shrink: 0;
    margin-top: 1px;
  }

  .notif-dismiss {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    background: none;
    border: none;
    color: var(--c-text-tertiary);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    border-radius: var(--r-sm);
    transition: color var(--dur-fast) var(--ease-out);
    line-height: 1;
  }
  .notif-dismiss:hover { color: var(--c-text); }

  .notif--info {
    background: var(--c-blue-soft);
    border-color: rgba(90, 143, 180, 0.2);
  }
  .notif--info i { color: var(--c-blue); }

  .notif--success {
    background: var(--c-green-soft);
    border-color: rgba(107, 143, 92, 0.2);
  }
  .notif--success i { color: var(--c-green); }

  .notif--warning {
    background: var(--c-amber-soft);
    border-color: rgba(224, 148, 48, 0.2);
  }
  .notif--warning i { color: var(--c-amber); }

  .notif--error {
    background: var(--c-accent-soft);
    border-color: rgba(200, 85, 58, 0.2);
  }
  .notif--error i { color: var(--c-accent); }

  /* Notification actions */
  .notif-actions {
    display: flex;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
  }

  /* Notification list (activity feed style) */
  .notif-list {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    overflow: hidden;
  }

  .notif-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--c-border-subtle);
  }

  .notif-list-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
  }

  .notif-count {
    background: var(--c-accent);
    color: #fff;
    font-size: 10px;
    font-weight: var(--fw-semi);
    padding: 1px 6px;
    border-radius: var(--r-pill);
    line-height: 1.5;
  }

  .notif-list-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--c-border-subtle);
    transition: background var(--dur-fast) var(--ease-out);
    cursor: default;
  }
  .notif-list-item:last-child { border-bottom: none; }
  .notif-list-item:hover { background: var(--c-bg-sunken); }

  .notif-list-item--unread {
    background: rgba(90, 143, 180, 0.03);
  }
  .notif-list-item--unread::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-blue);
    flex-shrink: 0;
    margin-top: 6px;
  }

  .notif-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  .notif-list-body {
    flex: 1;
    min-width: 0;
  }

  .notif-list-text {
    font-size: var(--fs-sm);
    color: var(--c-text);
    line-height: var(--lh-normal);
  }

  .notif-list-meta {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    margin-top: 2px;
  }

  /* ============================================================
     TOAST POPUPS
     ============================================================ */
  .toast-container {
    position: fixed;
    bottom: var(--sp-5);
    right: var(--sp-5);
    display: flex;
    flex-direction: column-reverse;
    gap: var(--sp-3);
    z-index: 1000;
    pointer-events: none;
  }

  .toast-popup {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    padding-bottom: calc(var(--sp-4) + 4px);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 420px;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    transform: translateX(calc(100% + var(--sp-5)));
    opacity: 0;
    transition: transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
  }

  .toast-popup.toast-enter {
    transform: translateX(0);
    opacity: 1;
  }

  .toast-popup.toast-exit {
    transform: translateX(calc(100% + var(--sp-5)));
    opacity: 0;
  }

  .toast-popup i.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
  }

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

  .toast-popup .toast-msg-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--c-text);
    margin-bottom: 2px;
  }

  .toast-popup .toast-msg-text {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    line-height: var(--lh-relaxed);
  }

  .toast-popup .toast-close {
    background: none;
    border: none;
    color: var(--c-text-tertiary);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    border-radius: var(--r-sm);
    transition: color var(--dur-fast) var(--ease-out);
    flex-shrink: 0;
    line-height: 1;
  }
  .toast-popup .toast-close:hover { color: var(--c-text); }

  /* Progress bar at bottom of toast for auto-dismiss */
  .toast-timer {
    position: absolute;
    bottom: 0;
    left: var(--sp-3);
    right: var(--sp-3);
    height: 2px;
    background: var(--c-border-subtle);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    overflow: hidden;
  }

  .toast-timer-fill {
    height: 100%;
    border-radius: var(--r-pill);
    transition: width linear;
  }

  /* Toast demo button row */
  .toast-demo-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
  }

  /* ============================================================
     DATA TABLES
     ============================================================ */
  .data-table-wrap {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    overflow: hidden;
  }

  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
  }

  .data-table thead {
    border-bottom: 1px solid var(--c-border);
  }

  .data-table th {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    font-weight: var(--fw-semi);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  .data-table td {
    padding: var(--sp-3) var(--sp-4);
    color: var(--c-text);
    border-bottom: 1px solid var(--c-border-subtle);
    vertical-align: middle;
  }

  .data-table tbody tr {
    transition: background var(--dur-fast) var(--ease-out);
  }
  .data-table tbody tr:hover {
    background: var(--c-bg-sunken);
  }
  .data-table tbody tr:last-child td {
    border-bottom: none;
  }

  .table-query {
    font-weight: var(--fw-medium);
    color: var(--c-text);
  }

  .table-mono {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-secondary);
  }

  .table-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
  }
  .table-trend--up   { color: var(--c-green); }
  .table-trend--down { color: var(--c-accent); }

  .table-time {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
  }

  .table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-4);
    border-bottom: 1px solid var(--c-border-subtle);
  }

  .table-title {
    font-weight: var(--fw-medium);
    font-size: var(--fs-base);
    color: var(--c-text);
  }

  /* Position badge */
  .pos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    border-radius: var(--r-sm);
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semi);
    background: var(--c-bg-sunken);
    color: var(--c-text-secondary);
  }
  .pos-badge--top3 {
    background: var(--c-accent-soft);
    color: var(--c-accent);
  }

  /* ============================================================
     DROPDOWNS
     ============================================================ */
  .dropdown {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: box-shadow var(--dur-normal) var(--ease-out);
  }
  .dropdown:hover {
    box-shadow: var(--shadow-sm);
  }

  .dropdown-trigger {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    width: 100%;
    padding: var(--sp-4);
    background: none;
    border: none;
    font-family: var(--ff-sans);
    font-size: var(--fs-sm);
    color: var(--c-text);
    cursor: pointer;
    text-align: left;
    transition: background var(--dur-fast) var(--ease-out);
  }
  .dropdown-trigger:hover {
    background: var(--c-bg-sunken);
  }

  .dropdown-trigger-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  .dropdown-trigger-content {
    flex: 1;
    min-width: 0;
  }

  .dropdown-trigger-title {
    font-weight: var(--fw-medium);
    color: var(--c-text);
    margin-bottom: 1px;
  }

  .dropdown-trigger-sub {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
  }

  .dropdown-chevron {
    font-size: 18px;
    color: var(--c-text-tertiary);
    transition: transform 0.3s var(--ease-out);
    flex-shrink: 0;
  }

  .dropdown.dropdown--open .dropdown-chevron {
    transform: rotate(180deg);
  }

  .dropdown-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease-out);
  }

  .dropdown--open .dropdown-body {
    max-height: 600px;
  }

  .dropdown-inner {
    padding: 0 var(--sp-4) var(--sp-4);
    border-top: 1px solid var(--c-border-subtle);
    padding-top: var(--sp-4);
  }

  .dropdown-inner p {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    line-height: var(--lh-relaxed);
    margin-bottom: var(--sp-3);
  }
  .dropdown-inner p:last-child { margin-bottom: 0; }

  .dropdown-meta {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
  }

  .dropdown-meta-item {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
  }
  .dropdown-meta-item i { font-size: 14px; }

  .dropdown-stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

  /* ============================================================
     DESIGN PRINCIPLES (Section 0)
     ============================================================ */
  .principles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
  }

  .principle {
    padding: var(--sp-5);
    border-radius: var(--r-lg);
    border: 1px solid var(--c-border-subtle);
    background: var(--c-bg-raised);
    transition: border-color var(--dur-normal) var(--ease-out);
  }
  .principle:hover { border-color: var(--c-border); }

  .principle-number {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-accent);
    margin-bottom: var(--sp-2);
    letter-spacing: 0.04em;
  }

  .principle-title {
    font-weight: var(--fw-semi);
    font-size: var(--fs-base);
    color: var(--c-text);
    margin-bottom: var(--sp-2);
    line-height: var(--lh-tight);
  }

  .principle-text {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    line-height: var(--lh-relaxed);
  }

  .dl-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--sp-1) var(--sp-4);
    margin-top: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--c-border-subtle);
  }

  .dl-label {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    padding: var(--sp-1) 0;
  }

  .dl-value {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    padding: var(--sp-1) 0;
    border-bottom: 1px solid var(--c-border-subtle);
  }
  .dl-value:last-child { border-bottom: none; }

  .dl-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
  }

  /* ============================================================
     FILTER PANEL
     ============================================================ */
  .filter-panel {
    display: none;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--c-border-subtle);
    background: var(--c-bg-sunken);
    gap: var(--sp-3);
    flex-wrap: wrap;
    align-items: center;
  }
  .filter-panel.filter-open { display: flex; }

  .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 4px 10px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    border-radius: var(--r-pill);
    border: 1px solid var(--c-border);
    background: var(--c-bg-raised);
    color: var(--c-text-secondary);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
  }
  .filter-chip:hover { border-color: var(--c-text-tertiary); }
  .filter-chip.filter-active {
    background: var(--c-accent-soft);
    border-color: var(--c-accent);
    color: var(--c-accent);
  }
  .filter-chip i { font-size: 12px; }

  /* ============================================================
     CHATBOT
     ============================================================ */
  .chat-window {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-xl);
    overflow: hidden;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
  }

  .chat-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-bottom: 1px solid var(--c-border-subtle);
  }

  .chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--r-pill);
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  .chat-header-info {
    flex: 1;
  }

  .chat-header-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--c-text);
  }

  .chat-header-status {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .chat-body {
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    min-height: 320px;
    max-height: 420px;
    overflow-y: auto;
  }

  /* Message rows */
  .chat-row {
    display: flex;
    gap: var(--sp-2);
    align-items: flex-end;
    opacity: 0;
    transform: translateY(8px);
    animation: chatIn 0.3s var(--ease-out) forwards;
  }
  .chat-row--user {
    flex-direction: row-reverse;
  }

  @keyframes chatIn {
    to { opacity: 1; transform: translateY(0); }
  }

  .chat-msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--r-pill);
    display: grid;
    place-items: center;
    font-size: 11px;
    flex-shrink: 0;
    margin-bottom: 2px;
  }

  /* Bubbles */
  .chat-bubble {
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
    max-width: 80%;
  }

  .chat-bubble--bot {
    background: var(--c-bg-sunken);
    color: var(--c-text);
    border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-sm);
  }

  .chat-bubble--user {
    background: var(--c-accent);
    color: #fff;
    border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg);
  }

  /* Tool use card */
  .chat-tool {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--c-border-subtle);
    border-radius: var(--r-lg);
    background: var(--c-bg-raised);
    max-width: 80%;
    font-size: var(--fs-xs);
  }

  .chat-tool-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    font-size: 14px;
    flex-shrink: 0;
  }

  .chat-tool-info {
    flex: 1;
    min-width: 0;
  }

  .chat-tool-name {
    font-weight: var(--fw-semi);
    color: var(--c-text);
    margin-bottom: 1px;
  }

  .chat-tool-detail {
    color: var(--c-text-tertiary);
    font-family: var(--ff-mono);
  }

  .chat-tool-status {
    font-size: 14px;
    flex-shrink: 0;
  }

  /* Typing indicator */
  .chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--sp-3) var(--sp-4);
    background: var(--c-bg-sunken);
    border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-sm);
    width: fit-content;
  }

  .typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-text-tertiary);
    animation: typingBounce 1.2s var(--ease-in-out) infinite;
  }
  .typing-dot:nth-child(2) { animation-delay: 0.15s; }
  .typing-dot:nth-child(3) { animation-delay: 0.3s; }

  @keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-4px); opacity: 1; }
  }

  /* Chat input bar */
  .chat-input-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--c-border-subtle);
  }

  .chat-input {
    flex: 1;
    padding: var(--sp-2) var(--sp-3);
    font-family: var(--ff-sans);
    font-size: var(--fs-sm);
    color: var(--c-text);
    background: var(--c-bg-sunken);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--dur-fast) var(--ease-out);
  }
  .chat-input:focus { border-color: var(--c-border); }
  .chat-input::placeholder { color: var(--c-text-tertiary); }

  .chat-send {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    border: none;
    background: var(--c-accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 16px;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
  }
  .chat-send:hover { background: var(--c-accent-hover); }
  .chat-send:active { transform: scale(0.92); }

  /* ============================================================
     STAGGER ENTRY ANIMATIONS
     ============================================================ */
  .section {
    opacity: 0;
    transform: translateY(16px);
    animation: fadeUp 0.5s var(--ease-out) forwards;
  }
  .section:nth-child(1)  { animation-delay: 0.05s; }
  .section:nth-child(2)  { animation-delay: 0.1s; }
  .section:nth-child(3)  { animation-delay: 0.15s; }
  .section:nth-child(4)  { animation-delay: 0.2s; }
  .section:nth-child(5)  { animation-delay: 0.25s; }
  .section:nth-child(6)  { animation-delay: 0.3s; }
  .section:nth-child(7)  { animation-delay: 0.35s; }
  .section:nth-child(8)  { animation-delay: 0.4s; }
  .section:nth-child(9)  { animation-delay: 0.45s; }
  .section:nth-child(10) { animation-delay: 0.5s; }
  .section:nth-child(11) { animation-delay: 0.55s; }
  .section:nth-child(12) { animation-delay: 0.6s; }
  .section:nth-child(13) { animation-delay: 0.65s; }
  .section:nth-child(14) { animation-delay: 0.7s; }
  .section:nth-child(15) { animation-delay: 0.75s; }
  .section:nth-child(16) { animation-delay: 0.8s; }
  .section:nth-child(17) { animation-delay: 0.85s; }
  .section:nth-child(18) { animation-delay: 0.9s; }
  .section:nth-child(19) { animation-delay: 0.95s; }

  @keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
  }

  /* ============================================================
     RESPONSIVE
     ============================================================ */
  @media (max-width: 640px) {
    .shell { padding: var(--sp-5) var(--sp-4); }
    .masthead { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
    .type-row { grid-template-columns: 1fr; gap: var(--sp-1); }
    .icon-weights { flex-wrap: wrap; gap: var(--sp-4); }
    .stat-row { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .principles { grid-template-columns: 1fr; }
    .dl-grid { grid-template-columns: 1fr; gap: 0 var(--sp-2); }
    .donut-wrap { flex-direction: column; align-items: flex-start; }
    .notif-list { max-width: 100% !important; }
    .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .dropdown-stack { max-width: 100% !important; }
  }