/**
 * Hundred Mobile Storyboard & Design System Explorer
 * Styling for Mobbin-style screen explorer, flows, components, and tokens.
 */

/* ==========================================================================
   1. Typography & @font-face
   ========================================================================== */
@font-face {
  font-family: 'Gyst-Medium';
  src: url('fonts/Gyst-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gyst-MediumItalic';
  src: url('fonts/Gyst-MediumItalic.otf') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-BookBody';
  src: url('fonts/SequelSans-BookBody.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-MediumBody';
  src: url('fonts/SequelSans-MediumBody.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-SemiBoldBody';
  src: url('fonts/SequelSans-SemiBoldBody.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-RomanBody';
  src: url('fonts/SequelSans-RomanBody.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-MediumHead';
  src: url('fonts/SequelSans-MediumHead.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-Roman-Disp';
  src: url('fonts/SequelSans-Roman-Disp.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-BookDisp';
  src: url('fonts/SequelSans-BookDisp.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SequelSans-SemiBoldDisp';
  src: url('fonts/SequelSans-SemiBoldDisp.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   2. Design Tokens & Theme Variables
   ========================================================================== */
:root {
  /* Brand Constants */
  --brand-charcoal: #151B1A;
  --brand-ivory: #F3F2EB;
  --brand-rust: #B0593C;
  --brand-moss: #7C7C54;
  --brand-ochre: #F2C874;
  --brand-yellow: #D3A74C;
  --brand-white: #FFFFFF;

  --accent-blue: #4295C5;
  --accent-green: #4EC669;
  --accent-red: #E0684F;
  --accent-purple: #8B6CC8;

  /* Font Families */
  --font-serif: 'Gyst-Medium', Georgia, serif;
  --font-serif-italic: 'Gyst-MediumItalic', Georgia, serif;
  --font-sans: 'SequelSans-BookBody', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans-medium: 'SequelSans-MediumBody', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans-bold: 'SequelSans-SemiBoldBody', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans-head: 'SequelSans-MediumHead', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans-disp: 'SequelSans-Roman-Disp', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Spacing */
  --space-xxxs: 8px;
  --space-xxs: 12px;
  --space-xs: 16px;
  --space-sm: 20px;
  --space-md: 32px;
  --space-lg: 40px;
  --space-xl: 64px;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Header Height */
  --header-height: 58px;

  /* Transition */
  --transition-fast: 0.15s ease;
  --transition-base: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
html[data-theme="light"] {
  --bg-app: #F5F4EE;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #FFFFFF;
  --bg-secondary: #EBEAE1;
  --bg-tertiary: #E0DED4;
  --bg-overlay: rgba(21, 27, 26, 0.65);

  --text-primary: #151B1A;
  --text-secondary: #4A5452;
  --text-muted: #7E8785;
  --text-on-dark: #F3F2EB;

  --border-subtle: rgba(21, 27, 26, 0.08);
  --border-base: rgba(21, 27, 26, 0.14);
  --border-strong: rgba(21, 27, 26, 0.28);
  --border-focus: #151B1A;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.24);

  --card-device-bg: #FFFFFF;
  --card-device-bezel: #222928;
  --card-device-island: #151B1A;

  --badge-bg: rgba(21, 27, 26, 0.06);
  --badge-text: #2B3332;

  --code-bg: #EBEAE1;
}

/* Dark Theme Variables (Default) */
html[data-theme="dark"] {
  --bg-app: #121616;
  --bg-surface: #1B2221;
  --bg-surface-elevated: #232B2A;
  --bg-secondary: #242D2C;
  --bg-tertiary: #2D3736;
  --bg-overlay: rgba(0, 0, 0, 0.75);

  --text-primary: #F3F2EB;
  --text-secondary: #BFC4C3;
  --text-muted: #7D8886;
  --text-on-dark: #151B1A;

  --border-subtle: rgba(243, 242, 235, 0.07);
  --border-base: rgba(243, 242, 235, 0.12);
  --border-strong: rgba(243, 242, 235, 0.24);
  --border-focus: #F3F2EB;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 24px 72px rgba(0, 0, 0, 0.7);

  --card-device-bg: #151B1A;
  --card-device-bezel: #090C0C;
  --card-device-island: #000000;

  --badge-bg: rgba(243, 242, 235, 0.08);
  --badge-text: #D2D6D5;

  --code-bg: #151B1A;
}

/* ==========================================================================
   3. Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  outline: none;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--brand-rust);
  outline-offset: 2px;
}

/* ==========================================================================
   4. Top Global Navigation
   ========================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-sm);
  gap: var(--space-xs);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  color: var(--brand-rust);
  display: flex;
  align-items: center;
}

.brand-name {
  font-family: var(--font-sans-bold);
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--brand-rust);
  color: #FFFFFF;
  padding: 2px 5px;
  border-radius: var(--radius-xs);
}

.persona-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--badge-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
@media (max-width: 1700px) {
  .persona-indicator {
    display: none;
  }
}
.persona-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.nav-sections {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--badge-bg);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-sans-medium);
}

.tab-count {
  font-size: 10px;
  background: var(--badge-bg);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.nav-tab.active .tab-count {
  background: var(--border-subtle);
  color: var(--text-secondary);
}

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

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  color: var(--text-secondary);
  font-size: 12.5px;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.action-btn.icon-only-btn {
  width: 34px;
  padding: 0;
}

.search-trigger-btn {
  width: 110px;
  justify-content: flex-start;
  color: var(--text-muted);
  padding: 0 8px;
  gap: 6px;
}

@media (max-width: 1500px) {
  .search-trigger-btn {
    width: 32px;
    padding: 0;
    justify-content: center;
  }
  .search-trigger-btn .search-label,
  .search-trigger-btn .kbd-badge {
    display: none;
  }
}

.search-label {
  flex: 1;
  text-align: left;
}

.kbd-badge kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  color: var(--text-muted);
}
/* Persona Switcher in Header */
.persona-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.persona-select-input {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  height: 26px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  max-width: 120px;
}
.persona-select-input:focus {
  border-color: var(--brand-ochre);
}

/* Persona Compare Row (8 side-by-side columns horizontally scrollable) */
.persona-compare-container {
  display: grid;
  grid-template-columns: repeat(8, 260px);
  gap: 16px;
  width: 100%;
  overflow-x: auto;
  padding: 16px 8px 24px 8px;
  box-sizing: border-box;
  min-width: 0;
}
.persona-compare-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 12px;
  gap: 8px;
  cursor: pointer;
}

.persona-compare-col:hover {
  border-color: var(--brand-ochre);
}

.persona-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.persona-col-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-ochre);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.persona-col-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.persona-col-condition {
  font-size: 11px;
  color: var(--text-muted);
}

.persona-compare-device {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 393 / 852;
  background: var(--bg-canvas);
  border-radius: 24px;
  border: 2px solid var(--border-base);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.persona-compare-device img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Screenshot Theme Switch */
.screenshot-theme-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

@media (max-width: 1500px) {
  /* Persona and Light/Dark read on their own; a bare Off/On does not, so
     the Autoplay group keeps its label. */
  .switch-label:not(.autoplay-switch .switch-label),
  .screenshot-theme-switch .key-hint {
    display: none;
  }
}

.switch-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.switch-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.theme-toggle-btn {
  position: relative;
  display: flex;
  align-items: center;
  height: 26px;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  padding: 2px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.theme-option {
  position: relative;
  z-index: 2;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

html[data-screenshot-theme="light"] .theme-option.light-opt {
  color: #FFFFFF;
}

html[data-screenshot-theme="dark"] .theme-option.dark-opt {
  color: #FFFFFF;
}

.theme-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  background: var(--brand-rust);
  border-radius: 3px;
  transition: transform var(--transition-base);
  z-index: 1;
}

html[data-screenshot-theme="dark"] .theme-slider {
  transform: translateX(100%);
}


/* Autoplay Switch */
.autoplay-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-base);
}

html[data-autoplay="on"] #autoplay-toggle .theme-slider {
  transform: translateX(100%);
}

html[data-autoplay="off"] #autoplay-toggle .off-opt {
  color: #FFFFFF;
}

html[data-autoplay="on"] #autoplay-toggle .on-opt {
  color: #FFFFFF;
}

/* Motion Badge & Tile Videos */
.motion-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: rgba(21, 27, 26, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.motion-badge svg {
  width: 11px;
  height: 11px;
  margin-left: 1px;
}

.tile-video-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 4;
  display: none;
  background: var(--bg-surface);
  pointer-events: none;
}

.has-video {
  position: relative;
}

.has-video.video-playing .tile-video-player {
  display: block;
}

.has-video.video-playing .phone-mockup-screen,
.has-video.video-playing img {
  /* Keep cover under video or hide while video renders */
}

.has-video.video-playing .motion-badge {
  opacity: 0.25;
  transform: scale(0.85);
}
.key-hint {
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--badge-bg);
  padding: 1px 4px;
  border-radius: 2px;
  color: var(--text-muted);
}

/* UI Theme icons */
html[data-theme="dark"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: block; }
html[data-theme="light"] .theme-icon-light { display: block; }
html[data-theme="light"] .theme-icon-dark { display: none; }

/* ==========================================================================
   5. App Layout & Views
   ========================================================================== */
.app-root {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
}

.view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   6. Screens View (Mobbin Grid + Sidebar Filters)
   ========================================================================== */
.screens-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
}

.screens-sidebar {
  width: 290px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-base);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: var(--space-sm) var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sidebar-search-box {
  position: relative;
  margin-bottom: 4px;
}

.sidebar-search-input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.sidebar-search-input:focus {
  border-color: var(--border-focus);
}

.sidebar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  cursor: pointer;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar-toggle-icon {
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.sidebar-filter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.sidebar-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.sidebar-filter-item:hover {
  background: var(--badge-bg);
  color: var(--text-primary);
}

.sidebar-filter-item.active {
  background: var(--brand-rust);
  color: #FFFFFF;
}

.sidebar-filter-item.active .filter-count {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.filter-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-icon-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-filter-item.active .filter-icon-dot {
  background: #FFFFFF;
}

.filter-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--text-muted);
}

.sidebar-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.toggle-checkbox {
  accent-color: var(--brand-rust);
  width: 15px;
  height: 15px;
}

.clear-filters-btn {
  width: 100%;
  padding: 6px 12px;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.clear-filters-btn:hover {
  color: var(--brand-rust);
  border-color: var(--brand-rust);
  background: var(--badge-bg);
}

/* Screens Main Content */
.screens-main {
  flex: 1;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}

.screens-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.screens-count-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.active-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--badge-bg);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.chip-remove-btn {
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.chip-remove-btn:hover {
  color: var(--brand-rust);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.sort-select {
  height: 30px;
  padding: 0 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
}

.thumbnail-size-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.size-btn {
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.size-btn.active {
  background: var(--brand-rust);
  color: #FFFFFF;
  border-color: var(--brand-rust);
}

/* View Mode Switcher (Grid vs States Row) */
.view-mode-toggle-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-secondary);
  padding: 2px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-base);
}

.mode-btn {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.mode-btn.active {
  background: var(--brand-rust);
  color: #FFFFFF;
}

/* Thumbnail Scrubbing UI */
.scrub-bar-container {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  height: 3px;
  display: flex;
  gap: 2px;
  z-index: 10;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.phone-mockup-wrapper:hover .scrub-bar-container {
  opacity: 1;
}

.scrub-segment {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  transition: background var(--transition-fast);
}

.scrub-segment.active {
  background: #FFFFFF;
}

.scrub-tooltip {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(21, 27, 26, 0.9);
  color: #FFFFFF;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.phone-mockup-wrapper:hover .scrub-tooltip {
  opacity: 1;
}

/* States View Mode (Row per screen) */
.screens-states-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding-bottom: var(--space-xl);
}

.screen-states-row {
  display: flex;
  gap: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  align-items: flex-start;
}

.row-screen-info {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row-states-strip {
  flex: 1;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.row-state-card {
  width: 170px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.row-state-card:hover {
  transform: translateY(-2px);
}

.flow-state-select {
  height: 30px;
  padding: 0 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}
/* Screens Grid */
.screens-grid {
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-col-width, 220px), 1fr));
  padding-bottom: var(--space-xl);
}

.screens-grid.size-sm {
  --grid-col-width: 170px;
}

.screens-grid.size-md {
  --grid-col-width: 220px;
}

.screens-grid.size-lg {
  --grid-col-width: 290px;
}

/* Screen Card (Mobbin style phone mockup) */
.screen-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  position: relative;
  outline: none;
}

.phone-mockup-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 393 / 852;
  background: var(--card-device-bg);
  border-radius: var(--radius-lg);
  border: 4px solid var(--card-device-bezel);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.screen-card:hover .phone-mockup-wrapper {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-rust);
}

.phone-mockup-screen {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg-surface);
}

.phone-island-pill {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 26%;
  height: 10px;
  background: var(--card-device-island);
  border-radius: 10px;
  z-index: 5;
  pointer-events: none;
}

/* Missing / Placeholder Screen */
.screen-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  background: var(--bg-secondary);
  color: var(--text-muted);
  gap: 8px;
}

.screen-placeholder.no-ui-placeholder {
  background: rgba(242, 200, 116, 0.08);
  border: 1px dashed var(--brand-ochre);
}

.placeholder-icon {
  color: var(--text-muted);
  opacity: 0.6;
}

.placeholder-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.placeholder-reason {
  font-size: 10.5px;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 4px;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.card-title {
  font-size: 13px;
  font-family: var(--font-sans-medium);
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-order-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.flow-tag {
  font-size: 10.5px;
  color: var(--text-muted);
}

.pattern-tag-badge {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--badge-bg);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}

.states-count-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(176, 89, 60, 0.15);
  color: var(--brand-rust);
}

.no-ui-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--brand-ochre);
  color: #151B1A;
}

/* ==========================================================================
   7. Screen Detail Modal / Drawer
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.screen-detail-modal {
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-base);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-modal-header {
  height: 60px;
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.detail-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-title {
  font-family: var(--font-sans-head);
  font-size: 18px;
  color: var(--text-primary);
}

.detail-flow-pill {
  font-size: 11.5px;
  padding: 3px 8px;
  background: var(--badge-bg);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.detail-preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  padding: var(--space-md);
  overflow-y: auto;
  align-items: center;
  gap: var(--space-md);
}

.detail-view-mode-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-base);
}

.view-mode-btn {
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.view-mode-btn.active {
  background: var(--brand-rust);
  color: #FFFFFF;
}

/* Screen detail toolbar: persona dropdown chip + view mode switch */
.detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

.persona-dropdown {
  position: relative;
}

.persona-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--border-base);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.persona-chip:hover,
.persona-dropdown.open .persona-chip {
  border-color: var(--brand-ochre);
}

.persona-chip-initials {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-rust);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
}

.persona-dropdown-caret {
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

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

.persona-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 280px;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-base);
  background: var(--bg-surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.persona-dropdown-menu.hidden {
  display: none;
}

.persona-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
}

.persona-dropdown-item:hover,
.persona-dropdown-item:focus-visible {
  background: var(--bg-secondary);
  outline: none;
}

.persona-dropdown-item.not-applicable {
  opacity: 0.45;
}

.persona-dropdown-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.persona-dropdown-name {
  font-size: 13px;
  font-weight: 600;
}

.persona-dropdown-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.persona-dropdown-check {
  width: 14px;
  color: var(--brand-rust);
  font-weight: 700;
}

.persona-dropdown-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--border-subtle);
}

.detail-device-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  min-width: 0;
}

.detail-device-container.mode-compare {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.detail-device-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.device-theme-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.detail-phone-mockup {
  height: min(430px, 47vh);
  max-height: 48vh;
  width: auto;
  aspect-ratio: 393 / 852;
  border-radius: 36px;
  border: 6px solid var(--card-device-bezel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  background: var(--card-device-bg);
  flex-shrink: 0;
}

.detail-phone-mockup img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* State Filmstrip */
.state-filmstrip-section {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filmstrip-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.state-filmstrip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.state-filmstrip-card {
  width: 92px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  padding: 5px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.state-filmstrip-card:hover {
  border-color: var(--brand-rust);
  transform: translateY(-2px);
}

.state-filmstrip-card.active {
  border-color: var(--brand-rust);
  box-shadow: 0 0 0 2px var(--brand-rust);
  background: rgba(176, 89, 60, 0.08);
}

.state-card-thumb {
  width: 100%;
  aspect-ratio: 393 / 852;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.state-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.state-filmstrip-card:hover {
  border-color: var(--brand-rust);
}

.state-filmstrip-card.active {
  border-color: var(--brand-rust);
  background: rgba(176, 89, 60, 0.08);
}

.state-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.state-card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.state-tag-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--badge-bg);
  color: var(--text-muted);
}

.state-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.state-card-knobs {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: 4px;
  color: var(--brand-rust);
  word-break: break-all;
}

/* Detail Metadata Sidebar */
.detail-sidebar-pane {
  width: 360px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-base);
  background: var(--bg-surface);
  padding: var(--space-md);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

.meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}

.meta-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 6px 10px;
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  word-break: break-all;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn {
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: var(--brand-rust);
  color: #FFFFFF;
}

.components-used-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.component-used-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.component-used-item:hover {
  background: var(--brand-rust);
  color: #FFFFFF;
}

/* ==========================================================================
   8. Flows View (Horizontal Filmstrip + Step-Through Presentation)
   ========================================================================== */
.flows-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-md);
  gap: var(--space-md);
  overflow-y: auto;
}

.flows-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}

.flow-tabs-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  max-width: 100%;
}

.flow-pill-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

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

.flow-pill-btn.active {
  background: var(--brand-rust);
  color: #FFFFFF;
  border-color: var(--brand-rust);
}

.presentation-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-base);
}

.flow-timeline-scroll {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  overflow-x: auto;
  padding: var(--space-md) var(--space-xs);
}

.timeline-step-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.flow-step-card {
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.flow-step-card:hover {
  transform: translateY(-4px);
}

.step-indicator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.step-number-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--brand-rust);
  color: #FFFFFF;
}

.timeline-connector {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ==========================================================================
   9. Components View (Catalog, Variants, UsedIn)
   ========================================================================== */
.components-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
}

.components-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-base);
  padding: var(--space-sm) var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.components-main {
  flex: 1;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
}

.components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md);
}

.component-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.component-card:hover {
  border-color: var(--brand-rust);
  box-shadow: var(--shadow-md);
}

.comp-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.comp-name {
  font-family: var(--font-sans-head);
  font-size: 16px;
  color: var(--text-primary);
}

.comp-category-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--badge-bg);
  color: var(--text-secondary);
}

.comp-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.comp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-muted);
}
/* Component Card Hero Preview */
.comp-card-hero {
  width: 100%;
  height: 150px;
  background: var(--bg-app);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  padding: 10px;
  margin-bottom: 4px;
}

.comp-card-hero img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Component Used-In Screens Grid */
.comp-used-screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.comp-used-screen-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.comp-used-screen-card:hover {
  border-color: var(--brand-rust);
  transform: translateY(-2px);
}

.comp-used-screen-thumb {
  width: 36px;
  aspect-ratio: 393 / 852;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.comp-used-screen-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Component Detail Modal */
.component-detail-modal {
  width: 90vw;
  max-width: 1200px;
  max-height: 88vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-base);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.comp-detail-body {
  padding: var(--space-md);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.variant-box {
  background: var(--bg-app);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.variant-renders-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.variant-render-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.variant-render-tile img {
  max-width: 240px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   10. Tokens View (Themes, Scales, Typography, Spacing, Radius)
   ========================================================================== */
.tokens-layout {
  display: flex;
  flex: 1;
  padding: var(--space-md);
  gap: var(--space-md);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.tokens-nav-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + var(--space-md));
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.token-nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.token-nav-link:hover, .token-nav-link.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.token-nav-link.active {
  color: var(--brand-rust);
  font-weight: 600;
}

.tokens-content-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.token-group-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.token-section-title {
  font-family: var(--font-sans-head);
  font-size: 20px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.token-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Swatch Grid (Themes side-by-side) */
.swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.color-token-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-token-card:hover {
  border-color: var(--border-focus);
}

.swatch-pair {
  display: flex;
  width: 54px;
  height: 40px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.swatch-box {
  flex: 1;
  height: 100%;
}

.swatch-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.swatch-name {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.swatch-hexes {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Color Scales */
.scales-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.scale-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scale-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scale-swatches-strip {
  display: flex;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.scale-step-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.scale-step-box:hover {
  transform: scaleY(1.08);
  z-index: 2;
}

/* Typography Specimens */
.typography-specimens-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.specimen-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--space-sm);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.specimen-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.specimen-text {
  color: var(--text-primary);
  outline: none;
  word-break: break-word;
}

/* Spacing Ruler */
.spacing-ruler-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spacing-item-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.space-label-cell {
  width: 90px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

.space-unit-cell {
  width: 90px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.space-bar-visual {
  height: 20px;
  background: var(--brand-rust);
  border-radius: 3px;
  opacity: 0.85;
}

/* Radius Specimens */
.radius-specimens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.radius-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.radius-box-demo {
  width: 64px;
  height: 64px;
  background: var(--brand-moss);
  border: 2px solid var(--border-focus);
}

.radius-token-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ==========================================================================
   11. Command Palette Modal
   ========================================================================== */
.command-palette-box {
  width: 90vw;
  max-width: 640px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.palette-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-base);
  gap: 10px;
}

.palette-search-icon {
  color: var(--text-muted);
}

.palette-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
}

.palette-close-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}

.palette-results-container {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.palette-result-item:hover, .palette-result-item.selected {
  background: var(--brand-rust);
  color: #FFFFFF;
}

.palette-result-item.selected .result-type-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.result-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.result-item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-item-sub {
  font-size: 11px;
  opacity: 0.7;
}

.result-type-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--badge-bg);
  color: var(--text-muted);
}

.palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  font-size: 11px;
  color: var(--text-muted);
}

.kbd-shortcuts-list {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   12. Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  padding: 8px 16px;
  background: var(--brand-charcoal);
  color: var(--brand-ivory);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease forwards;
  pointer-events: auto;
}

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

/* ==========================================================================
   13. Print Styles (@media print)
   ========================================================================== */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  .top-nav, .screens-sidebar, .screens-toolbar, .modal-backdrop, .toast-container {
    display: none !important;
  }

  .screens-main {
    padding: 0 !important;
  }

  .screens-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
    page-break-inside: auto;
  }

  .screen-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .phone-mockup-wrapper {
    box-shadow: none !important;
    border: 1px solid #CCCCCC !important;
  }
}

.comp-preview-frame, .comp-card-preview { background: #141824 !important; padding: 6px !important; }
.comp-preview-frame img, .comp-card-preview img { width: 100% !important; height: 100% !important; object-fit: contain !important; border-radius: 8px !important; }

/* XL Grid Size + Card Quick-Zoom Button + 2x Zoom Inspector + Fullscreen Lightbox */
.screens-grid.size-xl {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)) !important;
  gap: 28px !important;
}
.screens-grid.size-lg {
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)) !important;
  gap: 22px !important;
}
.screen-card {
  position: relative !important;
}
.card-zoom-fab {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  background: rgba(15, 19, 28, 0.88);
  color: #00E5FF;
  border: 1.5px solid #00E5FF;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.screen-card:hover .card-zoom-fab {
  opacity: 1;
}
.card-zoom-fab:hover {
  background: #00E5FF;
  color: #030710;
  transform: scale(1.06);
}
.detail-zoom2x-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px 40px;
}
.detail-zoom2x-header {
  font-size: 12px;
  font-weight: 700;
  color: #00E5FF;
  margin-bottom: 12px;
  text-align: center;
}
.detail-zoom2x-frame {
  width: 560px;
  max-width: 95%;
  cursor: zoom-in;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid #00E5FF;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65);
}
.detail-zoom2x-frame img {
  width: 100%;
  height: auto;
  display: block;
}
.lightbox-backdrop {
  background: rgba(4, 7, 14, 0.94) !important;
  backdrop-filter: blur(8px);
  z-index: 9999 !important;
}
.lightbox-content {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  background: transparent !important;
}
.lb-toolbar {
  height: 62px;
  padding: 0 24px;
  background: #0b111e;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 16px;
}
.lb-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
}
.lb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.lb-zoom-group {
  display: flex;
  background: #151d2e;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  overflow: hidden;
}
.lb-btn {
  background: #151d2e;
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.14);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
}
.lb-zoom-group .lb-btn {
  border: none;
  border-radius: 0;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.lb-btn.active {
  background: #00E5FF;
  color: #030710;
}
.lb-btn:hover:not(:disabled) {
  border-color: #00E5FF;
}
.lb-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.lb-close {
  background: rgba(255, 82, 82, 0.2);
  color: #ff5252;
  border-color: #ff5252;
}
.lb-scroll-stage {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 28px 24px 80px;
}
.lb-image-frame {
  cursor: zoom-in;
  transition: width 0.18s ease;
}

/* Make Screen Detail Modal preview pane roomy and render phone at full 393px native width in Fit View */
.screen-detail-modal {
  width: min(1360px, 96vw) !important;
  height: min(900px, 94vh) !important;
}
.detail-device-container {
  overflow-y: auto !important;
  align-items: flex-start !important;
  padding: 20px 24px 36px !important;
}
.detail-phone-mockup {
  width: 393px !important;
  max-width: 393px !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 393 / 852 !important;
}
.detail-zoom2x-frame {
  width: 640px !important;
  max-width: 96% !important;
}
