/* style.css - Premium Swiss Minimalist Design System for GE Adoption Portal */

/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables for Premium Minimalist Theme */
:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  /* Harmonized Modular Type Scale */
  --text-3xs: 0.8125rem;    /* 10.4px - Micro badges, tags, indicator labels */
  --text-2xs: 0.8125rem;    /* 11.5px - Eyebrows, uppercase badges & sub-metadata */
  --text-xs: 0.8125rem;     /* 12.5px - Small inputs, helper captions */
  --text-sm: 0.875rem;     /* 13.6px - Card summaries, secondary body text */
  --text-base: 1rem;   /* 14.7px - Main readable interface body text */
  --text-md: 1.0rem;      /* 16.0px - Prominent buttons, tab items */
  --text-lg: 1.125rem;    /* 18.0px - Step headers & sub-section headers */
  --text-xl: 1.25rem;     /* 20.0px - Card titles & container headers */
  --text-2xl: 1.45rem;    /* 23.2px - Section display titles */
  --text-3xl: 1.75rem;    /* 28.0px - Modal headlines & view headers */
  --text-4xl: 2.15rem;    /* 34.4px - Hero page titles */

  /* Precise Tracking Tokens */
  --tracking-tighter: -0.035em;
  --tracking-tight: -0.018em;
  --tracking-normal: -0.005em;
  --tracking-wide: 0.025em;
  --tracking-widest: 0.06em;

  /* Humanist Line Height Tokens */
  --leading-none: 1.15;
  --leading-tight: 1.28;
  --leading-snug: 1.42;
  --leading-normal: 1.58;
  --leading-relaxed: 1.7;

  /* Color Palette - Swiss Carbon & Muted Slate Dark Mode */
  --bg-dark-base: #0E1014;       /* Pure ink black background */
  --bg-dark-surface: #171A21;    /* Flat solid surface */
  --bg-dark-card: #171A21;       /* Contrast card surface against canvas */
  --bg-dark-modal: #171A21;      /* Pure solid modal surface */

  --color-primary: #4C8DF6;       /* Deep brand Indigo */
  --color-primary-glow: rgba(76, 141, 246, 0.12);
  --color-primary-hover: #3A7BEA;
  --color-secondary: #0ea5e9;     /* Tech Cyan */
  --color-secondary-glow: rgba(14, 165, 233, 0.08);
  --color-accent: #a855f7;        /* Violet */
  --color-accent-glow: rgba(168, 85, 247, 0.08);
  --color-success: #10b981;       /* Emerald */
  --color-success-glow: rgba(16, 185, 129, 0.08);
  --color-warning: #f59e0b;       /* Amber */
  --color-warning-glow: rgba(245, 158, 11, 0.08);
  --color-danger: #ef4444;        /* Rose */
  --color-danger-glow: rgba(239, 68, 68, 0.08);

  --text-primary: #F3F4F6;        /* Clean, high-contrast off-white */
  --text-secondary: #C9CDD6;      /* Higher contrast silver slate */
  --text-muted: #8A90A2;          /* High-contrast slate 400 for micro-copy */

  --border-card: rgba(255, 255, 255, 0.12); /* Clearer, bolder card border */
  --border-card-hover: rgba(76, 141, 246, 0.6);
  --border-glass: rgba(255, 255, 255, 0.09); /* Hairline divider */
  --border-glass-focused: rgba(255, 255, 255, 0.22);
  --border-glow-primary: rgba(76, 141, 246, 0.35);

  --blur-glass: 0px;              /* Pure flat minimalism */
  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);

  /* Sidebar, Navbar, and Lock Layers */
  --bg-sidebar: #12151B;
  --bg-navbar: rgba(14, 16, 20, 0.82);
  --brand-text-start: #ffffff;
  --brand-text-end: #ffffff;
  --welcome-msg-start: #ffffff;
  --welcome-msg-end: #a1a1aa;
  --bg-lock-overlay: rgba(14, 16, 20, 0.94);
  --bg-modal-overlay: rgba(0, 0, 0, 0.6);
  --bg-prompt-box: #12151B;       /* Dark grey prompt background */
  --text-prompt-box: #cbd5e1;
  --bg-copy-btn: rgba(255, 255, 255, 0.04);

  /* Interactive Elements */
  --border-tag: rgba(255, 255, 255, 0.05);
  --bg-tag-feature: rgba(255, 255, 255, 0.03);
  --bg-tag-level: rgba(14, 165, 233, 0.06);
  --border-tag-level: rgba(14, 165, 233, 0.15);
  --bg-toggle-inactive: #27272a;
  --bg-toggle-circle: #a1a1aa;
  --bg-filter-hover: rgba(255, 255, 255, 0.03);
  --bg-search-input: rgba(255, 255, 255, 0.02);
  --bg-search-input-focus: rgba(255, 255, 255, 0.04);
  --bg-profile-card: rgba(255, 255, 255, 0.01);
  --border-profile-card: rgba(255, 255, 255, 0.04);
  --bg-nav-btn: rgba(255, 255, 255, 0.02);
  --bg-nav-btn-hover: rgba(255, 255, 255, 0.04);
  --border-nav-btn-hover: rgba(255, 255, 255, 0.12);
  --bg-connector-item: rgba(255, 255, 255, 0.01);
  --bg-connector-item-hover: rgba(255, 255, 255, 0.03);
  --modal-title-gradient: linear-gradient(to right, #ffffff, #e4e4e7);
  --bg-copy-btn-hover: rgba(255, 255, 255, 0.08);
  --border-copy-btn-hover: rgba(255, 255, 255, 0.15);

  --border-badge-primary: rgba(76, 141, 246, 0.2);
  --border-badge-secondary: rgba(14, 165, 233, 0.15);
  --border-badge-accent: rgba(168, 85, 247, 0.15);
  --border-badge-success: rgba(16, 185, 129, 0.15);

  /* Engineering Grid Line Color */
  --grid-line: rgba(255, 255, 255, 0.015);

  /* Timeline Core Adaptive Variables */
  --timeline-track-bg: rgba(255, 255, 255, 0.15);
  --timeline-pin-color: rgba(255, 255, 255, 0.25);
  --timeline-flag-bg: #18181b;
  --timeline-flag-bg-hover: #27272a;
  --timeline-flag-border: rgba(255, 255, 255, 0.15);
  --timeline-flag-shadow: rgba(0, 0, 0, 0.4);
}

html[data-theme="light"] {
  --bg-dark-base: #F6F7F9;        /* Elegant pure architectural paper */
  --bg-dark-surface: #ffffff;     /* Pure flat white cards */
  --bg-dark-card: #ffffff;
  --bg-dark-modal: #ffffff;

  --color-primary: #2F6FDF;        /* Solid Deep Indigo */
  --color-primary-glow: rgba(47, 111, 223, 0.08);
  --color-primary-hover: #245BC0;
  --color-secondary: #0369a1;      /* Deep Ocean Blue */
  --color-secondary-glow: rgba(3, 105, 161, 0.04);
  --color-accent: #6d28d9;         /* Plum */
  --color-accent-glow: rgba(109, 40, 217, 0.04);
  --color-success: #047857;        /* Forest Emerald */
  --color-success-glow: rgba(4, 120, 87, 0.04);
  --color-warning: #b45309;        /* Warm Amber */
  --color-warning-glow: rgba(180, 83, 9, 0.04);
  --color-danger: #b91c1c;         /* Deep Crimson */
  --color-danger-glow: rgba(185, 28, 28, 0.04);

  --text-primary: #0E1014;        /* Pure ink black */
  --text-secondary: #4b5563;      /* High-contrast slate */
  --text-muted: #5C6273;          /* High-contrast slate 500 for micro-copy */

  --border-card: rgba(24, 24, 27, 0.12); /* Clearer, bolder card border */
  --border-card-hover: rgba(47, 111, 223, 0.6);
  --border-glass: rgba(24, 24, 27, 0.08); /* Precise soft guidelines */
  --border-glass-focused: rgba(24, 24, 27, 0.20);
  --border-glow-primary: rgba(47, 111, 223, 0.16);

  --bg-sidebar: #EEF0F4;          /* Cool grey light sidebar background */
  --bg-navbar: rgba(246, 247, 249, 0.85);
  --brand-text-start: #18181b;
  --brand-text-end: #18181b;
  --welcome-msg-start: #18181b;
  --welcome-msg-end: #52525b;
  --bg-lock-overlay: rgba(252, 252, 252, 0.94);
  --bg-modal-overlay: rgba(24, 24, 27, 0.25);
  --bg-prompt-box: #f4f4f5;        /* Soft paper background for prompt code */
  --text-prompt-box: #18181b;
  --bg-copy-btn: rgba(24, 24, 27, 0.03);

  /* Light Theme Variables */
  --border-tag: rgba(24, 24, 27, 0.05);
  --bg-tag-feature: rgba(24, 24, 27, 0.02);
  --bg-tag-level: rgba(3, 105, 161, 0.04);
  --border-tag-level: rgba(3, 105, 161, 0.1);
  --bg-toggle-inactive: #e4e4e7;
  --bg-toggle-circle: #71717a;
  --bg-filter-hover: rgba(24, 24, 27, 0.02);
  --bg-search-input: rgba(24, 24, 27, 0.01);
  --bg-search-input-focus: rgba(24, 24, 27, 0.03);
  --bg-profile-card: rgba(24, 24, 27, 0.01);
  --border-profile-card: rgba(24, 24, 27, 0.04);
  --bg-nav-btn: rgba(24, 24, 27, 0.02);
  --bg-nav-btn-hover: rgba(24, 24, 27, 0.04);
  --border-nav-btn-hover: rgba(24, 24, 27, 0.1);
  --bg-connector-item: rgba(24, 24, 27, 0.01);
  --bg-connector-item-hover: rgba(24, 24, 27, 0.03);
  --modal-title-gradient: linear-gradient(to right, #18181b, #3f3f46);
  --bg-copy-btn-hover: rgba(24, 24, 27, 0.06);
  --border-copy-btn-hover: rgba(24, 24, 27, 0.12);

  --border-badge-primary: rgba(47, 111, 223, 0.14);
  --border-badge-secondary: rgba(3, 105, 161, 0.1);
  --border-badge-accent: rgba(109, 40, 217, 0.1);
  --border-badge-success: rgba(4, 120, 87, 0.1);

  /* Engineering Grid Line Color */
  --grid-line: rgba(24, 24, 27, 0.015);

  /* Timeline Core Adaptive Variables */
  --timeline-track-bg: rgba(24, 24, 27, 0.12);
  --timeline-pin-color: rgba(24, 24, 27, 0.18);
  --timeline-flag-bg: #ffffff;
  --timeline-flag-bg-hover: #f4f4f5;
  --timeline-flag-border: rgba(24, 24, 27, 0.15);
  --timeline-flag-shadow: rgba(24, 24, 27, 0.08);
}

/* Base Reset & Scrollbar Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-glass) transparent;
}

*::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--border-glass);
  border-radius: 0px; /* Sharp modernist sliders */
}

/* Custom Selection Highlight */
::selection {
  background: var(--color-primary-glow);
  color: var(--color-primary);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  letter-spacing: -0.01em;
  
  transition: background-color 0.3s ease;
}

/* Typography Custom Rules */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

p {
  font-family: var(--font-body);
  line-height: var(--leading-normal);
}

/* Material Outlined Icons Customization: Razor-Thin Stroke Override */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 20;
  display: inline-block;
  vertical-align: middle;
}

/* Pure Modernist Panels: Replacing busy Glassmorphism with Editorial Spacing */
.glass-panel {
  background: var(--bg-dark-card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border-glass);
  border-radius: 4px; /* Crisp, architectural structure */
  box-shadow: none;   /* Flat layout */
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: var(--border-glass-focused);
  box-shadow: none;
}

/* Core Layout Container */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Brand mark */
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: 4px; /* Matching the structural grid */
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon .material-symbols-outlined {
  font-size: 18px;
  color: #ffffff !important;
}

.brand-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Right Hand Workspace */
.workspace {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

/* Nav Header */
.navbar {
  height: 72px;
  border-bottom: 1px solid var(--border-glass);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-navbar);
  position: sticky;
  top: 0;
  z-index: 40;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 45%;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  height: 38px;
  background: var(--bg-search-input);
  border: 1px solid var(--border-glass);
  border-radius: 4px; /* Sharp minimalist */
  padding: 0 12px 0 38px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  background: var(--bg-search-input-focus);
  border-color: var(--color-primary);
  box-shadow: none; /* Solid border change only */
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-muted);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Flat Minimalist Buttons */
.nav-button {
  background: var(--bg-nav-btn);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  height: 38px;
  padding: 0 14px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.nav-button:hover {
  background: var(--bg-nav-btn-hover);
  border-color: var(--border-nav-btn-hover);
}

.nav-button span.material-symbols-outlined {
  font-size: 16px;
  color: var(--text-secondary);
}

.nav-button:hover span.material-symbols-outlined {
  color: var(--text-primary);
}

.nav-button-primary {
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  box-shadow: none;
  color: #ffffff !important;
}

.nav-button-primary span.material-symbols-outlined {
  color: #ffffff !important;
}

.nav-button-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: none;
}

/* Main Dashboard Body Container */
.content-area {
  padding: 40px;
  flex-grow: 1;
}

.dashboard-header {
  margin-bottom: 36px;
}

.dashboard-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.welcome-msg {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
}

.welcome-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  max-width: 600px;
}

/* Controlled Color Accents */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

/* Use Case Card Styling - High-Contrast Rounded Workbench Cards */
.card {
  padding: 24px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  background: var(--bg-dark-card);
  border: 1.5px solid var(--border-card);
  border-radius: 18px; /* High-contrast rounded corners */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: var(--transition-smooth);
}

/* Card hover: elevation, border glow, and subtle lift */
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-card-hover);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] .card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

/* Hide glass flash effects */
.card::after {
  display: none;
}

/* Top Subtle Accent Strip */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  opacity: 0;
  transition: var(--transition-smooth);
}

.card:hover::before {
  opacity: 1;
}

.card-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1.5px solid var(--border-tag);
}

.tag-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1.5px solid var(--border-tag);
  background: var(--bg-tag-feature);
  color: var(--text-secondary);
  transition: var(--transition-fast);
  cursor: default;
}

.tag-icon-only .material-symbols-outlined {
  font-size: 15px;
}

.tag-icon-only:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-glow);
}

.tag-full {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border-tag);
  background: var(--bg-tag-feature);
  color: var(--text-secondary);
}

.tag-full .material-symbols-outlined {
  font-size: 15px;
}

.tag-feature {
  background: var(--bg-tag-feature);
  color: var(--text-secondary);
}

.tag-level {
  background: var(--bg-tag-level);
  color: var(--color-secondary);
  border-color: var(--border-tag-level);
}

/* Connector tags: one consistent red scheme for every connector (icon-only on cards, full chips in the modal).
   Solid Google red fill with white ink in both themes (matches the solid feature tone chips). */
:root {
  --connector-ink: #FFFFFF;
  --connector-bg: #D93025;
  --connector-bg-hover: #B3261E;
  --connector-line: #D93025;
}
html[data-theme="light"] {
  --connector-ink: #FFFFFF;
  --connector-bg: #D93025;
  --connector-bg-hover: #B3261E;
  --connector-line: #D93025;
}
.tag-connector,
.tag-connector .material-symbols-outlined {
  color: var(--connector-ink) !important;
}
.tag-connector {
  background: var(--connector-bg) !important;
  border-color: var(--connector-line) !important;
}
.tag-connector:hover {
  background: var(--connector-bg-hover) !important;
  border-color: var(--connector-bg-hover) !important;
}


.card-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  padding: 8px 0 10px 0;
  margin-bottom: 2px;
}

.card-summary {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-glass);
}

/* Modal Drawer Slide-Out */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-modal-overlay);
  backdrop-filter: none; /* Pure solid overlays for speed and high-contrast */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content-card {
  position: relative;
  width: 94vw;
  max-width: 1360px;
  height: 88vh;
  max-height: 920px;
  background: var(--bg-dark-modal);
  border: 1.5px solid var(--border-card);
  border-radius: 24px; /* Distinctive rounded corners */
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(18px);
  transition: var(--transition-smooth);
}

html[data-theme="light"] .modal-content-card {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.14);
}

.modal-overlay.active .modal-content-card {
  transform: translateY(0);
}

.modal-header {
  padding: 24px 36px;
  border-bottom: 1.5px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
}

.modal-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  padding: 4px 0 6px 0;
}

.close-btn {
  background: var(--bg-nav-btn);
  border: 1.5px solid var(--border-glass);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-btn:hover {
  background: var(--bg-nav-btn-hover);
  color: var(--text-primary);
  border-color: var(--border-glass-focused);
}

.close-btn .material-symbols-outlined {
  font-size: 18px;
}

.modal-body {
  padding: 28px 36px 36px 36px;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-label {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label .material-symbols-outlined {
  font-size: 16px;
}

/* Claude Prompt Library Style Collapsible Accordion */
.prompt-collapsible {
  border: 1.5px solid var(--border-glass);
  border-radius: 16px;
  background: var(--bg-dark-card);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.prompt-collapsible[open] {
  border-color: var(--border-glass-focused);
}

.prompt-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  background: var(--bg-sidebar);
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}

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

.prompt-summary:hover {
  background: var(--bg-nav-btn-hover);
}

.prompt-summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-summary-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--color-primary-glow);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.prompt-summary-chevron {
  font-size: 20px;
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.prompt-collapsible[open] .prompt-summary-chevron {
  transform: rotate(180deg);
}

.prompt-content-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-top: 1.5px solid var(--border-glass);
}

/* Responsive Side-by-Side Prompt Workbench Grid */
.prompt-workbench-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 960px) {
  .prompt-workbench-grid {
    grid-template-columns: 1fr;
  }
}

.variable-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.variable-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: #818cf8;
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.02em;
}

html[data-theme="light"] .variable-label {
  color: #4338ca;
}

.variable-input {
  background: var(--bg-dark-card);
  border: 1.5px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: all 0.2s ease;
}

.variable-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.variable-input.pulse-focus {
  animation: pulseVariableFocus 1.2s ease;
}

@keyframes pulseVariableFocus {
  0% {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.45);
    transform: scale(1.02);
  }
  50% {
    border-color: #6366f1;
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.25);
  }
  100% {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    transform: scale(1);
  }
}

/* Prompt Box Sandbox Area */
.prompt-box {
  background: var(--bg-prompt-box);
  border: 1.5px solid var(--border-glass);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-prompt-box);
  line-height: 1.65;
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
}

.prompt-raw-text {
  flex-grow: 1;
  word-break: break-word;
}

.copy-prompt-btn {
  align-self: flex-end;
  margin-top: 16px;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.copy-prompt-btn:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.copy-prompt-btn .material-symbols-outlined {
  font-size: 16px;
}

/* Simplified Steps with Larger, Cleaner Typography & Embedded Helper Prompts */
.steps-list {
  list-style-type: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid var(--border-glass);
  border-radius: 14px;
  transition: var(--transition-fast);
}

html[data-theme="light"] .step-item {
  background: rgba(0, 0, 0, 0.015);
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary-glow);
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-title-text {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: var(--tracking-normal);
  color: var(--text-primary);
  line-height: var(--leading-snug);
}

.step-concept-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

/* Embedded Prerequisite Helper Prompts */
.helper-prompts-container {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 42px;
}

.helper-prompt-collapsible {
  border: 1.5px solid var(--border-glass);
  border-radius: 10px;
  background: var(--bg-dark-surface);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.helper-prompt-collapsible[open] {
  border-color: rgba(99, 102, 241, 0.4);
}

.helper-prompt-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.015);
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}

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

.helper-prompt-summary:hover {
  background: var(--bg-nav-btn-hover);
}

.helper-prompt-summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.helper-prompt-body {
  padding: 14px 16px;
  border-top: 1px solid var(--border-glass);
  background: var(--bg-prompt-box);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.helper-prompt-text {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-prompt-box);
  white-space: pre-wrap;
  word-break: break-word;
}

.helper-copy-btn {
  align-self: flex-end;
  background: var(--bg-nav-btn);
  border: 1px solid var(--border-glass);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-fast);
}

.helper-copy-btn:hover {
  background: var(--bg-nav-btn-hover);
  color: var(--text-primary);
  border-color: var(--border-glass-focused);
}

/* Manual Fallback Tip Box */
.manual-tip-box {
  background: rgba(245, 158, 11, 0.07);
  border: 1.5px solid rgba(245, 158, 11, 0.22);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.manual-tip-box .material-symbols-outlined {
  font-size: 20px;
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 1px;
}

.manual-tip-text strong {
  color: var(--text-primary);
}

/* Pro Tip Boxes */
.pro-tip-box {
  background: var(--color-success-glow);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
}

.pro-tip-icon {
  color: var(--color-success);
  flex-shrink: 0;
  font-size: 16px;
}

.pro-tip-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pro-tip-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.pro-tip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Setup Guide Section */
.setup-guide-box {
  background: var(--color-warning-glow);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 4px;
  padding: 14px 16px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-warning);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setup-guide-header .material-symbols-outlined {
  font-size: 14px;
}

.setup-steps {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 16px;
}

.setup-steps li {
  margin-bottom: 4px;
}

/* Onboarding Welcome Wizard - Beautiful Architectural Card Box */
.wizard-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark-base);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: var(--transition-smooth);
}

.wizard-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-dark-surface);
  border: 1px solid var(--border-glass-focused);
  border-radius: 4px; /* Crisp and solid */
  box-shadow: none;
  padding: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

/* Soft technical layout grid instead of glows */
.wizard-card::before {
  display: none;
}

.wizard-header {
  text-align: center;
}

.wizard-logo {
  width: 44px;
  height: 44px;
  background: var(--color-primary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  box-shadow: none;
}

.wizard-logo .material-symbols-outlined {
  font-size: 20px;
  color: #ffffff !important;
}

.wizard-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.wizard-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  max-width: 380px;
  line-height: 1.5;
}

.wizard-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select-control {
  width: 100%;
  height: 40px;
  background: var(--bg-search-input);
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 0 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.select-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: none;
}

.select-control option {
  background: var(--bg-dark-surface);
  color: var(--text-primary);
}

.wizard-actions {
  width: 100%;
  margin-top: 8px;
}

.btn-wide {
  width: 100%;
  height: 42px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Toast Notification (Copied Success popup) */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--color-success);
  color: white;
  padding: 10px 20px;
  border-radius: 4px; /* Sharp minimal style */
  backdrop-filter: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition-smooth);
  pointer-events: none;
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

.toast .material-symbols-outlined {
  font-size: 16px;
  color: #ffffff !important;
}

/* Premium LCS Diff Classes */
.diff-row {
  display: flex;
  min-height: 24px;
}
.diff-cell-left {
  flex: 0 0 50%;
  width: 50%;
  padding: 8px 16px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  border-right: 1px solid var(--border-glass);
  line-height: 1.5;
  box-sizing: border-box;
}
.diff-cell-right {
  flex: 0 0 50%;
  width: 50%;
  padding: 8px 16px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }

  .workspace {
    width: 100% !important;
    margin-left: 0 !important;
    height: 100vh;
    overflow-y: auto;
  }
  
  .navbar {
    padding: 16px 24px !important;
  }
}

@media (max-width: 768px) {

  .navbar {
    flex-direction: column;
    height: auto;
    padding: 14px 16px !important;
    gap: 12px;
  }

  .navbar-left {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .search-wrapper {
    flex: 1;
    width: auto !important;
  }

  .navbar-right {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .navbar-right .nav-button,
  .navbar-right select {
    width: 100% !important;
    justify-content: center !important;
    font-size: 13px !important;
    padding: 0 8px !important;
    height: 36px !important;
    margin-left: 0 !important;
  }
  
  /* Place language select and theme toggle as grid squares */
  #btnThemeToggle {
    grid-column: span 1;
  }
  #navLang {
    grid-column: span 1;
  }
  #btnChangeContext {
    grid-column: span 1;
  }
  #btnLogout {
    grid-column: span 1;
  }

  .content-area {
    padding: 16px !important;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .modal-content-card {
    height: 100vh !important;
    max-height: none !important;
    border-radius: 0 !important;
  }
  
  .modal-header {
    padding: 16px 20px !important;
  }

  /* Make diff row stack vertically on narrow phones */
  .diff-row {
    flex-direction: column !important;
  }
  .diff-cell-left {
    flex: 1 0 100% !important;
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px dashed var(--border-glass) !important;
  }
  .diff-cell-right {
    flex: 1 0 100% !important;
    width: 100% !important;
  }
}

/* Placeholder Focus Softening: hides placeholders instantly upon active user input focus */
input:focus::placeholder,
textarea:focus::placeholder {
  color: transparent !important;
  opacity: 0 !important;
  transition: color 0.15s ease, opacity 0.15s ease;
}

/* Gemini Generating Loader & Overlay */
.gemini-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gemini-loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.gemini-loader-circle {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gemini-loader-sparkle {
  font-size: 42px;
  background: linear-gradient(135deg, #a78bfa 0%, #6366f1 50%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse-sparkle 2s infinite ease-in-out, spin-slow 12s infinite linear;
}

.gemini-loader-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top-color: #818cf8;
  border-bottom-color: #3b82f6;
  border-radius: 50%;
  animation: spin-fast 1.5s infinite linear;
}

.gemini-loader-ring-outer {
  position: absolute;
  width: 120%;
  height: 120%;
  border: 1px solid transparent;
  border-left-color: rgba(167, 139, 250, 0.4);
  border-right-color: rgba(59, 130, 246, 0.4);
  border-radius: 50%;
  animation: spin-reverse 3s infinite linear;
}

.gemini-loader-bar {
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 24px;
  overflow: hidden;
  position: relative;
}

.gemini-loader-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #818cf8, #a78bfa, #3b82f6);
  background-size: 200% 100%;
  animation: shimmer-bar 1.5s infinite linear;
}

@keyframes pulse-sparkle {
  0%, 100% { transform: scale(0.9); opacity: 0.8; filter: drop-shadow(0 0 4px rgba(129, 140, 248, 0.3)); }
  50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 15px rgba(129, 140, 248, 0.8)); }
}

@keyframes spin-slow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spin-fast {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spin-reverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes shimmer-bar {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   ADOPTION ROADMAP TIMELINE STYLING (REDESIGNED V2)
   ========================================================================== */

/* 1. DESKTOP ALTERNATING FLAG TIMELINE CONTAINER (Inspired by timeline2.webp) */
.alternating-timeline-container {
  position: relative;
  width: 100%;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.04);
  margin-bottom: 32px;
  overflow: visible; /* Crucial to let floating flags display without clipping */
  display: flex;
  flex-direction: column;
  gap: 24px; /* Cozy spacing between the two track sections */
}

@media (max-width: 1024px) {
  .alternating-timeline-container {
    display: none; /* Collapse into vertical stream timeline on mobile */
  }
}

/* Timeline Track Blocks */
.timeline-track-block {
  position: relative;
  width: 100%;
  height: 290px; /* Symmetrical height for UP and DOWN flags */
  overflow: visible;
}

/* Track Header Labels */
.timeline-track-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.track-header-icon {
  font-size: 20px;
}

.track-header-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-transform: uppercase;
}

/* Track Divider Line */
.timeline-track-divider {
  height: 1px;
  background: var(--border-glass);
  margin: 4px 0;
  opacity: 0.6;
}

/* Horizontal Track Baseline */
.timeline-horizontal-track {
  position: absolute;
  left: 0;
  top: 180px; /* Shifted down to clear header space */
  width: 100%;
  height: 8px;
  background: var(--timeline-track-bg);
  border-radius: 4px;
  transform: translateY(-50%);
  pointer-events: none; /* Let clicks pass to parent/siblings */
}

/* Dynamic Progress Fill Bar */
.timeline-track-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
  border-radius: 4px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Joint Nodes along track (Siblings of track, positioned at y = 120px) */
.timeline-node-joint {
  position: absolute;
  top: 180px; /* Shifted down to clear header space */
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  
  --node-color: #6366f1; /* Fallback */
  border: 4px solid var(--border-glass-focused);
}

.node-joint-icon {
  font-size: 15px;
  color: var(--text-secondary);
  font-variation-settings: 'FILL' 1;
}

.timeline-node-joint:hover {
  transform: translate(-50%, -50%) scale(1.15);
  border-color: var(--node-color) !important;
}

.timeline-node-joint.active {
  border-color: var(--node-color) !important;
  background: var(--bg-card) !important;
  transform: translate(-50%, -50%) scale(1.25);
  box-shadow: 0 0 15px var(--node-color);
}

.timeline-node-joint.active .node-joint-icon {
  color: var(--node-color) !important;
}

/* Completed Node State */
.timeline-node-joint.completed {
  background: var(--node-color) !important;
  border-color: var(--node-color) !important;
  box-shadow: 0 0 12px var(--node-color);
}

.timeline-node-joint.completed .node-joint-icon {
  color: white !important;
}

.timeline-node-joint.completed.active {
  transform: translate(-50%, -50%) scale(1.25);
  box-shadow: 0 0 20px var(--node-color);
}

/* Alternating Vertical Guidelines Connector Pins (Centered at y = 120px) */
.alternating-marker-pin {
  position: absolute;
  left: 50%;
  width: 2px;
  z-index: 2;
  pointer-events: none;
  transition: all 0.35s ease;
  border-left: 2px dashed var(--timeline-pin-color);
}

/* UP markers */
.alternating-marker-pin.pin-up {
  bottom: 110px; /* Starts exactly at center y = 180px (290px height container) */
  height: 50px;
}

/* DOWN markers */
.alternating-marker-pin.pin-down {
  top: 180px; /* Starts exactly at center y = 180px */
  height: 50px;
}

.timeline-node-joint.active ~ .alternating-marker-pin {
  border-left-style: solid;
  border-left-color: var(--node-color) !important;
}

.timeline-node-joint.completed ~ .alternating-marker-pin {
  border-left-style: solid;
  border-left-color: var(--node-color) !important;
}

/* Floating Flag Schedule Cards */
.floating-schedule-flag {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 175px;
  background: var(--timeline-flag-bg);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 12px 30px var(--timeline-flag-shadow);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 5;
  
  --node-color: #6366f1; /* Fallback */
  border: 1px solid var(--timeline-flag-border);
}

.floating-schedule-flag.flag-up {
  bottom: 160px; /* Sits cleanly above the 50px pin (130px top distance) */
  border-top: 4px solid var(--node-color) !important;
}

.floating-schedule-flag.flag-down {
  top: 230px; /* Sits cleanly below the 50px pin (230px top distance) */
  border-bottom: 4px solid var(--node-color) !important;
}

/* Flag Pointer triangles */
.floating-schedule-flag::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.floating-schedule-flag.flag-up::after {
  bottom: -6px;
  border-top: 6px solid var(--timeline-flag-border);
}

.floating-schedule-flag.flag-down::after {
  top: -6px;
  border-bottom: 6px solid var(--timeline-flag-border);
}

/* Hover effects */
.floating-schedule-flag.flag-up:hover {
  transform: translateX(-50%) translateY(-6px);
  border-color: var(--node-color) !important;
  background: var(--timeline-flag-bg-hover);
  box-shadow: 0 12px 36px var(--timeline-flag-shadow);
}

.floating-schedule-flag.flag-down:hover {
  transform: translateX(-50%) translateY(6px);
  border-color: var(--node-color) !important;
  background: var(--timeline-flag-bg-hover);
  box-shadow: 0 12px 36px var(--timeline-flag-shadow);
}

/* Active node flag */
.floating-schedule-flag.active {
  background: var(--timeline-flag-bg-hover);
  border-color: var(--node-color) !important;
  box-shadow: 0 12px 30px var(--timeline-flag-shadow);
  transform: translateX(-50%) scale(1.04);
  z-index: 6;
}

.floating-schedule-flag.completed {
  border-color: var(--node-color) !important;
}

/* Flag inner labels */
.flag-date-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--node-color) !important;
  margin-bottom: 4px;
  transition: color 0.3s ease;
}

.flag-title-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flag-subtitle-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* TRACK 2: CONTINUOUS PIPELINE DESIGN (No pop-ups, ultra-compact arrow line) */
.timeline-track-block-continuous {
  position: relative;
  width: 100%;
  margin-top: 4px;
}

.continuous-pipeline-capsule {
  position: relative;
  width: 100%;
  height: 52px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.continuous-pipeline-capsule:hover {
  transform: translateY(-2px);
  border-color: #a855f7 !important;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.12);
}

.continuous-pipeline-capsule.active {
  border-color: #a855f7 !important;
  background: var(--bg-card);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.15);
}

/* Thicker horizontal track with arrow head inside the capsule */
.continuous-pipeline-track {
  position: absolute;
  left: 20px;
  right: 48px; /* Leaves perfect space for the arrow */
  height: 12px;
  background: transparent; /* No inner dark grey line */
  border-radius: 6px;
}

.continuous-pipeline-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #a855f7 0%, #d8b4fe 100%);
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Pulsating Continuous Right Arrow Indicator representing endless delivery */
.continuous-pipeline-arrow {
  position: absolute;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #a855f7;
  text-shadow: 0 0 8px rgba(168, 85, 247, 0.55);
  animation: pipelineArrowPulse 1.8s infinite cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

@keyframes pipelineArrowPulse {
  0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.8; }
  50% { transform: translateY(-50%) translateX(6px); opacity: 1; }
}

/* Overlaying labels */
.continuous-pipeline-overlay {
  position: relative;
  z-index: 5;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.pipeline-badge {
  font-size: 13px;
  font-weight: 800;
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}

.pipeline-subtitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-left: 12px;
  margin-right: auto;
}

.pipeline-stats-pill {
  font-size: 13px;
  font-weight: 700;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.15);
  padding: 4px 12px;
  border-radius: 12px;
}

/* 2. DUAL-COLUMN ROADMAP SPLIT DASHBOARD PANEL */
.roadmap-split-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 12px;
  align-items: start;
}

@media (max-width: 1024px) {
  .roadmap-split-dashboard {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.roadmap-dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.roadmap-card-header-bar {
  height: 6px;
  width: 100%;
}

.roadmap-card-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.roadmap-section-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.roadmap-section-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.roadmap-section-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

.roadmap-section-badge.verified {
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
}

.roadmap-section-badge.pending {
  background: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
}

.roadmap-section-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Verification list styles */
.roadmap-checklist-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.roadmap-task-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-glass);
  transition: all 0.2s ease;
}

.roadmap-task-label:hover {
  background: var(--bg-card);
  border-color: var(--border-glass-focused);
}

.roadmap-task-label.checked {
  background: var(--bg-card);
  border-color: rgba(16, 185, 129, 0.15);
}

.roadmap-task-label input[type="checkbox"] {
  display: none; /* Hide native checkbox */
}

/* Beautiful custom checkbox square */
.roadmap-checkbox-indicator {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--text-muted);
  background: var(--bg-card);
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.roadmap-task-label:hover .roadmap-checkbox-indicator {
  border-color: var(--text-secondary);
}

.roadmap-task-label input[type="checkbox"]:checked + .roadmap-checkbox-indicator {
  background: #10b981;
  border-color: #10b981;
}

.roadmap-checkbox-indicator::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center;
}

.roadmap-task-label input[type="checkbox"]:checked + .roadmap-checkbox-indicator::after {
  transform: rotate(45deg) scale(1);
}

.roadmap-task-text {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.roadmap-task-label.checked .roadmap-task-text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--border-glass-focused);
}

/* 3. MOBILE RESPONSIVE ROADMAP STREAM STYLES */
.chronological-timeline-mobile {
  display: none;
  flex-direction: column;
  position: relative;
  padding-left: 20px;
  margin-bottom: 24px;
}

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

.mobile-timeline-item {
  position: relative;
  padding-bottom: 24px;
  cursor: pointer;
}

.mobile-timeline-item:last-child {
  padding-bottom: 0;
}

.mobile-timeline-connector {
  position: absolute;
  top: 0;
  left: -11px;
  width: 2px;
  height: 100%;
  background: var(--border-glass);
}

.mobile-timeline-item:last-child .mobile-timeline-connector {
  display: none;
}

.mobile-timeline-badge {
  position: absolute;
  top: 6px;
  left: -15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  z-index: 5;
}

.mobile-timeline-content-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.25s ease;
}

.mobile-timeline-item:hover .mobile-timeline-content-card {
  border-color: var(--node-accent);
}

.mobile-timeline-item.active .mobile-timeline-content-card {
  background: var(--bg-card);
  border-color: var(--node-accent) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.mobile-card-subtitle {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.mobile-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.mobile-card-progress {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.mobile-card-progress-bar {
  height: 100%;
  border-radius: 2px;
}

/* 4. PLAYBOOK SECTOR ASSIGNMENTS LIST STYLES */
.milestone-playbooks-section-title {
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.milestone-playbooks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.milestone-playbook-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
}

.milestone-playbook-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.milestone-playbook-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
  min-width: 0;
}

.milestone-playbook-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.milestone-playbook-status-dot.active {
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

.milestone-playbook-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-playbook-title.completed {
  color: var(--text-secondary);
}

.btn-toggle-deploy-mini {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-toggle-deploy-mini:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
  border-color: #3b82f630;
}

.btn-toggle-deploy-mini.active {
  background: #10b98115;
  color: #10b981;
  border-color: #10b98130;
}

.btn-remove-playbook {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-remove-playbook:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.add-playbook-dropdown-wrapper {
  margin-top: auto;
  position: relative;
}

.select-add-playbook {
  width: 100%;
  height: 38px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-glass-focused);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.select-add-playbook:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--color-accent);
  color: var(--text-primary);
}

.empty-playbook-msg {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
  border: 1px dashed var(--border-glass-focused);
  border-radius: 8px;
  background: var(--bg-sidebar);
}

/* PREMIUM FLOATING FEEDBACK BUTTON */
.floating-feedback-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: #1A73E8;
  border: none;
  border-radius: 30px;
  color: white !important;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(26, 115, 232, 0.35);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-feedback-button:hover {
  transform: translateY(-4px) scale(1.04);
  background: #1557B0;
  box-shadow: 0 12px 30px rgba(26, 115, 232, 0.45);
}

.floating-feedback-button:active {
  transform: translateY(-1px) scale(0.98);
}

.feedback-button-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .floating-feedback-button {
    padding: 12px;
    border-radius: 50%;
  }
  .feedback-button-text {
    display: none;
  }
}

/* ==========================================================================
   V2 UI LAYER
   Shared topbar, pill filter bar, flat card grid, particle canvas, modal
   workbench, admin tabs/tables, settings, token cards.
   Everything below overrides the legacy rules above it.
   ========================================================================== */

:root {
  --accent: #4C8DF6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(76, 141, 246, 0.14);
  --surface-2: #1D2129;
  --line: rgba(243, 244, 246, 0.10);
  --line-strong: rgba(243, 244, 246, 0.20);
  --ok: #34A853;
  --warn: #FBBC04;
  --err: #EA4335;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --control-h: 44px;
  --page-pad: clamp(16px, 4vw, 40px);
  --shadow-pop: 0 18px 48px rgba(0, 0, 0, 0.45);
  /* Card / panel edges: clearly visible on dark surfaces, a touch brighter on hover */
  --line-card: rgba(255, 255, 255, 0.34);
  --line-card-hover: rgba(255, 255, 255, 0.60);
  --shadow-card-hover: 0 10px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  --accent: #2F6FDF;
  --accent-soft: rgba(47, 111, 223, 0.10);
  --surface-2: #F0F2F5;
  --line: rgba(14, 16, 20, 0.10);
  --line-strong: rgba(14, 16, 20, 0.20);
  --shadow-pop: 0 18px 48px rgba(14, 16, 20, 0.14);
  --line-card: rgba(14, 16, 20, 0.32);
  --line-card-hover: rgba(14, 16, 20, 0.55);
  --shadow-card-hover: 0 10px 28px rgba(14, 16, 20, 0.10);
}

[hidden] { display: none !important; }

.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;
}

html { overflow-x: hidden; }

body {
  font-size: 16px;
  line-height: 1.5;
  background-image: none;
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Particle canvas ----------------------------------------------------- */
#fieldCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* Layers that sit above the canvas stay transparent so the field shows through */
.app-container,
.admin-portal {
  position: relative;
  z-index: 1;
  background: transparent;
}

/* Login and onboarding: let the field show behind the card; hide the app beneath */
.wizard-overlay {
  background: transparent;
  z-index: 1500;
  padding: 16px;
  overflow-y: auto;
}

body:has(#wizardOverlay:not([style*="none"])) #appLayout,
body:has(#wizardOverlay:not([style*="none"])) #adminPortal {
  visibility: hidden;
}

/* --- Buttons and controls ------------------------------------------------ */
.nav-button {
  height: var(--control-h);
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-primary);
  white-space: nowrap;
  justify-content: center;
}

.nav-button:hover { border-color: var(--line-strong); background: var(--surface-2); }

.nav-button-primary,
.nav-button-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink) !important;
}

.nav-button-primary:hover { filter: brightness(1.08); }

.nav-button:disabled,
.nav-button.is-busy { opacity: 0.65; cursor: progress; }

.nav-button .material-symbols-outlined { font-size: 18px; }

.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }

.btn-danger { color: var(--err) !important; }
.btn-danger:hover { border-color: var(--err); }

.btn-wide {
  height: 48px;
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
}

.icon-btn {
  width: var(--control-h);
  height: var(--control-h);
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn .material-symbols-outlined { font-size: 20px; }
.icon-btn.btn-sm { width: 36px; height: 36px; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  align-self: center;
}

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

.pill-select {
  height: var(--control-h);
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 0 38px 0 16px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  max-width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.pill-select:hover { border-color: var(--line-strong); }
.pill-select:focus { outline: none; border-color: var(--accent); }
.pill-select option { background: var(--bg-dark-surface); color: var(--text-primary); }

.form-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
}

.select-control {
  height: var(--control-h);
  border-radius: var(--radius-sm);
  font-size: 15px;
  border-color: var(--line);
  background-color: var(--surface-2);
}

textarea.select-control { height: auto; padding: 10px 12px; line-height: 1.5; }

.select-control[aria-invalid] { border-color: var(--err); }

.field-hint { font-size: 13px; color: var(--text-muted); margin: 0; }
.field-error { font-size: 13px; color: var(--err); margin: 0; min-height: 0; }
.field-error:empty { display: none; }
.field-warning {
  font-size: 13px;
  color: var(--warn);
  background: rgba(251, 188, 4, 0.10);
  border: 1px solid rgba(251, 188, 4, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 0;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  cursor: pointer;
}

.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* --- Inline feedback, status pills, spinner ----------------------------- */
.inline-feedback {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-wrap: anywhere;
}

.inline-feedback.is-info { border-color: rgba(76, 141, 246, 0.35); background: var(--accent-soft); }
.inline-feedback.is-success { border-color: rgba(52, 168, 83, 0.35); background: rgba(52, 168, 83, 0.10); }
.inline-feedback.is-error { border-color: rgba(234, 67, 53, 0.35); background: rgba(234, 67, 53, 0.10); color: var(--text-primary); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-pill.is-ok { color: var(--ok); border-color: rgba(52, 168, 83, 0.4); background: rgba(52, 168, 83, 0.10); }
.status-pill.is-error { color: var(--err); border-color: rgba(234, 67, 53, 0.4); background: rgba(234, 67, 53, 0.10); }
.status-pill.is-muted { color: var(--text-muted); }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.is-ok::before { background: var(--ok); }
.status-dot.is-pending::before { background: var(--warn); }
.status-dot.is-off::before { background: var(--text-muted, #9aa0a6); }
.row-builtin-admin td { background: rgba(66, 133, 244, 0.04); }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: v2-spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* --- Toast ---------------------------------------------------------------- */
.toast {
  left: 50%;
  right: auto;
  bottom: 24px;
  transform: translate(-50%, 10px);
  max-width: min(560px, calc(100vw - 32px));
  background: var(--ok);
  color: #ffffff;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow-pop);
  z-index: 3000;
}

.toast.active { transform: translate(-50%, 0); }
.toast.is-warning { background: #B3261E; }

/* --- Copy rows -------------------------------------------------------------- */
.copy-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.copy-row-label { font-size: 13px; color: var(--text-muted); }

.copy-row-value {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-dark-base);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  overflow-wrap: anywhere;
  word-break: break-all;
  flex: 1 1 180px;
  min-width: 0;
}

/* --- Login / token cards ------------------------------------------------- */
.wizard-card {
  max-width: 440px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-dark-surface);
  box-shadow: var(--shadow-pop);
  padding: clamp(24px, 6vw, 40px);
  margin: auto;
}

.wizard-logo { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); }
.wizard-logo .material-symbols-outlined { font-size: 26px !important; }
.wizard-title { font-size: 24px; line-height: 1.25; }
#loginSubtitle { color: var(--accent) !important; font-size: 16px !important; }
.wizard-desc { font-size: 15px; color: var(--text-muted); margin: 8px auto 0; }

#loginErrorMsg,
#resetErrorMsg { font-size: 14px !important; border-radius: var(--radius-sm) !important; }

/* --- Topbar ------------------------------------------------------------------ */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--page-pad);
  background: var(--bg-navbar);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.topbar .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.topbar .logo-icon .material-symbols-outlined { font-size: 20px; color: #fff; }

.topbar .brand-text {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.topbar-search {
  flex: 1 1 auto;
  max-width: 560px;
  margin: 0 auto;
  min-width: 0;
}

.topbar-spacer { flex: 1 1 auto; }

.topbar .search-input {
  height: var(--control-h);
  border-radius: 999px;
  font-size: 15px;
  padding: 0 16px 0 44px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.topbar .search-input:focus { border-color: var(--accent); }
.topbar .search-icon { left: 16px; font-size: 20px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-lang { width: auto; }

/* --- Avatar menu ------------------------------------------------------------- */
.avatar-wrap { position: relative; }

.avatar-btn {
  width: var(--control-h);
  height: var(--control-h);
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--accent-soft); }

.avatar-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(300px, calc(100vw - 24px));
  background: var(--bg-dark-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 60;
}

.avatar-menu-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.avatar-menu-email {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.avatar-menu-context { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.avatar-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.avatar-menu-item:hover { background: var(--surface-2); }
.avatar-menu-item .material-symbols-outlined { font-size: 20px; color: var(--text-muted); }

/* --- Playbook page -------------------------------------------------------- */
.workspace {
  height: auto;
  overflow: visible;
  flex: 1 1 auto;
  width: 100%;
}

.content-area {
  padding: 32px var(--page-pad) 96px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.results-head { margin-bottom: 16px; }

.results-head .welcome-msg {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

/* Cards: equal-height rows; no fixed height so nothing clips */
.cards-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: 1fr;
  gap: 20px;
}

@media (min-width: 720px) { .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card {
  height: auto;
  min-height: 0;
  overflow: visible;
  justify-content: flex-start;
  gap: 12px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-dark-card);
  box-shadow: none;
}

.card::before { display: none; }

.card:hover,
.card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--border-card-hover);
  box-shadow: var(--shadow-pop);
}

html[data-theme="light"] .card { box-shadow: 0 1px 2px rgba(14, 16, 20, 0.04); }
html[data-theme="light"] .card:hover { box-shadow: var(--shadow-pop); }

.card-tags { gap: 6px; min-height: 28px; }

.tag {
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  border-width: 1px;
}

.tag-icon-only { width: 28px; height: 28px; border-width: 1px; padding: 0; }
.tag-icon-only .material-symbols-outlined { font-size: 16px; }
.tag-full { font-size: 13px; text-transform: none; letter-spacing: 0; border-width: 1px; padding: 4px 10px; }

.card-title {
  font-size: 20px;
  line-height: 1.3;
  padding: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-summary {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted);
  -webkit-line-clamp: 3;
  margin: 0;
}

.card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-role {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.pref-btn {
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pref-btn .material-symbols-outlined { font-size: 18px; }
.pref-btn:hover { border-color: var(--line-strong); color: var(--text-primary); }
.btn-like.is-active { color: var(--err); border-color: rgba(234, 67, 53, 0.4); background: rgba(234, 67, 53, 0.08); }
.btn-like.is-active .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20; }
/* Read-only view counter (eye icon) that sits next to the like button */
.view-count {
  height: 36px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: default;
}
.view-count .material-symbols-outlined { font-size: 18px; }
.uc-pref .view-count { height: 44px; padding: 0 8px; font-size: 14px; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.empty-state .material-symbols-outlined { font-size: 40px; }
.empty-state h3 { font-size: 20px; color: var(--text-primary); }
.empty-state p { font-size: 16px; max-width: 420px; }
.empty-state .nav-button { margin-top: 8px; }

/* --- Use case modal ---------------------------------------------------------- */
.modal-overlay { padding: 24px; }

.modal-content-card {
  width: 100%;
  max-width: 1120px;
  height: auto;
  max-height: calc(100dvh - 48px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--bg-dark-modal);
  box-shadow: var(--shadow-pop);
}

.modal-small { max-width: 520px; }

.modal-header {
  padding: 20px 28px;
  gap: 16px;
  background: var(--bg-dark-modal);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
}

.modal-header-left { min-width: 0; }

.modal-title {
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.close-btn { width: 44px; height: 44px; flex-shrink: 0; border-width: 1px; }
.close-btn .material-symbols-outlined { font-size: 22px; }

.modal-body {
  padding: 24px 28px 32px;
  gap: 28px;
  font-size: 16px;
}

.uc-hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.uc-hero {
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.uc-hero img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
a.uc-hero:hover img { transform: scale(1.02); }

.uc-hero-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--accent);
  background: radial-gradient(circle at 30% 30%, var(--accent-soft), transparent 70%), var(--surface-2);
}

.uc-hero-placeholder .material-symbols-outlined { font-size: 44px; }

.uc-summary { font-size: 17px; line-height: 1.6; color: var(--text-secondary); }
.uc-pref { display: flex; gap: 8px; }
.uc-pref .pref-btn { height: 44px; min-width: 44px; }

.section-label {
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.uc-how .steps-list { list-style: none; display: flex; flex-direction: column; gap: 16px; padding: 0; }

.uc-how .step-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: transparent;
}

.uc-how .step-header { display: flex; gap: 14px; align-items: flex-start; }

.uc-how .step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
}

.uc-how .step-info { min-width: 0; }
.uc-how .step-title { font-weight: 700; font-size: 17px; color: var(--text-primary); }
.uc-how .step-desc { font-size: 16px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }

/* <details> shared look: summary row with a rotating chevron */
.helpers-group,
.helper-prompt-collapsible,
.wb-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  min-width: 0;
}

.helpers-group-summary,
.helper-prompt-summary,
.wb-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.helpers-group-summary::-webkit-details-marker,
.helper-prompt-summary::-webkit-details-marker,
.wb-summary::-webkit-details-marker { display: none; }

.helpers-group-summary > .material-symbols-outlined:first-child,
.wb-summary > .material-symbols-outlined:first-child { color: var(--accent); font-size: 20px; }

.chevron { margin-left: auto; font-size: 22px; color: var(--text-muted); transition: transform 0.2s ease; }
details[open] > summary > .chevron { transform: rotate(180deg); }

.helpers-list { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.helper-prompt-collapsible { background: var(--bg-dark-modal); }
.helper-prompt-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.helper-prompt-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.type-chip .material-symbols-outlined { font-size: 16px; }

.wb-count {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}

.wb-panel > :not(summary) { margin: 0 16px 16px; }

.variable-input-group { display: flex; flex-direction: column; gap: 6px; }

.variable-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
}

.variable-input {
  height: var(--control-h);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-dark-modal);
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
  padding: 0 12px;
  width: 100%;
}

.variable-input:focus { outline: none; border-color: var(--accent); }

.pulse-focus { animation: v2-pulse 1.2s ease-out 1; }

@keyframes v2-pulse {
  0% { box-shadow: 0 0 0 0 rgba(76, 141, 246, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(76, 141, 246, 0); }
}

.muted-note { font-size: 15px; color: var(--text-muted); }

.prompt-raw-text {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-prompt-box);
  background: var(--bg-prompt-box);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  max-height: 420px;
  overflow-y: auto;
}

.var-chip {
  display: inline;
  font: inherit;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 1px 8px;
  margin: 0 1px;
  border-radius: 999px;
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  line-height: 1.6;
  vertical-align: baseline;
}

.var-chip.is-filled {
  border-style: solid;
  border-color: rgba(52, 168, 83, 0.5);
  background: rgba(52, 168, 83, 0.12);
  color: var(--ok);
}

.prompt-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.manual-tip-box,
.pro-tip-box,
.setup-guide-box {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  font-size: 15px;
}

.setup-guide-box { flex-direction: column; }
.manual-tip-title, .pro-tip-title, .setup-guide-header { font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.manual-tip-text, .pro-tip-text, .setup-steps { font-size: 15px; color: var(--text-muted); line-height: 1.5; }
.setup-steps { padding-left: 20px; }
.pro-tip-icon, .manual-tip-icon { color: var(--warn); }

/* --- Admin portal ----------------------------------------------------------- */
.admin-portal { min-height: 100vh; }

.tab-row {
  display: flex;
  gap: 4px;
  padding: 0 var(--page-pad);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-navbar);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 72px;
  z-index: 40;
}

.tab-row::-webkit-scrollbar { display: none; }

.tab-item {
  height: 52px;
  padding: 0 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px var(--page-pad) 96px;
}

/* showAdminTab toggles inline display:block, so space children with margins, not gap */
.admin-tab-content > * + * { margin-top: 20px; }

.panel {
  background: var(--bg-dark-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-desc { font-size: 15px; color: var(--text-muted); margin: 0; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.inline-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-form .form-group { min-width: 0; }
.grow { flex: 1 1 260px; }

/* Tables scroll inside their wrapper, never the page */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.panel.table-wrap { padding: 0; display: block; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text-primary);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-2); }

.col-actions { text-align: right; width: 1%; }
.col-check { width: 44px; }
.col-check input, .data-table td input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.col-thumb { width: 96px; }

.thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: block;
  background: var(--surface-2);
}

.cell-mono { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.cell-strong { font-weight: 600; }
.cell-pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 520px; line-height: 1.5; }
.muted { color: var(--text-muted); }

.table-empty { text-align: center; color: var(--text-muted); padding: 32px 16px !important; }
.table-empty.is-error { color: var(--err); }

.row-actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }

.ge-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

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

/* Analytics */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card { gap: 6px; }
.stat-label { font-size: 14px; color: var(--text-muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.stat-value { font-family: var(--font-heading); font-size: 32px; font-weight: 700; color: var(--text-primary); }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.chart-legend > div { display: inline-flex; align-items: center; gap: 8px; }
#adminChartContainer { overflow-x: auto; }

/* Settings */
.settings-panel { max-width: 880px; }
.settings-form { display: flex; flex-direction: column; gap: 18px; }

.settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-row-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }

.settings-test {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Edit user modal */
.modal-small .modal-body { gap: 16px; }

.reset-access-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.reset-access-title { font-weight: 700; font-size: 15px; }

.modal-footer-row {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
}

/* Case form infographic */
.infographic-preview { display: flex; flex-direction: column; gap: 8px; }
.infographic-preview-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

.infographic-preview-row img {
  width: 192px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: block;
}

/* Floating feedback button: keep it clear of the toast and small screens */
.floating-feedback-button { z-index: 900; }

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .workbench { grid-template-columns: 1fr; }
  .uc-hero-row { grid-template-columns: 1fr; gap: 20px; }
  .settings-row-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .settings-row-3 > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  /* Topbar: brand + actions on row one, full-width search on row two */
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 12px;
  }

  .topbar-brand { flex: 1 1 auto; }
  .topbar .brand-text { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { gap: 8px; }
  .topbar-lang { padding: 0 30px 0 12px; font-size: 13px; background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; }

  .topbar-search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    margin: 0;
  }

  .tab-row { top: 69px; }

  .content-area { padding-top: 24px; }

  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: calc(var(--page-pad) * -1);
    margin-right: calc(var(--page-pad) * -1);
    padding: 0 var(--page-pad) 2px;
  }

  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar .pill-select { flex-shrink: 0; }

  .card { padding: 20px; }

  /* Modals become full-screen sheets with a sticky header */
  .modal-overlay { padding: 0; align-items: stretch; }

  .modal-content-card,
  .modal-small {
    max-width: none;
    width: 100%;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none;
  }

  .modal-header { padding: 12px 16px !important; }
  .modal-body { padding: 20px 16px 40px; }
  .uc-how .step-item { padding: 16px 14px; }

  .panel { padding: 18px; }
  .settings-row,
  .settings-row-3 { grid-template-columns: 1fr; }
  .settings-row-3 > :first-child { grid-column: auto; }

  .inline-form > .nav-button,
  .settings-test > .nav-button { width: 100%; }

  .toast { bottom: 16px; border-radius: var(--radius-md); }
}

@media (max-width: 420px) {
  .topbar .brand-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ==========================================================================
   V4 LAYER: visible card/panel edges, overview variables panel, feedback
   modal heading alignment.
   ========================================================================== */

/* --- Card / panel borders (dark: rgba(255,255,255,.16), hover .30) -------- */
.card,
.panel,
.wizard-card,
.modal-content-card,
.uc-how .step-item,
.helpers-group,
.wb-panel,
.manual-tip-box,
.pro-tip-box,
.setup-guide-box {
  border-color: var(--line-card);
}

.card { transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.card:hover,
.card:focus-visible {
  border-color: var(--line-card-hover);
  box-shadow: var(--shadow-card-hover);
}
html[data-theme="light"] .card:hover { box-shadow: var(--shadow-card-hover); }

.panel,
.uc-how .step-item,
.wb-panel { transition: border-color 0.2s ease; }
.panel:hover,
.uc-how .step-item:hover,
.wb-panel:hover { border-color: var(--line-card-hover); }

/* Step 2 now holds only the sample prompt */
.workbench { grid-template-columns: minmax(0, 1fr); }

/* ==========================================================================
   V5 LAYER: hero variables column, roomier steps, Try it / Copy prompt colours
   ========================================================================== */

/* --- Hero: image stays top-aligned; the right column grows naturally ------ */
.uc-hero-row { align-items: start; }

/* --- Hero variables column (fill once, updates every prompt) -------------- */
.uc-vars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line-card);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  min-width: 0;
}
.uc-vars-head { display: flex; align-items: center; gap: 8px; }
.uc-vars-head > .material-symbols-outlined { color: var(--accent); font-size: 20px; }
.uc-vars-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.uc-vars-hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.uc-vars-list { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.uc-vars .variable-input-group { gap: 4px; }
.uc-vars .variable-label { font-family: var(--font-body); font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--text-secondary); }
.uc-vars .variable-input { height: 40px; font-size: 14px; }

/* --- How it works: consistent inner padding for all three steps ----------- */
.uc-how .step-item { padding: 24px; gap: 18px; }
.uc-how .step-header { gap: 16px; align-items: flex-start; }
.uc-how .step-num { width: 34px; height: 34px; }

.helpers-group-summary,
.helper-prompt-summary,
.wb-summary { min-height: 56px; padding: 0 20px; gap: 12px; }

.wb-panel > :not(summary) { margin: 4px 20px 20px; }
.wb-panel > .prompt-actions { margin-top: 0; }
.helpers-list { gap: 12px; padding: 4px 16px 16px; }
.helper-prompt-body { padding: 4px 20px 20px; gap: 14px; }
.prompt-raw-text { padding: 16px 18px; }

/* --- Prompt actions: Try it = Google green, Copy prompt = Gemini blue ------
   Same colours in light and dark mode; white text and icon (≥4.5:1 contrast). */
.nav-button.btn-try-it,
.nav-button.btn-copy-prompt {
  height: var(--control-h);
  padding: 0 18px;
  color: #fff !important;
  filter: none;
}
.nav-button.btn-try-it .material-symbols-outlined,
.nav-button.btn-copy-prompt .material-symbols-outlined { color: #fff !important; }

.nav-button.btn-try-it { background: #1e8e3e; border-color: #1e8e3e; }
.nav-button.btn-try-it:hover { background: #137333; border-color: #137333; }
.nav-button.btn-try-it:focus-visible { outline: 2px solid #1e8e3e; outline-offset: 3px; }

.nav-button.btn-copy-prompt { background: #1a73e8; border-color: #1a73e8; }
.nav-button.btn-copy-prompt:hover { background: #1557b0; border-color: #1557b0; }
.nav-button.btn-copy-prompt:focus-visible { outline: 2px solid #1a73e8; outline-offset: 3px; }

@media (max-width: 720px) {
  .uc-how .step-item { padding: 16px; gap: 14px; }
  .helpers-group-summary,
  .helper-prompt-summary,
  .wb-summary { padding: 0 16px; }
  .wb-panel > :not(summary) { margin: 4px 16px 16px; }
  .helpers-list { padding: 4px 12px 12px; }
  .helper-prompt-body { padding: 4px 16px 16px; }
  .uc-vars { padding: 14px 16px 16px; }
}

/* --- Feedback modal heading: icon and title share one centred row --------- */
.modal-header-left.feedback-modal-heading {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-width: 0;
}
.feedback-modal-icon {
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}
.feedback-modal-heading .feedback-modal-title,
.feedback-modal-title {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

#feedbackSubmissionModal .modal-header { align-items: center; }

/* ==========================================================================
   V6 LAYER: modal hero split (image + summary | variables), header like/view
   actions, connector chips, blue feedback UI.
   ========================================================================== */

/* --- Modal header: tags row (GE features neutral, connectors red) + title,
   like / view / close grouped on the right at the 44px control height ------ */
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-tags:empty { display: none; }
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.modal-header-actions .uc-pref { align-items: center; flex-wrap: nowrap; }
.modal-header-actions .pref-btn { height: var(--control-h); min-width: var(--control-h); }
.modal-header-actions .view-count { height: var(--control-h); padding: 0 8px; font-size: 14px; }

/* --- Hero: left column = infographic with summary directly below; right
   column = the variables panel only. `.is-single` (no variables) spans full width */
.uc-hero-row { grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); align-items: start; }
.uc-hero-row.is-single { grid-template-columns: minmax(0, 1fr); }
.uc-hero-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.uc-hero-main .uc-summary { margin: 0; }

/* --- Feedback UI: Gemini blue, white text, darker hover, blue focus -------- */
.floating-feedback-button:focus-visible { outline: 2px solid #1A73E8; outline-offset: 3px; }
.nav-button.btn-feedback-submit {
  background: #1A73E8;
  border-color: #1A73E8;
  color: #fff !important;
}
.nav-button.btn-feedback-submit:hover { background: #1557B0; border-color: #1557B0; }
.nav-button.btn-feedback-submit:focus-visible { outline: 2px solid #1A73E8; outline-offset: 3px; }
#feedbackSubmissionModal .select-control:focus,
#feedbackSubmissionModal textarea:focus {
  outline: none;
  border-color: #1A73E8 !important;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.25);
}

@media (max-width: 900px) {
  .uc-hero-row,
  .uc-hero-row.is-single { grid-template-columns: minmax(0, 1fr); }
}

/* Mobile header: tags + actions share row one, the title takes row two at full width.
   `display: contents` lifts the tags/title out of .modal-header-left into the header grid. */
@media (max-width: 720px) {
  #modalOverlay .modal-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "tags actions" "title title";
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
  }
  #modalOverlay .modal-header > .modal-header-left { display: contents; }
  #modalOverlay #modalTags { grid-area: tags; min-width: 0; }
  #modalOverlay #modalTitle { grid-area: title; }
  #modalOverlay .modal-header-actions { grid-area: actions; gap: 6px; }
  #modalOverlay .modal-header-actions .view-count { padding: 0 4px; }
}

/* Light mode: keep hero variable labels neutral (overrides the legacy indigo light-theme label colour) */
html[data-theme="light"] .uc-vars .variable-label { color: var(--text-secondary); }

/* ==========================================================================
   V6 LAYER: colourful GE feature tags, Quest Run strip (pixel scene, quest
   bubble, academic timeline, Archie's news drawer), admin News tab, academic
   calendar settings, case-form timing chips + question repeater.
   ========================================================================== */

/* --- Feature tone tokens (dark default; light below) ---------------------- */
:root {
  --tone-research-ink: #5BD07A; --tone-research-bg: rgba(52, 168, 83, 0.26);  --tone-research-line: #34A853;
  --tone-create-ink: #7BAAF7;   --tone-create-bg: rgba(66, 133, 244, 0.28);   --tone-create-line: #4285F4;
  --tone-agent-ink: #FFD54F;    --tone-agent-bg: rgba(251, 188, 4, 0.24);     --tone-agent-line: #FBBC04;
  --tone-connector-ink: #FF7B6E; --tone-connector-bg: rgba(234, 67, 53, 0.26); --tone-connector-line: #EA4335;
  --quest-gold: #F2C14E;
  --quest-gold-ink: #3B2A05;
  --quest-panel: #12151B;
}
html[data-theme="light"] {
  /* Google brand colours; ink slightly deepened where needed for AA contrast on the tint */
  --tone-research-ink: #188038; --tone-research-bg: rgba(52, 168, 83, 0.16); --tone-research-line: #34A853;
  --tone-create-ink: #1967D2;   --tone-create-bg: rgba(66, 133, 244, 0.16);  --tone-create-line: #4285F4;
  --tone-agent-ink: #B06000;    --tone-agent-bg: rgba(251, 188, 4, 0.22);    --tone-agent-line: #F9AB00;
  --tone-connector-ink: #C5221F; --tone-connector-bg: rgba(234, 67, 53, 0.14); --tone-connector-line: #EA4335;
  --quest-panel: #FFFFFF;
}

/* !important: the legacy .tag-icon-only:hover rule recolours every chip to primary blue.
   Chips use solid Google brand fills (same in light + dark) for maximum colour:
   green #1E8E3E, blue #1A73E8, yellow #FBBC04 (dark ink for contrast), red #D93025. */
.tag.tone-research, .type-chip.tone-research { color: #FFFFFF !important; background: #1E8E3E !important; border-color: #1E8E3E !important; }
.tag.tone-create, .type-chip.tone-create { color: #FFFFFF !important; background: #1A73E8 !important; border-color: #1A73E8 !important; }
.tag.tone-agent, .type-chip.tone-agent { color: #202124 !important; background: #FBBC04 !important; border-color: #FBBC04 !important; }
.tag.tone-connector, .type-chip.tone-connector { color: #FFFFFF !important; background: #D93025 !important; border-color: #D93025 !important; }
.tag[class*="tone-"] .material-symbols-outlined, .type-chip[class*="tone-"] .material-symbols-outlined { color: inherit !important; }
.tag.tag-icon-only[class*="tone-"]:hover { filter: brightness(1.1); }

/* Selected GE feature: pale solid fill in the chip's colour family (Google 100/200 shades, same in both themes) */
#filterFeature[data-tone] { color: var(--pill-ink); font-weight: 600;
  background-image: linear-gradient(45deg, transparent 50%, var(--pill-ink) 50%), linear-gradient(135deg, var(--pill-ink) 50%, transparent 50%); }
#filterFeature[data-tone="research"] { --pill-ink: #0D652D; background-color: #CEEAD6; border-color: #81C995; }
#filterFeature[data-tone="create"] { --pill-ink: #174EA6; background-color: #D2E3FC; border-color: #8AB4F8; }
#filterFeature[data-tone="agent"] { --pill-ink: #7A5200; background-color: #FEEFC3; border-color: #FDD663; }
#filterFeature[data-tone=""] { --pill-ink: var(--text-primary); color: var(--text-primary); font-weight: 500;
  background-color: var(--surface-2); border-color: var(--line);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); }
#filterFeature[data-tone]:not([data-tone=""]):hover { filter: brightness(1.08); }
#filterFeature option.tone-research { color: var(--tone-research-ink); }
#filterFeature option.tone-create { color: var(--tone-create-ink); }
#filterFeature option.tone-agent { color: var(--tone-agent-ink); }
#filterFeature option:not([class*="tone-"]) { color: var(--text-primary); }

/* --- Quest Run strip ------------------------------------------------------- */
.quest-strip {
  margin: 0 0 28px;
  border: 1px solid var(--line-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--quest-panel);
  max-width: 100%;
}
.quest-strip[hidden] { display: none; }
.quest-scene {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: #1b2340;
}
.quest-scene[hidden] { display: none; }
.quest-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Bubble: pixel border via stepped box-shadows, tail pointing at the hero. */
.quest-bubble {
  position: absolute;
  top: 14px;
  /* Right-aligned; the left ~260px lane belongs to the hero and Archie (see laneRight() in app.js). */
  left: auto;
  right: 16px;
  width: min(480px, calc(100% - 280px));
  padding: 10px 14px 10px;
  background: #FFFDF5;
  color: #1C1B18;
  border: 3px solid #1C1B18;
  border-radius: 4px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 180ms steps(3), opacity 180ms steps(3);
  transform-origin: left bottom;
}
.quest-bubble::after {
  content: "";
  position: absolute;
  left: -14px;
  bottom: 18px;
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 12px solid #1C1B18;
}
.quest-bubble.is-folding { transform: scale(0.92, 0.2); opacity: 0; }
.quest-bubble-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5B5A55;
}
.quest-bubble-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  min-height: 1.35em;
  overflow-wrap: anywhere;
}
.quest-bubble-body { margin: 0; font-size: 13px; line-height: 1.4; color: #3A3934; overflow-wrap: anywhere; }
.quest-bubble-body[hidden] { display: none; }
.quest-bubble-actions { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.quest-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 10px;
  border: 2px solid #1C1B18;
  border-radius: 3px;
  background: #1A73E8;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1C1B18;
}
.quest-action:hover { background: #1557B0; }
.quest-action:active { transform: translate(2px, 2px); box-shadow: none; }
.quest-action[hidden] { display: none; }
.quest-action .material-symbols-outlined { font-size: 16px; }
.quest-bubble .quest-icon-btn { color: #1C1B18; }
.quest-bubble .quest-icon-btn:hover { background: rgba(0, 0, 0, 0.08); }

/* --- News = Archie's pixel parchment scroll ----------------------------------
   Art: game/scroll.png (160x64) and game/wax_seal.png (24x30), generated by
   `npm run game-assets -- --only=scroll,wax_seal` (Nano Banana, same 16-bit
   pipeline as the forest backdrop).
   9-slice: `border-image` slices the sprite 14px top/bottom and 16px left/right
   (source pixels), covering the knobbed rolled ends and the torn paper edges.
   Corners and rolls are drawn at an exact integer scale (--px: 2 desktop, 1 mobile)
   so the pixels stay crisp. Only the plain parchment centre and edge bands
   stretch with the text. The wax seal is a pseudo-element pinned to the
   bottom-right of the paper, like a sealed letter. All news text uses the
   Ark Pixel font (方舟像素字体, OFL, self-hosted in fonts/ark-pixel) in en, zh-TW
   and zh-CN; see the @font-face notes below.
   The unroll animation (clip-path from the centre out) restarts from JS whenever
   a news item appears. */

/* Ark Pixel 12px proportional. Three faces, chosen per language:
   - "Ark Pixel Latin": ~11KB subset (ASCII, Latin-1/Ext-A/B, punctuation, arrows),
     always listed first so English/ASCII glyphs render the same in every language.
   - "Ark Pixel TC" / "Ark Pixel SC": full CJK faces (~550KB woff2), used as the
     fallback for zh-TW / zh-CN via html[lang]. The browser downloads a face only
     when a news item actually needs it, so the user portal stays light.
   Pixel fonts are drawn on a 12px grid: sizes must be integer multiples of 12px,
   with no faux bold and no anti-aliasing, or the glyphs blur. */
@font-face {
  font-family: "Ark Pixel Latin";
  src: url("fonts/ark-pixel/ark-pixel-12px-proportional-latin.woff") format("woff");
  unicode-range: U+0020-007E, U+00A0-024F, U+2000-206F, U+20AC, U+2122, U+2190-2193;
  font-display: swap;
}
@font-face {
  font-family: "Ark Pixel TC";
  src: url("fonts/ark-pixel/ark-pixel-12px-proportional-zh_tw.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Ark Pixel SC";
  src: url("fonts/ark-pixel/ark-pixel-12px-proportional-zh_hans.woff2") format("woff2");
  font-display: swap;
}
/* Ark Pixel still lacks some rarer hanzi (e.g. 獻), so a system CJK sans covers the gaps. */
:root { --font-news: "Ark Pixel Latin", "Ark Pixel TC", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", monospace; }
html[lang="zh-CN"] { --font-news: "Ark Pixel Latin", "Ark Pixel SC", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", monospace; }
.quest-bubble[data-kind="news"] .quest-bubble-kicker,
.quest-bubble[data-kind="news"] .quest-bubble-text,
.quest-bubble[data-kind="news"] .quest-bubble-body,
.quest-bubble[data-kind="news"] .quest-action {
  font-family: var(--font-news);
  font-weight: 400;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0;
}
.quest-bubble[data-kind="news"] {
  --px: 2;
  padding: 0 4px;
  border-style: solid;
  border-width: calc(14px * var(--px)) calc(16px * var(--px));
  border-image: url("game/scroll.png") 14 16 fill / calc(14px * var(--px)) calc(16px * var(--px)) stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.4));
  image-rendering: pixelated;
  color: #3B2410;
  gap: 0;
  transform: none;
  transform-origin: center;
}
.quest-bubble[data-kind="news"]::after {
  content: "";
  position: absolute;
  left: auto;
  right: calc(-6px * var(--px));
  bottom: calc(-12px * var(--px));
  width: calc(24px * var(--px));
  height: calc(30px * var(--px));
  border: 0;
  background: url("game/wax_seal.png") center / 100% 100% no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}
.quest-bubble[data-kind="news"] .quest-bubble-kicker {
  font-size: 12px;
  line-height: 12px;
  text-transform: none;
  color: #A3191B;
  margin-top: -4px;
}
.quest-bubble[data-kind="news"] .quest-bubble-text,
.quest-bubble[data-kind="news"] .quest-bubble-body {
  color: #3B2410;
  padding-right: calc(18px * var(--px)); /* keep text clear of the wax seal */
}
.quest-bubble[data-kind="news"] .quest-bubble-text { font-size: 24px; line-height: 28px; margin-top: 2px; }
.quest-bubble[data-kind="news"] .quest-bubble-body { font-size: 12px; line-height: 16px; color: #5A3A1A; }
.quest-bubble[data-kind="news"] .quest-bubble-actions { margin-top: 2px; margin-bottom: -6px; padding-right: calc(18px * var(--px)); }
.quest-bubble[data-kind="news"] .quest-action { background: #8E1B1B; font-size: 12px; border-color: #3B2410; box-shadow: 2px 2px 0 #3B2410; }
.quest-bubble[data-kind="news"] .quest-action:hover { background: #6E1414; }
.quest-bubble[data-kind="news"] .quest-icon-btn { color: #4A2E12; }
.quest-bubble[data-kind="news"].is-unrolling { animation: quest-scroll-unroll 560ms steps(8, end) both; }
@keyframes quest-scroll-unroll {
  from { clip-path: inset(0 calc(50% - 24px) 0 calc(50% - 24px)); }
  to { clip-path: inset(-20px -20px -20px -20px); }
}
@media (prefers-reduced-motion: reduce) {
  .quest-bubble[data-kind="news"].is-unrolling { animation: none; }
}
@media (max-width: 640px) {
  .quest-bubble[data-kind="news"] { --px: 1; padding: 0 2px; border-width: 14px 16px; }
  .quest-bubble[data-kind="news"] .quest-bubble-kicker { margin-top: -2px; }
  .quest-bubble[data-kind="news"] .quest-bubble-text {
    font-size: 12px; line-height: 14px; margin-top: 0;
    padding-right: 26px; /* clear the top-right wax seal on mobile */
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  }
  .quest-bubble[data-kind="news"] .quest-bubble-actions { margin-bottom: -2px; padding-right: 0; }
  /* Short mobile strip: pin the seal to the top-right corner, clear of the action row. */
  .quest-bubble[data-kind="news"]::after { top: -6px; bottom: auto; right: -4px; }
}
.quest-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.quest-icon-btn:hover { background: var(--accent-soft); color: var(--text-primary); }
.quest-icon-btn:focus-visible, .quest-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.quest-icon-btn[hidden] { display: none; }
.quest-icon-btn .material-symbols-outlined { font-size: 20px; }

/* --- Timeline -------------------------------------------------------------- */
.quest-timeline { padding: 10px 16px 12px; border-top: 1px solid var(--line); }
.quest-strip.is-collapsed .quest-timeline { border-top: 0; }
.quest-timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quest-position { font-size: 14px; font-weight: 600; color: var(--text-primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quest-timeline-actions { display: flex; gap: 2px; flex-shrink: 0; }
.quest-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--err);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.quest-badge[hidden] { display: none; }
.quest-track { position: relative; height: 40px; margin-top: 6px; }
.quest-terms { position: absolute; left: 0; right: 0; top: 0; height: 16px; }
.quest-term {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.quest-term + .quest-term { border-left: 2px solid var(--quest-panel); }
.quest-term-label {
  display: block;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  color: rgba(0, 0, 0, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quest-term-semA, .cal-swatch.quest-term-semA { background: #8AB4F8; }
.quest-term-winter, .cal-swatch.quest-term-winter { background: #C9D6E8; }
.quest-term-semB, .cal-swatch.quest-term-semB { background: #81C995; }
.quest-term-summer, .cal-swatch.quest-term-summer { background: #FDD663; }
.quest-term.is-current { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35); }
.quest-months { position: absolute; left: 0; right: 0; top: 20px; height: 16px; }
.quest-month {
  position: absolute;
  top: 0;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  transform: translateX(2px);
  border-left: 1px solid var(--line-strong);
  padding-left: 3px;
  line-height: 14px;
}
.quest-today {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  height: 30px;
  width: 2px;
  background: var(--err);
}
.quest-today .material-symbols-outlined {
  position: absolute;
  top: -12px;
  left: -1px;
  font-size: 16px;
  color: var(--err);
  font-variation-settings: "FILL" 1;
}

/* --- News drawer ----------------------------------------------------------- */
.quest-drawer-backdrop { position: fixed; inset: 0; background: var(--bg-modal-overlay); z-index: 1200; }
.quest-drawer-backdrop[hidden] { display: none; }
.quest-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100vw);
  background: var(--bg-dark-surface);
  border-left: 1px solid var(--line-card);
  box-shadow: var(--shadow-pop);
  z-index: 1201;
  display: flex;
  flex-direction: column;
  transform: translateX(16px);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}
.quest-drawer.is-open { transform: none; opacity: 1; }
.quest-drawer[hidden] { display: none; }
.quest-drawer:focus { outline: none; }
.quest-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.quest-drawer-head h2 { margin: 0; font-family: var(--font-heading); font-size: 18px; }
.quest-drawer-list { list-style: none; margin: 0; padding: 12px 16px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.quest-drawer-item { padding: 12px 14px; border: 1px solid var(--line-card); border-radius: var(--radius-md); background: var(--surface-2); }
.quest-drawer-item.is-pinned { border-color: rgba(242, 193, 78, 0.6); }
.quest-drawer-item-head { display: flex; align-items: center; gap: 8px; }
.quest-drawer-item-head .material-symbols-outlined { color: var(--quest-gold); font-size: 18px; }
.quest-drawer-item h3 { margin: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.quest-drawer-item p { margin: 6px 0 0; font-size: 14px; color: var(--text-secondary); overflow-wrap: anywhere; }
.quest-drawer-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.quest-drawer-date { font-size: 12px; color: var(--text-muted); }
.quest-drawer-empty { padding: 24px 20px; color: var(--text-muted); margin: 0; }
.quest-drawer-empty[hidden] { display: none; }

/* --- Mobile: shorter scene, compact bubble to the right of the hero ---------
   The hero sits at 12% of the width (see createQuestRenderer), so the bubble
   starts just past its 48px sprite and keeps the hero visible. */
@media (max-width: 640px) {
  .quest-strip { margin-bottom: 20px; }
  .quest-scene { height: 132px; }
  .quest-bubble { top: 8px; left: auto; right: 8px; width: calc(100% - 150px); max-width: none; padding: 6px 8px; gap: 2px; border-width: 2px; box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35); }
  .quest-bubble::after { left: -12px; bottom: 12px; border-top-width: 6px; border-bottom-width: 6px; border-right-width: 10px; }
  .quest-bubble-text { font-size: 13px; line-height: 1.3; }
  .quest-bubble-body { display: none; }
  .quest-bubble-kicker { display: none; }
  .quest-action { min-height: 28px; font-size: 12px; padding: 0 8px; }
  .quest-bubble .quest-icon-btn { width: 28px; height: 28px; }
  .quest-timeline { padding: 8px 12px 10px; }
  .quest-position { font-size: 13px; }
  .quest-month.is-odd { display: none; }
}

/* --- Light theme ----------------------------------------------------------- */
html[data-theme="light"] .quest-term { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .quest-drawer { background: #FFFFFF; }
html[data-theme="light"] .quest-scene { background: #bfe3ff; }

/* --- Admin: shared small controls ----------------------------------------- */
.nav-button.nav-button-small { min-height: 36px; height: 36px; padding: 0 12px; font-size: 13px; gap: 6px; display: inline-flex; align-items: center; }
.nav-button.nav-button-small .material-symbols-outlined { font-size: 18px; }
.nav-button.is-busy { opacity: 0.7; pointer-events: none; }
.field-counter { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.field-counter.is-near { color: var(--warn); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin-top: 8px; }
.check-grid .check-row { font-size: 14px; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-check { position: relative; display: inline-flex; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
}
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-check input:disabled + span { opacity: 0.6; cursor: not-allowed; }

/* --- Admin: News tab ------------------------------------------------------- */
.news-form-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.news-form-fields { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.news-lang-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.news-lang-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.news-lang-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  align-self: flex-start;
}
.news-audience { border: 0; padding: 0; margin: 0; min-width: 0; }
.news-flags { display: flex; gap: 24px; flex-wrap: wrap; }
.news-preview-wrap { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.quest-bubble.quest-bubble-preview { position: relative; top: auto; left: auto; right: auto; width: auto; max-width: 480px; margin-left: 14px; }
.news-cell-title { display: flex; align-items: center; gap: 6px; }
.news-cell-title .material-symbols-outlined { font-size: 16px; color: var(--quest-gold); }
.news-cell-aud { font-size: 12px; margin-top: 2px; }
#adminNewsTableBody td.col-actions { white-space: nowrap; }

/* --- Admin: academic calendar --------------------------------------------- */
.cal-grid { display: flex; flex-direction: column; gap: 10px; }
.cal-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.cal-term { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; padding-bottom: 12px; }
.cal-swatch { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.cal-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-preview { margin: 4px 0 0; font-weight: 600; color: var(--text-primary); }
.cal-preview:empty { display: none; }
.cal-footer-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Admin: case form timing + Quest Run questions ------------------------ */
.hint-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.hint-list:empty { display: none; }
.hint-item { border: 1px solid var(--line-card); border-radius: var(--radius-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.hint-item-head { display: flex; align-items: center; justify-content: space-between; }
.hint-num { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.hint-field { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 8px; }
.hint-lang { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.hint-aud summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); }
/* Set up prompt rows reuse .hint-item; each language gets a title input over a prompt textarea */
.helper-item .helper-type { max-width: 220px; }
.helper-lang-block { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 6px 8px; align-items: start; }
.helper-lang-block .hint-lang { padding-top: 8px; }
.helper-lang-fields { display: flex; flex-direction: column; gap: 6px; }
.helper-lang-fields textarea { min-height: 72px; resize: vertical; font-family: monospace; font-size: 13px; padding: 8px 12px; }

@media (max-width: 900px) {
  .news-form-grid { grid-template-columns: minmax(0, 1fr); }
  .news-preview-wrap { position: static; }
}
@media (max-width: 640px) {
  .cal-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cal-term { grid-column: 1 / -1; padding-bottom: 0; }
}

/* --- Reduced motion: no fold / slide animations (the canvas draws one static frame) */
@media (prefers-reduced-motion: reduce) {
  .quest-bubble, .quest-drawer { transition: none !important; }
  .quest-bubble.is-folding { transform: none; opacity: 1; }
}

/* Case form Quest fieldsets: drop the browser's default fieldset frame so
   they line up with the other .form-group blocks. */
.case-quest-fields { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.case-quest-fields > legend { padding: 0; margin-bottom: 4px; }
.case-quest-fields .field-hint { margin: 0 0 8px; }

/* ==========================================================================
   V7: categories, idea providers, feedback conversion, creator dashboard
   ========================================================================== */

/* Category chips (cards, modal, admin tables) */
.cat-chips, .uc-cats, .liked-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Category checklist (users + playbook form) */
.form-group-full { flex: 1 1 100%; }
.cat-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.cat-check {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cat-check:hover { border-color: var(--line-strong); }
.cat-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cat-check input { width: 18px; height: 18px; accent-color: var(--accent); grid-row: 1 / span 2; }
.cat-check .material-symbols-outlined { font-size: 20px; color: var(--accent); grid-row: 1 / span 2; }
.cat-check-label { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.cat-check-roles { grid-column: 3; font-size: 12px; color: var(--text-muted); }
.cat-check:has(input:disabled) { cursor: default; opacity: 0.75; }

/* Idea provider on cards and in the playbook modal */
.card-creator, .uc-creator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
}
.card-creator .material-symbols-outlined, .uc-creator .material-symbols-outlined { font-size: 16px; flex-shrink: 0; }
.card-creator-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-creator.is-default, .uc-creator.is-default { color: var(--text-muted); font-weight: 500; }
.uc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; }

.creator-input-row { display: flex; gap: 8px; }
.creator-input-row .select-control { flex: 1; min-width: 0; }
.creator-input-row .nav-button { white-space: nowrap; }

/* Creator dashboard */
.creator-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat-card-mini {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.stat-card-mini .stat-value { font-size: 24px; }
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.leaderboard-col { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; min-width: 0; }
.leaderboard-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0 0 8px; }
.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-item { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.lb-rank {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
}
.lb-rank[data-rank="1"] { background: rgba(251, 188, 4, 0.18); color: var(--warn); }
.lb-rank[data-rank="2"] { background: rgba(192, 192, 192, 0.18); color: #A8A8A8; }
.lb-rank[data-rank="3"] { background: rgba(205, 127, 50, 0.18); color: #CD7F32; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.lb-count { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.lb-empty { font-size: 13px; color: var(--text-muted); padding: 12px 0; list-style: none; text-align: center; }
.lb-empty.is-error, .convert-status .is-error { color: var(--err); }

/* Most liked list */
.liked-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.liked-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.liked-title { font-weight: 700; color: var(--text-primary); }
.liked-count {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  color: var(--err); background: rgba(234, 67, 53, 0.10);
  font-weight: 700; font-size: 13px;
}
.liked-count .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 1; }

/* Feedback status + conversion */
.fb-status { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); }
.fb-status.is-converted { color: var(--ok); font-weight: 600; }
.fb-status .material-symbols-outlined { font-size: 16px; }
.btn-convert-feedback { display: inline-flex; align-items: center; gap: 4px; }
.btn-convert-feedback .material-symbols-outlined { font-size: 16px; }

.convert-body { gap: 12px; overflow-y: auto; }
.convert-quote {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  line-height: 1.5;
}
.convert-status { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.convert-status p { margin: 0; }
.convert-reco { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.convert-reco.is-enhance { color: var(--accent); }
.convert-reco.is-new { color: var(--ok); }
.convert-note { color: var(--warn); font-size: 13px; }
.convert-matches { display: flex; flex-direction: column; gap: 8px; }
.convert-match {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.convert-match:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.convert-match input { margin-top: 3px; accent-color: var(--accent); }
.convert-match-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.convert-match-head { display: flex; align-items: center; gap: 8px; }
.convert-match-title { font-weight: 700; color: var(--text-primary); flex: 1; min-width: 0; }
.convert-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
}
.convert-score { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.convert-reason { font-size: 13px; color: var(--text-muted); line-height: 1.45; }

/* Idea quality: clarification step in the convert dialog + feedback submit hint */
.convert-reco.is-clarify { color: var(--warn); }
.convert-clarify {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.convert-clarify[hidden] { display: none; }
.convert-clarify-head { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text-primary); }
.convert-clarify-head .material-symbols-outlined { color: var(--warn); font-size: 20px; }
.convert-clarify p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.clarify-q { display: flex; flex-direction: column; gap: 4px; }
.clarify-q label { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.clarify-q textarea {
  min-height: 44px; resize: vertical; padding: 8px 10px;
  font: inherit; font-size: 13px; line-height: 1.45;
  color: var(--text-primary); background: var(--bg-primary);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.clarify-q textarea:focus { outline: none; border-color: var(--accent); }
.clarify-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.clarify-actions a.nav-button { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.feedback-hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.4; }
.feedback-error { font-size: 13px; color: var(--err); margin: 8px 0 0; line-height: 1.4; }
.feedback-error[hidden] { display: none; }

/* ==========================================================================
   v9: first-login tips (overlay tour), drafting idea box, drafting prompt
   ========================================================================== */
.tour-overlay { position: fixed; inset: 0; z-index: 2000; }
.tour-overlay.is-centered { background: rgba(0, 0, 0, 0.6); }
.tour-spotlight {
  position: fixed;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  pointer-events: none;
  transition: left 0.22s ease, top 0.22s ease, width 0.22s ease, height 0.22s ease;
}
.tour-card {
  position: fixed;
  width: min(360px, calc(100vw - 16px));
  background: var(--bg-dark-surface);
  color: var(--text-primary);
  border: 1px solid var(--line-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tour-card:focus { outline: none; }
.tour-kicker { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--accent); letter-spacing: var(--tracking-wide); }
.tour-kicker .material-symbols-outlined { font-size: 18px; }
.tour-title { font-family: var(--font-heading); font-size: var(--text-lg); line-height: var(--leading-tight); margin: 0; }
.tour-body { font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--text-secondary); margin: 0; }
.tour-dots { display: flex; gap: 6px; margin-top: 4px; }
.tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.tour-dots span.is-active { background: var(--accent); width: 18px; border-radius: 3px; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.tour-nav { display: flex; gap: 8px; }
.tour-skip { border-color: transparent; background: transparent; color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { .tour-spotlight { transition: none; } }

.draft-idea { border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface-2); }
.draft-idea-head { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); }
.draft-idea-head .material-symbols-outlined { font-size: 16px; color: var(--warn); }
.draft-idea-text { margin: 4px 0 0; font-size: 13px; color: var(--text-primary); white-space: pre-wrap; max-height: 140px; overflow: auto; }
.draft-notes { margin: 0; font-size: 13px; color: var(--text-secondary); }
.draft-prompt-text { min-height: 320px; padding: 10px 12px; resize: vertical; font-family: var(--font-mono); font-size: 13px; line-height: var(--leading-snug); }

/* Try it for copy-and-paste types: where to paste the copied prompt in Gemini Enterprise */
.try-guide { margin-top: 10px; border: 1px solid var(--line-card); border-left: 3px solid #1e8e3e; border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); font-size: 13px; }
.try-guide-head { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-primary); }
.try-guide-head .material-symbols-outlined { font-size: 18px; color: #1e8e3e; }
.try-guide-close { margin-left: auto; }
.try-guide ol { margin: 6px 0 0; padding-left: 20px; color: var(--text-secondary); line-height: var(--leading-snug); }
.try-guide li + li { margin-top: 3px; }
.try-guide-note { margin: 6px 0 0; color: var(--text-muted); }

/* ==========================================================================
   v10: Idea Leaderboard (user view, teaser, admin Analytics)
   ========================================================================== */
:root { --gold: #FBBC04; --silver: #BDC1C6; --bronze: #E3955B; --lb-glow: rgba(251, 188, 4, 0.18); }

.btn-leaderboard { display: inline-flex; align-items: center; gap: 6px; border-color: rgba(251, 188, 4, 0.55); }
.btn-leaderboard .material-symbols-outlined { color: var(--gold); font-size: 20px; }
.btn-leaderboard.is-active, .btn-leaderboard:hover { background: var(--lb-glow); border-color: var(--gold); }
@media (max-width: 720px) { .btn-leaderboard-label { display: none; } .btn-leaderboard { padding: 0 10px; } }

.lb-teaser {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; max-width: 100%;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-primary); background: linear-gradient(90deg, var(--lb-glow), transparent 85%);
  border: 1px solid rgba(251, 188, 4, 0.55); text-align: left;
}
.lb-teaser .material-symbols-outlined { color: var(--gold); font-size: 20px; }
.lb-teaser .lb-teaser-go { color: var(--text-muted); font-size: 18px; transition: transform 0.2s ease; }
.lb-teaser:hover .lb-teaser-go { transform: translateX(3px); }

.lb-view { display: flex; flex-direction: column; gap: 20px; }
.lb-head { display: flex; flex-direction: column; gap: 14px; }
.lb-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; }
.lb-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px 24px; border-radius: var(--radius-lg);
  border: 1px solid rgba(251, 188, 4, 0.45);
  background: radial-gradient(circle at 0% 0%, rgba(251, 188, 4, 0.22), transparent 55%), radial-gradient(circle at 100% 100%, rgba(76, 141, 246, 0.16), transparent 50%), var(--bg-dark-surface); }
.lb-trophy { font-size: 52px !important; color: var(--gold); filter: drop-shadow(0 4px 14px rgba(251, 188, 4, 0.45)); }
.lb-hero > div { flex: 1 1 320px; }
.lb-title { font-family: var(--font-heading); font-size: clamp(26px, 3vw, 34px); margin: 0; letter-spacing: var(--tracking-tight); }
.lb-desc { margin: 4px 0 0; color: var(--text-secondary); font-size: 15px; line-height: var(--leading-snug); }
.lb-cta { display: inline-flex; align-items: center; gap: 6px; }
.lb-ranges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lb-range { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-secondary); }
.lb-range.is-active { background: var(--gold); border-color: var(--gold); color: #202124; }
.lb-loading { display: flex; justify-content: center; padding: 60px 0; }

/* Podium: 2nd · 1st · 3rd, steps of different heights */
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; margin-top: 6px; }
.lb-podium-slot { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; min-width: 0; }
.lb-avatar { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 22px; color: #202124; background: var(--silver); flex-shrink: 0; }
.is-place-1 .lb-avatar { width: 84px; height: 84px; font-size: 28px; background: var(--gold); box-shadow: 0 0 0 6px var(--lb-glow), 0 10px 30px rgba(251, 188, 4, 0.35); }
.is-place-3 .lb-avatar { background: var(--bronze); }
.lb-medal { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #202124; background: #fff; border: 2px solid var(--bg-dark-surface); }
.lb-podium-name { font-weight: 700; font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-podium-points { font-family: var(--font-heading); font-weight: 800; font-size: 22px; color: var(--gold); }
.is-place-1 .lb-podium-points { font-size: 28px; }
.lb-podium-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; font-size: 12.5px; color: var(--text-muted); }
.lb-step { width: 100%; margin-top: 8px; border-radius: 14px 14px 4px 4px; display: grid; place-items: center;
  font-family: var(--font-heading); font-weight: 800; font-size: 30px; color: rgba(32, 33, 36, 0.55); }
.is-place-1 .lb-step { height: 120px; background: linear-gradient(180deg, var(--gold), rgba(251, 188, 4, 0.55)); }
.is-place-2 .lb-step { height: 88px; background: linear-gradient(180deg, var(--silver), rgba(189, 193, 198, 0.5)); }
.is-place-3 .lb-step { height: 64px; background: linear-gradient(180deg, var(--bronze), rgba(227, 149, 91, 0.5)); }
.lb-podium-slot.is-open .lb-avatar { background: transparent; border: 2px dashed var(--line-strong); color: var(--text-muted); box-shadow: none; }
.lb-podium-slot.is-open .lb-step { opacity: 0.35; }
.lb-podium-slot.is-open .lb-podium-name { color: var(--text-muted); font-weight: 600; }
.lb-podium-slot.is-me .lb-podium-name { color: var(--accent); }
.lb-you { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: middle;
  background: var(--accent); color: #fff; }

.lb-me { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--radius-md);
  border: 1px solid var(--accent); background: var(--accent-soft); }
.lb-me-main { flex: 1 1 260px; }
.lb-me-title { font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-widest); }
.lb-me-rank { font-family: var(--font-heading); font-size: 20px; font-weight: 800; }
.lb-me-next { font-size: 14px; color: var(--text-secondary); }
.lb-avatar.is-small { width: 44px; height: 44px; font-size: 16px; background: var(--accent); color: #fff; }
.lb-avatar.is-tiny { width: 30px; height: 30px; font-size: 12px; }

.lb-sub { font-size: 14px; font-weight: 700; color: var(--text-secondary); margin: 4px 0 -8px; }
.lb-rest { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-rest-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.lb-rest-item.is-me { border-color: var(--accent); }
.lb-rest-rank { width: 24px; text-align: center; font-weight: 800; color: var(--text-muted); }
.lb-rest-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-rest-item .lb-podium-stats { justify-content: flex-end; }
.lb-rest-points { font-weight: 800; color: var(--gold); min-width: 64px; text-align: right; }
@media (max-width: 640px) { .lb-rest-item .lb-podium-stats { display: none; } .lb-podium-stats { font-size: 11.5px; } .lb-step { font-size: 22px; } }

.lb-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.lb-board { border: 1px solid var(--line-card); border-radius: var(--radius-md); padding: 16px 18px; background: var(--bg-dark-surface); }
.lb-board-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 16px; }
.lb-board-title .material-symbols-outlined { font-size: 20px; color: #EA4335; }
.lb-board:last-child .lb-board-title .material-symbols-outlined { color: var(--accent); }
.lb-board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lb-board-item { display: flex; align-items: center; gap: 12px; border-radius: var(--radius-sm); padding: 4px; }
.lb-board-item.is-openable { cursor: pointer; }
.lb-board-item.is-openable:hover { background: var(--surface-2); }
.lb-board-rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--surface-2); color: var(--text-secondary); flex-shrink: 0; }
.lb-board-item:nth-child(1) .lb-board-rank { background: var(--gold); color: #202124; }
.lb-board-item:nth-child(2) .lb-board-rank { background: var(--silver); color: #202124; }
.lb-board-item:nth-child(3) .lb-board-rank { background: var(--bronze); color: #202124; }
.lb-board-main { flex: 1; min-width: 0; }
.lb-board-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-board-credit { font-size: 12.5px; color: var(--text-muted); }
.lb-board-credit.is-community { color: var(--accent); font-weight: 600; }
.lb-bar { height: 6px; border-radius: 999px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.lb-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #EA4335, #FBBC04); }
.lb-board:last-child .lb-bar span { background: linear-gradient(90deg, #4C8DF6, #34A853); }
.lb-board-count { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 14px; }
.lb-board-count .material-symbols-outlined { font-size: 16px; color: var(--text-muted); }
.lb-how { font-size: 14px; color: var(--text-secondary); }
.lb-how summary { cursor: pointer; font-weight: 600; }
.lb-how ul { margin: 8px 0 0; padding-left: 20px; line-height: var(--leading-normal); }
.lb-empty-wide { text-align: center; }
#adminLeaderboard { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.lb-body { display: flex; flex-direction: column; gap: 18px; }
.content-area.is-leaderboard .quest-strip { display: none !important; }

/* Admin Analytics: four compact contributor leaderboards */
.lb-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .lb-charts { grid-template-columns: minmax(0, 1fr); } }
.lb-chart { border: 1px solid var(--line-card); border-radius: var(--radius-md); padding: 14px 16px; background: var(--bg-dark-surface); border-top: 3px solid var(--chart-tone); }
.lb-chart.is-gold { --chart-tone: #FBBC04; } .lb-chart.is-amber { --chart-tone: #F29900; }
.lb-chart.is-blue { --chart-tone: #4C8DF6; } .lb-chart.is-red { --chart-tone: #EA4335; }
.lb-chart-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 15px; }
.lb-chart-title .material-symbols-outlined { font-size: 20px; color: var(--chart-tone); }
.lb-chart-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.lb-chart-list li { display: flex; align-items: center; gap: 10px; }
.lb-chart-rank { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--text-secondary); flex-shrink: 0; }
.lb-chart-list li:first-child .lb-chart-rank { background: var(--chart-tone); color: #202124; }
.lb-chart-main { flex: 1; min-width: 0; }
.lb-chart-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-chart .lb-bar span { background: var(--chart-tone); }
.lb-chart-value { font-size: 13px; font-weight: 800; white-space: nowrap; }

/* Change password dialog */
.cp-card { max-width: 440px; padding: 24px; height: auto; }
#changePasswordModal .settings-form { gap: 12px; }
