/* Trail Builder Design System - Consolidated CSS */
/*
 * Font Loading
 * Salesforce Sans and display font family definitions
 * Local files with CDN fallback
 */

/* Salesforce Sans - Light (300) */
@font-face {
  font-family: "Salesforce Sans";
  src: url("/fonts/SalesforceSans-Light.woff2") format("woff2"),
       url("/fonts/SalesforceSans-Light.woff") format("woff"),
       url("https://a.sfdcstatic.com/shared/fonts/salesforce-sans/SalesforceSans-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* Salesforce Sans - Light Italic (300) */
@font-face {
  font-family: "Salesforce Sans";
  src: url("/fonts/SalesforceSans-LightItalic.woff2") format("woff2"),
       url("/fonts/SalesforceSans-LightItalic.woff") format("woff"),
       url("https://a.sfdcstatic.com/shared/fonts/salesforce-sans/SalesforceSans-LightItalic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

/* Salesforce Sans - Regular (400) */
@font-face {
  font-family: "Salesforce Sans";
  src: url("/fonts/SalesforceSans-Regular.woff2") format("woff2"),
       url("/fonts/SalesforceSans-Regular.woff") format("woff"),
       url("https://a.sfdcstatic.com/shared/fonts/salesforce-sans/SalesforceSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Salesforce Sans - Regular Italic (400) */
@font-face {
  font-family: "Salesforce Sans";
  src: url("/fonts/SalesforceSans-Italic.woff2") format("woff2"),
       url("/fonts/SalesforceSans-Italic.woff") format("woff"),
       url("https://a.sfdcstatic.com/shared/fonts/salesforce-sans/SalesforceSans-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Salesforce Sans - Bold (700) */
@font-face {
  font-family: "Salesforce Sans";
  src: url("/fonts/SalesforceSans-Bold.woff2") format("woff2"),
       url("/fonts/SalesforceSans-Bold.woff") format("woff"),
       url("https://a.sfdcstatic.com/shared/fonts/salesforce-sans/SalesforceSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Salesforce Sans - Bold Italic (700) */
@font-face {
  font-family: "Salesforce Sans";
  src: url("/fonts/SalesforceSans-BoldItalic.woff2") format("woff2"),
       url("/fonts/SalesforceSans-BoldItalic.woff") format("woff"),
       url("https://a.sfdcstatic.com/shared/fonts/salesforce-sans/SalesforceSans-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* Neutraface - Display font */
@font-face {
  font-family: "Neutraface";
  src: url("/fonts/Neutraface.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* TrailheadBold - Trailhead branding font */
@font-face {
  font-family: "TrailheadBold";
  src: url("/fonts/TrailheadBold.eot");
  src: url("/fonts/TrailheadBold.woff2") format("woff2"),
       url("/fonts/TrailheadBold.woff") format("woff"),
       url("/fonts/TrailheadBold.svg") format("svg");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* AvantGarde-Demi - Display headings font */
@font-face {
  font-family: "AvantGarde-Demi";
  src: url("/fonts/AvantGarde-Demi.woff2") format("woff2"),
       url("https://a.sfdcstatic.com/shared/fonts/avant-garde/AvantGardeForSalesforceW05-Dm.woff2") format("woff2"),
       url("https://a.sfdcstatic.com/shared/fonts/avant-garde/AvantGardeForSalesforceW05-Dm.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ITC Avant Garde - Alias for compatibility */
@font-face {
  font-family: "ITC Avant Garde";
  src: url("/fonts/AvantGarde-Demi.woff2") format("woff2"),
       url("https://a.sfdcstatic.com/shared/fonts/avant-garde/AvantGardeForSalesforceW05-Dm.woff2") format("woff2"),
       url("https://a.sfdcstatic.com/shared/fonts/avant-garde/AvantGardeForSalesforceW05-Dm.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
/*
 * Design Tokens
 * Color primitives, semantic tokens, spacing, typography, and theming
 */

:root {
  /* -------------------------------------------------------------------------
     Color Primitives - Raw color values
     ------------------------------------------------------------------------- */
  --blue-50: #f3f8ff;
  --blue-100: #eaf5fe;
  --blue-200: #d4ebfd;
  --blue-600: #1b96ff;
  --blue-700: #0176d3;
  --blue-800: #0a3e8b;
  --blue-900: #0b3173;
  --blue-950: #032d60;

  --gray-50: #fafafa;
  --gray-100: #f3f3f3;
  --gray-200: #e5e5e5;
  --gray-300: #c9c9c9;
  --gray-400: #aeaeae;
  --gray-500: #706e6b;
  --gray-600: #444444;
  --gray-700: #333333;
  --gray-800: #252525;
  --gray-900: #181818;

  --green-100: #def0d8;
  --green-500: #2e844a;
  --green-600: #22683a;

  --orange-100: #fef0e1;
  --orange-500: #fe9339;
  --orange-700: #b45309;

  --red-500: #ea001e;

  /* Trailhead Brand Colors */
  --trailhead-blue: #00a1df;
  --trailhead-blue-dark: #00407e;
  --trailhead-blue-light: rgba(0, 161, 223, 0.05);
  --trailhead-navy: #032d60;
  --trailhead-cyan: #1b96ff;
  --trailhead-teal: #04a49c;
  --trailhead-purple: #9050e9;
  --trailhead-orange: #ff6d3d;
  --trailhead-gradient-start: #032d60;
  --trailhead-gradient-end: #0b5cab;
  --sf-brand-blue: #00a1e0;

  --tds-color-white: hsl(0 0% 100%);
  --tds-color-fog: hsl(0 0% 89.80392156862746%);
  --tds-color-sand: hsl(0 0% 95.29411764705881%);
  --tds-color-meteorite: hsl(0 0% 36.07843137254902%);
  --tds-color-black: hsl(0 0% 9.411764705882353%);
  --tds-color-ocean: hsl(206.57142857142856 99.05660377358491% 41.56862745098039%);
  --tds-color-ocean-dark: #0b5cab;
  --tds-color-ocean-light: #eef4ff;
  --tds-color-ocean-lighter: #d8e6fe;
  --tds-color-foundation-blue: hsl(218.82352941176464 100% 96.66666666666667%);
  --tds-color-midnight: hsl(212.9032258064516 93.93939393939394% 19.411764705882355%);
  --tds-color-granite: hsl(0 0% 68.23529411764706%);
  --tds-color-navy: #001e5b;
  --tds-color-success: #048149;
  --tds-color-ruby: hsl(349.3333333333333 61.016949152542374% 46.274509803921575%);
  --tds-color-stormcloud: hsl(0 0% 57.647058823529406%);

  --tds-font-size-xs: 12px;
  --tds-font-size-sm: 14px;
  --tds-font-size-md: 16px;
  --tds-font-size-lg: 18px;
  --tds-font-size-xl: 20px;
  --tds-font-size-2xl: 24px;
  --tds-font-size-3xl: 32px;

  --tds-spacing-0: 0px;
  --tds-spacing-1: 4px;
  --tds-spacing-2: 8px;
  --tds-spacing-2-5: 10px;
  --tds-spacing-3: 12px;
  --tds-spacing-4: 16px;
  --tds-spacing-5: 20px;
  --tds-spacing-6: 24px;
  --tds-spacing-8: 32px;
  --tds-spacing-10: 40px;
  --tds-spacing-12: 48px;
  --tds-spacing-16: 64px;
  --tds-spacing-20: 80px;
  --tds-spacing-24: 96px;
  --tds-spacing-32: 128px;
  --tds-spacing-40: 160px;
  --tds-spacing-48: 192px;
  --tds-spacing-px: 16px;

  --tds-radius-sm: 2px;
  --tds-radius-md: 4px;
  --tds-radius-lg: 8px;
  --tds-radius-lg-2: 12px;
  --tds-radius-xl: 16px;
  --tds-radius-full: 100%;

  --tds-shadow-none: none;
  --tds-shadow-xs: 0 0 2px 0 #18181808, 0 2px 4px 1px #18181816;
  --tds-shadow-sm: 0 2px 8px -2px #18181808, 0 8px 12px -2px #18181816;

  --tds-line-height-none: 16px;
  --tds-line-height-tight: 18px;
  --tds-line-height-snug: 20.4px;
  --tds-line-height-normal: 24px;
  --tds-line-height-relaxed: 26px;
  --tds-line-height-loose: 32px;
  --tds-font-weight-light: 300;
  --tds-font-weight-regular: 400;
  --tds-font-weight-semibold: 600;
  --tds-font-weight-bold: 700;

  --tds-container-sm: 480px;
  --tds-container-md: 768px;
  --tds-container-lg: 1024px;
  --tds-container-xl: 1280px;

  --tds-breakpoint-sm: 30rem;
  --tds-breakpoint-md: 48rem;
  --tds-breakpoint-lg: 64rem;

  --tds-z-index-negative: -1;
  --tds-z-index-default: 0;
  --tds-z-index-foreground: 1;
  --tds-z-index-page-1: 1100;

  --purple-50: #f3e8ff;
  --purple-500: #9050e9;

  /* -------------------------------------------------------------------------
     Semantic Tokens - Light Theme (default)
     ------------------------------------------------------------------------- */

  /* Backgrounds */
  --color-bg: var(--tds-color-white);
  --color-bg-alt: var(--tds-color-sand);
  --color-bg-subtle: var(--tds-color-sand);
  --color-bg-inverse: var(--tds-color-midnight);
  --color-bg-accent: var(--tds-color-ocean);
  --color-bg-accent-hover: var(--tds-color-ocean-dark);
  --color-bg-success: #def0d8;
  --color-bg-warning: #fef0e1;
  --color-bg-hover: rgba(3, 45, 96, 0.04);
  --color-bg-active: rgba(3, 45, 96, 0.08);
  --color-bg-layout: var(--tds-color-sand);
  --color-bg-accent-light: var(--tds-color-foundation-blue);

  /* Foregrounds */
  --color-text: var(--tds-color-black);
  --color-text-secondary: var(--tds-color-meteorite);
  --color-text-muted: var(--tds-color-stormcloud);
  --color-text-inverse: var(--tds-color-white);
  --color-text-accent: var(--tds-color-ocean);
  --color-text-success: var(--tds-color-evergreen);
  --color-text-warning: #b45309;
  --color-text-error: #ea001e;

  /* Borders */
  --color-border: var(--tds-color-fog);
  --color-border-strong: var(--tds-color-granite);
  --color-border-accent: var(--tds-color-ocean);
  --color-border-success: rgba(46, 132, 74, 0.3);

  /* -------------------------------------------------------------------------
     Surfaces & Component Colors
     ------------------------------------------------------------------------- */
  --surface-sidebar: var(--tds-color-white);
  --surface-main: var(--tds-color-sand);
  --surface-card: var(--tds-color-white);
  --surface-subtle: var(--tds-color-sand);
  --border-card: var(--tds-color-fog);
  --border-muted: var(--tds-color-fog);
  --tile-bg: var(--tds-color-foundation-blue);
  --tile-border: var(--tds-color-ice);
  --confidence-bg: var(--tds-color-foundation-blue);
  --confidence-border: var(--tds-color-ice);
  --success-bg: #f1fff6;
  --heading-accent: var(--tds-color-midnight);
  --draft-bg: var(--tds-color-foundation-blue);
  --draft-border: rgba(27, 150, 255, 0.12);
  --generated-bg: var(--tds-color-foundation-blue);
  --generated-outline: rgba(27, 150, 255, 0.18);
  --accent-soft: var(--tds-color-foundation-blue);
  --progress-track: var(--tds-color-foundation-blue);
  --scrollbar-track: var(--tds-color-sand);
  --scrollbar-thumb: var(--tds-color-granite);
  --scrollbar-thumb-hover: var(--tds-color-stormcloud);

  --trl-surface: #ffffff;
  --trl-surface-alt: #f4f7fb;
  --trl-surface-soft: #eef1f6;
  --trl-border: #d8dde6;
  --trl-border-strong: #c7d3e5;
  --trl-pill-bg: #f4f6f9;
  --trl-pill-border: #d8dde6;
  --trl-pill-filter-bg: var(--tds-color-ocean-light);
  --trl-pill-filter-text: var(--tds-color-ocean-dark);
  --trl-pill-filter-hover-bg: var(--tds-color-ocean-lighter);
  --trl-pill-filter-border: var(--tds-color-ocean-dark);
  --trl-accent-bg: #0b5cab;
  --trl-accent-hover: #084b93;
  --trl-accent-icon: #0b5cab;
  --trl-timeline-line: #d8dde6;
  --trl-node-border: #c7d3e5;
  --trl-node-icon: #8a99ad;
  --trl-discover-icon-bg: #eaf2ff;
  --trl-discover-icon-bg-purple: #f2eaff;
  --trl-heading: #032d60;
  --trl-app-btn-bg: #181818;
  --trl-app-btn-bg-hover: #333333;
  --trl-app-btn-text: #ffffff;
  --trl-badge-header-bg: var(--tds-color-navy);
  --trl-badge-arc-bg: var(--tds-color-white);
  --trl-badge-border: var(--tds-color-fog);
  --trl-badge-shadow: var(--tds-shadow-sm);
  --trl-badge-check-bg: var(--tds-color-success);
  --trl-badge-check-border: var(--tds-color-white);
  --trl-badge-check-shadow: var(--tds-shadow-none);
  --trl-badge-tag-bg: var(--tds-color-sand);
  --trl-badge-tag-text: var(--tds-color-meteorite);
  --trl-badge-title: var(--tds-color-black);
  --trl-badge-desc: var(--tds-color-meteorite);
  --trl-badge-link: var(--tds-color-ocean);
  --trl-badge-btn-border: var(--tds-color-ocean);
  --trl-badge-btn-text: var(--tds-color-ocean);
  --trl-badge-btn-bg: var(--tds-color-white);
  --trl-badge-btn-hover-bg: var(--tds-color-sand);
  --trl-badge-btn-hover-border: var(--tds-color-ocean);
  --trl-badge-btn-hover-text: var(--tds-color-ocean);
  --trl-taxonomy-heading: var(--tds-color-meteorite);
  --trl-taxonomy-text: var(--tds-color-meteorite);
  --trl-taxonomy-link: var(--tds-color-ocean);
  --trl-series-link: var(--tds-color-ocean);
  --trl-locale-bg: var(--tds-color-sand);
  --trl-locale-text: var(--tds-color-meteorite);
  --trl-locale-link: var(--tds-color-ocean);
  --trl-locale-icon: var(--tds-color-meteorite);
  --trl-module-title: var(--tds-color-midnight);
  --trl-module-desc: var(--tds-color-black);
  --trl-module-meta: var(--tds-color-meteorite);
  --trl-module-border: var(--tds-color-fog);
  --trl-module-border-strong: var(--tds-color-granite);
  --trl-module-node-bg: var(--tds-color-white);
  --trl-module-node-border: var(--tds-color-fog);
  --trl-module-node-icon: var(--tds-color-meteorite);

  --trl-btn-bg: var(--tds-color-white);
  --trl-btn-border: var(--tds-color-ocean);
  --trl-btn-text: var(--tds-color-ocean);
  --trl-btn-hover-bg: var(--tds-color-sand);
  --trl-btn-hover-border: var(--tds-color-ocean);
  --trl-btn-hover-text: var(--tds-color-ocean);
  --trl-btn-font-size: var(--tds-font-size-md);
  --trl-btn-line-height: var(--tds-line-height-snug);
  --trl-btn-padding-y: var(--tds-spacing-2);
  --trl-btn-padding-x: var(--tds-spacing-4);
  --trl-btn-radius: var(--tds-radius-md);
  --trl-btn-gap: var(--tds-spacing-2);
  --trl-btn-min-height: 40px;

  --trl-stats-bg: var(--tds-color-sand);
  --trl-stats-text: var(--tds-color-midnight);
  --trl-stats-divider: var(--tds-color-fog);
  --trl-banner-bg: var(--tds-color-midnight);
  --trl-banner-text: var(--tds-color-white);

  /* -------------------------------------------------------------------------
     Layout Dimensions
     ------------------------------------------------------------------------- */
  --topbar-h: 56px;
  --subbar-h: 52px;
  --sidebar-w: 320px;
  --panel-w: 340px;

  /* -------------------------------------------------------------------------
     Spacing Scale (4px base)
     ------------------------------------------------------------------------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* -------------------------------------------------------------------------
     Typography
     ------------------------------------------------------------------------- */
  --font-sans: "Salesforce Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, monospace;

  --text-xs: var(--tds-font-size-xs);
  --text-sm: var(--tds-font-size-sm);
  --text-base: var(--tds-font-size-sm);
  --text-lg: var(--tds-font-size-md);
  --text-xl: var(--tds-font-size-lg);
  --text-2xl: var(--tds-font-size-xl);
  --text-3xl: var(--tds-font-size-2xl);
  --text-4xl: var(--tds-font-size-3xl);

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* -------------------------------------------------------------------------
     Border Radius
     ------------------------------------------------------------------------- */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* -------------------------------------------------------------------------
     Shadows
     ------------------------------------------------------------------------- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-focus: 0 0 0 3px rgba(1, 118, 211, 0.15);

  /* -------------------------------------------------------------------------
     Transitions
     ------------------------------------------------------------------------- */
  --transition-fast: 100ms ease;
  --transition-base: 150ms ease;
  --transition-slow: 200ms ease;
}

/* Dark Theme */
[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #1a1a1a;
  --color-bg-alt: #252525;
  --color-bg-subtle: #2a2a2a;
  --color-bg-inverse: #0b3173;
  --color-bg-accent: #1b96ff;
  --color-bg-accent-hover: #4aa3ff;
  --color-bg-success: #1f2a22;
  --color-bg-warning: #2f2417;
  --color-bg-hover: rgba(255, 255, 255, 0.06);
  --color-bg-active: rgba(255, 255, 255, 0.1);
  --color-bg-layout: #15181d;
  --color-bg-accent-light: rgba(100, 181, 255, 0.12);

  --color-text: #f0f0f0;
  --color-text-secondary: #b0b0b0;
  --color-text-muted: #888888;
  --color-text-inverse: #ffffff;
  --color-text-accent: #64b5ff;

  --color-border: #3a3a3a;
  --color-border-strong: #505050;
  --color-border-accent: #64b5ff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  --surface-sidebar: #1d1f23;
  --surface-main: #1a1b1e;
  --surface-card: #1f2125;
  --surface-subtle: #23252a;
  --border-card: #2f3339;
  --border-muted: #3a3f46;
  --tile-bg: #1e2a3a;
  --tile-border: #2c3f56;
  --confidence-bg: #1c2a3c;
  --confidence-border: #2a3b52;
  --success-bg: #1f2a22;
  --heading-accent: #c0d8ff;
  --draft-bg: #1a2738;
  --draft-border: rgba(100, 181, 255, 0.25);
  --generated-bg: #182538;
  --generated-outline: rgba(100, 181, 255, 0.28);
  --accent-soft: #1c2a3c;
  --progress-track: #24324a;
  --scrollbar-track: #1a1c20;
  --scrollbar-thumb: #3a3f46;
  --scrollbar-thumb-hover: #4a515a;

  --trl-surface: #141922;
  --trl-surface-alt: #0f1319;
  --trl-surface-soft: #1c2431;
  --trl-border: #2b3440;
  --trl-border-strong: #354152;
  --trl-pill-bg: #1b2330;
  --trl-pill-border: #2b3440;
  --trl-pill-filter-bg: var(--trl-surface-soft);
  --trl-pill-filter-text: var(--color-text-accent);
  --trl-pill-filter-hover-bg: var(--trl-accent-bg);
  --trl-pill-filter-border: var(--color-border-accent);
  --trl-accent-bg: #1b3d6b;
  --trl-accent-hover: #24507f;
  --trl-accent-icon: #7fb3ff;
  --trl-timeline-line: #2b3440;
  --trl-node-border: #354152;
  --trl-node-icon: #7f90a8;
  --trl-discover-icon-bg: #1a2636;
  --trl-discover-icon-bg-purple: #2b2340;
  --trl-heading: #dbe6f4;
  --trl-app-btn-bg: #0b0f14;
  --trl-app-btn-bg-hover: #1a1f27;
  --trl-app-btn-text: #ffffff;

  --trl-btn-bg: var(--trl-surface);
  --trl-btn-border: var(--color-border-accent);
  --trl-btn-text: var(--color-text-accent);
  --trl-btn-hover-bg: var(--trl-surface-soft);
  --trl-btn-hover-border: var(--color-border-accent);
  --trl-btn-hover-text: var(--color-text-accent);

  --trl-stats-bg: var(--trl-pill-bg);
  --trl-stats-text: var(--color-text);
  --trl-stats-divider: var(--trl-pill-border);
  --trl-banner-bg: var(--trl-accent-bg);
  --trl-banner-text: var(--color-text-inverse);
  --trl-taxonomy-heading: var(--color-text-secondary);
  --trl-taxonomy-text: var(--color-text-secondary);
  --trl-taxonomy-link: var(--color-text-accent);
  --trl-series-link: var(--color-text-accent);
  --trl-locale-bg: var(--trl-surface-soft);
  --trl-locale-text: var(--color-text-secondary);
  --trl-locale-link: var(--color-text-accent);
  --trl-locale-icon: var(--color-text-secondary);
  --trl-module-title: var(--color-text);
  --trl-module-desc: var(--color-text);
  --trl-module-meta: var(--color-text-secondary);
  --trl-module-border: var(--trl-border);
  --trl-module-border-strong: var(--trl-border-strong);
  --trl-module-node-bg: var(--trl-surface);
  --trl-module-node-border: var(--trl-border);
  --trl-module-node-icon: var(--color-text-secondary);
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #1a1a1a;
    --color-bg-alt: #252525;
    --color-bg-subtle: #2a2a2a;
    --color-bg-inverse: #0b3173;
    --color-bg-accent: #1b96ff;
    --color-bg-accent-hover: #4aa3ff;
    --color-bg-success: #1f2a22;
    --color-bg-warning: #2f2417;
    --color-bg-hover: rgba(255, 255, 255, 0.06);
    --color-bg-active: rgba(255, 255, 255, 0.1);
    --color-bg-layout: #15181d;
    --color-bg-accent-light: rgba(100, 181, 255, 0.12);

    --color-text: #f0f0f0;
    --color-text-secondary: #b0b0b0;
    --color-text-muted: #888888;
    --color-text-inverse: #ffffff;
    --color-text-accent: #64b5ff;

    --color-border: #3a3a3a;
    --color-border-strong: #505050;
    --color-border-accent: #64b5ff;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --surface-sidebar: #1d1f23;
    --surface-main: #1a1b1e;
    --surface-card: #1f2125;
    --surface-subtle: #23252a;
    --border-card: #2f3339;
    --border-muted: #3a3f46;
    --tile-bg: #1e2a3a;
    --tile-border: #2c3f56;
    --confidence-bg: #1c2a3c;
    --confidence-border: #2a3b52;
    --success-bg: #1f2a22;
    --heading-accent: #c0d8ff;
    --draft-bg: #1a2738;
    --draft-border: rgba(100, 181, 255, 0.25);
    --generated-bg: #182538;
    --generated-outline: rgba(100, 181, 255, 0.28);
    --accent-soft: #1c2a3c;
    --progress-track: #24324a;
    --scrollbar-track: #1a1c20;
    --scrollbar-thumb: #3a3f46;
    --scrollbar-thumb-hover: #4a515a;

    --trl-surface: #141922;
    --trl-surface-alt: #0f1319;
    --trl-surface-soft: #1c2431;
    --trl-border: #2b3440;
    --trl-border-strong: #354152;
    --trl-pill-bg: #1b2330;
    --trl-pill-border: #2b3440;
    --trl-pill-filter-bg: var(--trl-surface-soft);
    --trl-pill-filter-text: var(--color-text-accent);
    --trl-pill-filter-hover-bg: var(--trl-accent-bg);
    --trl-pill-filter-border: var(--color-border-accent);
    --trl-accent-bg: #1b3d6b;
    --trl-accent-hover: #24507f;
    --trl-accent-icon: #7fb3ff;
    --trl-timeline-line: #2b3440;
    --trl-node-border: #354152;
    --trl-node-icon: #7f90a8;
    --trl-discover-icon-bg: #1a2636;
    --trl-discover-icon-bg-purple: #2b2340;
    --trl-heading: #dbe6f4;
    --trl-app-btn-bg: #0b0f14;
    --trl-app-btn-bg-hover: #1a1f27;
    --trl-app-btn-text: #ffffff;

    --trl-btn-bg: var(--trl-surface);
    --trl-btn-border: var(--color-border-accent);
    --trl-btn-text: var(--color-text-accent);
    --trl-btn-hover-bg: var(--trl-surface-soft);
    --trl-btn-hover-border: var(--color-border-accent);
    --trl-btn-hover-text: var(--color-text-accent);

    --trl-stats-bg: var(--trl-pill-bg);
    --trl-stats-text: var(--color-text);
    --trl-stats-divider: var(--trl-pill-border);
    --trl-banner-bg: var(--trl-accent-bg);
    --trl-banner-text: var(--color-text-inverse);
    --trl-taxonomy-heading: var(--color-text-secondary);
    --trl-taxonomy-text: var(--color-text-secondary);
    --trl-taxonomy-link: var(--color-text-accent);
    --trl-series-link: var(--color-text-accent);
    --trl-locale-bg: var(--trl-surface-soft);
    --trl-locale-text: var(--color-text-secondary);
    --trl-locale-link: var(--color-text-accent);
    --trl-locale-icon: var(--color-text-secondary);
    --trl-module-title: var(--color-text);
    --trl-module-desc: var(--color-text);
    --trl-module-meta: var(--color-text-secondary);
    --trl-module-border: var(--trl-border);
    --trl-module-border-strong: var(--trl-border-strong);
    --trl-module-node-bg: var(--trl-surface);
    --trl-module-node-border: var(--trl-border);
    --trl-module-node-icon: var(--color-text-secondary);
  }
}
/*
 * Reset & Base Styles
 * CSS reset and foundational element styles
 */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg-alt);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.builder-shell {
  height: 100%;
  overflow: hidden;
}

.body--dashboard {
  background: var(--surface-main);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

ul,
ol {
  list-style: none;
}

/* Turbo frames must not break layout */
turbo-frame {
  display: contents;
}
/*
 * Shell Layout
 * Root container and main structural layout
 *
 * SCROLLING PATTERN (must be followed consistently):
 * ═══════════════════════════════════════════════════
 *
 * For scrolling to work in CSS Grid/Flexbox, EVERY ancestor must constrain height.
 * Default behavior (min-height: auto) prevents scrolling by expanding to fit content.
 *
 * PATTERN FOR SCROLL CONTAINERS:
 *
 * .scroll-parent {
 *   display: flex;
 *   flex-direction: column;
 *   min-height: 0;        ← Required: allows shrinking below content height
 *   overflow: hidden;     ← Required: establishes scroll boundary
 * }
 *
 * .scroll-area {
 *   flex: 1;              ← Takes available space
 *   min-height: 0;        ← Required: allows shrinking
 *   overflow-y: auto;     ← Enables scrolling
 * }
 *
 * .fixed-header-or-footer {
 *   flex-shrink: 0;       ← Prevents shrinking
 * }
 *
 * FOR CSS GRID:
 * - All grid children need min-height: 0
 * - Use 1fr for flexible rows/columns
 *
 * HIERARCHY IN THIS APP:
 * html/body (100%) → .shell (100vh) → .content (1fr) → columns → scroll areas
 */

/* Shell - Root container, fills viewport exactly */
.shell {
  display: grid;
  grid-template-rows: var(--topbar-h) var(--subbar-h) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;       /* Allow grid to shrink */
  overflow: hidden;    /* Nothing escapes the shell */
}

/* All direct children of shell must stretch to fill and not overflow */
.shell > * {
  min-height: 0;
  min-width: 0;
}

/* ---------------------------------------------------------------------------
   Content Area - Multi-column layout

   Structure: .content > .sidebar + .main + .panel (optional)
   Each column is a scroll-parent; scroll happens in children
   --------------------------------------------------------------------------- */

.content {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--panel-w);  /* Default: 3 columns */
  grid-template-rows: minmax(0, 1fr);  /* Single row, fills available space, can shrink */
  height: 100%;
  max-height: 100%;
  min-height: 0;        /* Critical: allows content to shrink within shell */
  overflow: hidden;     /* Boundary for all columns */
}

/* 2-column mode (no panel) */
.content--2col {
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* All columns must be able to shrink - grid handles height via stretch */
.content > * {
  min-height: 0;        /* Allow shrinking below content size */
  min-width: 0;         /* Prevent horizontal overflow */
}
/*
 * Top Bar
 * Primary navigation header
 */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--topbar-h);
  gap: var(--sp-4);
  padding: 0 var(--sp-4);
  background: var(--tds-color-white);
  color: var(--tds-color-midnight);
  border-bottom: 1px solid var(--tds-color-fog);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.topbar__section {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.topbar__section--center {
  justify-content: center;
}

.topbar__section--end {
  justify-content: flex-end;
}

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

.topbar__logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* Language toggle */
.lang-toggle {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.5px;
}

.topbar__title {
  font-family: var(--tds-font-family-display);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.topbar__trail-name {
  color: var(--tds-color-midnight);
  font-weight: var(--weight-bold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
}

.topbar .pill {
  background: var(--tds-color-sand);
  border-color: var(--tds-color-fog);
  color: var(--tds-color-meteorite);
}

[data-theme="dark"] .topbar {
  background: var(--trl-surface);
  color: var(--color-text);
  border-bottom-color: var(--trl-border);
  box-shadow: none;
}

[data-theme="dark"] .topbar__trail-name {
  color: var(--color-text);
}

[data-theme="dark"] .topbar .pill {
  background: var(--trl-pill-bg);
  border-color: var(--trl-border);
  color: var(--color-text-secondary);
}
/*
 * Sub Bar
 * Secondary navigation with tabs
 */

.subbar {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--panel-w);
  align-items: center;
  height: var(--subbar-h);
  background: var(--tds-color-white);
  border-bottom: 1px solid var(--tds-color-fog);
  position: relative;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

[data-theme="dark"] .subbar {
  background: var(--trl-surface);
  border-bottom-color: var(--trl-border);
  box-shadow: none;
}

.subbar--2col {
  grid-template-columns: var(--sidebar-w) 1fr auto;
}

.subbar__section {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--sp-4);
}

.subbar__section--start {
  justify-content: space-between;
  border-right: 1px solid var(--border-card);
}

.subbar__section--end {
  justify-content: flex-end;
  gap: var(--sp-2);
  border-left: 1px solid var(--border-card);
}

.subbar--2col .subbar__section--end {
  border-left: none;
  padding-right: var(--sp-4);
}

.subbar__brand {
  font-weight: var(--weight-bold);
  color: var(--color-text-accent);
}

.subbar__controls {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

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

/* Tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  height: 100%;
  padding: 0 var(--sp-5);
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--sp-1);
  font-weight: var(--weight-bold);
  color: var(--color-text-muted);
  transition: color var(--transition-base);
}

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

.tab[aria-current="page"] {
  color: var(--color-text-accent);
}

.tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--tds-color-ocean);
  border-radius: 3px 3px 0 0;
}
/*
 * Sidebar (Left Column)
 *
 * Pattern: scroll-parent with chat__messages as scroll-area
 * Structure: .sidebar > .chat > .chat__messages (scrolls) + .chat__composer (fixed)
 */

.sidebar {
  /* Grid item with scroll-parent pattern */
  display: flex;
  flex-direction: column;
  height: 100%;         /* Fill grid cell (row is minmax(0, 1fr)) */
  max-height: 100%;
  min-height: 0;        /* Critical: allows shrinking below content size */
  overflow: hidden;     /* Contain children, establish scroll boundary */
  position: relative;
  z-index: 1;

  /* Visual */
  background: var(--surface-sidebar);
  border-right: 1px solid var(--color-border);
}
/*
 * Main (Center Column)
 *
 * Pattern: scroll-parent with main__inner as scroll-area
 * Structure: .main > .main__inner (scrolls)
 */

.main {
  /* Grid item with scroll-parent pattern */
  display: flex;
  flex-direction: column;
  height: 100%;         /* Fill grid cell (row is minmax(0, 1fr)) */
  max-height: 100%;
  min-height: 0;        /* Critical: allows shrinking below content size */
  overflow: hidden;     /* Contain children, establish scroll boundary */
  position: relative;
  z-index: 1;

  /* Visual */
  background: var(--surface-main);
}

.main__inner {
  /* Scroll area - takes remaining space and scrolls */
  flex: 1 1 0%;         /* Grow, shrink, with 0 base */
  height: 100%;
  max-height: 100%;
  min-height: 0;        /* Critical: allows shrinking below content size */
  overflow-x: hidden;
  overflow-y: auto;     /* Enable vertical scrolling */
  overscroll-behavior: contain;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;

  /* Content constraints */
  padding: var(--sp-5);
}

.main__inner::-webkit-scrollbar {
  width: 10px;
}

.main__inner::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.main__inner::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

.main__inner::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Inline Preview Banner - outside main__inner, full width */
.main > .preview-banner--inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  width: 100%;
  max-width: none;
  padding: var(--sp-3) var(--sp-5);
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--color-bg-accent-light);
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
  color: var(--color-text-accent);
  font-size: var(--text-sm);
}

.main > .preview-banner--inline .preview-banner__text {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--weight-semibold);
}

.main > .preview-banner--inline .preview-banner__text .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.main > .preview-banner--inline .publish-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Preview Device Modes */
.main__inner[data-preview-device="mobile"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-bg-alt);
}

/* Mobile preview container */
.main__inner[data-preview-device="mobile"] > .trl-preview {
  max-width: 375px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  border-radius: 16px;
  overflow: hidden;
}
/*
 * Panel (Right Column)
 *
 * Pattern: scroll-parent with panel__wrap as scroll-area
 * Structure: .panel > .panel__wrap (scrolls)
 */

.panel {
  /* Grid item with scroll-parent pattern */
  display: flex;
  flex-direction: column;
  height: 100%;         /* Fill grid cell (row is minmax(0, 1fr)) */
  max-height: 100%;
  min-height: 0;        /* Critical: allows shrinking below content size */
  overflow: hidden;     /* Contain children, establish scroll boundary */
  position: relative;
  z-index: 2;

  /* Visual */
  background: var(--surface-card);
  border-left: 1px solid var(--color-border);
}

.panel__wrap {
  /* Scroll area - takes remaining space and scrolls */
  flex: 1 1 0%;         /* Grow, shrink, with 0 base */
  height: 100%;
  max-height: 100%;
  min-height: 0;        /* Critical: allows shrinking below content size */
  overflow-x: hidden;
  overflow-y: auto;     /* Enable vertical scrolling */
  overscroll-behavior: contain;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;

  /* Content spacing */
  padding: var(--sp-4);
}

.panel__wrap::-webkit-scrollbar {
  width: 10px;
}

.panel__wrap::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.panel__wrap::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

.panel__wrap::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
/*
 * Buttons
 * All button variants and icon buttons
 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--tds-spacing-2) var(--tds-spacing-4);
  font-weight: var(--tds-font-weight-bold);
  font-size: var(--tds-font-size-sm);
  line-height: var(--tds-line-height-snug);
  border-radius: var(--tds-radius-md);
  border: 1px solid var(--tds-color-stormcloud);
  background: var(--tds-color-white);
  color: var(--tds-color-ocean);
  box-shadow: none;
  transition: all var(--transition-base);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--tds-color-sand);
  border-color: var(--tds-color-ocean);
  box-shadow: none;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn--primary {
  background: var(--tds-color-ocean);
  border-color: var(--tds-color-ocean);
  color: var(--tds-color-white);
}

.btn--primary:hover {
  background: var(--tds-color-ocean-dark);
}

.btn--outline {
  background: transparent;
  border-color: var(--tds-color-ocean);
  color: var(--tds-color-ocean);
}

.btn--outline:hover {
  background: var(--tds-color-foundation-blue);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--tds-color-ocean);
}

.btn--ghost:hover {
  background: var(--tds-color-sand);
}

.btn--active {
  background: var(--tds-color-foundation-blue);
  color: var(--tds-color-ocean);
}

.btn--active:hover {
  background: var(--tds-color-foundation-blue);
}

.btn--sm {
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--text-sm);
}

.btn--lg {
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-lg);
}

.btn--full {
  width: 100%;
}

.btn--icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--tds-radius-md);
}

.btn--icon-sm {
  width: 28px;
  height: 28px;
}

.btn--icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
}

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

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

/* Icon buttons for topbar (light on dark) */
.btn--topbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--tds-color-midnight);
  cursor: pointer;
}

.btn--topbar:hover {
  background: var(--tds-color-sand);
}

[data-theme="dark"] .btn--topbar {
  color: var(--color-text);
}

[data-theme="dark"] .btn--topbar:hover {
  background: var(--trl-surface-soft);
}

[data-theme="dark"] .btn {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  color: var(--color-text);
}

[data-theme="dark"] .btn:hover {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border-strong);
}

[data-theme="dark"] .btn--primary {
  background: var(--tds-color-ocean);
  border-color: var(--tds-color-ocean);
  color: var(--tds-color-white);
}

[data-theme="dark"] .btn--primary:hover {
  background: var(--tds-color-ocean-dark);
}

[data-theme="dark"] .btn--outline {
  border-color: var(--color-text-accent);
  color: var(--color-text-accent);
}

[data-theme="dark"] .btn--ghost {
  color: var(--color-text-accent);
}

[data-theme="dark"] .btn--ghost:hover {
  background: var(--trl-surface-soft);
}

.btn--topbar .icon {
  pointer-events: none;
}

/* Theme Toggle */
.theme-toggle__icon {
  display: none;
}

.theme-toggle[data-theme-mode="light"] .theme-toggle__icon--sun,
.theme-toggle[data-theme-mode="dark"] .theme-toggle__icon--moon {
  display: block;
}

/* Icon */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.icon--sm {
  width: 14px;
  height: 14px;
}

.icon--lg {
  width: 24px;
  height: 24px;
}
/*
 * Cards
 * Card container and variants
 */

.card {
  background: var(--tds-color-white);
  border: 1px solid var(--tds-color-fog);
  border-radius: var(--tds-radius-lg);
  box-shadow: var(--tds-shadow-xs);
}

[data-theme="dark"] .card {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  box-shadow: none;
}

.card--interactive {
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card--interactive:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.card__header {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--tds-color-fog);
}

.card__body {
  padding: var(--sp-4);
}

.card__footer {
  padding: var(--sp-4);
  border-top: 1px solid var(--tds-color-fog);
}

[data-theme="dark"] .card__header,
[data-theme="dark"] .card__footer {
  border-color: var(--trl-border);
}

/* Card modifiers for panel */
.card--confidence {
  background: var(--tds-color-foundation-blue);
  border-color: var(--tds-color-ice);
}

[data-theme="dark"] .card--confidence {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
}

/* Mini card (inside accordion) */
.mini-card {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: var(--tds-color-sand);
  border-radius: var(--tds-radius-md);
  border: 1px solid var(--tds-color-fog);
}

.mini-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.mini-card__title {
  font-weight: var(--weight-bold);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-midnight);
}

.mini-card__link {
  color: var(--tds-color-ocean);
  font-size: var(--tds-font-size-sm);
  font-weight: var(--weight-semibold);
}

.mini-card__link:hover {
  text-decoration: underline;
}

.mini-card__list {
  margin-top: var(--sp-2);
  padding-left: var(--sp-4);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
}

/* Bubble Card (inside message) */
.bubble-card {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--tds-radius-md);
  border: 1px solid var(--tds-color-fog);
  background: var(--tds-color-sand);
}

.bubble-card--success {
  background: rgba(46, 132, 74, 0.1);
  border-color: rgba(46, 132, 74, 0.3);
}

.bubble-card__title {
  font-weight: var(--weight-extrabold);
  color: var(--tds-color-midnight);
  margin-bottom: var(--sp-2);
}

.bubble-card__subtitle {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  margin-top: var(--sp-1);
}

.bubble-card__body {
  padding: var(--sp-2);
  background: var(--tds-color-white);
  border: 1px solid var(--tds-color-fog);
  border-radius: var(--tds-radius-sm);
}

.bubble-card__label {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
}

.bubble-card__value {
  font-weight: var(--weight-bold);
  color: var(--tds-color-midnight);
  margin-top: var(--sp-1);
}

.bubble-card__list {
  margin-top: var(--sp-2);
  padding-left: var(--sp-4);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
}

.bubble-card__footer {
  margin-top: var(--sp-3);
  display: flex;
  justify-content: flex-end;
}

.bubble-card__status {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--tds-color-fog);
}
/*
 * Forms
 * Form fields, inputs, and form-related components
 */

.field {
  display: grid;
  gap: var(--sp-1);
}

.label {
  font-size: var(--tds-font-size-sm);
  font-weight: var(--tds-font-weight-bold);
  color: var(--tds-color-meteorite);
}

.input,
.textarea {
  width: 100%;
  padding: var(--tds-spacing-2) var(--tds-spacing-3);
  background: var(--tds-color-white);
  border: 1px solid var(--tds-color-fog);
  border-radius: var(--tds-radius-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.input:hover,
.textarea:hover {
  border-color: var(--tds-color-granite);
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--tds-color-ocean);
  box-shadow: 0 0 0 3px rgba(1, 118, 211, 0.15);
}

.textarea {
  min-height: 72px;
  resize: vertical;
}

/* Field with sparkle button */
.field--sparkle {
  position: relative;
}

.field--sparkle .input,
.field--sparkle .textarea {
  padding-right: 36px;
}

.sparkle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--tds-radius-sm);
  color: var(--tds-color-ocean);
  opacity: 0.7;
  transition: opacity var(--transition-base), background var(--transition-base);
}

.sparkle:hover {
  opacity: 1;
  background: var(--tds-color-foundation-blue);
}

[data-theme="dark"] .label {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .input,
[data-theme="dark"] .textarea {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  color: var(--color-text);
}

[data-theme="dark"] .input:hover,
[data-theme="dark"] .textarea:hover {
  border-color: var(--trl-border-strong);
}

[data-theme="dark"] .input:focus,
[data-theme="dark"] .textarea:focus {
  border-color: var(--color-text-accent);
  box-shadow: 0 0 0 3px rgba(27, 150, 255, 0.25);
}

[data-theme="dark"] .sparkle {
  color: var(--color-text-accent);
}

[data-theme="dark"] .sparkle:hover {
  background: var(--trl-surface-soft);
}
/*
 * Pills & Tags
 * Pill badges and tag components
 */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.4rem 0.75rem;
  font-size: var(--tds-font-size-xs);
  font-weight: var(--weight-medium);
  border-radius: 20px;
  border: 1px solid var(--tds-color-fog);
  background: var(--tds-color-sand);
  color: var(--tds-color-meteorite);
  white-space: nowrap;
}

.pill--success {
  background: rgba(46, 132, 74, 0.12);
  border-color: rgba(46, 132, 74, 0.3);
  color: var(--tds-color-evergreen);
}

.pill--neutral {
  background: var(--tds-color-sand);
  border-color: var(--tds-color-fog);
  color: var(--tds-color-meteorite);
}

[data-theme="dark"] .pill {
  background: var(--trl-pill-bg);
  border-color: var(--trl-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .pill--success {
  background: rgba(46, 132, 74, 0.2);
  border-color: rgba(46, 132, 74, 0.4);
  color: #7fc97f;
}

[data-theme="dark"] .pill--neutral {
  background: var(--trl-pill-bg);
  border-color: var(--trl-border);
  color: var(--color-text-secondary);
}

.tag {
  display: inline-block;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  border-radius: var(--radius-full);
  background: var(--blue-100);
  color: var(--blue-800);
}
/*
 * Accordion
 * Expandable content sections using details/summary
 */

.accordion {
  border-top: 1px solid var(--color-border);
}

.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--sp-3);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
  transition: background var(--transition-base);
}

.accordion__trigger::-webkit-details-marker {
  display: none;
}

.accordion__trigger:hover {
  background: var(--color-bg-hover);
}

.accordion__trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition-base);
}

.accordion[open] .accordion__trigger::after {
  transform: rotate(-135deg);
}

.accordion__content {
  padding: 0 var(--sp-3) var(--sp-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

/* Accordion inside panel (using details/summary) */
.card.accordion {
  border: 1px solid var(--border-card);
  box-shadow: none;
}

.card.accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  cursor: pointer;
  list-style: none;
  transition: background var(--transition-base);
}

.card.accordion > summary::-webkit-details-marker {
  display: none;
}

.card.accordion > summary:hover {
  background: var(--color-bg-hover);
}
/*
 * Chat Components
 * Chat container, messages, composer, and avatar
 */

/* Avatar */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.avatar--agent {
  background: var(--tds-color-foundation-blue);
  border: 1px solid var(--tds-color-ice);
  color: var(--tds-color-ocean);
}

.avatar__icon {
  width: 20px;
  height: 20px;
}

/* Chat Container */
.chat {
  /* Flex child of .sidebar - fills available space */
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;         /* Grow, shrink, with 0 base (important for flex sizing) */
  min-height: 0;        /* Critical: allows shrinking below content size */
  overflow: hidden;     /* Contain scroll area */
}

.chat__messages {
  /* Scroll area - takes remaining space and scrolls */
  flex: 1 1 0%;         /* Grow, shrink, with 0 base */
  min-height: 0;        /* Critical: allows shrinking below content size */
  padding: var(--sp-3) var(--sp-4);
  overflow-x: hidden;
  overflow-y: auto;     /* Enable vertical scrolling */
  overscroll-behavior: contain;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

.chat__messages::-webkit-scrollbar {
  width: 10px;
}

.chat__messages::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.chat__messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

.chat__messages::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.chat__timestamp {
  display: flex;
  justify-content: center;
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  margin: var(--sp-2) 0 var(--sp-3);
}

[data-theme="dark"] .chat__timestamp {
  color: var(--color-text-secondary);
}

.chat__composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 1px solid var(--tds-color-fog);
  align-items: center;
  flex-shrink: 0;
  background: var(--tds-color-white);
}

.chat__input {
  border: 1px solid var(--tds-color-fog);
  border-radius: var(--tds-radius-full);
  padding: var(--sp-2) var(--sp-3);
  background: var(--tds-color-white);
}

.chat__input:focus {
  outline: none;
  border-color: var(--tds-color-ocean);
  box-shadow: 0 0 0 3px rgba(1, 118, 211, 0.15);
}

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

/* Message */
.message {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.message__content {
  min-width: 0;
}

.message__bubble {
  background: var(--tds-color-white);
  border: 1px solid var(--tds-color-fog);
  border-radius: var(--tds-radius-md);
  padding: var(--sp-2) var(--sp-3);
  box-shadow: none;
  font-size: var(--tds-font-size-sm);
  line-height: var(--leading-relaxed);
  color: var(--tds-color-meteorite);
}

.message__meta {
  font-size: var(--tds-font-size-xs);
  color: var(--tds-color-stormcloud);
  margin-top: var(--sp-1);
}

.message__greeting {
  margin-bottom: var(--sp-2);
}

.message__p {
  margin-top: var(--sp-3);
}

.message__p:first-child {
  margin-top: 0;
}

.message__actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

/* Signal (status indicator) */
.signal {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.signal--check {
  font-size: var(--tds-font-size-sm);
  font-weight: var(--weight-semibold);
  color: var(--tds-color-evergreen);
}

.signal__icon {
  width: 16px;
  height: 16px;
}

.signal__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--tds-color-evergreen);
}

.signal__dot--warn {
  background: var(--tds-color-tangerine, #fe9339);
}
/*
 * Panel Components
 * Right panel UI elements
 */

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

.panel__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3);
  font-weight: var(--weight-bold);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-midnight);
}

.panel__body {
  padding: 0 var(--sp-3) var(--sp-3);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  line-height: var(--leading-relaxed);
}

.panel__quote {
  margin: var(--sp-3) 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--tds-color-sand);
  border-radius: var(--tds-radius-sm);
  border-left: 3px solid var(--tds-color-ocean);
  font-style: italic;
}

.panel__actions {
  margin-top: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.panel__rows {
  margin: var(--sp-3) 0;
}

.panel__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--tds-color-fog);
}

.panel__row:last-child {
  border-bottom: none;
}

.panel__row dt {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
}

.panel__row dd {
  font-size: var(--tds-font-size-sm);
  font-weight: var(--weight-semibold);
  color: var(--tds-color-midnight);
}

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-border);
}

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

.panel-row dt {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.panel-row dd {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

/* Panel mini card */
.panel-mini {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.panel-mini__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.panel-mini__title {
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
}

.panel-mini__link {
  color: var(--color-text-accent);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.panel-mini__link:hover {
  text-decoration: underline;
}

.panel-mini__list {
  margin-top: var(--sp-2);
  padding-left: var(--sp-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* Metrics */
.metrics {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-2);
  font-size: var(--tds-font-size-sm);
}

.metric__value {
  font-weight: var(--weight-semibold);
}

/* Stars */
.stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.star {
  width: 16px;
  height: 16px;
  color: var(--color-border-strong);
}

.star--filled {
  color: #FFB400;
}

/* Progress */
.progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-2);
}

.progress__bar {
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--tds-color-foundation-blue);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: var(--progress, 50%);
  background: linear-gradient(90deg, var(--tds-color-ocean), var(--tds-color-azure, #1b96ff));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.progress--success .progress__bar {
  background: rgba(46, 132, 74, 0.15);
}

.progress--success .progress__fill {
  background: linear-gradient(90deg, #048149, #2e844a);
}

[data-theme="dark"] .mini-card,
[data-theme="dark"] .bubble-card {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
}

[data-theme="dark"] .bubble-card__body {
  background: var(--trl-surface);
  border-color: var(--trl-border);
}

[data-theme="dark"] .bubble-card__title,
[data-theme="dark"] .mini-card__title,
[data-theme="dark"] .panel__title {
  color: var(--color-text);
}

[data-theme="dark"] .bubble-card__subtitle,
[data-theme="dark"] .bubble-card__label,
[data-theme="dark"] .bubble-card__list,
[data-theme="dark"] .mini-card__list,
[data-theme="dark"] .panel__body,
[data-theme="dark"] .panel__row dt,
[data-theme="dark"] .message__bubble {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .bubble-card__status {
  border-top-color: var(--trl-border);
}

[data-theme="dark"] .message__bubble {
  background: var(--trl-surface);
  border-color: var(--trl-border);
}

[data-theme="dark"] .message__meta {
  color: var(--color-text-muted);
}

[data-theme="dark"] .chat__composer {
  background: var(--trl-surface);
  border-top-color: var(--trl-border);
}

[data-theme="dark"] .chat__input {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  color: var(--color-text);
}

[data-theme="dark"] .chat__input:focus {
  border-color: var(--color-text-accent);
  box-shadow: 0 0 0 3px rgba(27, 150, 255, 0.25);
}

[data-theme="dark"] .avatar--agent {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
  color: var(--color-text-accent);
}

[data-theme="dark"] .panel__quote {
  background: var(--trl-surface-soft);
  border-left-color: var(--color-text-accent);
}

[data-theme="dark"] .panel__row {
  border-bottom-color: var(--trl-border);
}

[data-theme="dark"] .panel__row dd {
  color: var(--color-text);
}

[data-theme="dark"] .progress__bar {
  background: var(--trl-surface-soft);
}
/*
 * Builder Page Components
 * Segment controls, trail cards, milestones, steps
 */

/* Segment control */
.segment {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1);
  border-radius: 20px;
  background: var(--tds-color-sand);
  border: 1px solid var(--tds-color-fog);
  box-shadow: none;
}

.segment__item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1px solid transparent;
  font-weight: var(--weight-bold);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  transition: all var(--transition-base);
}

.segment__item:hover {
  color: var(--tds-color-midnight);
}

.segment__item--active {
  background: var(--tds-color-ocean);
  color: var(--tds-color-white);
  border-color: var(--tds-color-ocean);
}

.segment__item--ghost {
  border: 1px solid var(--tds-color-fog);
  color: var(--tds-color-meteorite);
}

.segment__item--ghost:hover {
  border-color: var(--tds-color-ocean);
  color: var(--tds-color-ocean);
}

/* Trail card (main editable card) */
.trail-card {
  overflow: hidden;
}

.trail-card__body {
  padding: var(--tds-spacing-5);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--tds-spacing-6);
  align-items: start;
}

.trail-card__icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}

.trail-card__icon {
  width: 72px;
  height: 72px;
  border-radius: var(--tds-radius-lg);
  background: linear-gradient(135deg, var(--tds-color-midnight), var(--tds-color-ocean));
  box-shadow: var(--tds-shadow-sm);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.trail-card__icon svg,
.trail-card__icon img {
  width: 44px;
  height: 44px;
}

.trail-card__icon-actions {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.trail-card__icon:hover .trail-card__icon-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.trail-card__icon:focus-within .trail-card__icon-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.trail-card__icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--tds-radius-md);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}

.trail-card__icon-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

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

.trail-card__icon-label {
  font-size: var(--tds-font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tds-color-meteorite);
}

.trail-card__fields {
  display: grid;
  gap: var(--tds-spacing-4);
}

.trail-card__fields .label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--tds-font-size-xs);
}

/* Metric tiles */
.metric-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-top: 1px solid var(--tds-color-fog);
}

.metric-tile {
  flex: 1 1 auto;
  min-width: 150px;
  background: var(--tds-color-foundation-blue);
  border: 1px solid var(--tds-color-ice);
  border-radius: var(--tds-radius-md);
  padding: var(--sp-3);
}

.metric-tile__label {
  display: block;
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  margin-bottom: var(--sp-1);
}

.metric-tile__value {
  font-size: var(--tds-font-size-md);
  font-weight: var(--weight-bold);
  color: var(--tds-color-midnight);
}

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

.metric-tile__edit {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-ocean);
}

.metric-tile__edit:hover {
  text-decoration: underline;
}

/* Milestone */
.milestone {
  margin-top: var(--sp-4);
  overflow: hidden;
}

.milestone__header {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-3);
  padding: var(--tds-spacing-4);
  border-bottom: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
  cursor: pointer;
  list-style: none;
  line-height: var(--tds-line-height-normal);
}

.milestone__header::-webkit-details-marker {
  display: none;
}

.milestone__chevron {
  width: 16px;
  height: 16px;
  color: var(--tds-color-meteorite);
  transition: transform var(--transition-slow);
  margin-top: 1px;
}

.milestone[open] .milestone__chevron {
  transform: rotate(0deg);
}

.milestone:not([open]) .milestone__chevron {
  transform: rotate(-90deg);
}

.milestone__title {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--weight-extrabold);
  font-size: var(--tds-font-size-md);
  color: var(--tds-color-midnight);
}

.milestone__collapsed-info {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
  min-width: 0;
}

.milestone:not([open]) .milestone__collapsed-info {
  display: flex;
}

.milestone__arrow {
  width: 14px;
  height: 14px;
  color: var(--tds-color-meteorite);
}

.milestone__collapsed-title {
  font-weight: var(--weight-bold);
  font-size: var(--tds-font-size-md);
  color: var(--tds-color-midnight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone__actions {
  margin-left: auto;
}

.milestone__body {
  padding: var(--tds-spacing-4);
  display: grid;
  gap: var(--tds-spacing-3);
  border-bottom: 1px solid var(--tds-color-fog);
}

.milestone__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--tds-spacing-3) var(--tds-spacing-4);
  border-top: 1px solid var(--tds-color-fog);
  background: var(--tds-color-sand);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  line-height: var(--tds-line-height-normal);
  gap: var(--tds-spacing-3);
}

.milestone__points {
  font-weight: var(--weight-semibold);
  color: var(--tds-color-midnight);
}

.milestone__add-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  height: 56px;
  color: var(--tds-color-ocean);
  font-weight: var(--weight-bold);
  border-top: 1px solid var(--tds-color-fog);
  border-radius: 0 0 var(--tds-radius-lg) var(--tds-radius-lg);
  transition: background var(--transition-base);
}

.milestone__add-step:hover {
  background: var(--tds-color-sand);
}

/* Step list */
.step-list {
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: var(--sp-3);
  padding: var(--tds-spacing-4) var(--tds-spacing-5);
  border-top: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
  transition: background var(--transition-base);
}

.step:hover {
  background: var(--tds-color-sand);
}

.step--generated {
  background: var(--generated-bg);
  outline: 2px solid var(--generated-outline);
  outline-offset: -2px;
}

.step__drag-handle {
  width: 24px;
  height: 24px;
  color: var(--tds-color-granite);
  cursor: grab;
  opacity: 0.6;
  transition: opacity var(--transition-base);
  margin-top: 2px;
}

.step:hover .step__drag-handle {
  opacity: 1;
}

.step__drag-handle svg {
  width: 20px;
  height: 20px;
}

.step__content {
  cursor: pointer;
  min-width: 0;
}

.step__kind {
  font-size: var(--tds-font-size-xs);
  color: var(--tds-color-meteorite);
  display: inline-flex;
  align-items: center;
  gap: var(--tds-spacing-2);
  margin-bottom: var(--sp-1);
}

.step__type-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: var(--weight-semibold);
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  border: 1px solid transparent;
  background: var(--tds-color-sand);
}

.step__type-icon {
  width: 16px;
  height: 16px;
}

.step__type-badge--badge,
.step__type-badge--generated-badge {
  color: var(--tds-color-ocean);
  background: var(--tds-color-foundation-blue);
  border-color: var(--tds-color-ice);
}

.step__type-badge--video {
  color: var(--tds-color-ruby);
  background: rgba(234, 0, 30, 0.08);
  border-color: rgba(234, 0, 30, 0.2);
}

.step__type-badge--knowledge-article {
  color: var(--tds-color-evergreen);
  background: rgba(46, 132, 74, 0.1);
  border-color: rgba(46, 132, 74, 0.25);
}

.step__status {
  font-size: var(--tds-font-size-xs);
  font-weight: var(--weight-bold);
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  background: var(--tds-color-sand);
  border: 1px solid var(--tds-color-fog);
  color: var(--tds-color-meteorite);
}

.step__status--pending {
  background: rgba(254, 147, 57, 0.16);
  border-color: rgba(254, 147, 57, 0.4);
  color: var(--tds-color-tangerine, #fe9339);
}

.step__title {
  font-weight: var(--weight-extrabold);
  font-size: var(--tds-font-size-md);
  color: var(--tds-color-ocean);
  line-height: 1.4;
}

.step__title:hover {
  text-decoration: underline;
}

.step__title--link {
  text-decoration: none;
  cursor: pointer;
}

.step__title--link:hover {
  text-decoration: underline;
}

.step__desc {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  margin-top: var(--tds-spacing-1);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.step__source {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-1);
  margin-top: var(--sp-2);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
}

.step__source-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tds-color-ocean);
}

.step__aside {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-3);
  align-self: start;
  padding-top: var(--tds-spacing-1);
}

.step__time {
  font-size: var(--tds-font-size-xs);
  color: var(--tds-color-meteorite);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.step__complete {
  color: var(--tds-color-ocean);
  font-weight: var(--weight-semibold);
  font-size: var(--tds-font-size-sm);
  white-space: nowrap;
}

.step__complete:hover {
  text-decoration: underline;
}

/* Dropdown button */
.dropdown-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--tds-radius-md);
  border: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
  display: grid;
  place-items: center;
  color: var(--tds-color-ocean);
  transition: background var(--transition-base);
}

.dropdown-btn:hover {
  background: var(--tds-color-sand);
}

.dropdown-btn--accent {
  border-color: var(--tds-color-ocean);
  color: var(--tds-color-ocean);
}

.dropdown-btn--accent:hover {
  background: var(--tds-color-foundation-blue);
}

/* Add milestone button */
.add-milestone {
  display: flex;
  justify-content: center;
  padding: var(--sp-4) 0;
}

.add-milestone__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 40px;
  padding: 0 var(--tds-spacing-4);
  border: 1px solid var(--tds-color-ocean);
  border-radius: var(--tds-radius-md);
  background: var(--tds-color-white);
  color: var(--tds-color-ocean);
  font-weight: var(--weight-bold);
  box-shadow: none;
  transition: background var(--transition-base);
}

.add-milestone__btn:hover {
  background: var(--tds-color-sand);
}

.add-milestone__btn--lg {
  height: 48px;
  padding: 0 var(--tds-spacing-6);
  font-size: var(--tds-font-size-md);
}

[data-theme="dark"] .segment {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
}

[data-theme="dark"] .segment__item {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .segment__item--active {
  background: var(--tds-color-ocean);
  border-color: var(--tds-color-ocean);
  color: var(--tds-color-white);
}

[data-theme="dark"] .segment__item--ghost {
  border-color: var(--trl-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .segment__item--ghost:hover {
  border-color: var(--color-text-accent);
  color: var(--color-text-accent);
}

[data-theme="dark"] .trail-card__icon {
  background: linear-gradient(135deg, var(--trl-surface-soft), var(--trl-surface));
}

[data-theme="dark"] .trail-card__icon-label {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .metric-tiles {
  border-top-color: var(--trl-border);
}

[data-theme="dark"] .metric-tile {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
}

[data-theme="dark"] .metric-tile__label {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .metric-tile__value {
  color: var(--color-text);
}

[data-theme="dark"] .milestone__header,
[data-theme="dark"] .milestone__body {
  background: var(--trl-surface);
  border-color: var(--trl-border);
}

[data-theme="dark"] .milestone__meta {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .milestone__chevron,
[data-theme="dark"] .milestone__arrow {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .milestone__title,
[data-theme="dark"] .milestone__collapsed-title {
  color: var(--color-text);
}

[data-theme="dark"] .milestone__add-step {
  color: var(--color-text-accent);
  border-top-color: var(--trl-border);
}

[data-theme="dark"] .milestone__add-step:hover {
  background: var(--trl-surface-soft);
}

[data-theme="dark"] .step {
  background: var(--trl-surface);
  border-top-color: var(--trl-border);
}

[data-theme="dark"] .step:hover {
  background: var(--trl-surface-soft);
}

[data-theme="dark"] .step__drag-handle {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .step__kind,
[data-theme="dark"] .step__desc,
[data-theme="dark"] .step__source,
[data-theme="dark"] .step__time {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .step__title {
  color: var(--color-text-accent);
}

[data-theme="dark"] .step__type-badge {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
}

[data-theme="dark"] .step__type-badge--badge,
[data-theme="dark"] .step__type-badge--generated-badge {
  color: var(--color-text-accent);
  background: rgba(27, 150, 255, 0.15);
  border-color: rgba(27, 150, 255, 0.35);
}

[data-theme="dark"] .step__type-badge--video {
  color: #ff9aa2;
  background: rgba(234, 0, 30, 0.18);
  border-color: rgba(234, 0, 30, 0.35);
}

[data-theme="dark"] .step__type-badge--knowledge-article {
  color: #7fd18c;
  background: rgba(46, 132, 74, 0.18);
  border-color: rgba(46, 132, 74, 0.35);
}

[data-theme="dark"] .step__status {
  background: var(--trl-surface-soft);
  border-color: var(--trl-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .dropdown-btn {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  color: var(--color-text-accent);
}

[data-theme="dark"] .dropdown-btn:hover {
  background: var(--trl-surface-soft);
}

[data-theme="dark"] .dropdown-btn--accent {
  border-color: var(--color-text-accent);
  color: var(--color-text-accent);
}

[data-theme="dark"] .dropdown-btn--accent:hover {
  background: var(--trl-surface-soft);
}

[data-theme="dark"] .add-milestone__btn {
  background: var(--trl-surface);
  border-color: var(--color-text-accent);
  color: var(--color-text-accent);
}

[data-theme="dark"] .add-milestone__btn:hover {
  background: var(--trl-surface-soft);
}

/* Build page layout */
.build__top {
  display: flex;
  justify-content: center;
  margin-bottom: var(--sp-3);
}

.build__empty {
  display: flex;
  justify-content: center;
  padding: var(--sp-8) 0;
}
/* ==========================================================================
   6. PAGE-SPECIFIC STYLES
   ========================================================================== */

/* -------------------------------------------------------------------------
   Dashboard
   ------------------------------------------------------------------------- */

.dashboard {
  height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
  background: var(--tds-color-sand);
}

.dashboard__sidebar {
  border-right: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  overflow-y: auto;
}

.dashboard__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-2);
}

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

.dashboard__brand .theme-toggle {
  border-radius: var(--radius-full);
}

.dashboard__mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.dashboard__brand-name {
  font-family: var(--tds-font-family-display);
  font-weight: var(--weight-extrabold);
  color: var(--tds-color-midnight);
}

.dashboard__nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.dashboard__nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 0.45rem 0.6rem;
  border-radius: var(--tds-radius-md);
  border: 1px solid transparent;
  font-weight: var(--weight-bold);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  transition: background var(--transition-base);
}

.dashboard__nav-item:hover {
  background: var(--tds-color-sand);
}

.dashboard__nav-item--active {
  color: var(--tds-color-ocean);
  background: var(--tds-color-foundation-blue);
  border-color: var(--tds-color-ocean);
}

.dashboard__nav-item-content {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.dashboard__nav-icon {
  width: 18px;
  height: 18px;
  color: var(--tds-color-stormcloud);
}

.dashboard__nav-item--active .dashboard__nav-icon {
  color: var(--tds-color-ocean);
}

.dashboard__count {
  min-width: 22px;
  height: 22px;
  padding: 0 var(--sp-1);
  border-radius: var(--tds-radius-full);
  background: var(--tds-color-foundation-blue);
  font-size: var(--tds-font-size-xs);
  font-weight: var(--weight-bold);
  display: grid;
  place-items: center;
  color: var(--tds-color-ocean);
}

.dashboard__recent {
  flex: 1;
  padding-top: var(--tds-spacing-2);
}

.dashboard__recent-title {
  font-size: var(--tds-font-size-sm);
  font-weight: var(--weight-bold);
  color: var(--tds-color-meteorite);
  padding: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard__recent-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
}

.dashboard__recent-link {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  line-height: var(--tds-line-height-normal);
}

.dashboard__recent-link:hover {
  color: var(--tds-color-midnight);
}

.dashboard__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.dashboard__content {
  flex: 1;
  padding: var(--sp-10) var(--sp-10) var(--sp-12);
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.dashboard__headline {
  font-family: var(--tds-font-family-display);
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
  text-align: center;
  color: var(--tds-color-midnight);
}

.dashboard__subhead {
  margin-top: var(--sp-2);
  text-align: center;
  color: var(--tds-color-meteorite);
}

.dashboard__prompt {
  margin: var(--sp-6) auto 0;
  max-width: 760px;
  border-radius: var(--tds-radius-lg);
  box-shadow: var(--tds-shadow-sm);
  border: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
}

.dashboard__prompt-input {
  width: 100%;
  min-height: 92px;
  border: 1px solid var(--tds-color-fog);
  border-radius: var(--tds-radius-md);
  padding: var(--tds-spacing-4);
  background: var(--tds-color-white);
  font-size: var(--tds-font-size-md);
  line-height: var(--tds-line-height-normal);
  resize: none;
}

.dashboard__prompt-input:focus {
  outline: none;
  border-color: var(--tds-color-ocean);
  box-shadow: 0 0 0 3px rgba(1, 118, 211, 0.15);
}

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

.dashboard__prompt-footer {
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--tds-spacing-3) var(--tds-spacing-4);
  border-top: 1px solid var(--tds-color-fog);
}

.dashboard__prompt-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.dashboard__prompt .pill {
  background: var(--color-bg);
  border-color: var(--color-border-strong);
  font-size: var(--text-xs);
  padding: 4px var(--sp-2);
}

.dashboard__notice {
  font-size: var(--tds-font-size-xs);
  color: var(--tds-color-meteorite);
}

.dashboard__notice-link {
  color: var(--tds-color-ocean);
  font-weight: var(--weight-bold);
}

.dashboard__notice-link:hover {
  text-decoration: underline;
}

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

.dashboard__prompt-actions .btn--icon {
  width: 34px;
  height: 34px;
}

.dashboard__prompt-actions .btn--primary {
  padding: var(--tds-spacing-2) var(--tds-spacing-5);
  font-size: var(--tds-font-size-sm);
  height: 40px;
}

.dashboard__prompt-actions .btn--primary::after {
  content: "→";
  font-weight: var(--weight-bold);
  margin-left: var(--tds-spacing-2);
}

.dashboard__prompt-actions .btn--icon .icon {
  width: 16px;
  height: 16px;
}

.dashboard__section {
  margin-top: var(--tds-spacing-8);
}

.dashboard__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--tds-spacing-3);
}

.dashboard__section-title {
  font-weight: var(--weight-extrabold);
  color: var(--tds-color-midnight);
}

.dashboard__section-link {
  font-weight: var(--weight-bold);
  color: var(--tds-color-ocean);
}

.dashboard__section-link:hover {
  text-decoration: underline;
}

.dashboard__draft {
  position: relative;
  max-width: 360px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--sp-3);
  padding: var(--tds-spacing-4);
  align-items: start;
  border: 1px solid var(--tds-color-fog);
}

.dashboard__draft-action {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
}

.dashboard__draft-cover {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--tds-color-midnight), var(--tds-color-ocean));
  display: grid;
  place-items: center;
}

.dashboard__draft-cover svg {
  width: 40px;
  height: 40px;
}

.dashboard__draft-title {
  font-weight: var(--weight-extrabold);
  margin-top: 2px;
}

.dashboard__draft-desc {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  margin-top: var(--sp-1);
}

.dashboard__draft-footer {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
}

/* Templates */
.dashboard__templates {
  margin-top: var(--sp-8);
}

.dashboard__templates-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--tds-spacing-3);
}

.dashboard__templates-title {
  font-weight: var(--weight-extrabold);
  color: var(--color-text);
}

.dashboard__templates-nav {
  display: flex;
  gap: var(--sp-2);
}

.dashboard__templates-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
}

.dashboard__templates-btn:hover {
  background: var(--tds-color-sand);
}

.dashboard__templates-subtitle {
  font-size: var(--tds-font-size-sm);
  color: var(--tds-color-meteorite);
  margin-bottom: var(--sp-4);
}

.dashboard__templates-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--tds-spacing-4);
}

@media (max-width: 1024px) {
  .dashboard__templates-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.template-card {
  padding: var(--sp-4);
  cursor: pointer;
  border: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
  transition: all var(--transition-slow);
}

.template-card:hover {
  border-color: var(--tds-color-ocean);
  box-shadow: var(--tds-shadow-sm);
  transform: translateY(-2px);
}

[data-theme="dark"] .dashboard__prompt {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  box-shadow: none;
}

[data-theme="dark"] .dashboard__prompt-input {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  color: var(--color-text);
}

[data-theme="dark"] .dashboard__prompt-input:focus {
  border-color: var(--color-text-accent);
  box-shadow: 0 0 0 3px rgba(27, 150, 255, 0.25);
}

[data-theme="dark"] .dashboard__templates-btn {
  background: var(--trl-surface);
  border-color: var(--trl-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .dashboard__templates-btn:hover {
  background: var(--trl-surface-soft);
}

[data-theme="dark"] .template-card {
  background: var(--trl-surface);
  border-color: var(--trl-border);
}

[data-theme="dark"] .template-card:hover {
  border-color: var(--color-text-accent);
  box-shadow: none;
}

.template-card__icon {
  width: 32px;
  height: 32px;
  margin-bottom: var(--sp-3);
  color: var(--tds-color-ocean);
  transition: transform var(--transition-slow);
}

.template-card:hover .template-card__icon {
  transform: scale(1.1);
}

.template-card__title {
  font-weight: var(--weight-bold);
  color: var(--tds-color-midnight);
}

[data-theme="dark"] .dashboard {
  background: var(--trl-surface-alt);
}

[data-theme="dark"] .dashboard__sidebar {
  background: var(--trl-surface);
  border-right-color: var(--trl-border);
}

[data-theme="dark"] .dashboard__nav-item {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .dashboard__nav-item:hover {
  background: var(--trl-surface-soft);
}

[data-theme="dark"] .dashboard__nav-item--active {
  background: var(--trl-surface-soft);
  border-color: var(--color-text-accent);
  color: var(--color-text-accent);
}

[data-theme="dark"] .dashboard__nav-icon {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .dashboard__nav-item--active .dashboard__nav-icon {
  color: var(--color-text-accent);
}

[data-theme="dark"] .dashboard__count {
  background: var(--trl-surface-soft);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .dashboard__recent-title,
[data-theme="dark"] .dashboard__recent-link,
[data-theme="dark"] .dashboard__subhead,
[data-theme="dark"] .dashboard__templates-subtitle,
[data-theme="dark"] .dashboard__draft-desc,
[data-theme="dark"] .dashboard__draft-footer,
[data-theme="dark"] .dashboard__notice {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .dashboard__recent-link:hover {
  color: var(--color-text);
}

[data-theme="dark"] .dashboard__section-title,
[data-theme="dark"] .template-card__title {
  color: var(--color-text);
}

[data-theme="dark"] .template-card__icon {
  color: var(--color-text-accent);
}

/* -------------------------------------------------------------------------
   Preview Page
   ------------------------------------------------------------------------- */

.preview {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--sp-8);
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--sp-6);
}

.preview__left {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  position: sticky;
  top: var(--sp-6);
}

.preview__right {
  min-width: 0;
}

/* Overview Card */
.preview__overview-card {
  overflow: hidden;
}

.preview__overview-header {
  height: 80px;
  background: var(--blue-950);
  position: relative;
}

.preview__overview-arc {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  line-height: 0;
  color: var(--surface-card);
}

.preview__overview-arc svg {
  display: block;
  width: 100%;
  height: 25px;
}

.preview__overview-badge {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 96px;
  background: linear-gradient(135deg, var(--blue-950), var(--blue-700));
  border: 4px solid var(--surface-card);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.preview__overview-badge svg {
  width: 64px;
  height: 64px;
}

.preview__overview-content {
  padding: 56px var(--sp-6) var(--sp-6);
  text-align: center;
}

.preview__overview-tag {
  display: inline-block;
  padding: var(--sp-1) var(--sp-3);
  background: var(--surface-subtle);
  color: var(--color-text-secondary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  margin-bottom: var(--sp-3);
}

.preview__overview-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--heading-accent);
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-2);
}

.preview__overview-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview__overview-actions {
  margin-top: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.preview__overview-secondary {
  display: flex;
  gap: var(--sp-3);
}

/* Test Section */
.preview__test {
  padding: var(--sp-5);
}

.preview__test-icon {
  width: 40px;
  height: 40px;
  color: var(--color-text-accent);
  margin-bottom: var(--sp-3);
}

.preview__test-icon svg {
  width: 40px;
  height: 40px;
}

.preview__test-title {
  font-weight: var(--weight-extrabold);
  font-size: var(--text-lg);
  color: var(--heading-accent);
  margin-bottom: var(--sp-2);
}

/* Stats Bar */
.preview__stats-bar {
  background: var(--surface-subtle);
  border: 1px solid var(--border-card);
  border-radius: 56px;
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.preview__stat {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--weight-bold);
}

.preview__stat-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-accent);
}

.preview__stat-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border-strong);
}

/* Timeline */
.preview__timeline {
  padding-left: 48px;
  position: relative;
}

.preview__milestone-wrapper {
  position: relative;
  margin-bottom: var(--sp-6);
  display: flex;
  gap: var(--sp-4);
}

.preview__timeline-node {
  position: relative;
  flex-shrink: 0;
}

.preview__timeline-node svg {
  position: relative;
  z-index: 2;
  color: var(--border-muted);
  background: var(--surface-card);
  border-radius: 50%;
}

.preview__timeline-line {
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: -var(--sp-6);
  width: 2px;
  background: var(--color-border);
  z-index: 1;
  height: calc(100% + var(--sp-6));
}

/* Milestone Card (Preview) */
.preview__milestone-card {
  flex: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-card);
  border: 1px solid var(--border-card);
}

.preview__milestone-card[open] {
  box-shadow: var(--shadow-md);
  border-color: var(--border-muted);
}

.preview__milestone-summary {
  padding: var(--sp-6);
  cursor: pointer;
  list-style: none;
}

.preview__milestone-summary::-webkit-details-marker {
  display: none;
}

.preview__milestone-header {
  margin-bottom: var(--sp-4);
}

.preview__milestone-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  color: var(--heading-accent);
  margin-bottom: var(--sp-2);
}

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

.preview__milestone-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--color-text-accent);
  font-weight: var(--weight-bold);
}

.preview__toggle-text {
  font-size: var(--text-sm);
}

.preview__chevron {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-slow);
}

.preview__milestone-card[open] .preview__chevron {
  transform: rotate(180deg);
}

.preview__milestone-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
}

/* Milestone Content */
.preview__milestone-content {
  border-top: 1px solid var(--border-card);
  background: var(--surface-subtle);
  padding: 0 var(--sp-6);
}

/* Preview Step */
.preview__step {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-6) 0;
  border-bottom: 1px solid var(--color-border);
}

.preview__step:last-child {
  border-bottom: none;
}

.preview__step-check {
  padding-top: var(--sp-1);
}

.preview__step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--color-border-strong);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--transition-base);
}

.preview__step-circle:hover {
  border-color: var(--color-border-accent);
}

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

.preview__step-type {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text-muted);
  text-transform: capitalize;
  margin-bottom: var(--sp-1);
}

.preview__step-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-accent);
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-2);
}

.preview__step-title:hover {
  text-decoration: underline;
  cursor: pointer;
}

.preview__step-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--sp-3);
}

.preview__step-meta {
  display: flex;
  gap: var(--sp-4);
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
}

.preview__step-favorite {
  color: var(--color-border-strong);
  padding: var(--sp-1);
  opacity: 0;
  transition: opacity var(--transition-base), color var(--transition-base);
}

.preview__step:hover .preview__step-favorite {
  opacity: 1;
}

.preview__step-favorite:hover {
  color: var(--color-text-accent);
}

/* About Section */
.preview__about {
  margin-top: var(--sp-12);
  padding-top: var(--sp-12);
  border-top: 1px solid var(--color-border);
  max-width: 800px;
}

.preview__about-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--heading-accent);
  margin-bottom: var(--sp-2);
}

/* Skills Section */
.preview__skills {
  margin-top: var(--sp-12);
}

.preview__skills-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--heading-accent);
  margin-bottom: var(--sp-2);
}

.preview__skills-group {
  margin-top: var(--sp-6);
}

.preview__skills-label {
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
  margin-bottom: var(--sp-3);
}

.preview__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* Discover Section */
.preview__discover {
  margin-top: var(--sp-12);
}

.preview__discover-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--heading-accent);
  margin-bottom: var(--sp-2);
}

.preview__discover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-6);
}

.preview__discover-card {
  padding: var(--sp-5);
  text-align: center;
}

.preview__discover-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--sp-4);
  color: var(--color-text-accent);
}

.preview__discover-card-title {
  font-weight: var(--weight-bold);
  color: var(--heading-accent);
  margin-bottom: var(--sp-2);
}

/* Preview Footer */
.preview__footer {
  background: var(--blue-950);
  color: var(--color-text-inverse);
  padding: var(--sp-12) var(--sp-6);
  margin-top: var(--sp-12);
}

.preview__footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.preview__footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-8);
  margin-bottom: var(--sp-10);
}

.preview__footer-section h4 {
  font-weight: var(--weight-bold);
  margin-bottom: var(--sp-4);
}

.preview__footer-section ul {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.preview__footer-section a {
  opacity: 0.8;
  font-size: var(--text-sm);
  transition: opacity var(--transition-base);
}

.preview__footer-section a:hover {
  opacity: 1;
}

.preview__footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-8) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.preview__footer-apps h4 {
  margin-bottom: var(--sp-3);
}

.preview__footer-buttons {
  display: flex;
  gap: var(--sp-3);
}

.preview__app-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  background: transparent;
  color: white;
  transition: background var(--transition-base);
}

.preview__app-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.preview__app-icon {
  width: 24px;
  height: 24px;
}

.preview__app-btn span {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.preview__app-btn small {
  font-size: var(--text-xs);
  opacity: 0.8;
}

.preview__footer-social {
  display: flex;
  gap: var(--sp-2);
}

.preview__social-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  transition: transform var(--transition-base);
}

.preview__social-btn:hover {
  transform: scale(1.1);
}

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

.preview__social-btn--facebook { background: #1877F2; }
.preview__social-btn--twitter { background: #000000; }
.preview__social-btn--linkedin { background: #0A66C2; }

.preview__footer-legal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-6);
  font-size: var(--text-sm);
  opacity: 0.8;
}

.preview__footer-links {
  display: flex;
  gap: var(--sp-6);
}

.preview__footer-links a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------------------
   Insights Page
   ------------------------------------------------------------------------- */

.insights__header {
  margin-bottom: var(--sp-3);
}

.insights__title {
  font-weight: var(--weight-extrabold);
  font-size: var(--text-xl);
  color: var(--blue-800);
}

.insights__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.insights__card {
  padding: var(--sp-3);
}

.insights__card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}

.insights__card-title {
  font-weight: var(--weight-extrabold);
}

.insights__toggle {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
}

.insights__toggle:hover {
  background: var(--color-bg-hover);
}

.insights__big {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  text-align: center;
  margin-top: var(--sp-2);
}

.insights__bars {
  margin-top: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.insights__bar {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: var(--sp-2);
  align-items: center;
  font-size: var(--text-sm);
}

.insights__track {
  height: 10px;
  border-radius: var(--radius-full);
  background: rgba(27, 110, 243, 0.14);
  overflow: hidden;
}

.insights__fill {
  height: 100%;
  background: #6d28d9;
  border-radius: var(--radius-full);
}

.insights__kv {
  margin-top: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--text-sm);
}

/* -------------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------------- */

dialog.modal {
  width: min(740px, calc(100% - 40px));
  border: none;
  margin: auto;
  inset: 0;
  background: var(--surface-card);
  color: var(--color-text);
  padding: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal__header {
  padding: var(--sp-4) var(--sp-5) 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.modal__title {
  font-weight: var(--weight-extrabold);
  font-size: var(--text-xl);
  color: var(--color-text);
}

.modal__close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

.modal__close:hover {
  background: var(--color-bg-hover);
}

.modal__body {
  padding: var(--sp-2) var(--sp-5) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.modal__footer {
  padding: var(--sp-3) var(--sp-5) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.modal__drafts {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}

.draft {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  background: var(--draft-bg);
  border: 1px solid var(--draft-border);
}

.draft__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.draft__icon svg {
  width: 44px;
  height: 44px;
}

.draft__title {
  font-weight: var(--weight-bold);
}

.draft__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
}

.draft__time {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ==========================================================================
   11. TRAILHEAD PREVIEW PAGE - Pixel Perfect Implementation
   ========================================================================== */

/* Preview Container */
.trl-preview {
  min-height: 100vh;
  background: var(--trl-surface);
  font-family: "Salesforce Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text);
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--tds-spacing-4);
  background: var(--trl-badge-header-bg);
  color: var(--tds-color-white);
  padding: var(--tds-spacing-3) var(--tds-spacing-6);
  border-radius: var(--tds-radius-md);
  z-index: 9999;
  font-weight: var(--tds-font-weight-semibold);
  font-size: var(--tds-font-size-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--tds-spacing-4);
}

/* ==========================================================================
   Salesforce Global Header
   ========================================================================== */

.sf-global-header {
  background: var(--trl-surface);
  border-bottom: 1px solid var(--trl-border);
  padding: 0 var(--tds-spacing-8);
}

.sf-global-header__inner {
  max-width: var(--tds-container-xl);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 52px;
  gap: var(--tds-spacing-4);
}

.sf-global-header__logo {
  display: flex;
  align-items: center;
  color: var(--sf-brand-blue);
  font-size: 0;
  gap: 0;
  line-height: 0;
  text-decoration: none;
  flex: 0 0 auto;
  min-width: 30px;
  width: 30px;
  height: 22px;
  margin-right: 8px;
}

.sf-global-header__logo-icon {
  width: 30px;
  height: 22px;
  display: block;
  fill: currentColor;
  flex-shrink: 0;
  color: var(--sf-brand-blue);
}

.sf-global-header__nav {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-3);
  flex: 1;
  justify-content: flex-start;
}

.sf-global-header__nav-link {
  display: inline-flex;
  align-items: center;
  padding: var(--tds-spacing-2) var(--tds-spacing-4);
  font-size: var(--tds-font-size-sm);
  font-weight: var(--tds-font-weight-semibold);
  color: var(--trl-heading);
  text-decoration: none;
  transition: color 0.15s;
}

.sf-global-header__nav-link:hover {
  color: var(--color-text-accent);
  text-decoration: underline;
}

.sf-global-header__actions {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-3);
}

.sf-global-header__actions .sf-global-header__search {
  order: 1;
}

.sf-global-header__actions .sf-global-header__phone {
  order: 2;
}

.sf-global-header__actions .sf-global-header__avatar,
.sf-global-header__actions .sf-global-header__login,
.sf-global-header__actions .sf-global-header__cta {
  order: 3;
}

.sf-global-header__actions .trl-theme-toggle {
  order: 4;
  margin-left: 4px;
  opacity: 0.85;
}

.sf-global-header__actions .trl-theme-toggle__btn {
  font-size: var(--tds-font-size-xs);
  padding: 2px var(--tds-spacing-2);
}

.sf-global-header__search {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-2);
  padding: var(--tds-spacing-2) var(--tds-spacing-4);
  border: 1px solid var(--trl-border);
  border-radius: 999px;
  font-size: var(--tds-font-size-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  min-width: 320px;
  background: var(--trl-surface);
}

.sf-global-header__search:hover {
  border-color: var(--color-text-accent);
}

.sf-global-header__phone {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--trl-heading);
  width: 32px;
  height: 32px;
}

.sf-global-header__phone:hover {
  color: var(--color-text-accent);
}

.sf-global-header__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
}

.sf-global-header__login {
  font-size: var(--tds-font-size-xs);
  font-weight: var(--tds-font-weight-semibold);
  color: var(--trl-heading);
  text-decoration: none;
}

.sf-global-header__login:hover {
  color: var(--color-text-accent);
  text-decoration: underline;
}

.sf-global-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--tds-spacing-2) var(--tds-spacing-4);
  background: var(--color-text-accent);
  color: var(--color-text-inverse);
  border-radius: 999px;
  font-size: var(--tds-font-size-xs);
  font-weight: var(--tds-font-weight-semibold);
  text-decoration: none;
}

.sf-global-header__cta:hover {
  background: var(--trl-accent-hover);
}

.sf-global-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Trailhead Header
   ========================================================================== */

.trl-header {
  background: var(--trl-surface);
  border-bottom: 1px solid var(--trl-border);
  padding: 0 var(--tds-spacing-8);
  position: sticky;
  top: 0;
  z-index: 100;
}

.trl-header__inner {
  max-width: var(--tds-container-xl);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  gap: var(--tds-spacing-5);
}

.trl-header__logo {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-2);
  text-decoration: none;
  color: var(--trl-heading);
  font-size: var(--tds-font-size-lg);
  font-weight: var(--tds-font-weight-bold);
}

.trl-header__logo-icon {
  width: 30px;
  height: 30px;
}

.trl-header__logo-text {
  color: var(--trl-heading);
}

.trl-header__nav {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-1);
  flex: 1;
}

.trl-header__nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--tds-spacing-1);
  padding: var(--tds-spacing-2) var(--tds-spacing-4);
  color: var(--trl-heading);
  font-size: var(--tds-font-size-sm);
  font-weight: var(--tds-font-weight-semibold);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--tds-radius-md);
  transition: background 0.15s ease;
}

.trl-header__nav-link:hover {
  background: var(--color-bg-alt);
}

.trl-header__nav-link svg {
  opacity: 0.6;
}

.trl-header__actions {
  display: flex;
  align-items: center;
  gap: var(--tds-spacing-3);
}

.trl-header__actions:empty {
  display: none;
}

.trl-header__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--trl-surface);
  border: 1px solid var(--trl-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
  min-width: 220px;
}

.trl-header__login {
  font-size: 13px;
  font-weight: 600;
  color: var(--trl-heading);
  text-decoration: none;
}

.trl-header__login:hover {
  color: var(--color-text-accent);
  text-decoration: underline;
}

.trl-header__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
}

.trl-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trl-theme-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 1px;
  border: 1px solid var(--trl-border);
  border-radius: 999px;
  background: var(--trl-surface);
}

.trl-theme-toggle__btn {
  border: none;
  background: transparent;
  color: var(--trl-heading);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.trl-theme-toggle__btn:hover {
  background: var(--color-bg-hover);
}

/* ==========================================================================
   Main Layout - Two Column
   ========================================================================== */

.trl-layout {
  background: var(--trl-surface-alt);
  min-height: calc(100vh - 56px);
}

.trl-layout__inner {
  max-width: var(--tds-container-xl);
  margin: 0 auto;
  padding: 0 var(--tds-spacing-8) var(--tds-spacing-8);
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  grid-template-areas: "sidebar main";
  column-gap: var(--tds-spacing-12);
  row-gap: var(--tds-spacing-6);
  align-items: start;
}

/* Constrained width layout (inside builder preview) */
@container (max-width: 900px) {
  .trl-layout__inner {
    grid-template-columns: 1fr;
    padding: 0 var(--tds-spacing-4) var(--tds-spacing-6);
  }

  .trl-sidebar {
    width: 100%;
  }

  .trl-main-content {
    padding: 0 0 var(--tds-spacing-6);
  }
}

/* Enable container queries on preview */
.trl-preview {
  container-type: inline-size;
}

/* ==========================================================================
   Left Sidebar
   ========================================================================== */

.trl-sidebar {
  position: sticky;
  top: var(--tds-spacing-4);
  display: flex;
  flex-direction: column;
  gap: var(--tds-spacing-5);
  grid-area: sidebar;
  width: 400px;
}

/* Badge Card */
.trl-badge-card {
  width: 352px;
  max-width: 100%;
  background: var(--trl-surface);
  border-radius: var(--tds-radius-lg);
  overflow: hidden;
  box-shadow: var(--trl-badge-shadow);
  border: 1px solid var(--trl-badge-border);
}

.trl-badge-card__top {
  background: var(--trl-badge-header-bg);
  height: 4rem;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
}

.trl-badge-card__top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 2.5rem;
  height: 25px;
  background: var(--trl-badge-arc-bg);
  z-index: 0;
  -webkit-clip-path: polygon(0% 98%, 0% 2%, 0% 2%, 0.711% 4.688%, 2.75% 11.984%, 5.977% 22.736%, 10.25% 35.792%, 15.43% 50%, 21.375% 64.208%, 27.945% 77.264%, 35% 88.016%, 42.398% 95.312%, 50% 98%, 50% 98%, 57.602% 95.312%, 65% 88.016%, 72.055% 77.264%, 78.625% 64.208%, 84.57% 50%, 89.75% 35.792%, 94.023% 22.736%, 97.25% 11.984%, 99.289% 4.688%, 100% 2%, 100% 98%, 0% 98%);
  clip-path: polygon(0% 98%, 0% 2%, 0% 2%, 0.711% 4.688%, 2.75% 11.984%, 5.977% 22.736%, 10.25% 35.792%, 15.43% 50%, 21.375% 64.208%, 27.945% 77.264%, 35% 88.016%, 42.398% 95.312%, 50% 98%, 50% 98%, 57.602% 95.312%, 65% 88.016%, 72.055% 77.264%, 78.625% 64.208%, 84.57% 50%, 89.75% 35.792%, 94.023% 22.736%, 97.25% 11.984%, 99.289% 4.688%, 100% 2%, 100% 98%, 0% 98%);
}

.trl-badge-card__badge {
  width: 90px;
  height: 90px;
  position: relative;
  z-index: 1;
}

.trl-badge-card__badge-svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: var(--tds-radius-lg);
  margin-bottom: -4rem;
}

.trl-badge-card__complete {
  position: absolute;
  top: -0.25rem;
  right: -0.75rem;
  width: 24px;
  height: 24px;
  background: var(--trl-badge-check-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--trl-badge-check-border);
  box-shadow: var(--trl-badge-check-shadow);
}

.trl-badge-card__complete svg {
  width: 12px;
  height: 12px;
  color: var(--tds-color-white);
}

.trl-badge-card__bottom {
  margin-top: var(--tds-spacing-6);
  padding: var(--tds-spacing-5);
}

.trl-badge-card__content-header {
  margin-top: var(--tds-spacing-2);
}

.trl-badge-card__eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.trl-badge-card__action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  margin-bottom: 0;
}

.trl-badge-card__tag {
  display: inline-block;
  background: var(--trl-badge-tag-bg);
  color: var(--trl-badge-tag-text);
  font-size: var(--tds-font-size-xs);
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  line-height: 1.5;
}

.trl-badge-card__title {
  font-family: "ITC Avant Garde", "ITC Avant Garde Gothic Pro", var(--font-sans);
  font-size: var(--tds-font-size-xl);
  font-weight: 700;
  color: var(--trl-badge-title);
  line-height: 1.3;
  margin: 0 0 var(--tds-spacing-1) 0;
}

.trl-badge-card__desc {
  font-size: var(--tds-font-size-md);
  color: var(--trl-badge-desc);
  line-height: 1.5;
  margin: 0 0 var(--tds-spacing-3) 0;
  display: -webkit-box;
  -webkit-line-clamp: var(--trl-desc-lines, 4);
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.trl-badge-card.is-expanded .trl-badge-card__desc {
  -webkit-line-clamp: unset;
  max-height: none;
}

.trl-badge-card__more {
  display: inline-block;
  background: none;
  border: none;
  color: var(--trl-badge-link);
  font-size: var(--tds-font-size-md);
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  margin-bottom: 0;
}

.trl-badge-card__more:hover {
  text-decoration: underline;
}

.trl-badge-card__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--tds-spacing-3);
  margin-top: var(--tds-spacing-3);
}

.trl-badge-card__actions .trl-btn {
  width: 100%;
  font-size: var(--tds-font-size-md);
  font-weight: 600;
  min-height: 40px;
  padding: 0.625rem 0;
  gap: var(--tds-spacing-2);
  border-radius: var(--tds-radius-md);
  line-height: 20px;
}

.trl-badge-card__actions .trl-btn--outline {
  background: var(--trl-badge-btn-bg);
  border: 1px solid var(--trl-badge-btn-border);
  color: var(--trl-badge-btn-text);
  box-shadow: none;
}

.trl-badge-card__actions .trl-btn--outline:hover {
  background: var(--trl-badge-btn-hover-bg);
  border-color: var(--trl-badge-btn-hover-border);
  color: var(--trl-badge-btn-hover-text);
}

/* Buttons */
.trl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--trl-btn-gap);
  padding: var(--trl-btn-padding-y) var(--trl-btn-padding-x);
  font-size: var(--trl-btn-font-size);
  font-weight: 600;
  border-radius: var(--trl-btn-radius);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: var(--trl-btn-line-height);
  min-height: var(--trl-btn-min-height);
}

.trl-btn--outline {
  background: var(--trl-btn-bg);
  border: 1px solid var(--trl-btn-border);
  color: var(--trl-btn-text);
}

.trl-btn--outline:hover {
  background: var(--trl-btn-hover-bg);
  border-color: var(--trl-btn-hover-border);
  color: var(--trl-btn-hover-text);
}

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

/* Series Link */
.trl-series-link {
  display: inline-flex;
  align-items: center;
  gap: var(--tds-spacing-1);
  color: var(--trl-series-link);
  font-size: var(--tds-font-size-sm);
  font-weight: 600;
  text-decoration: none;
  margin-top: var(--tds-spacing-8);
}

.trl-series-link:hover {
  text-decoration: underline;
}

.trl-series-link svg {
  width: 16px;
  height: 16px;
}

.trl-icon--xx-small {
  width: 12px;
  height: 12px;
}

.trl-icon--x-small {
  width: 14px;
  height: 14px;
}

.trl-icon--small {
  width: 16px;
  height: 16px;
}

.trl-icon--medium {
  width: 20px;
  height: 20px;
}

.trl-icon--large {
  width: 24px;
  height: 24px;
}

/* Taxonomy Sections (Skills, Products, Industries) */
.trl-taxonomy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trl-taxonomy__title {
  font-size: var(--tds-font-size-md);
  font-weight: 700;
  color: var(--trl-taxonomy-heading);
  margin: 0 0 var(--tds-spacing-1) 0;
}

.trl-taxonomy__subtitle {
  font-size: var(--tds-font-size-sm);
  color: var(--trl-taxonomy-text);
  margin: 0;
  line-height: 1.4;
}

.trl-taxonomy__subtitle a {
  color: var(--trl-taxonomy-link);
  text-decoration: underline;
}

.trl-taxonomy__subtitle a:hover {
  text-decoration: underline;
}

.trl-taxonomy__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tds-spacing-2-5) var(--tds-spacing-1);
  margin-top: var(--tds-spacing-4);
}

.trl-tag {
  display: inline-block;
  border-radius: 20px;
  font-weight: 700;
  line-height: 1.5;
  padding: 0.4rem 0.75rem;
  font-size: var(--tds-font-size-xs);
  background: var(--trl-pill-filter-bg);
  color: var(--trl-pill-filter-text);
  border: 1px solid transparent;
  text-decoration: none;
}

.trl-tag--product {
  background: var(--trl-pill-filter-bg);
  color: var(--trl-pill-filter-text);
}

.trl-tag:hover {
  background: var(--trl-pill-filter-hover-bg);
  text-decoration: underline;
}

.trl-tag:active,
.trl-tag:focus-visible {
  border-color: var(--trl-pill-filter-border);
  text-decoration: underline;
}

.trl-taxonomy__toggle {
  display: inline-block;
  background: none;
  border: none;
  color: var(--color-text-accent);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-align: start;
  margin-top: 6px;
}

.trl-taxonomy__toggle:hover {
  text-decoration: underline;
}

.trl-locale-disclaimer {
  display: flex;
  gap: var(--tds-spacing-2);
  align-items: baseline;
  background: var(--trl-locale-bg);
  color: var(--trl-locale-text);
  border-radius: var(--tds-radius-lg);
  padding: var(--tds-spacing-3);
  margin-top: var(--tds-spacing-8);
  font-size: var(--tds-font-size-sm);
  line-height: 20px;
}

.trl-locale-disclaimer__icon {
  color: var(--trl-locale-icon);
  display: inline-flex;
  align-items: center;
}

.trl-locale-disclaimer__icon svg {
  width: 16px;
  height: 16px;
}

.trl-locale-disclaimer__text {
  flex: 1;
}

.trl-locale-disclaimer__link {
  color: var(--trl-locale-link);
  text-decoration: underline;
  font-weight: 600;
  margin-left: var(--tds-spacing-1);
}

/* ==========================================================================
   Right Main Content
   ========================================================================== */

.trl-main-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  grid-area: main;
  padding: var(--tds-spacing-6) 0;
}

/* Stats Bar - Pill-shaped container for trail metrics (matches Trailhead th-content-stats) */
.trl-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  flex-wrap: wrap;
  background: var(--trl-stats-bg);
  border-radius: 56px;
  padding: var(--tds-spacing-4) 0;
  margin-bottom: var(--tds-spacing-8);
  font-size: var(--tds-font-size-sm);
  gap: 0;
}

.trl-stats-bar__item {
  display: flex;
  align-items: center;
  font-weight: var(--tds-font-weight-bold);
  color: var(--trl-stats-text);
  justify-content: center;
  text-align: center;
  padding: var(--tds-spacing-2) var(--tds-spacing-4);
  white-space: nowrap;
}

.trl-stats-bar__icon {
  width: 16px;
  height: 16px;
  color: var(--trl-stats-text);
  flex-shrink: 0;
  margin-right: var(--tds-spacing-2);
}

.trl-stats-bar__value {
  font-size: var(--tds-font-size-sm);
  font-weight: var(--tds-font-weight-bold);
  color: var(--trl-stats-text);
  white-space: nowrap;
  letter-spacing: 0;
}

.trl-stats-bar__divider {
  width: 1px;
  background: var(--trl-stats-divider);
  flex-shrink: 0;
}

/* Hide dividers in narrow containers */
@container (max-width: 600px) {
  .trl-stats-bar__divider {
    display: none;
  }

  .trl-stats-bar {
    border-radius: var(--tds-radius-lg);
    padding: var(--tds-spacing-2) var(--tds-spacing-4);
  }
}

/* Announcement Banner */
.trl-announcement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--trl-banner-bg);
  color: var(--trl-banner-text);
  padding: var(--tds-spacing-4) var(--tds-spacing-5);
  border-radius: var(--tds-radius-xl);
  margin-top: var(--tds-spacing-2);
  margin-bottom: var(--tds-spacing-10);
  gap: 16px;
}

.trl-announcement__content {
  flex: 1;
}

.trl-announcement__content strong {
  font-size: 13px;
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.trl-announcement__content p {
  font-size: 12px;
  margin: 0;
  opacity: 0.9;
}

.trl-announcement__btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.trl-announcement__btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Modules Timeline
   ========================================================================== */

.trl-modules {
  position: relative;
  padding-left: 40px;
}

.trl-modules__line {
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: 30px;
  width: 2px;
  background: var(--trl-timeline-line);
  border-radius: 2px;
}

.trl-modules__line--completed {
  background: var(--green-500);
}

/* Module Item */
.trl-module {
  position: relative;
  margin-bottom: 12px;
}

.trl-module:last-of-type {
  margin-bottom: 0;
}

.trl-module__node {
  position: absolute;
  left: -40px;
  top: 16px;
  width: 26px;
  height: 26px;
  background: var(--color-bg);
  border: 2px solid var(--trl-node-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.trl-module__node svg {
  width: 14px;
  height: 14px;
  color: var(--trl-node-icon);
}

/* Completed node styles moved to .trl-module__icon in preview.css for TDS */

.trl-module--completed .trl-module__node svg {
  color: white;
}

.trl-module--locked .trl-module__node {
  border-color: var(--color-border);
  background: var(--color-bg);
}

.trl-module--locked .trl-module__node svg {
  color: var(--color-text-muted);
}

.trl-module__card {
  background: var(--trl-surface);
  border: 1px solid var(--trl-border);
  border-radius: 8px;
  box-shadow: none;
  overflow: hidden;
}

.trl-module__summary {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  gap: 4px;
}

.trl-module__summary::-webkit-details-marker {
  display: none;
}

.trl-module__summary::marker {
  display: none;
}

.trl-module__info {
  width: 100%;
}

.trl-module__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--trl-heading);
  margin: 0 0 6px 0;
  line-height: 1.4;
  cursor: pointer;
}

.trl-module__desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 0 0 6px 0;
  line-height: 1.5;
}

.trl-module__title:hover {
  color: var(--color-text-accent);
}

.trl-module__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.trl-module__points {
  color: var(--color-text-secondary);
  font-weight: 600;
}

.trl-module__steps {
  color: var(--color-text-muted);
  text-align: end;
}

.trl-module__card .trl-module__toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--tds-color-fog);
  color: var(--tds-color-ocean);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 16px 20px;
  min-height: 50px;
  width: 100%;
  margin: 0;
  align-self: stretch;
  justify-content: center;
  border-radius: 0;
  text-decoration: none;
  text-align: center;
}

.trl-module__toggle-text {
  margin-inline-start: 10px;
}

[data-theme="dark"] .trl-module__toggle {
  color: var(--color-text-accent);
  border-color: var(--trl-border);
}

.trl-module__toggle-icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.trl-module__card[data-expanded="true"] .trl-module__toggle-icon {
  transform: rotate(180deg);
}

[dir="rtl"] .trl-module__toggle-icon {
  transform: scaleX(-1);
}

[dir="rtl"] .trl-module__card[data-expanded="true"] .trl-module__toggle-icon {
  transform: scaleX(-1) rotate(180deg);
}

.trl-module__toggle:hover .trl-module__toggle-text {
  text-decoration: underline;
}

.trl-module__toggle:focus {
  outline: none;
}

.trl-module__toggle:focus-visible {
  outline: var(--tds-a11y-outline-focus);
  outline-offset: var(--tds-a11y-outline-offset-focus);
}

.trl-module__content {
  padding: 0;
  border-top: 1px solid var(--tds-color-fog);
  max-height: 0;
  overflow: hidden;
  visibility: hidden;
  transition: max-height 0.5s ease, visibility 0.5s;
}

.trl-module__card[data-expanded="true"] .trl-module__content {
  visibility: visible;
  max-height: 5000px;
}

.trl-module__empty {
  padding: 12px 0 4px;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* Sub-steps */
.trl-substeps {
  list-style: none;
  padding: 0;
  margin: 16px 0 0 0;
}

.trl-substep {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

.trl-substep:last-child {
  border-bottom: none;
}

.trl-substep__check {
  width: 24px;
  height: 24px;
  background: var(--color-bg-alt);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.trl-substep--completed .trl-substep__check {
  background: var(--green-500);
}

.trl-substep__check svg {
  width: 14px;
  height: 14px;
  color: white;
}

.trl-substep__body {
  flex: 1;
}

.trl-substep__type {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.trl-substep__title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-accent);
  text-decoration: none;
  margin-bottom: 4px;
}

.trl-substep__title:hover {
  text-decoration: underline;
}

.trl-substep__desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0 0 8px 0;
}

.trl-substep__meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--color-text-muted);
}

.trl-module--locked .trl-module__card {
  border-style: dashed;
  background: var(--color-bg-subtle);
}

.trl-substep--locked .trl-substep__title {
  color: var(--color-text-muted);
  pointer-events: none;
  text-decoration: none;
}

.trl-substep--locked .trl-substep__desc {
  color: var(--color-text-muted);
}

.trl-substep--locked .trl-substep__check {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
}

/* Completion Message */
.trl-completion-msg {
  position: relative;
  margin-top: 20px;
  padding-inline-start: 0;
  display: flex;
  gap: 16px;
}

.trl-completion-msg__node {
  position: absolute;
  left: -40px;
  top: 0;
  width: 26px;
  height: 26px;
  background: var(--green-500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.trl-completion-msg__node svg {
  width: 14px;
  height: 14px;
  color: white;
}

.trl-completion-msg__content {
  padding-top: 6px;
}

.trl-completion-msg__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-accent);
  margin: 0 0 8px 0;
}

.trl-completion-msg__text {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0 0 8px 0;
}

.trl-completion-msg__date {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ==========================================================================
   About This Trail Section
   ========================================================================== */

.trl-about-section {
  background: var(--trl-surface-alt);
  padding: 36px 24px 20px;
}

.trl-about-section__inner {
  max-width: 760px;
  margin: 0 auto;
}

.trl-about-section__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--trl-heading);
  margin: 0 0 12px 0;
}

.trl-about-section__text {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ==========================================================================
   Discover More Section
   ========================================================================== */

.trl-discover {
  background: var(--trl-surface-alt);
  padding: 20px 24px 40px;
}

.trl-discover__inner {
  max-width: 960px;
  margin: 0 auto;
}

.trl-discover__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--trl-heading);
  margin: 0 0 6px 0;
}

.trl-discover__subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0 0 20px 0;
  max-width: 680px;
}

.trl-discover__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.trl-discover-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  background: var(--trl-surface);
  border: 1px solid var(--trl-border);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.trl-discover-card:hover {
  border-color: var(--trl-border-strong);
}

.trl-discover-card__icon {
  width: 28px;
  height: 28px;
  background: var(--trl-discover-icon-bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.trl-discover-card__icon svg {
  width: 16px;
  height: 16px;
  color: var(--color-text-accent);
}

.trl-discover-card__icon--purple {
  background: var(--trl-discover-icon-bg-purple);
}

.trl-discover-card__icon--purple svg {
  color: var(--trailhead-purple);
}

.trl-discover-card__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-accent);
  margin: 0 0 6px 0;
}

.trl-discover-card__desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.trl-discover__more {
  display: block;
  margin: 0 auto;
  background: none;
  border: none;
  color: var(--color-text-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.trl-discover__more:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Landscape Illustration
   ========================================================================== */

.trl-landscape {
  width: 100%;
  height: 160px;
  overflow: hidden;
  margin-top: -10px;
}

.trl-landscape__svg {
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.trl-footer {
  background: var(--trl-surface);
  padding: 36px 24px 24px;
  border-top: 1px solid var(--trl-border);
}

.trl-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.trl-footer__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 48px;
  margin-bottom: 48px;
}

.trl-footer__section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trl-footer__heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--trl-heading);
  margin: 0;
}

.trl-footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trl-footer__links a {
  font-size: 12px;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.trl-footer__links a:hover {
  color: var(--color-text-accent);
  text-decoration: underline;
}

/* Footer Apps */
.trl-footer__apps {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.trl-footer__apps-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--trl-heading);
}

.trl-footer__apps-btns {
  display: flex;
  gap: 12px;
}

.trl-footer__app-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--trl-app-btn-bg);
  color: var(--trl-app-btn-text);
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.trl-footer__app-btn svg {
  width: 20px;
  height: 20px;
}

.trl-footer__app-btn:hover {
  background: var(--trl-app-btn-bg-hover);
}

/* Social Links */
.trl-footer__social {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.trl-footer__social-link {
  width: 40px;
  height: 40px;
  background: var(--trl-accent-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-inverse);
  text-decoration: none;
  transition: background 0.15s ease;
}

.trl-footer__social-link:hover {
  background: var(--trl-accent-hover);
}

.trl-footer__social-link svg {
  width: 20px;
  height: 20px;
}

/* Legal Section */
.trl-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.trl-footer__copyright {
  color: var(--color-text-secondary);
}

.trl-footer__legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.trl-footer__legal-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.trl-footer__legal-links a:hover {
  text-decoration: underline;
}

.trl-footer__lang {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.trl-footer__lang svg {
  width: 16px;
  height: 16px;
}

.trl-footer__lang-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 14px;
}

.trl-footer__lang-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

[data-theme="dark"] .trl-landscape__svg {
  filter: brightness(0.75) saturate(0.85);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .trl-landscape__svg {
    filter: brightness(0.75) saturate(0.85);
  }
}

[dir="rtl"] .trl-preview {
  direction: rtl;
}

[dir="rtl"] .trl-header__inner,
[dir="rtl"] .sf-global-header__inner {
  direction: rtl;
  flex-direction: row-reverse;
}

html[dir="rtl"] .trl-layout__inner,
.trl-preview[dir="rtl"] .trl-layout__inner {
  direction: rtl;
  grid-template-columns: 400px minmax(0, 1fr);
  grid-template-areas: "sidebar main";
}

/* RTL mirroring: keep nav items in logical order and align from the right. */
[dir="rtl"] .trl-header__nav,
[dir="rtl"] .sf-global-header__nav {
  justify-content: flex-start;
}

[dir="rtl"] .trl-header__nav-link svg {
  transform: scaleX(-1);
}

[dir="rtl"] .trl-header__actions,
[dir="rtl"] .sf-global-header__actions {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

[dir="rtl"] .trl-header__logo,
[dir="rtl"] .sf-global-header__logo {
  order: 3;
}

[dir="rtl"] .trl-header__nav,
[dir="rtl"] .sf-global-header__nav {
  order: 2;
}

[dir="rtl"] .trl-header__actions,
[dir="rtl"] .sf-global-header__actions {
  order: 1;
}

[dir="rtl"] .trl-header__search,
[dir="rtl"] .sf-global-header__search {
  flex-direction: row-reverse;
}

[dir="rtl"] .sf-global-header__actions .sf-global-header__search {
  order: 1;
}

[dir="rtl"] .sf-global-header__actions .sf-global-header__phone {
  order: 2;
}

[dir="rtl"] .sf-global-header__actions .sf-global-header__avatar,
[dir="rtl"] .sf-global-header__actions .sf-global-header__login,
[dir="rtl"] .sf-global-header__actions .sf-global-header__cta {
  order: 3;
}

[dir="rtl"] .sf-global-header__actions .trl-theme-toggle {
  order: 4;
  margin-left: 0;
  margin-right: 4px;
}

[dir="rtl"] .trl-badge-card__bottom,
[dir="rtl"] .trl-taxonomy,
[dir="rtl"] .trl-module__summary,
[dir="rtl"] .trl-module__content,
[dir="rtl"] .trl-about-section__inner,
[dir="rtl"] .trl-discover__inner,
[dir="rtl"] .trl-footer__inner {
  text-align: right;
}

[dir="rtl"] .trl-badge-card__actions {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

[dir="rtl"] .trl-series-link {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .trl-module__meta,
/* RTL: flex-direction row-reverse removed - RTL already reverses flex row naturally */

[dir="rtl"] .trl-substep__body {
  text-align: right;
}

[dir="rtl"] .trl-stats-bar {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

[dir="rtl"] .trl-stats-bar__item {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .trl-module__card .trl-module__toggle {
  flex-direction: row-reverse;
  justify-content: center;
}

[dir="rtl"] .trl-taxonomy__tags {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

[dir="rtl"] .trl-tag {
  text-align: right;
}

[dir="rtl"] .trl-locale-disclaimer__link {
  margin-left: 0;
  margin-right: var(--tds-spacing-1);
}

[dir="rtl"] .trl-badge-card__title,
[dir="rtl"] .trl-badge-card__desc,
[dir="rtl"] .trl-taxonomy__subtitle,
[dir="rtl"] .trl-module__title,
[dir="rtl"] .trl-module__desc,
[dir="rtl"] .trl-module__meta,
[dir="rtl"] .trl-substep__body,
[dir="rtl"] .trl-substep__title,
[dir="rtl"] .trl-substep__desc,
[dir="rtl"] .trl-substep__meta,
[dir="rtl"] .trl-about-section__text,
[dir="rtl"] .trl-discover__subtitle,
[dir="rtl"] .trl-discover-card__title,
[dir="rtl"] .trl-discover-card__desc,
[dir="rtl"] .trl-announcement__content,
[dir="rtl"] .trl-completion-msg__content {
  text-align: right;
}

[dir="rtl"] .trl-substep__check {
  margin-inline-start: 0;
  margin-inline-end: 0;
}

/* RTL completion message styles moved to preview.css with logical properties */

[dir="rtl"] .trl-footer__grid {
  direction: rtl;
}

[dir="rtl"] .trl-footer__section {
  text-align: right;
}

[dir="rtl"] .trl-footer__apps {
  flex-direction: row-reverse;
}

[dir="rtl"] .trl-modules {
  padding-left: 0;
  padding-right: 40px;
  direction: rtl;
}

[dir="rtl"] .trl-modules__line {
  left: auto;
  right: 14px;
}

[dir="rtl"] .trl-modules__line--completed {
  background: var(--green-500);
}

/* RTL positioning handled by logical properties (inset-inline-start) in preview.css */

[dir="rtl"] .icon-flip-rtl {
  transform: scaleX(-1);
}

[dir="rtl"] .trl-series-link svg,
[dir="rtl"] .trl-module__toggle svg,
[dir="rtl"] .trl-header__nav-link svg {
  transform: scaleX(-1);
}

[dir="rtl"] .trl-footer__apps-btns,
[dir="rtl"] .trl-footer__app-btn,
[dir="rtl"] .trl-footer__legal,
[dir="rtl"] .trl-footer__legal-links,
[dir="rtl"] .trl-footer__lang,
[dir="rtl"] .trl-footer__social {
  flex-direction: row-reverse;
}

[dir="rtl"] .trl-btn {
  flex-direction: row-reverse;
}

[dir="rtl"] .trl-btn svg {
  margin-inline-start: var(--sp-2);
  margin-inline-end: 0;
}

[dir="rtl"] .trl-tag {
  direction: rtl;
}

[dir="rtl"] .trl-landscape__svg {
  transform: scaleX(-1);
}

[dir="rtl"] .shell {
  direction: rtl;
}

[dir="rtl"] .topbar,
[dir="rtl"] .topbar__section,
[dir="rtl"] .topbar__section--end,
[dir="rtl"] .topbar__logo,
[dir="rtl"] .subbar,
[dir="rtl"] .subbar__section,
[dir="rtl"] .subbar__section--start,
[dir="rtl"] .subbar__section--end,
[dir="rtl"] .subbar__controls,
[dir="rtl"] .tabs,
[dir="rtl"] .content,
[dir="rtl"] .chat__composer,
[dir="rtl"] .chat__actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .topbar__section .btn--icon:first-child svg,
[dir="rtl"] .chat__actions .btn--icon:last-child svg {
  transform: scaleX(-1);
}

[dir="rtl"] .sidebar {
  order: 2;
  border-inline-start: none;
  border-inline-end: 1px solid var(--border-card);
}

[dir="rtl"] .main {
  order: 1;
}

[dir="rtl"] .panel {
  order: 0;
  border-inline-start: none;
  border-inline-end: 1px solid var(--border-card);
}

[dir="rtl"] .chat {
  direction: rtl;
}

[dir="rtl"] .chat__messages,
[dir="rtl"] .message__content,
[dir="rtl"] .message__bubble,
[dir="rtl"] .message__meta,
[dir="rtl"] .bubble-card {
  text-align: right;
}

[dir="rtl"] .chat__timestamp {
  text-align: center;
}

[dir="rtl"] .message {
  flex-direction: row-reverse;
}

[dir="rtl"] .bubble-card__footer {
  justify-content: flex-start;
}

[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: right;
}

[dir="rtl"] .form-field__label {
  text-align: right;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 800px) {
  .trl-layout__inner {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
  }

  .trl-sidebar {
    position: static;
    order: -1;
    grid-area: auto;
    width: 100%;
    min-width: auto;
    max-width: none;
  }

  .trl-badge-card,
  .tds-badge-card {
    width: 100%;
    max-width: none;
  }

  .trl-header__nav {
    display: none;
  }

  .trl-header__search span {
    display: none;
  }

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

  .trl-footer__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .trl-layout__inner {
    padding: 16px;
  }

  .trl-badge-card__top {
    padding: 24px;
  }

  .trl-badge-card__badge {
    width: 100px;
    height: 100px;
  }

  .trl-badge-card__title {
    font-size: 18px;
  }

  .trl-stats-bar {
    flex-wrap: wrap;
    gap: 16px;
  }

  .trl-stats-bar__divider {
    display: none;
  }

  .trl-announcement {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .trl-module__summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .trl-discover__grid {
    grid-template-columns: 1fr;
  }

  .trl-footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .trl-footer__apps {
    flex-direction: column;
    align-items: flex-start;
  }

  .trl-footer__social {
    justify-content: flex-start;
  }

  .trl-footer__legal {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .trl-header__inner {
    padding: 0 16px;
  }

  .trl-badge-card__actions {
    flex-direction: column;
  }

  .trl-btn {
    width: 100%;
  }

  .trl-modules {
    padding-inline-start: 32px;
  }

  .trl-module__node {
    inset-inline-start: -32px;
    width: 28px;
    height: 28px;
  }

  .trl-completion-msg__node {
    inset-inline-start: -32px;
    width: 28px;
    height: 28px;
  }
}

/* Print Styles */
@media print {
  .trl-header,
  .trl-footer,
  .trl-announcement,
  .trl-discover,
  .trl-landscape {
    display: none;
  }

  .trl-layout {
    background: var(--color-bg);
  }

  .trl-layout__inner {
    display: block;
  }

  .trl-sidebar {
    position: static;
  }
}

/* Reduced Motion - WCAG 2.1 AA Compliance */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .trl-module__toggle svg,
  .trl-discover-card,
  .trl-btn,
  .trl-social-link {
    transition: none !important;
  }
}
/*
 * Utility Classes
 * Common helper classes for text, spacing, and display
 */

.link {
  color: var(--color-text-accent);
  font-weight: var(--weight-semibold);
  transition: color var(--transition-base);
}

.link:hover {
  color: var(--color-bg-accent-hover);
  text-decoration: underline;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-accent {
  color: var(--color-text-accent);
}

.text-success {
  color: var(--color-text-success);
}

.text-warning {
  color: var(--color-text-warning);
}

.text-error {
  color: var(--color-text-error);
}

.text-center {
  text-align: center;
}

.font-bold {
  font-weight: var(--weight-bold);
}

.font-extrabold {
  font-weight: var(--weight-extrabold);
}
/*
 * Responsive Breakpoints
 * Media query adjustments for different screen sizes
 */

@media (max-width: 1200px) {
  :root {
    --sidebar-w: 280px;
    --panel-w: 300px;
  }

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

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

  .preview {
    grid-template-columns: 280px 1fr;
  }
}

@media (max-width: 768px) {
  .subbar,
  .content {
    grid-template-columns: 1fr;
  }

  .subbar__section--start,
  .subbar__section--end {
    display: none;
  }

  .tabs {
    justify-content: center;
  }

  .sidebar,
  .panel {
    display: none;
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .dashboard__sidebar {
    display: none;
  }

  .dashboard__templates-grid {
    grid-template-columns: 1fr;
  }

  .insights__grid {
    grid-template-columns: 1fr;
  }

  .preview {
    grid-template-columns: 1fr;
    padding: var(--sp-4);
  }

  .preview__left {
    position: static;
  }

  .timeline {
    padding-left: 0;
  }

  .timeline__node {
    display: none;
  }
}

@media (max-width: 600px) {
  :root {
    --topbar-h: 48px;
    --subbar-h: 44px;
  }

  .topbar {
    padding: 0 var(--sp-2);
  }

  .topbar__trail-name {
    max-width: 200px;
  }

  .main__inner {
    padding: var(--sp-3);
  }

  .dashboard__content {
    padding: var(--sp-4);
  }

  .dashboard__headline {
    font-size: var(--text-3xl);
  }

  .stats-bar {
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
  }

  .stats-bar__divider {
    display: none;
  }
}

/* Print styles */
@media print {
  .shell {
    display: block;
    height: auto;
  }

  .topbar,
  .subbar,
  .sidebar,
  .panel {
    display: none;
  }

  .content {
    display: block;
  }

  .main {
    overflow: visible;
  }
}
/*
 * Accessibility Utilities
 * Screen reader, focus styles, and motion preferences
 */

/* Screen reader only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Enhanced focus styles for accessibility */
.focus-visible:focus-visible,
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--trailhead-blue);
  outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --border-card: #000000;
  }
}
/*
 * UX Polish & Micro-interactions
 * Enhanced animations, loading states, empty states, and accessibility
 */

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes ripple {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* ==========================================================================
   ENHANCED THINKING INDICATOR
   ========================================================================== */

.thinking-indicator {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  animation: fadeInUp 0.3s ease-out;
}

.thinking-indicator__avatar {
  position: relative;
}

.thinking-indicator__avatar::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--color-text-accent);
  animation: spin 1s linear infinite;
}

.thinking-indicator__content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.thinking-indicator__text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.thinking-indicator__status {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Enhanced thinking dots */
.thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-accent);
  animation: bounce 1s ease-in-out infinite;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

/* Typing cursor effect */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--color-text-accent);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

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

/* ==========================================================================
   MESSAGE ANIMATIONS
   ========================================================================== */

.message {
  animation: fadeInUp 0.25s ease-out;
  animation-fill-mode: both;
}

.message--user {
  animation: slideInFromRight 0.25s ease-out;
}

.message:not(.message--user) {
  animation: slideInFromLeft 0.25s ease-out;
}

/* Staggered message entry */
.message:nth-child(1) { animation-delay: 0ms; }
.message:nth-child(2) { animation-delay: 50ms; }
.message:nth-child(3) { animation-delay: 100ms; }
.message:nth-child(4) { animation-delay: 150ms; }
.message:nth-child(5) { animation-delay: 200ms; }

/* Message bubble hover effect */
.message__bubble {
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.message__bubble:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--sp-4);
  color: var(--color-text-muted);
  opacity: 0.6;
}

.empty-state__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  margin-bottom: var(--sp-2);
}

.empty-state__description {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 320px;
  margin-bottom: var(--sp-4);
  line-height: var(--leading-relaxed);
}

.empty-state__actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  justify-content: center;
}

/* Chat empty state */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: var(--sp-6);
  text-align: center;
}

.chat-empty-state__greeting {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--sp-2);
}

.chat-empty-state__hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 280px;
  margin-bottom: var(--sp-4);
}

.chat-empty-state__suggestions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
  max-width: 300px;
  margin-top: var(--sp-4);
}

/* Hint text for chat messages */
.message__hint {
  margin-top: var(--sp-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* New trail creation form */
.new-trail-form {
  margin-top: var(--sp-4);
}

.new-trail-form .field {
  margin-bottom: var(--sp-3);
}

.suggestion-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.suggestion-chip:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-accent);
  color: var(--color-text-accent);
  transform: translateX(4px);
}

.suggestion-chip__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-accent);
}

/* ==========================================================================
   LOADING SKELETONS
   ========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-alt) 25%,
    var(--color-bg-subtle) 50%,
    var(--color-bg-alt) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton--text {
  height: 1em;
  width: 100%;
}

.skeleton--text-short {
  height: 1em;
  width: 60%;
}

.skeleton--avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.skeleton--card {
  height: 120px;
  border-radius: var(--radius-md);
}

.skeleton--milestone {
  height: 56px;
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-2);
}

/* ==========================================================================
   ENHANCED FOCUS STATES
   ========================================================================== */

/* Global focus-visible outline */
:focus-visible {
  outline: 2px solid var(--color-border-accent);
  outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Interactive element focus enhancement */
.btn:focus-visible,
.chat__input:focus-visible,
.segment__item:focus-visible,
.dropdown-btn:focus-visible {
  outline: 2px solid var(--color-border-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(1, 118, 211, 0.15);
}

/* Card focus for keyboard navigation */
.card:focus-within {
  box-shadow: var(--shadow-md), 0 0 0 2px var(--color-border-accent);
}

/* Step focus highlight */
.step:focus-within {
  background: var(--accent-soft);
  outline: 2px solid var(--color-border-accent);
  outline-offset: -2px;
}

/* ==========================================================================
   ARIA LIVE REGIONS & ANNOUNCEMENTS
   ========================================================================== */

/* Visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Live region for dynamic announcements */
.aria-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Status indicators with ARIA */
[role="status"],
[role="alert"] {
  /* Ensure they're announced */
}

/* ==========================================================================
   ENHANCED DRAG & DROP
   ========================================================================== */

/* Draggable item states */
[draggable="true"] {
  cursor: grab;
}

[draggable="true"]:active {
  cursor: grabbing;
}

/* Drag handle visibility - always visible for discoverability */
.step__drag-handle,
.milestone__drag-handle {
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.step:hover .step__drag-handle,
.milestone:hover .milestone__drag-handle {
  opacity: 0.7;
}

.step__drag-handle:hover,
.milestone__drag-handle:hover {
  opacity: 1;
}

/* Dragging state */
.is-dragging {
  opacity: 0.6;
  transform: rotate(2deg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

/* Drop target indicator */
.drop-target {
  position: relative;
}

.drop-target::before {
  content: '';
  position: absolute;
  left: var(--sp-4);
  right: var(--sp-4);
  height: 3px;
  background: var(--color-bg-accent);
  border-radius: 2px;
  opacity: 0;
  transform: scaleX(0);
  transition: all 0.15s ease;
}

.drop-target--above::before {
  top: -2px;
  opacity: 1;
  transform: scaleX(1);
}

.drop-target--below::before {
  bottom: -2px;
  opacity: 1;
  transform: scaleX(1);
}

/* Drop zone highlight */
.drop-zone-active {
  background: var(--accent-soft);
  border: 2px dashed var(--color-border-accent);
  border-radius: var(--radius-md);
}

/* ==========================================================================
   INLINE EDITING FEEDBACK
   ========================================================================== */

/* Editable field states */
.editable-field {
  position: relative;
  transition: all 0.15s ease;
}

.editable-field:hover {
  background: var(--color-bg-hover);
}

.editable-field:focus-within {
  background: var(--color-bg);
  box-shadow: inset 0 0 0 2px var(--color-border-accent);
}

/* Edit indicator */
.editable-field::after {
  content: '';
  position: absolute;
  right: var(--sp-2);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M11.5 2.5l2 2-8 8H3.5v-2l8-8z' stroke='%23706e6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  opacity: 0;
  transition: opacity 0.15s ease;
}

.editable-field:hover::after {
  opacity: 0.5;
}

/* Saving indicator */
.is-saving {
  position: relative;
  pointer-events: none;
}

.is-saving::after {
  content: '';
  position: absolute;
  right: var(--sp-2);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-text-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Saved feedback */
.is-saved {
  position: relative;
}

.is-saved::after {
  content: '✓';
  position: absolute;
  right: var(--sp-2);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-success);
  font-size: var(--text-sm);
  animation: fadeIn 0.2s ease-out;
}

/* ==========================================================================
   BUTTON INTERACTIONS
   ========================================================================== */

/* Ripple effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  padding-bottom: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

.btn:active::after {
  animation: ripple 0.4s ease-out;
}

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

.btn--loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn--primary.btn--loading::before {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: white;
}

/* ==========================================================================
   PROGRESS INDICATORS
   ========================================================================== */

.progress-bar {
  height: 4px;
  background: var(--progress-track);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--color-bg-accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-bar--indeterminate .progress-bar__fill {
  width: 30%;
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ==========================================================================
   TOAST ENHANCEMENTS
   ========================================================================== */

.toast {
  animation: slideInFromRight 0.3s ease-out, fadeIn 0.3s ease-out;
}

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

@keyframes slideOutToRight {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ==========================================================================
   CARD HOVER EFFECTS
   ========================================================================== */

.card {
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

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

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

/* Trail card icon hover */
.trail-card__icon {
  transition: transform 0.2s ease;
}

.trail-card:hover .trail-card__icon {
  transform: scale(1.02);
}

/* ==========================================================================
   MILESTONE EXPAND/COLLAPSE
   ========================================================================== */

.milestone__body {
  animation: fadeIn 0.2s ease-out;
}

.milestone__chevron {
  transition: transform 0.2s ease;
}

/* Smooth height transition */
.milestone[open] .milestone__body {
  animation: expandIn 0.2s ease-out;
}

@keyframes expandIn {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

/* ==========================================================================
   SCROLL BEHAVIOR
   ========================================================================== */

/* Smooth scrolling for chat */
.chat__messages {
  scroll-behavior: smooth;
}

/* Scroll shadow indicators */
.scroll-shadow-top {
  box-shadow: inset 0 8px 8px -8px rgba(0, 0, 0, 0.1);
}

.scroll-shadow-bottom {
  box-shadow: inset 0 -8px 8px -8px rgba(0, 0, 0, 0.1);
}

.scroll-shadow-both {
  box-shadow:
    inset 0 8px 8px -8px rgba(0, 0, 0, 0.1),
    inset 0 -8px 8px -8px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .chat__messages {
    scroll-behavior: auto;
  }
}

/* ==========================================================================
   DASHBOARD STAGGERED ANIMATIONS
   ========================================================================== */

/* Staggered entrance for dashboard sections */
.dashboard__section {
  animation: fadeInUp 0.4s ease-out backwards;
}

.dashboard__section:nth-child(1) { animation-delay: 0.1s; }
.dashboard__section:nth-child(2) { animation-delay: 0.2s; }
.dashboard__section:nth-child(3) { animation-delay: 0.3s; }

/* Template cards staggered entrance */
.template-card {
  animation: fadeInUp 0.3s ease-out backwards;
}

.template-card:nth-child(1) { animation-delay: 0.1s; }
.template-card:nth-child(2) { animation-delay: 0.15s; }
.template-card:nth-child(3) { animation-delay: 0.2s; }
.template-card:nth-child(4) { animation-delay: 0.25s; }

/* Draft card animation */
.dashboard__draft {
  animation: fadeInUp 0.4s ease-out backwards;
  animation-delay: 0.15s;
  border-radius: var(--tds-radius-lg);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.dashboard__draft:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   INSIGHTS CARDS ENHANCEMENTS
   ========================================================================== */

/* Insights card styling */
.insights__card {
  border-radius: var(--tds-radius-lg);
  border: 1px solid var(--tds-color-fog);
  background: var(--tds-color-white);
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  animation: fadeInUp 0.4s ease-out backwards;
}

.insights__card:nth-child(1) { animation-delay: 0.05s; }
.insights__card:nth-child(2) { animation-delay: 0.1s; }
.insights__card:nth-child(3) { animation-delay: 0.15s; }
.insights__card:nth-child(4) { animation-delay: 0.2s; }
.insights__card:nth-child(5) { animation-delay: 0.25s; }
.insights__card:nth-child(6) { animation-delay: 0.3s; }

.insights__card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -6px rgba(1, 118, 211, 0.15);
  border-color: var(--tds-color-ocean-light);
}

[data-theme="dark"] .insights__card {
  background: var(--trl-surface);
  border-color: var(--trl-border);
}

[data-theme="dark"] .insights__card:hover {
  border-color: var(--color-text-accent);
  box-shadow: 0 8px 20px -6px rgba(27, 150, 255, 0.2);
}

/* Big number animation */
.insights__big {
  transition: transform 0.2s ease;
}

.insights__card:hover .insights__big {
  transform: scale(1.02);
}

/* Progress bars animation */
.insights__fill {
  animation: growWidth 0.8s ease-out backwards;
  animation-delay: 0.3s;
}

@keyframes growWidth {
  from {
    width: 0;
  }
}

/* ==========================================================================
   SKELETON LOADING STATES
   ========================================================================== */

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--tds-color-fog) 25%,
    var(--tds-color-sand) 50%,
    var(--tds-color-fog) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

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

.skeleton-card {
  height: 120px;
  border-radius: var(--tds-radius-lg);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ==========================================================================
   BUTTON ENHANCEMENTS
   ========================================================================== */

/* Button press effect */
.btn:active:not(:disabled) {
  transform: scale(0.98);
}

/* Primary button glow on hover */
.btn--primary:hover:not(:disabled) {
  box-shadow: 0 4px 14px -2px rgba(1, 118, 211, 0.4);
}

/* Ghost button subtle background on hover */
.btn--ghost:hover:not(:disabled) {
  background: rgba(1, 118, 211, 0.08);
}

[data-theme="dark"] .btn--ghost:hover:not(:disabled) {
  background: rgba(27, 150, 255, 0.12);
}

/* ==========================================================================
   INPUT FOCUS ENHANCEMENTS
   ========================================================================== */

/* Enhanced input focus ring */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(1, 118, 211, 0.15);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  box-shadow: 0 0 0 3px rgba(27, 150, 255, 0.25);
}

/* ==========================================================================
   CHAT ENHANCEMENTS
   ========================================================================== */

/* Message entrance animation */
.message {
  animation: messageSlideIn 0.3s ease-out;
}

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

/* User message slide from right */
.message--user {
  animation: userMessageSlideIn 0.3s ease-out;
}

@keyframes userMessageSlideIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Chat input subtle bounce on focus */
.chat__input:focus {
  animation: inputPulse 0.3s ease;
}

@keyframes inputPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.005); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   MILESTONE CARD ENHANCEMENTS
   ========================================================================== */

/* Milestone card hover glow */
.milestone,
[class*="milestone-card"] {
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.milestone:hover,
[class*="milestone-card"]:hover {
  border-color: var(--tds-color-ocean-light);
  box-shadow: 0 4px 12px -4px rgba(1, 118, 211, 0.12);
}

/* Step item hover */
.step,
[class*="step-item"] {
  transition: background 0.15s ease;
  border-radius: var(--radius-md);
}

.step:hover,
[class*="step-item"]:hover {
  background: rgba(1, 118, 211, 0.04);
}

/* ==========================================================================
   NAVIGATION ACTIVE INDICATOR
   ========================================================================== */

/* Animated underline for active nav */
.builder__nav-link {
  position: relative;
}

.builder__nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--tds-color-ocean);
  border-radius: 3px 3px 0 0;
  transition: width 0.2s ease;
}

.builder__nav-link--active::after,
.builder__nav-link:hover::after {
  width: 100%;
}

/* ==========================================================================
   TOOLTIP STYLES
   ========================================================================== */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 6px 10px;
  background: var(--tds-color-midnight);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* ==========================================================================
   PUBLISH BUTTON SPECIAL EFFECT
   ========================================================================== */

.btn--publish:not(:disabled) {
  position: relative;
  overflow: hidden;
}

.btn--publish:not(:disabled)::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn--publish:not(:disabled):hover::before {
  left: 100%;
}
