/* ============================================================
   ML ENGINEER PROGRESS TRACKER — CUSTOM STYLES
   ============================================================ */

:root {
  /* ============================================================
     Color system — minimalist grayscale (ChatGPT-like)
     ============================================================ */

  /* 🎨 Surfaces */
  --background: #212121;
  --sidebar-background: #171717;
  --card: #2A2A2A;
  --card-hover: #333333;
  --sidebar-accent: #3D3D3D;
  --secondary: #383838;
  --muted: #383838;
  --accent: #383838;
  --popover: #2A2A2A;

  /* ✍️ Text */
  --foreground: #ECECEC;
  --muted-foreground: #BFBFBF;
  --text-muted: #B3B3B3;
  --sidebar-foreground: #ECECEC;

  /* 🔲 Borders / focus */
  --border: #525252;
  --border-hover: #707070;
  --sidebar-border: #3D3D3D;
  --input: #525252;
  --ring: #999999;

  /* 🏷️ Brand / Primary */
  --primary: #ECECEC;
  --primary-foreground: #171717;
  --primary-glow: #D9D9D9;
  --primary-hover: #E0E0E0;

  /* 🚦 Status */
  --success: #5FCC85;
  --success-soft: #88D9A3;
  --warning: #F0A455;
  --warning-soft: #F5C175;
  --destructive: #EB7070;
  --danger-soft: #F08585;

  /* 🔥 Heatmap */
  --heat-0: #2E2E2E;
  --heat-1: #305040;
  --heat-2: #3D7058;
  --heat-3: #479668;
  --heat-4: #5FCC85;

  /* 🌈 Gradients */
  --gradient-primary: linear-gradient(135deg, #ECECEC, #CCCCCC);
  --gradient-card: linear-gradient(180deg, #2A2A2A, #242424);
  --gradient-rank: linear-gradient(90deg, #479668, #5FCC85);

  /* 🚫 Shadows */
  --shadow-card: none;
  --shadow-elevated: none;
  --shadow-glow: none;

  /* ============================================================
     Backwards-compat mapping (existing code uses these)
     ============================================================ */
  --bg-primary: var(--background);
  --bg-secondary: var(--sidebar-background);
  --bg-card: var(--card);
  --bg-card-hover: var(--card-hover);
  --text-primary: var(--foreground);
  --text-secondary: var(--muted-foreground);
  --accent-hover: var(--primary-hover);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--sidebar-accent); border-radius: 3px; }

/* ---- LAYOUT ---- */
.app-shell {
  display: grid;
  grid-template-columns: 190px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

.header {
  grid-area: header;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.header-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.top-search {
  width: min(480px, 100%);
  background: #1f1f1f;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--foreground);
  padding: 8px 10px;
  font-size: 0.8rem;
}
.top-search:focus {
  outline: none;
  border-color: var(--ring);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted-foreground);
  font-size: 0.76rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-meta-item {
  color: var(--muted-foreground);
  white-space: nowrap;
}

.sidebar {
  grid-area: sidebar;
  background: var(--bg-secondary);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 8px 12px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 8px;
}
.logo-text {
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
.logo-sub { font-size: 0.65rem; color: var(--text-muted); }

.sidebar-section-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted-foreground);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
  border: 1px solid transparent;
  user-select: none;
}
.nav-item:hover {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--sidebar-border);
}
.nav-item.active {
  background: var(--sidebar-accent);
  color: var(--foreground);
  border-color: var(--sidebar-border);
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-path {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-border);
}

.main-content {
  grid-area: main;
  padding: 12px;
  overflow-y: auto;
}

/* ---- PATH SELECTOR ---- */
.path-selector-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--input);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s;
}
.path-selector-btn:hover, .path-selector-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

/* ---- CARDS ---- */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
}
.card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.stat-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ---- DASHBOARD GRID — overridden by tracker section below ---- */
.col-span-full { grid-column: 1 / -1; }
.lg\:col-span-1 { grid-column: span 1; }
.lg\:col-span-2 { grid-column: span 2; }

.mission-header { margin-bottom: 12px; }
.mission-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}
.mission-kicker {
  font-size: 0.68rem;
  color: var(--muted-foreground);
  margin-bottom: 4px;
}
.mission-overline {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
  margin-bottom: 4px;
}
.mission-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.05;
  color: var(--foreground);
}
.mission-subtitle {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--muted-foreground);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.stats-segment {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stats-segment:last-child { border-right: none; }
.stats-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
}
.stats-main {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
}

.dashboard-feature-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* ---- STAGE MINI GRID ---- */
.stage-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.stage-mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.stage-mini-card:hover {
  border-color: var(--border-hover);
  transform: none;
}
.stage-mini-card.priority {
  border-left-width: 3px;
}

/* ---- HEATMAP ---- */
.heatmap-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  transition: transform 0.1s;
  cursor: default;
}
.heatmap-cell:hover { transform: scale(1.3); }

/* ---- RECOMMENDATION CARDS ---- */
.rec-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.rec-card:hover {
  border-color: var(--border-hover);
  background: var(--card-hover);
}

/* ---- MILESTONES ---- */
.milestone-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.milestone-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  width: 80px;
  text-align: center;
  transition: all 0.2s;
  cursor: default;
}
.milestone-chip.unlocked {
  border-color: rgba(234,179,8,0.4);
  background: rgba(234,179,8,0.08);
}
.milestone-chip.unlocked:hover {
  border-color: rgba(234,179,8,0.7);
  transform: scale(1.05);
}

/* ---- ROADMAP ---- */
.roadmap-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .roadmap-layout { grid-template-columns: 1fr; }
}

.roadmap-sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
}

.roadmap-stage-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid var(--stage-color, var(--border));
}
.roadmap-stage-card:hover {
  border-color: var(--stage-color, var(--border-hover));
  background: var(--card-hover);
}
.roadmap-stage-card.active {
  background: var(--sidebar-accent);
  border-color: var(--border);
}
.roadmap-stage-card.priority-glow {
  box-shadow: none;
}

.roadmap-content { flex: 1; }

/* ---- TASKS ---- */
.task-list { display: flex; flex-direction: column; gap: 0; }
.task-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.task-row:last-child { border-bottom: none; }
.task-row.done { opacity: 0.7; }
.task-title { font-size: 0.9rem; font-weight: 500; line-height: 1.4; }

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid var(--border-hover);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: white;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-top: 2px;
}
.task-checkbox:hover { border-color: var(--accent); }
.task-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.notes-input {
  width: 100%;
  background: var(--secondary);
  border: 1px solid var(--input);
  border-radius: 6px;
  color: var(--foreground);
  font-size: 0.75rem;
  padding: 6px 8px;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s;
}
.notes-input:focus { outline: none; border-color: var(--ring); box-shadow: none; }
.notes-input::placeholder { color: var(--text-muted); }

/* ---- RESOURCES ---- */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
}
.resource-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.resource-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  display: block;
}
.resource-title:hover { color: var(--foreground); text-decoration: underline; }

/* ---- FILTER BUTTONS ---- */
.filter-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.filter-btn.active {
  background: var(--sidebar-accent);
  border-color: var(--border-hover);
  color: var(--foreground);
}

/* ---- PATH CARDS ---- */
.path-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
}
.path-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--path-color, var(--accent));
}
.path-card.active {
  background: rgba(var(--path-color-rgb, 99,102,241), 0.1);
  border-color: var(--path-color, var(--accent));
  box-shadow: none;
}

/* ---- INPUTS ---- */
.input-field {
  background: var(--secondary);
  border: 1px solid var(--input);
  border-radius: 8px;
  color: var(--foreground);
  font-size: 0.85rem;
  padding: 8px 12px;
  transition: border-color 0.15s;
  font-family: inherit;
}
.input-field:focus { outline: none; border-color: var(--ring); box-shadow: none; }
.input-field::placeholder { color: var(--text-muted); }
select.input-field { cursor: pointer; }
select.input-field option { background: var(--popover); color: var(--foreground); }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--primary-hover); transform: none; }
.btn-primary:active { transform: none; }

.btn-secondary {
  background: var(--secondary);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--card-hover); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-danger:hover { background: rgba(239,68,68,0.25); border-color: rgba(239,68,68,0.5); }

/* ---- TOAST ---- */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 340px;
  box-shadow: none;
  transition: all 0.3s ease;
}

/* ---- OVERALL PROGRESS BAR (header) ---- */
.header-progress {
  flex: 1;
  max-width: 200px;
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.main-content > div { animation: fadeIn 0.2s ease; }

/* ---- GRAYSCALE UTILITY ---- */
.grayscale { filter: grayscale(100%); }

/* ---- SCROLLBAR FOR ROADMAP SIDEBAR ---- */
.roadmap-sidebar::-webkit-scrollbar { width: 3px; }
.roadmap-sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-accent); }

/* ---- DETAILS/SUMMARY ---- */
details > summary { cursor: pointer; user-select: none; }
details > summary::-webkit-details-marker { display: none; }

/* ---- TABLE ---- */
table { border-collapse: collapse; }
td, th { vertical-align: middle; }

/* ---- RESPONSIVE TWEAKS ---- */
@media (max-width: 600px) {
  .main-content { padding: 12px; }
  .card { padding: 14px; }
  .resource-grid { grid-template-columns: 1fr; }
  .milestone-chip { width: 68px; }
  .stat-value { font-size: 1.5rem; }
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-feature-grid { grid-template-columns: 1fr; }
  .mission-title { font-size: 1.4rem; }
  .header-meta { gap: 8px; font-size: 0.68rem; }
  .settings-heading { display: block; }
  .settings-subtitle { margin-top: 8px; text-align: left; max-width: none; }
  .settings-form-grid { grid-template-columns: 1fr; }
  .settings-actions .btn-secondary,
  .settings-actions .btn-danger { width: 100%; justify-content: center; }
}

/* ============================================================
   RESOURCE CARDS — ENHANCED (v2)
   ============================================================ */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-items: start;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.resource-card:hover {
  border-color: var(--border-hover);
  transform: none;
  box-shadow: none;
}

/* Must-do cards get a gold left border accent */
.must-do-card {
  border-left: 3px solid #f59e0b;
}
.must-do-card:hover {
  border-left-color: var(--warning);
  box-shadow: none;
}

/* ---- BADGES ---- */
.badge-free {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge-paid {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(100,116,139,0.2);
  color: #94a3b8;
  border: 1px solid rgba(100,116,139,0.2);
  font-weight: 500;
}
.badge-mustdo {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(245,158,11,0.15);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.35);
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-portfolio {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--secondary);
  color: var(--foreground);
  border: 1px solid var(--border);
  font-weight: 600;
}

/* ---- METRICS ROW ---- */
.resource-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.metric-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.metric-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- NAV BADGE ---- */
.nav-badge {
  margin-left: auto;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--secondary);
  color: var(--foreground);
  border: 1px solid var(--border);
}

/* ============================================================
   LEARNING PATH VIEW
   ============================================================ */

.lp-timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

/* Vertical connector line */
.lp-timeline::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  opacity: 0.25;
  pointer-events: none;
}

.lp-phase {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--phase-color, var(--accent));
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.lp-phase-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, var(--bg-card-hover), var(--bg-card));
}
.lp-phase-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.lp-phase-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* Warning block */
.lp-warning {
  margin: 14px 20px 0;
  padding: 10px 14px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
}

/* Steps list */
.lp-steps {
  padding: 8px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lp-step {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.lp-step:last-child { border-bottom: none; }

.lp-step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  font-family: monospace;
  margin-top: 2px;
}

.lp-step-content {
  flex: 1;
  min-width: 0;
}

.lp-why {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--secondary);
  border-radius: 6px;
  border-left: 2px solid var(--border-hover);
  line-height: 1.5;
}

/* ============================================================
   RESOURCES — FILTER & SORT BAR
   ============================================================ */

.filter-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.filter-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.filter-btn.active {
  background: var(--sidebar-accent);
  border-color: var(--border-hover);
  color: var(--foreground);
  font-weight: 600;
}

@media (max-width: 600px) {
  .resource-grid { grid-template-columns: 1fr; }
  .lp-timeline::before { left: 20px; }
  .lp-phase-header { padding: 14px; }
  .lp-steps { padding: 8px 14px 14px; }
}

/* ============================================================
   TRACKER TABS BAR
   ============================================================ */
.tracker-tabs-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Tailwind utility overrides used heavily in templates */
.bg-indigo-500 { background: var(--primary) !important; }
.text-indigo-400 { color: var(--foreground) !important; }
.hover\:text-indigo-300:hover { color: var(--primary-hover) !important; }
.tracker-tab-btn {
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.tracker-tab-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.tracker-tab-btn.active { background: var(--primary); color: var(--primary-foreground); }

/* ============================================================
   GAMIFICATION
   ============================================================ */
.gamification-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1000px) { .gamification-layout { grid-template-columns: 1fr; } }

.gam-left, .gam-right { display: flex; flex-direction: column; }

/* Level card */
.level-card { position: relative; overflow: hidden; }
.level-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: none;
  pointer-events: none;
}
.level-circle {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 2px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
}
.level-num { font-size: 0.6rem; font-weight: 700; font-family: monospace; }

/* Rank progression */
.rank-progression {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}
.rank-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.rank-step.active .rank-step-icon {
  transform: scale(1.1);
  box-shadow: none;
}
.rank-step-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s;
}
.rank-step-label { font-size: 0.6rem; font-weight: 600; color: var(--text-muted); text-align: center; }
.rank-connector {
  height: 2px;
  flex: 1;
  min-width: 16px;
  background: var(--border);
  margin-bottom: 20px;
}

/* Employability */
.employ-score-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.employ-score-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}
.emp-breakdown { display: flex; flex-direction: column; gap: 6px; }
.emp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}
.emp-icon { font-size: 0.9rem; width: 20px; text-align: center; }
.emp-label { color: var(--text-secondary); width: 100px; shrink: 0; }
.emp-bar-wrap { flex: 1; height: 5px; background: var(--bg-primary); border-radius: 3px; overflow: hidden; }
.emp-bar { height: 5px; border-radius: 3px; transition: width 0.5s; }
.emp-pct { font-size: 0.7rem; font-family: monospace; color: var(--text-muted); width: 32px; text-align: right; }
.emp-label-row { text-align: center; margin-top: 8px; }

/* Badge grid */
.badge-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  width: 76px;
  cursor: default;
  transition: all 0.2s;
  text-align: center;
}
.badge-chip.unlocked {
  border-color: rgba(234,179,8,0.3);
  background: rgba(234,179,8,0.06);
}
.badge-chip.unlocked:hover { transform: scale(1.05); border-color: rgba(234,179,8,0.6); }
.badge-chip-label { font-size: 0.6rem; font-weight: 600; line-height: 1.2; }
.badge-chip-date { font-size: 0.55rem; color: var(--text-muted); }

/* Dashboard 6-column stat row */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
@media (max-width: 1400px) { .dashboard-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .dashboard-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .dashboard-grid { grid-template-columns: 1fr; } }

/* ============================================================
   DAILY TRACKER
   ============================================================ */
.daily-layout {}
.daily-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .daily-grid { grid-template-columns: 1fr; } }

.habit-daily-list { display: flex; flex-direction: column; gap: 6px; }
.habit-daily-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card-hover);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.habit-daily-btn:hover { border-color: var(--border-hover); }
.habit-daily-btn.done { color: var(--text-primary); font-weight: 500; }

.mood-btn {
  font-size: 1.3rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.mood-btn.active { border-color: var(--ring); background: var(--secondary); transform: none; }

/* ============================================================
   HABIT TRACKER GRID
   ============================================================ */
.habit-tracker-wrap { overflow-x: auto; }
.habit-grid-headers {
  display: flex;
  gap: 3px;
  margin-bottom: 4px;
  margin-left: 220px;
}
.habit-grid-header {
  width: 20px;
  font-size: 0.55rem;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}
.habit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.habit-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  flex-shrink: 0;
}
.habit-row-labels-spacer { width: 220px; flex-shrink: 0; }
.habit-grid-row { display: flex; gap: 3px; }
.habit-grid-cell {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--heat-0);
  cursor: pointer;
  transition: all 0.1s;
  flex-shrink: 0;
}
.habit-grid-cell:hover { transform: scale(1.2); z-index: 1; }
.habit-grid-cell.done { border-color: transparent; }

/* ============================================================
   PROJECT TRACKER
   ============================================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.project-card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  transition: border-color 0.2s;
}
.project-card:hover { border-color: var(--border-hover); }

/* ============================================================
   CERTIFICATE TRACKER
   ============================================================ */
.cert-list { display: flex; flex-direction: column; gap: 0; }
.cert-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cert-row:last-child { border-bottom: none; }
.cert-status-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: bold;
  flex-shrink: 0;
  transition: all 0.15s;
  font-family: inherit;
}
.cert-status-btn:hover { transform: scale(1.1); }

/* ============================================================
   WEEKLY PLANNER
   ============================================================ */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
@media (max-width: 700px) { .week-grid { grid-template-columns: repeat(4, 1fr); } }
.week-day-col {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  transition: border-color 0.15s;
}
.week-day-col.today { border-color: var(--ring); background: var(--secondary); }
.week-day-header { margin-bottom: 8px; }
.week-day-hours { margin-bottom: 8px; }

/* ============================================================
   SKILL HEATMAP
   ============================================================ */
.skill-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.skill-cell {
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  transition: all 0.2s;
  cursor: default;
  border: 1px solid rgba(255,255,255,0.05);
}
.skill-cell:hover { transform: none; box-shadow: none; }
.skill-stars { display: flex; justify-content: center; gap: 1px; }

/* ============================================================
   UI HUMANIZATION PASS
   Keep the interface restrained, consistent, and product-like.
   ============================================================ */

html, body {
  font-feature-settings: 'cv11', 'ss01';
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.logo-text {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--foreground);
  font-size: 0.78rem;
  letter-spacing: 0;
  line-height: 1.1;
}

.logo-sub {
  color: var(--muted-foreground);
  font-size: 0.62rem;
}

.sidebar-logo {
  padding: 8px 8px 16px;
}

.sidebar-section-label {
  padding: 14px 8px 5px;
  font-size: 0.58rem;
  letter-spacing: 0.11em;
  color: #888;
}

.nav-item {
  border-radius: 4px;
  padding: 8px 9px;
  gap: 9px;
  font-size: 0.78rem;
}

.nav-icon {
  width: 18px;
  height: 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  font-size: 0.58rem !important;
  font-weight: 700;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  border-color: var(--sidebar-border);
  color: var(--foreground);
}

.nav-badge {
  display: none;
}

.sidebar-path {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-panel {
  border: 1px solid var(--sidebar-border);
  background: var(--sidebar-accent);
  border-radius: 4px;
  padding: 10px;
}

.panel-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 5px;
}

.panel-value {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--foreground);
}

.panel-meta {
  font-size: 0.68rem;
  color: var(--muted-foreground);
  margin-top: 4px;
}

.card,
.stat-card,
.resource-card,
.project-card,
.lp-phase,
.roadmap-stage-card,
.habit-daily-btn,
.week-day-col,
.badge-chip,
.milestone-chip {
  border-radius: 4px;
  background: var(--card);
  border-color: var(--border);
  box-shadow: none;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.2;
}

.split-title > span:last-child {
  color: var(--muted-foreground);
  font-size: 0.68rem;
  font-weight: 500;
}

.btn-primary,
.btn-secondary,
.btn-danger,
.input-field,
.notes-input,
.filter-btn,
.path-selector-btn,
.tracker-tab-btn {
  border-radius: 4px;
}

.btn-primary,
.btn-secondary {
  min-height: 34px;
}

.btn-primary {
  font-weight: 650;
}

.field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-foreground);
  font-size: 0.68rem;
}

.mission-header {
  padding: 0;
  border: none;
  background: transparent;
}

.mission-title {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  letter-spacing: -0.04em;
}

.mission-kicker {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1px 5px;
  font-size: 0.56rem;
}

.mission-overline {
  margin-top: 6px;
}

.stats-strip {
  background: var(--card);
}

.stats-segment {
  min-height: 54px;
}

.stats-main {
  font-size: 1.2rem;
}

.heatmap-row {
  gap: 5px;
}

.heatmap-cell {
  width: 13px;
  height: 13px;
  border-radius: 2px;
}

.heatmap-cell:hover,
.habit-grid-cell:hover,
.badge-chip.unlocked:hover,
.milestone-chip.unlocked:hover,
.cert-status-btn:hover,
.mood-btn.active {
  transform: none;
}

.focus-list {
  display: flex;
  flex-direction: column;
}

.focus-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.focus-row:first-child {
  padding-top: 0;
}

.focus-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.focus-dot {
  width: 10px;
  height: 10px;
  border: 1px solid var(--muted-foreground);
  border-radius: 999px;
  margin-top: 4px;
}

.focus-title {
  color: var(--foreground);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
}

.focus-meta,
.focus-progress,
.empty-note {
  color: var(--muted-foreground);
  font-size: 0.68rem;
}

.stage-mini-card {
  border-left: 2px solid var(--stage-color, var(--border));
}

.stage-mini-name {
  color: var(--foreground);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.25;
}

.stage-mini-pct,
.stage-mini-meta {
  color: var(--muted-foreground);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.resource-title:hover {
  color: var(--foreground);
  text-decoration-color: var(--border-hover);
}

.lp-timeline::before {
  background: var(--border);
  opacity: 1;
}

.level-card::before {
  display: none;
}

.settings-shell {
  width: 100%;
  max-width: 920px;
  min-width: 0;
}

.settings-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.settings-title {
  margin: 0;
  color: var(--foreground);
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: -0.035em;
}

.settings-subtitle,
.settings-copy {
  color: var(--muted-foreground);
  font-size: 0.78rem;
  line-height: 1.45;
}

.settings-subtitle {
  margin: 0;
  max-width: 340px;
  text-align: right;
}

.settings-copy {
  margin: 0 0 12px;
}

.settings-path-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

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

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

.path-card {
  align-items: flex-start;
  text-align: left;
  min-width: 0;
  min-height: 88px;
  padding: 14px;
  border-left: 2px solid var(--path-color, var(--border));
}

.path-card:hover,
.path-card.active {
  background: var(--card-hover);
  border-color: var(--border-hover);
  border-left-color: var(--path-color, var(--border-hover));
}

.path-card-label {
  color: var(--foreground);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.2;
}

.path-card-meta {
  color: var(--muted-foreground);
  font-size: 0.7rem;
  line-height: 1.35;
}

.progress-track,
.bg-gray-800,
.bg-gray-800\/50,
.hover\:bg-gray-800\/30:hover {
  background: var(--secondary) !important;
}

.border-gray-800,
.border-t.border-gray-800 {
  border-color: var(--border) !important;
}

.text-white,
.text-gray-300,
.text-gray-400 {
  color: var(--foreground) !important;
}

.text-gray-500,
.text-gray-600,
.text-gray-700,
.text-muted-soft {
  color: var(--muted-foreground) !important;
}

.text-success-soft,
.text-green-300,
.text-green-400,
.text-emerald-400 {
  color: var(--success) !important;
}

.text-yellow-300,
.text-yellow-400,
.text-amber-300,
.text-amber-400 {
  color: var(--warning) !important;
}

.text-red-300,
.text-red-400,
.text-danger-soft {
  color: var(--destructive) !important;
}

.text-blue-300,
.text-blue-400,
.text-cyan-300,
.text-purple-300 {
  color: var(--muted-foreground) !important;
}

.bg-indigo-900\/50,
.bg-indigo-900\/60,
.bg-blue-900\/40,
.bg-blue-900\/50,
.bg-purple-900\/50,
.bg-red-900\/40,
.bg-red-900\/50,
.bg-red-900\/60,
.bg-yellow-900\/50,
.bg-yellow-900\/60,
.bg-green-900\/40,
.bg-green-900\/50,
.bg-orange-900\/60 {
  background: var(--secondary) !important;
}

.border-indigo-700,
.border-red-700,
.border-orange-700,
.border-yellow-700,
.border-gray-700 {
  border-color: var(--border) !important;
}

/* ============================================================
   Integrations + Career Intelligence
   ============================================================ */

.integ-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 18px;
}

.integ-btn { padding: 8px 14px; font-size: 13px; }

.integ-section { margin-top: 22px; }

.integ-section-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}

.integ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.integ-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.integ-card.is-connected { border-color: var(--success); }

.integ-card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.integ-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--secondary);
  color: var(--foreground);
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.integ-head-meta { flex: 1; min-width: 0; }

.integ-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.integ-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.integ-cat {
  font-size: 11px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.integ-kind {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.integ-kind-live    { background: rgba(95, 204, 133, 0.15); color: var(--success); }
.integ-kind-manual  { background: rgba(240, 164, 85, 0.15); color: var(--warning); }
.integ-kind-backend { background: var(--secondary); color: var(--muted-foreground); }

.integ-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.integ-pill-ok      { background: rgba(95, 204, 133, 0.15); color: var(--success); }
.integ-pill-manual  { background: rgba(240, 164, 85, 0.15); color: var(--warning); }
.integ-pill-off     { background: var(--secondary); color: var(--muted-foreground); }
.integ-pill-err     { background: rgba(235, 112, 112, 0.18); color: var(--destructive); }
.integ-pill-backend { background: var(--secondary); color: var(--muted-foreground); }

.integ-desc {
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.integ-caps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.integ-caps li {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
}

.integ-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
  padding: 10px;
  background: var(--background);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.integ-stat-num {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.1;
}

.integ-stat-lbl {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.integ-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.integ-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.integ-error {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(235, 112, 112, 0.1);
  border: 1px solid rgba(235, 112, 112, 0.4);
  color: var(--destructive);
}

.integ-meta {
  font-size: 11px;
  color: var(--muted-foreground);
}

.integ-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

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

.integ-field { display: flex; flex-direction: column; gap: 4px; }

.integ-form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.integ-form-empty {
  font-size: 12px;
  color: var(--muted-foreground);
  padding: 8px 10px;
  background: var(--background);
  border-radius: 6px;
  border: 1px dashed var(--border);
}

/* ---- Career Intelligence ---- */

.intel-hero { padding: 20px; }

.intel-hero-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 720px) {
  .intel-hero-row { grid-template-columns: 1fr; }
}

.intel-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
}

.intel-score {
  font-size: 56px;
  font-weight: 800;
  color: var(--foreground);
  line-height: 1;
  letter-spacing: -0.02em;
}

.intel-score-max {
  font-size: 20px;
  color: var(--muted-foreground);
  font-weight: 500;
  margin-left: 4px;
}

.intel-meta {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 6px;
}

.intel-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.intel-stat {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.intel-stat-n {
  font-size: 22px;
  font-weight: 700;
  color: var(--foreground);
}

.intel-stat-l {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-top: 2px;
}

.intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.card-sub {
  font-size: 12px;
  color: var(--muted-foreground);
  margin: -6px 0 12px;
}

.alloc-list, .trend-list, .timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alloc-row, .trend-row {
  display: grid;
  grid-template-columns: 140px 1fr 100px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.alloc-label, .trend-name { color: var(--foreground); }
.alloc-meta, .trend-meta { color: var(--muted-foreground); text-align: right; }

.alloc-bar, .trend-bar {
  height: 6px;
  background: var(--secondary);
  border-radius: 999px;
  overflow: hidden;
}

.alloc-fill, .trend-fill {
  height: 100%;
  background: var(--success);
  border-radius: 999px;
}

.trend-boost {
  color: var(--success);
  font-weight: 600;
  margin-left: 4px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 12px;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

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

.timeline-source {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

.timeline-title { color: var(--foreground); }

.timeline-ts { color: var(--muted-foreground); white-space: nowrap; }

.prod-chart {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  align-items: end;
  height: 110px;
}

.prod-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 2px;
}

.prod-bar {
  width: 100%;
  min-height: 2px;
  background: var(--success);
  border-radius: 2px;
}

.prod-h {
  font-size: 9px;
  color: var(--muted-foreground);
}

/* ---- Auth widget (Supabase) ---- */

.auth-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.auth-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  background: var(--card);
}

.auth-status-cloud { color: var(--success); border-color: var(--success); }
.auth-status-local { color: var(--muted-foreground); }

.auth-btn {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
}

.auth-btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.auth-btn-primary:hover { background: var(--primary-hover); }
.auth-btn-secondary:hover { background: var(--card-hover); }

/* Email OTP sign-in (header) */
.auth-widget--wide {
  flex-wrap: wrap;
  max-width: min(380px, 95vw);
  justify-content: flex-end;
}

.auth-otp {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.auth-otp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.auth-input {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  min-width: 0;
  width: 160px;
}

.auth-input-code {
  width: 110px;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

.auth-otp-msg {
  font-size: 11px;
  color: var(--muted-foreground);
  text-align: right;
  max-width: 320px;
  line-height: 1.35;
}

.auth-otp-msg--err {
  color: #f87171;
}

.cloud-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(95, 204, 133, 0.15);
  color: var(--success);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ============================================================
   Mobile & narrow viewports — load after base .sidebar / .nav-item
   so rules actually apply.
   ============================================================ */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "main";
    min-height: 100dvh;
    min-height: 100vh;
  }

  .main-content {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0));
    min-height: 0;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 10px;
    gap: 6px;
    position: relative;
    top: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    z-index: 20;
  }
  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar-logo,
  .sidebar-path,
  .sidebar-section-label {
    display: none !important;
  }

  .nav-item {
    flex-direction: column;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    min-width: 4.75rem;
    min-height: 52px;
    border-radius: 8px;
    text-align: center;
  }

  .nav-item .nav-label {
    display: block !important;
    font-size: 0.6rem;
    font-weight: 650;
    line-height: 1.2;
    max-width: 78px;
    white-space: normal;
    hyphens: auto;
  }

  .nav-item .nav-icon {
    font-size: 0.7rem !important;
  }

  .dashboard-feature-grid {
    grid-template-columns: 1fr;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mission-head-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .integ-grid,
  .intel-grid {
    grid-template-columns: 1fr;
  }

  .intel-score {
    font-size: clamp(2rem, 11vw, 3.5rem);
  }

  .alloc-row,
  .trend-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .alloc-meta,
  .trend-meta {
    text-align: left;
  }

  .timeline-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .timeline-ts {
    white-space: normal;
  }

  .prod-chart {
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 4px;
  }
}

@media (max-width: 640px) {
  .header {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 10px 12px calc(8px + env(safe-area-inset-top, 0));
    gap: 10px;
  }

  .header-left {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    flex: 1 1 100%;
  }

  .header-title {
    font-size: 0.88rem;
  }

  .top-search {
    width: 100%;
    max-width: none;
    min-height: 44px;
    font-size: 16px;
  }

  .header-meta {
    width: 100%;
    justify-content: flex-start;
    gap: 8px 12px;
    font-size: 0.7rem;
  }

  .auth-widget {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .auth-widget--wide {
    max-width: none;
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .auth-otp {
    align-items: stretch;
    width: 100%;
  }

  .auth-otp-row {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
  }

  .auth-input {
    width: 100% !important;
    min-height: 44px;
    font-size: 16px;
  }

  .auth-btn,
  .auth-btn-primary,
  .auth-btn-secondary {
    min-height: 44px;
    padding: 10px 14px;
  }

  #toast {
    right: 12px;
    left: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0));
    max-width: none;
  }

  .nav-item,
  .task-checkbox,
  .btn-primary,
  .btn-secondary,
  .filter-btn {
    touch-action: manipulation;
  }
}
