/* ============================================================================
   api.mutual.ai — aligned to Mesh style guide (mutual.app-style-guide + m-card)
   Light canvas (#F1F1F1) + skyBlue accent, Lato typography.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;500;600;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* Local Lato 900 (brand wordmark) — kept for offline fallback */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 900; font-display: swap; src: url('../fonts/lato-900-latin.woff2') format('woff2'); }

/* --- Design Tokens (light theme — canonical) --- */
:root {
  /* Canvas + surfaces */
  --bg:             #F1F1F1;   /* canvas-page */
  --surface:        #F5F5F5;   /* canvas-surface-quiet — skeletons, tracks, chips */
  --white:          #FCFCFC;   /* canvas-surface (card fill) */

  /* Strip palette — accents, actions, status */
  --accent:         #40A0FF;   /* skyBlue */
  --accent-hover:   #2F8EEE;
  --accent-light:   rgba(64,160,255,0.08);
  --green:          #A4C400;   /* limeGreen */
  --green-light:    rgba(164,196,0,0.12);
  --amber:          #FFA800;
  --gold:           #FFC800;
  --purple:         #8040FF;
  --coral:          #FF6600;
  --red:            #FF0040;
  --error:          #FF0040;
  --error-light:    rgba(255,0,64,0.10);

  /* Text hierarchy */
  --text:           #111827;
  --text-secondary: #4B5563;
  --text-tertiary:  #9CA3AF;

  /* Borders */
  --border:         rgba(0,0,0,0.06);
  --border-strong:  rgba(0,0,0,0.12);

  /* Typography */
  --font-ui:    'Lato', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --font-brand: 'Lato', system-ui, sans-serif;

  /* Spacing — 4-base scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Radii */
  --radius-sm: 4px;   /* inputs, small chips */
  --radius-md: 8px;   /* dialogs, small containers */
  --radius-lg: 12px;  /* cards */
  --radius-xl: 16px;  /* modals */

  /* Shadows — style-guide elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);                                  /* level-1 */
  --shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 4px 8px rgba(0,0,0,0.04);      /* level-2 */
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.06), 0 16px 32px rgba(0,0,0,0.08);   /* level-4 */

  /* Layout */
  --nav-height:   56px;
  --max-width:    1200px;
  --page-padding: 40px;

  /* Motion */
  --ease:  cubic-bezier(0.4, 0, 0.2, 1);
  --fast:  0.15s;
  --norm:  0.2s;
}

/* --- Dark theme (shell chrome / optional page dark mode) --- */
html.dark {
  --bg:             #060712;
  --surface:        #151829;
  --white:          #18181B;

  --text:           #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary:  #64748B;

  --border:         rgba(255,255,255,0.06);
  --border-strong:  rgba(255,255,255,0.12);

  --accent-light:   rgba(64,160,255,0.14);
  --green-light:    rgba(164,196,0,0.18);
  --error-light:    rgba(255,0,64,0.18);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.35), 0 4px 8px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.45), 0 16px 32px rgba(0,0,0,0.55);

  color-scheme: dark;
}
html.dark .main-nav   { background: rgba(6,7,18,0.92); }
html.dark .card,
html.dark .modal-panel,
html.dark .search-modal,
html.dark .nav-account-btn,
html.dark .nav-account-menu,
html.dark input,
html.dark select { background: var(--white); color: var(--text); }
html.dark .strip-dot { box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body {
  font-family: var(--font-ui);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--accent-hover); }
button { font-family: var(--font-ui); cursor: pointer; border: none; background: none; font-size: inherit; color: inherit; }
input, select, textarea { font-family: var(--font-ui); font-size: inherit; color: var(--text); }
::selection { background: var(--accent); color: #fff; }
[x-cloak] { display: none !important; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-brand);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}
h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

/* --- Navigation --- */
.main-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-height); z-index: 1000;
  background: rgba(241,241,241,0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--norm) var(--ease), box-shadow var(--norm) var(--ease);
}
.main-nav.scrolled { border-bottom-color: var(--border); }

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-xl);
}

.nav-logo { display: flex; align-items: center; text-decoration: none; }
.logo-text {
  font-family: var(--font-brand);
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo-dot { color: var(--accent); }

.nav-links { display: flex; gap: var(--space-lg); align-items: center; }
.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 0;
  transition: color var(--fast) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--accent); font-weight: 600; }

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

/* Account button */
.nav-account-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--white);
  cursor: pointer;
  transition: box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.nav-account-btn:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.nav-account-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 600;
}
.nav-chevron { transition: transform var(--norm) var(--ease); color: var(--text-tertiary); }
.nav-chevron.open { transform: rotate(180deg); }

/* Account dropdown */
.nav-account-wrap { position: relative; }
.nav-account-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 100;
}
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--fast), color var(--fast);
}
.nav-dropdown-item:hover { background: var(--accent-light); color: var(--text); }
.nav-dropdown-item--danger { color: var(--error); }
.nav-dropdown-item--danger:hover { background: var(--error-light); color: var(--error); }
.nav-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Theme toggle in account menu */
.nav-theme-bar { display: flex; gap: 4px; padding: 6px 14px; justify-content: center; }
.nav-theme-opt {
  padding: 4px 8px; border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: color var(--fast), background var(--fast);
  display: flex; align-items: center;
}
.nav-theme-opt:hover { color: var(--text); }
.nav-theme-opt.active { background: var(--accent-light); color: var(--accent); }

/* Spotlight trigger */
.nav-spotlight-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: border-color var(--fast), color var(--fast);
}
.nav-spotlight-pill:hover { border-color: var(--accent); color: var(--accent); }

/* --- Page Layout --- */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + var(--space-lg)) var(--page-padding) var(--space-4xl);
}

/* --- Page Header --- */
.page-header { margin-bottom: var(--space-3xl); }
.page-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}
.page-subtitle {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 640px;
}

/* --- Endpoint badge --- */
.endpoint-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--space-md);
}
.endpoint-badge svg { opacity: 0.8; }

/* --- Search / Toolbar --- */
.toolbar {
  display: flex; align-items: center; gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.search-wrap { position: relative; flex: 1; max-width: 400px; }
.search-wrap svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.search-input::placeholder { color: var(--text-tertiary); }

.toolbar-count { font-size: 0.8125rem; color: var(--text-tertiary); white-space: nowrap; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-sm); }
.toolbar-sort {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--fast), color var(--fast);
}
.toolbar-sort:hover { border-color: var(--border-strong); color: var(--text); }

.toolbar-views { display: flex; gap: 2px; }
.toolbar-view-btn {
  padding: 7px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: color var(--fast), background var(--fast);
}
.toolbar-view-btn:hover { color: var(--text-secondary); }
.toolbar-view-btn.active { color: var(--accent); background: var(--accent-light); }

/* --- Cards / List --- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--norm) var(--ease), box-shadow var(--norm) var(--ease), border-color var(--fast) var(--ease);
}
.card-clickable { cursor: pointer; }
.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md); margin-bottom: 4px;
}
.card-title {
  font-size: 1rem; font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 300;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-chevron { flex-shrink: 0; color: var(--text-tertiary); transition: color var(--fast), transform var(--fast); }
.card-clickable:hover .card-chevron { color: var(--accent); transform: translateX(2px); }

/* WTM topic breadcrumb above the card title */
.card-topic {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Grid view */
.card-list.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

/* --- Skeleton --- */
.skel {
  background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.04) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skel-shimmer 1.5s infinite;
}
.skel-title { height: 18px; width: 60%; }
.skel-text  { height: 12px; width: 90%; }
.skel-short { width: 50%; }
.skel-card  { padding: var(--space-lg); }
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
html.dark .skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
  color: var(--text-tertiary);
}
.empty-state svg { margin-bottom: var(--space-md); opacity: 0.4; }
.empty-state-text { font-size: 1rem; max-width: 45ch; margin: 0 auto; line-height: 1.6; }

/* --- Detail view --- */
.detail-back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: var(--text-tertiary);
  cursor: pointer; padding: 2px 0; margin-bottom: var(--space-sm);
  text-decoration: none;
  transition: color var(--fast);
}
.detail-back:hover { color: var(--accent); }
.detail-back svg { width: 12px; height: 12px; }

.detail-header { margin-bottom: var(--space-xl); }
.detail-category {
  display: inline-block;
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 4px;
}
.detail-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.01em; }
.detail-excerpt {
  font-size: 1rem; font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
}

.detail-sections { display: flex; flex-direction: column; gap: var(--space-xl); }
.detail-section-title {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* --- Four columns (priority cards) --- */
.four-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}
.four-col {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--norm) var(--ease), box-shadow var(--norm) var(--ease), border-color var(--fast);
  position: relative;
}
.four-col--clickable { cursor: pointer; }
.four-col--clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.four-col--recommended {
  border-color: var(--accent);
  background: rgba(64,160,255,0.03);
}
.four-col-rec-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff;
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 9999px;
  white-space: nowrap;
}
.four-col-rec-reason {
  margin-top: var(--space-md); padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  font-size: 0.75rem; color: var(--text-secondary); line-height: 1.5;
}
.four-col-pref-badge {
  position: absolute; top: -10px; right: 12px;
  background: var(--green); color: #fff;
  font-size: 0.5625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 9999px;
  white-space: nowrap;
}
.four-col--selected {
  border-color: var(--green);
  background: rgba(164,196,0,0.04);
}

/* Preference set button */
.pref-set-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: var(--accent);
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-weight: 500;
  transition: border-color var(--fast), background var(--fast);
}
.pref-set-btn:hover { border-color: var(--accent); background: var(--accent-light); }

/* Preference panel */
.pref-panel {
  margin-top: var(--space-lg);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pref-panel-inner { padding: var(--space-lg); }
.pref-panel-section { margin-bottom: var(--space-lg); }
.pref-panel-section:last-child { margin-bottom: 0; }
.pref-panel-label {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.pref-panel-options { display: flex; flex-wrap: wrap; gap: 6px; }
.pref-option {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.75rem; color: var(--text-secondary);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.pref-option:hover { border-color: var(--border-strong); color: var(--text); }
.pref-option.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.pref-assembly-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  font-size: 0.875rem; color: var(--text-secondary);
}
.pref-assembly-row + .pref-assembly-row { border-top: 1px solid var(--border); }

/* Toggle switch */
.pref-toggle {
  width: 36px; height: 20px; border-radius: 9999px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; position: relative;
  transition: background var(--norm), border-color var(--norm);
}
.pref-toggle.active { background: var(--accent); border-color: var(--accent); }
.pref-toggle-dot {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  transition: transform var(--norm);
  box-shadow: var(--shadow-sm);
}
.pref-toggle.active .pref-toggle-dot { transform: translateX(16px); }

/* Iteration buttons */
.pref-iter-btns { display: flex; gap: 4px; }
.pref-iter-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem; font-weight: 500;
  color: var(--text-secondary);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.pref-iter-btn:hover { border-color: var(--border-strong); }
.pref-iter-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* Panel footer */
.pref-panel-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  margin-top: var(--space-lg);
}
.pref-advanced-link {
  font-size: 0.75rem; color: var(--text-tertiary); cursor: pointer;
  transition: color var(--fast);
}
.pref-advanced-link:hover { color: var(--accent); }
.pref-panel-actions { display: flex; gap: 6px; }

@media (max-width: 768px) { .pref-panel-options { flex-direction: column; } }

/* Inline bars label */
.req-bars-title {
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.four-col-label {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}
.four-col--recommended .four-col-label { color: var(--accent); }
.four-col-stars { font-size: 1rem; letter-spacing: 2px; display: inline-flex; align-items: center; }
.star { display: inline-block; }
.star--full  { color: var(--accent); }
.star--half  { color: var(--accent); opacity: 0.45; }
.star--empty { color: var(--text-tertiary); opacity: 0.3; }

/* Strip-palette dot */
.strip-dot {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}

.four-col-stars {
  display: inline-flex !important;
  align-items: center;
  letter-spacing: 0 !important;
  font-size: 0 !important;
}
.four-col-row { align-items: center; }

/* --- Priority Triangle --- */
.priority-triangle-wrap {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-sm);
  -webkit-user-select: none; user-select: none;
}
.priority-triangle { cursor: crosshair; touch-action: none; }
.tri-bg   { fill: var(--accent-light); stroke: var(--border-strong); stroke-width: 1; }
.tri-grid { stroke: var(--border); stroke-width: 0.5; stroke-dasharray: 3 3; }
.tri-label {
  font-family: var(--font-ui); font-size: 10px; font-weight: 600;
  fill: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.tri-point { fill: var(--accent); stroke: #fff; stroke-width: 2; cursor: grab; transition: cx 0.2s ease, cy 0.2s ease; }
.tri-point-glow { fill: var(--accent); opacity: 0.15; pointer-events: none; transition: cx 0.2s ease, cy 0.2s ease; }
.tri-preset-label {
  font-size: 0.6875rem; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.12em;
}
html.dark .tri-point { stroke: var(--surface); }
html.dark .tri-bg { fill: rgba(64,160,255,0.08); }

.four-col-value  { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; margin-bottom: 2px; }
.four-col-sub    { font-size: 0.75rem; color: var(--text-tertiary); }
.four-col-row    { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.8125rem; }
.four-col-row + .four-col-row { border-top: 1px solid var(--border); }
.four-col-row-label { color: var(--text-secondary); }
.four-col-row-value { font-weight: 500; color: var(--text); }

/* Detail info grid */
.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.detail-info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
}
.detail-info-label {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.detail-info-value { font-size: 0.9375rem; color: var(--text); line-height: 1.6; }
.detail-info-value strong { font-weight: 600; }

/* --- Buttons --- */
.detail-cta { display: flex; gap: var(--space-md); align-items: center; padding-top: var(--space-lg); }
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  text-decoration: none;
  transition: transform var(--fast), box-shadow var(--fast), background var(--fast);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--white);
  text-decoration: none;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* --- Requirements inline bars --- */
.req-bars-inline { display: flex; flex-direction: column; gap: 6px; min-width: 240px; max-width: 280px; flex-shrink: 0; }
.req-bar-row { display: flex; align-items: center; gap: 8px; }
.req-bar-label {
  width: 100px; flex-shrink: 0;
  font-size: 0.6875rem; font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.req-bar-track {
  flex: 1; height: 8px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}
.req-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.req-bar-fill[data-level="high"]   { background: var(--accent); }
.req-bar-fill[data-level="medium"] { background: var(--amber); }
.req-bar-fill[data-level="low"]    { background: var(--text-tertiary); }

.req-more-link {
  font-size: 0.75rem; color: var(--accent);
  cursor: pointer; margin-top: 4px;
  text-align: right;
  transition: opacity var(--fast);
  opacity: 0.8;
}
.req-more-link:hover { opacity: 1; }

/* Requirements modal */
.req-modal-bars { display: flex; flex-direction: column; gap: 6px; }
.req-modal-bar-row { display: flex; align-items: center; gap: var(--space-sm); }
.req-modal-bar-label {
  width: 140px; flex-shrink: 0;
  font-size: 0.75rem; font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.req-modal-bar-track {
  flex: 1; height: 8px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden; position: relative;
}
.req-modal-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.req-modal-bar-fill[data-level="high"]   { background: var(--accent); }
.req-modal-bar-fill[data-level="medium"] { background: var(--amber); }
.req-modal-bar-fill[data-level="low"]    { background: var(--text-tertiary); }

.req-modal-bar-stack { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.req-modal-compare-fill {
  height: 6px; border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Compare palette — strip-palette selections */
.compare-color-0 { background: var(--accent); }        /* skyBlue */
.compare-color-1 { background: var(--purple); }        /* purple */
.compare-color-2 { background: var(--green); }         /* limeGreen */
.compare-color-3 { background: var(--coral); }         /* vividOrange */

.req-compare-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-md); }
.req-compare-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 9999px;
  font-size: 0.6875rem; color: #fff; font-weight: 500;
}
.req-compare-chip-remove { cursor: pointer; opacity: 0.75; transition: opacity var(--fast); }
.req-compare-chip-remove:hover { opacity: 1; }

.req-compare-search {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.75rem; background: var(--white); color: var(--text);
  margin-bottom: var(--space-sm);
}
.req-compare-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.req-compare-results { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--space-md); }
.req-compare-result {
  padding: 6px 10px; font-size: 0.75rem;
  color: var(--text-secondary); cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--fast);
}
.req-compare-result:hover { background: var(--accent-light); color: var(--text); }

/* --- Obligations --- */
.obligations-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.obligations-col { padding: var(--space-lg); }
.obligations-col + .obligations-col { border-left: 1px solid var(--border); }
.obligations-col-title {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: var(--space-md);
}
.obligations-col:first-child .obligations-col-title { color: var(--accent); }
.obligations-col:last-child  .obligations-col-title { color: var(--text-tertiary); }
.obligations-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.obligations-list li {
  font-size: 0.875rem; font-weight: 300;
  color: var(--text-secondary); line-height: 1.5;
  padding-left: 14px; position: relative;
}
.obligations-list li::before {
  content: ''; position: absolute; left: 0; top: 9px;
  width: 5px; height: 5px; border-radius: 50%;
}
.obligations-col:first-child .obligations-list li::before { background: var(--accent); opacity: 0.6; }
.obligations-col:last-child  .obligations-list li::before { background: var(--text-tertiary); opacity: 0.5; }
.obligations-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.6875rem; padding: 3px 10px;
  border-radius: 9999px;
  background: var(--accent-light); color: var(--accent);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}
.obligations-summary {
  font-size: 0.875rem; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: var(--space-md);
  font-weight: 300;
}
@media (max-width: 600px) {
  .obligations-grid { grid-template-columns: 1fr; }
  .obligations-col + .obligations-col { border-left: none; border-top: 1px solid var(--border); }
}

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-xl);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.modal-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 640px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: var(--space-2xl);
}
.modal-close {
  float: right; padding: 4px;
  color: var(--text-tertiary); cursor: pointer;
  transition: color var(--fast);
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 1.25rem; font-weight: 600; margin-bottom: var(--space-lg); letter-spacing: -0.01em; }
.modal-body { font-size: 0.9375rem; font-weight: 300; color: var(--text-secondary); line-height: 1.7; }
.modal-body h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin: var(--space-lg) 0 var(--space-sm); }
.modal-body p  { margin-bottom: var(--space-md); }
.modal-body ul { margin: 0 0 var(--space-md) var(--space-lg); }
.modal-body li { margin-bottom: var(--space-xs); }
.modal-step { display: flex; gap: var(--space-md); padding: var(--space-sm) 0; }
.modal-step + .modal-step { border-top: 1px solid var(--border); }
.modal-step-num {
  flex-shrink: 0; width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; font-weight: 600;
}
.modal-step-text { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; }
.modal-step-text strong { color: var(--text); font-weight: 600; }
.modal-highlight {
  background: var(--accent-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  font-size: 0.875rem; color: var(--text); line-height: 1.6;
}

/* --- Spotlight search modal --- */
.search-modal {
  width: 100%; max-width: 640px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-top: -10vh;
}
.search-modal-input-wrap {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.search-modal-input-wrap svg { flex-shrink: 0; color: var(--text-tertiary); }
.search-modal-input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 1.0625rem; color: var(--text); font-family: var(--font-ui);
}
.search-modal-input::placeholder { color: var(--text-tertiary); }
.search-modal-esc {
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 2px 6px; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.search-modal-results { max-height: 400px; overflow-y: auto; padding: var(--space-sm) 0; }
.search-modal-result {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  text-decoration: none;
  transition: background var(--fast);
}
.search-modal-result:hover { background: var(--accent-light); }
.search-modal-result-endpoint {
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent);
  min-width: 90px;
}
.search-modal-result-name { font-size: 0.875rem; color: var(--text); }
.search-modal-empty {
  padding: var(--space-xl) var(--space-lg);
  text-align: center; color: var(--text-tertiary); font-size: 0.875rem;
}
.search-modal-hints { padding: var(--space-sm) var(--space-lg) var(--space-md); }
.search-modal-hint {
  display: flex; align-items: center; gap: var(--space-md);
  font-size: 0.75rem; color: var(--text-tertiary);
}
.search-modal-hint-key {
  font-size: 0.625rem; font-weight: 600;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) var(--page-padding);
  margin-top: var(--space-4xl);
}
.footer-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--space-md);
}
.footer-text { font-size: 0.75rem; color: var(--text-tertiary); }
.footer-links { display: flex; gap: var(--space-lg); }
.footer-links a {
  font-size: 0.75rem; color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--fast);
}
.footer-links a:hover { color: var(--accent); }

/* --- WTM Detail Cards --- */
.wtm-fields { display: flex; flex-direction: column; gap: var(--space-lg); margin-bottom: var(--space-xl); }

.wtm-intent-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.wtm-intent-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md) var(--space-lg);
}
.wtm-intent-label {
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.wtm-intent-text { font-size: 0.875rem; color: var(--text); line-height: 1.6; }

.wtm-strategies {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-sm);
}
.wtm-strategy-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.wtm-strategy-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.wtm-strategy-name { font-size: 0.875rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.wtm-strategy-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.5; }

.wtm-milestones { position: relative; padding-left: 20px; }
.wtm-milestones::before {
  content: ''; position: absolute;
  left: 6px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border); border-radius: 1px;
}
.wtm-milestone { position: relative; padding: 6px 0 6px 16px; }
.wtm-milestone::before {
  content: ''; position: absolute;
  left: -17px; top: 12px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--accent);
}
.wtm-milestone-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.wtm-milestone-intent { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

.wtm-factors { display: flex; flex-wrap: wrap; gap: 6px; }
.wtm-factor-chip {
  font-size: 0.75rem; padding: 3px 10px;
  border-radius: 9999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Opinion factor cards with gradient bar */
.wtm-factor-cards { display: flex; flex-direction: column; gap: var(--space-sm); }
.wtm-factor-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  display: flex; align-items: center; gap: var(--space-md);
}
.wtm-factor-card-left { flex: 0 0 140px; }
.wtm-factor-card-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.wtm-factor-card-weight { font-size: 0.625rem; color: var(--text-tertiary); margin-top: 2px; }
.wtm-factor-card-bar { flex: 1; position: relative; }
.wtm-factor-card-track {
  height: 6px;
  background: linear-gradient(90deg, var(--error-light) 0%, var(--surface) 50%, var(--green-light) 100%);
  border-radius: 2px;
}
.wtm-factor-card-labels {
  display: flex; justify-content: space-between;
  margin-top: 3px;
  font-size: 0.625rem; color: var(--text-tertiary); line-height: 1.2;
}
.wtm-factor-card-neg { max-width: 45%; }
.wtm-factor-card-pos { max-width: 45%; text-align: right; }

/* Placeholders */
.wtm-placeholders { display: flex; flex-direction: column; gap: 4px; }
.wtm-placeholder {
  font-size: 0.875rem; color: var(--text-secondary);
  display: flex; align-items: baseline; gap: 8px;
}
.wtm-placeholder-name {
  font-weight: 600; color: var(--text); font-size: 0.75rem;
  background: var(--surface);
  padding: 2px 8px; border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* Entity primitives — use strip palette */
.wtm-primitives { display: flex; gap: 4px; align-items: flex-end; height: 40px; }
.wtm-primitive {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 48px;
}
.wtm-primitive-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  transition: height 0.4s ease;
}
.wtm-primitive-label {
  font-size: 0.625rem; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.wtm-primitive-bar[data-type="object"]  { background: var(--accent); }   /* skyBlue */
.wtm-primitive-bar[data-type="concept"] { background: var(--purple); }   /* purple */
.wtm-primitive-bar[data-type="actor"]   { background: var(--coral); }    /* vividOrange */
.wtm-primitive-bar[data-type="space"]   { background: var(--green); }    /* limeGreen */
.wtm-primitive-bar[data-type="time"]    { background: var(--amber); }    /* amber */

/* Story section cards */
.wtm-section-cards { display: flex; flex-direction: column; gap: var(--space-xs); }
.wtm-section-card {
  display: flex; gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}
.wtm-section-card:last-child { border-bottom: none; }
.wtm-section-card-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600;
}
.wtm-section-card-body { flex: 1; }
.wtm-section-card-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.wtm-section-card-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.wtm-section-card-type {
  font-size: 0.625rem; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* Used-in milestones */
.wtm-used-in { display: flex; flex-wrap: wrap; gap: 4px; }
.wtm-used-in-chip {
  font-size: 0.6875rem; padding: 2px 8px;
  border-radius: 9999px;
  background: var(--surface); color: var(--text-tertiary);
}

.wtm-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-xs);
}
.wtm-section-item {
  font-size: 0.875rem; color: var(--text-secondary);
  padding: 4px 0;
  display: flex; align-items: baseline; gap: 6px;
}
.wtm-section-num {
  font-size: 0.75rem; font-weight: 600;
  color: var(--accent);
  width: 18px; flex-shrink: 0; text-align: right;
  font-family: var(--font-mono);
}

.wtm-topic-path {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
  font-family: var(--font-mono);
}
.wtm-meta-type {
  display: inline-flex;
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 9999px;
  background: var(--surface); color: var(--text-tertiary);
  margin-left: 8px;
}

@media (max-width: 600px) {
  .wtm-intent-row { grid-template-columns: 1fr; }
  .wtm-strategies { grid-template-columns: 1fr; }
}

/* --- Utilities --- */
.text-sm { font-size: 0.875rem; }
.text-secondary { color: var(--text-secondary); }

/* --- Responsive --- */
@media (max-width: 768px) {
  :root { --page-padding: 20px; }
  .nav-links { display: none; }
  .toolbar { flex-wrap: wrap; }
  .search-wrap { max-width: 100%; }
  .card-list.view-grid { grid-template-columns: 1fr; }
  .four-columns { grid-template-columns: repeat(2, 1fr); }
  .detail-info-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
  .page-title { font-size: 1.5rem; }
}
@media (max-width: 480px) {
  .four-columns { grid-template-columns: 1fr; }
  .pair-grid, .restore-grid { grid-template-columns: 1fr !important; }
}
