/* ========== RESET & BASE ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ========== DESIGN TOKENS ========== */
:root {
  --bg:      oklch(99% 0.002 240);
  --surface: oklch(100% 0 0);
  --fg:      oklch(18% 0.012 250);
  --muted:   oklch(54% 0.012 250);
  --border:  oklch(92% 0.005 250);
  --accent:  oklch(58% 0.18 255);

  --nav-bg:   oklch(99% 0.002 240 / 0.85);
  --card-bg:  var(--surface);

  --green:  oklch(65% 0.18 145);
  --yellow: oklch(75% 0.18 80);
  --red:    oklch(55% 0.22 25);
  --orange: oklch(65% 0.18 50);
  --purple: oklch(62% 0.2 300);

  --code-bg:     oklch(97% 0.003 250);
  --code-border: oklch(89% 0.006 250);

  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  --font-mono:    'SF Mono', ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace;

  --radius:    12px;
  --radius-lg: 16px;
  --transition: 0.2s ease;

  --text-muted: var(--muted);
}

/* ========== DARK MODE ========== */
[data-theme="dark"] {
  --bg:      oklch(12% 0.012 250);
  --surface: oklch(16% 0.012 250);
  --fg:      oklch(93% 0.005 240);
  --muted:   oklch(60% 0.012 250);
  --border:  oklch(24% 0.012 250);
  --accent:  oklch(68% 0.18 255);

  --nav-bg:  oklch(12% 0.012 250 / 0.85);
  --card-bg: oklch(18% 0.012 250);

  --code-bg:     oklch(14% 0.012 250);
  --code-border: oklch(22% 0.012 250);
}

/* ========== BASE ========== */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--fg);
}

/* ========== HEADER ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.header__inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.header__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.header__subtitle {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1px;
}

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

.header__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--green);
  background: oklch(65% 0.18 145 / 0.1);
  border: 1px solid oklch(65% 0.18 145 / 0.25);
  padding: 5px 12px;
  border-radius: 100px;
}

.header__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.4); }
}

.header__github-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.header__github-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
  background: var(--surface);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--muted);
  background: var(--surface);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ========== MAIN ========== */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ========== HERO ========== */
.hero { padding: 56px 0 40px; }

.hero__content {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: oklch(58% 0.18 255 / 0.08);
  border: 1px solid oklch(58% 0.18 255 / 0.15);
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.hero__heading {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), oklch(68% 0.18 290));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__description {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 560px;
}

.hero__tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-pill {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 100px;
  transition: color var(--transition), border-color var(--transition);
}

.tech-pill:hover {
  color: var(--accent);
  border-color: oklch(58% 0.18 255 / 0.4);
}

.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg);
  transition: border-color var(--transition), transform var(--transition);
}

.flow-node:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.flow-node__icon { font-size: 26px; }

.flow-node__icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

[data-theme="dark"] .flow-node--zendesk .flow-node__icon svg path {
  fill: oklch(85% 0.05 195);
}

.flow-arrow svg {
  width: 48px;
  height: 24px;
}

/* ========== CONTROLS ========== */
.controls {
  padding: 20px 0;
  margin-bottom: 8px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.controls__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.controls__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
}

.controls__desc {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2px;
}

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

.controls__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--muted);
}

.controls__divider { color: var(--border); }

.controls__meta code {
  font-size: 0.75rem;
  padding: 1px 6px;
}

/* Filter button group */
.filter-group {
  display: inline-flex;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 2px;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--fg);
}

.filter-btn.is-active {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--border);
  box-shadow: 0 1px 2px oklch(58% 0.18 255 / 0.1);
}

/* Primary button */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), background var(--transition);
}

.btn:active { transform: scale(0.97); }

.btn__icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.btn.is-loading .btn__icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), oklch(52% 0.2 280));
  color: oklch(99% 0.002 240);
  border-color: oklch(58% 0.18 255 / 0.3);
  box-shadow: 0 4px 16px oklch(58% 0.18 255 / 0.25);
}

.btn--primary:hover {
  box-shadow: 0 6px 24px oklch(58% 0.18 255 / 0.38);
  transform: translateY(-1px);
}

.btn--primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ========== DASHBOARD ========== */
.dashboard {
  padding: 24px 0 48px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--muted);
  box-shadow: 0 4px 24px oklch(18% 0.012 250 / 0.08);
}

.stat-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-card__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.stat-card__icon { font-size: 1.2rem; }

.stat-card__value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--fg);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.stat-card__footer {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card__bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
  overflow: hidden;
}

.stat-card__bar::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card__bar--open::after    { background: linear-gradient(90deg, var(--red), oklch(65% 0.22 25)); }
.stat-card__bar--pending::after { background: linear-gradient(90deg, var(--yellow), oklch(82% 0.18 80)); }
.stat-card__bar--solved::after  { background: linear-gradient(90deg, var(--green), oklch(72% 0.18 145)); }
.stat-card__bar--total::after   { background: linear-gradient(90deg, var(--accent), oklch(68% 0.18 290)); }
.stat-card__bar--csat::after    { background: linear-gradient(90deg, var(--purple), oklch(75% 0.15 55)); }

.stat-card.active .stat-card__bar--open::after    { width: 70%; }
.stat-card.active .stat-card__bar--pending::after { width: 45%; }
.stat-card.active .stat-card__bar--solved::after  { width: 85%; }
.stat-card.active .stat-card__bar--total::after   { width: 90%; }
.stat-card.active .stat-card__bar--csat::after    { width: 80%; }

/* ========== PANELS ========== */
.dashboard__columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

.panel:hover { border-color: var(--muted); }

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.panel__title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
}

.panel__badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 100px;
}

.panel__body {
  padding: 20px;
  min-height: 200px;
}

/* Placeholders */
.tags-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px;
  color: var(--muted);
  text-align: center;
  gap: 10px;
}

.tags-placeholder__icon {
  font-size: 2rem;
  opacity: 0.4;
}

.tags-placeholder p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Tag Bars */
.tag-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  animation: slideIn 0.4s ease-out forwards;
  opacity: 0;
  transform: translateX(-16px);
}

.tag-bar:last-child { margin-bottom: 0; }

@keyframes slideIn {
  to { opacity: 1; transform: translateX(0); }
}

.tag-bar__rank {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 24px;
}

.tag-bar__info { flex: 1; }

.tag-bar__name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
}

.tag-bar__count {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

.tag-bar__meter {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  margin-top: 6px;
}

.tag-bar__meter-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), oklch(68% 0.18 290));
  transition: width 0.8s ease;
}

/* Status bar rows */
.status-row {
  display: grid;
  grid-template-columns: 110px 1fr 50px;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  animation: slideIn 0.4s ease-out forwards;
  opacity: 0;
  transform: translateX(-16px);
}

.status-row__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
}

.status-row__meter {
  height: 10px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.status-row__fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s ease;
}

.status-row__fill--open    { background: linear-gradient(90deg, var(--red), oklch(65% 0.22 25)); }
.status-row__fill--pending { background: linear-gradient(90deg, var(--yellow), oklch(82% 0.18 80)); }
.status-row__fill--solved  { background: linear-gradient(90deg, var(--green), oklch(72% 0.18 145)); }
.status-row__fill--new     { background: linear-gradient(90deg, var(--accent), oklch(68% 0.18 290)); }
.status-row__fill--hold    { background: linear-gradient(90deg, oklch(70% 0.008 250), oklch(80% 0.008 250)); }

.status-row__count {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* CSAT category bar */
.csat-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 4px;
  animation: slideIn 0.4s ease-out forwards;
  opacity: 0;
  transform: translateX(-16px);
}

.csat-row__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.csat-row__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
  text-transform: capitalize;
}

.csat-row__pct {
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.csat-row__meter {
  height: 8px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.csat-row__fill { height: 100%; border-radius: 6px; transition: width 0.8s ease; }
.csat-row__fill--good    { background: linear-gradient(90deg, var(--green), oklch(72% 0.18 145)); }
.csat-row__fill--bad     { background: linear-gradient(90deg, var(--red), oklch(65% 0.22 25)); }
.csat-row__fill--neutral { background: linear-gradient(90deg, var(--yellow), oklch(82% 0.18 80)); }
.csat-row__fill--none    { background: var(--border); }

/* CSAT comment cards */
.csat-comment {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  animation: fadeIn 0.4s ease-out;
}

.csat-comment:last-child { margin-bottom: 0; }

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

.csat-comment__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.csat-comment__rating {
  font-family: var(--font-mono);
  font-weight: 600;
}

.csat-comment__rating--good { color: var(--green); }
.csat-comment__rating--bad  { color: var(--red); }

.csat-comment__body {
  font-size: 0.8125rem;
  color: var(--fg);
  line-height: 1.5;
}

.csat-comment__ticket {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
}

/* ========== TICKET TABLE ========== */
.table-wrapper { overflow-x: auto; }

.ticket-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.ticket-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ticket-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--fg);
}

.ticket-table tbody tr { transition: background var(--transition); }

.ticket-table tbody tr:hover {
  background: oklch(58% 0.18 255 / 0.04);
}

.ticket-table tbody tr:last-child td { border-bottom: none; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge--open    { background: oklch(55% 0.22 25 / 0.12);  color: var(--red); }
.status-badge--pending { background: oklch(75% 0.18 80 / 0.15);  color: oklch(55% 0.15 80); }
.status-badge--solved  { background: oklch(65% 0.18 145 / 0.12); color: var(--green); }
.status-badge--new     { background: oklch(58% 0.18 255 / 0.12); color: var(--accent); }
.status-badge--hold    { background: oklch(70% 0.008 250 / 0.15); color: oklch(55% 0.008 250); }

.priority-badge {
  font-size: 0.75rem;
  font-weight: 500;
}

.priority-badge--urgent { color: var(--red); }
.priority-badge--high   { color: var(--orange); }
.priority-badge--normal { color: var(--muted); }
.priority-badge--low    { color: oklch(70% 0.008 250); }

.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  margin: 1px 2px;
}

.tag-chip--matched {
  background: oklch(58% 0.18 255 / 0.08);
  border-color: oklch(58% 0.18 255 / 0.3);
  color: var(--accent);
  font-weight: 600;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 28px;
}

/* ========== CODE SECTION ========== */
.code-section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.code-section__header {
  text-align: center;
  margin-bottom: 28px;
}

.code-section__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 6px;
}

.code-section__desc {
  font-size: 0.875rem;
  color: var(--muted);
}

.code-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.code-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.code-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.code-card__label {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.code-card__pre {
  padding: 16px;
  margin: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  color: var(--muted);
  background: var(--code-bg);
  border: none;
}

.code-card__pre code { all: unset; font-family: var(--font-mono); }

/* ========== FEATURES ========== */
.features {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.features__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  text-align: center;
  margin-bottom: 28px;
}

.features__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--muted);
  box-shadow: 0 8px 32px oklch(18% 0.012 250 / 0.08);
}

.feature-card__icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.feature-card h4 {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

.feature-card code {
  font-size: 0.72rem;
  padding: 1px 5px;
}

/* ========== FOOTER ========== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
}

.footer__inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer__text {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.footer__note {
  font-size: 0.75rem;
  color: oklch(70% 0.008 250);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .hero__content      { grid-template-columns: 1fr; }
  .stats-grid         { grid-template-columns: repeat(2, 1fr); }
  .code-cards         { grid-template-columns: 1fr; }
  .features__grid     { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header__inner      { flex-wrap: wrap; height: auto; padding: 12px 0; }
  .hero__heading      { font-size: 1.65rem; }
  .controls__inner    { flex-direction: column; align-items: stretch; text-align: center; }
  .controls__left     { text-align: center; }
  .controls__right    { justify-content: center; flex-direction: column; }
  .filter-group       { justify-content: center; }
  .stats-grid         { grid-template-columns: 1fr 1fr; }
  .dashboard__columns { grid-template-columns: 1fr; }
  .features__grid     { grid-template-columns: 1fr; }
  .status-row         { grid-template-columns: 90px 1fr 44px; }
}

@media (max-width: 480px) {
  .main               { padding: 0 1.25rem; }
  .header             { padding: 0 1.25rem; }
  .stats-grid         { grid-template-columns: 1fr; }
  .btn                { width: 100%; justify-content: center; }
  .hero               { padding: 36px 0 28px; }
  .stat-card__value   { font-size: 2rem; }
  .filter-btn         { font-size: 0.7rem; padding: 6px 10px; }
}


/* ========== METRICS GLOSSARY ========== */
.glossary {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.glossary__header {
  text-align: center;
  margin-bottom: 28px;
}

.glossary__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 6px;
}

.glossary__desc {
  font-size: 0.875rem;
  color: var(--muted);
}

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

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px oklch(58% 0.18 255 / 0.08);
}

.metric-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.metric-card__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.metric-card__name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.metric-card__source {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

.metric-card__row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.8125rem;
}

.metric-card__row + .metric-card__row {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

.metric-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 2px;
}

.metric-card__row code {
  font-size: 0.75rem;
  align-self: start;
  line-height: 1.6;
}

.metric-card__row p {
  font-size: 0.8125rem;
  color: var(--fg);
  line-height: 1.5;
  margin: 0;
}

.metric-card__row p code {
  display: inline;
  padding: 1px 5px;
  font-size: 0.72rem;
}

/* ========== EXTENDING THE DASHBOARD ========== */
.extend {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.extend__header {
  text-align: center;
  margin-bottom: 28px;
}

.extend__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 6px;
}

.extend__desc {
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

/* 3-step recipe header */
.extend__recipe {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
  padding: 20px;
  margin-bottom: 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.extend__step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.extend__step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), oklch(52% 0.2 280));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.extend__step-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.extend__step-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.extend__step-desc code {
  font-size: 0.72rem;
  padding: 1px 5px;
}

.extend__arrow {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 700;
  align-self: center;
}

/* Tabs */
.extend__tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.extend-tab {
  flex: 1;
  min-width: max-content;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.extend-tab:hover { color: var(--fg); }

.extend-tab.is-active {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--border);
  box-shadow: 0 1px 2px oklch(58% 0.18 255 / 0.08);
  font-weight: 600;
}

/* Body: ideas list + end-to-end recipe */
.extend__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.extend-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.extend-idea {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadeIn 0.3s ease-out;
  transition: border-color var(--transition), transform var(--transition);
}

.extend-idea:hover {
  transform: translateX(2px);
  border-color: var(--accent);
}

.extend-idea__icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.extend-idea__body { flex: 1; }

.extend-idea__name {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.extend-idea__desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

.extend-idea__formula {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: oklch(58% 0.18 255 / 0.08);
  border: 1px solid oklch(58% 0.18 255 / 0.2);
  padding: 2px 7px;
  border-radius: 4px;
}

/* End-to-end recipe card */
.extend-recipe {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 80px;
}

.extend-recipe__head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, oklch(58% 0.18 255 / 0.05), oklch(68% 0.18 290 / 0.05));
}

.extend-recipe__label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: oklch(58% 0.18 255 / 0.1);
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 10px;
}

.extend-recipe__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

.extend-recipe__title code {
  font-size: 0.85rem;
  padding: 1px 6px;
}

.extend-recipe__desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.extend-recipe__desc code {
  font-size: 0.72rem;
  padding: 1px 5px;
}

.extend-recipe__steps {
  padding: 6px 0;
}

.extend-recipe__step {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.extend-recipe__step:last-child { border-bottom: none; }

.extend-recipe__step-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.extend-recipe__note {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.extend-recipe__note code {
  font-size: 0.72rem;
  padding: 1px 5px;
}

.extend-recipe__code {
  margin: 0;
  padding: 12px 14px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  color: var(--fg);
}

.extend-recipe__code code { all: unset; font-family: var(--font-mono); }

/* Responsive tweaks */
@media (max-width: 1024px) {
  .glossary__grid        { grid-template-columns: 1fr; }
  .extend__body          { grid-template-columns: 1fr; }
  .extend-recipe         { position: static; }
  .extend__recipe {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .extend__arrow {
    transform: rotate(90deg);
    justify-self: center;
  }
}

@media (max-width: 768px) {
  .extend__tabs          { padding: 3px; }
  .extend-tab            { font-size: 0.72rem; padding: 7px 10px; }
  .metric-card__row      { grid-template-columns: 1fr; gap: 4px; }
  .metric-card__label    { padding-top: 0; }
}


/* ========== GALLERY - ACTUAL OUTPUT ========== */
.gallery {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.gallery__header {
  text-align: center;
  margin-bottom: 28px;
}

.gallery__tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  background: oklch(65% 0.18 145 / 0.1);
  border: 1px solid oklch(65% 0.18 145 / 0.25);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 10px;
}

.gallery__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 8px;
}

.gallery__desc {
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.gallery-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  margin: 0;
}

.gallery-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 28px oklch(18% 0.012 250 / 0.1);
}

.gallery-item__frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  cursor: zoom-in;
  background: oklch(96% 0.005 250);
}

[data-theme="dark"] .gallery-item__frame {
  background: oklch(20% 0.012 250);
}

.gallery-item__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: transform 0.4s ease;
  display: block;
}

.gallery-item:hover .gallery-item__frame img {
  transform: scale(1.03);
}

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: oklch(18% 0.012 250 / 0);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--transition), background 0.3s ease;
}

.gallery-item:hover .gallery-item__overlay {
  opacity: 1;
  background: oklch(18% 0.012 250 / 0.55);
}

.gallery-item figcaption {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--border);
}

.gallery-item figcaption h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

.gallery-item figcaption p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.gallery-item figcaption code {
  font-size: 0.72rem;
  padding: 1px 5px;
}

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  background: oklch(10% 0.005 250 / 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 5vh 6vw;
  animation: lightbox-fade 0.2s ease-out;
}

.lightbox.is-open {
  display: flex;
}

@keyframes lightbox-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox__content {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
}

.lightbox__content img {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 20px 60px oklch(5% 0.005 250 / 0.5);
  background: #fff;
  display: block;
}

.lightbox__content figcaption {
  color: oklch(85% 0.005 240);
  font-size: 0.875rem;
  text-align: center;
  max-width: 560px;
  line-height: 1.55;
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: oklch(18% 0.012 250 / 0.6);
  border: 1px solid oklch(50% 0.012 250 / 0.4);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.lightbox__close:hover {
  background: oklch(30% 0.012 250 / 0.8);
  transform: scale(1.05);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: oklch(18% 0.012 250 / 0.5);
  border: 1px solid oklch(50% 0.012 250 / 0.3);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  font-family: system-ui;
}

.lightbox__nav:hover {
  background: oklch(30% 0.012 250 / 0.8);
  transform: translateY(-50%) scale(1.05);
}

.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }

/* Gallery responsive */
@media (max-width: 1024px) {
  .gallery__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .gallery__grid { grid-template-columns: 1fr; }
  .lightbox__nav { width: 40px; height: 40px; font-size: 1.3rem; }
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
  .lightbox__close { top: 10px; right: 10px; width: 36px; height: 36px; }
}
