/* style.css — EPI Dashboard Design Tokens + Components */

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
  /* --- Type Scale (fluid) --- */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);

  /* --- 4px Spacing System --- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* --- Radius --- */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-golden: cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Content widths --- */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* --- Font family (DM Sans only) --- */
  --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;
  --font-display: 'DM Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'DM Mono', 'SF Mono', 'Consolas', monospace;
}

/* ============================================
   DARK MODE (DEFAULT)
   ============================================ */
:root, [data-theme="dark"] {
  --color-bg:             #111110;
  --color-surface:        #191918;
  --color-surface-2:      #1f1f1e;
  --color-surface-offset: #1a1a19;
  --color-surface-offset-2: #222221;
  --color-surface-dynamic: #2a2a29;
  --color-divider:        #2c2c2b;
  --color-border:         #363635;

  --color-text:           #ececea;
  --color-text-muted:     #8b8b88;
  --color-text-faint:     #555554;
  --color-text-inverse:   #111110;

  --color-primary:        #4f98a3;
  --color-primary-hover:  #3aafbe;
  --color-primary-active: #1a626b;
  --color-primary-highlight: #1e3234;
  --color-primary-subtle: rgba(79, 152, 163, 0.12);

  --color-success:        #6daa45;
  --color-success-hover:  #4d8f25;
  --color-success-active: #387015;
  --color-success-highlight: #1e2e1a;
  --color-success-subtle: rgba(109, 170, 69, 0.12);

  --color-warning:        #e8af34;
  --color-warning-hover:  #fdc551;
  --color-warning-active: #feda74;
  --color-warning-highlight: #332d1e;
  --color-warning-subtle: rgba(232, 175, 52, 0.12);

  --color-error:          #dd6974;
  --color-error-hover:    #c24a59;
  --color-error-active:   #a53142;
  --color-error-highlight: #2e1c1e;
  --color-error-subtle: rgba(221, 105, 116, 0.12);

  --color-blue:           #5591c7;
  --color-blue-hover:     #3b78ab;
  --color-blue-active:    #275f8e;
  --color-blue-highlight: #1e2a34;

  --color-purple:         #a86fdf;
  --color-purple-hover:   #9250d0;
  --color-purple-active:  #7537ba;
  --color-purple-highlight: #2a1e34;

  --color-orange:         #fdab43;
  --color-orange-hover:   #fec47e;
  --color-orange-active:  #fdd1a4;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

/* ============================================
   LIGHT MODE
   ============================================ */
[data-theme="light"] {
  --color-bg:             #f7f6f2;
  --color-surface:        #ffffff;
  --color-surface-2:      #fbfbf9;
  --color-surface-offset: #f0ede8;
  --color-surface-offset-2: #eae7e2;
  --color-surface-dynamic: #e2dfda;
  --color-divider:        #dcd9d5;
  --color-border:         #d0cdc7;

  --color-text:           #1a1917;
  --color-text-muted:     #6b6a66;
  --color-text-faint:     #a3a29e;
  --color-text-inverse:   #f7f6f2;

  --color-primary:        #01696f;
  --color-primary-hover:  #0c4e54;
  --color-primary-active: #0f3638;
  --color-primary-highlight: #cedcd8;
  --color-primary-subtle: rgba(1, 105, 111, 0.08);

  --color-success:        #437a22;
  --color-success-hover:  #2e5c10;
  --color-success-active: #1e3f0a;
  --color-success-highlight: #d4dfcc;
  --color-success-subtle: rgba(67, 122, 34, 0.08);

  --color-warning:        #b07a00;
  --color-warning-hover:  #8a5b00;
  --color-warning-active: #6b4500;
  --color-warning-highlight: #e9e0c6;
  --color-warning-subtle: rgba(176, 122, 0, 0.08);

  --color-error:          #a13544;
  --color-error-hover:    #782b33;
  --color-error-active:   #521f24;
  --color-error-highlight: #dececb;
  --color-error-subtle: rgba(161, 53, 68, 0.08);

  --color-blue:           #006494;
  --color-blue-hover:     #0b5177;
  --color-blue-active:    #0b3751;
  --color-blue-highlight: #c6d8e4;

  --color-purple:         #7a39bb;
  --color-purple-hover:   #5f2699;
  --color-purple-active:  #431673;
  --color-purple-highlight: #dacfde;

  --color-orange:         #da7101;
  --color-orange-hover:   #c55700;
  --color-orange-active:  #ac3e00;

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

html, body {
  height: 100%;
  overflow: hidden;
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  height: 100dvh;
}

.sidebar {
  grid-row: 1 / -1;
  background: var(--color-surface);
  border-right: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6) var(--space-4);
  z-index: 20;
}

.top-bar {
  grid-column: 2;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  z-index: 10;
  gap: var(--space-4);
  min-height: 56px;
}

.main-content {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6);
}

/* ============================================
   SIDEBAR
   ============================================ */

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  padding: var(--space-1) 0;
}

.logo svg {
  flex-shrink: 0;
}

.logo-text {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

.logo-sub {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 400;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition-interactive),
              color var(--transition-interactive);
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.nav-item.active {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

/* ============================================
   TOP BAR
   ============================================ */

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.top-bar-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sync-status {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-warning);
}

.sync-dot.synced {
  background: var(--color-success);
}

.sync-dot.syncing {
  animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-interactive),
              color var(--transition-interactive),
              box-shadow var(--transition-interactive),
              transform var(--transition-interactive);
  border: none;
  white-space: nowrap;
  min-height: 36px;
}

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

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  min-height: 28px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: background var(--transition-interactive),
              color var(--transition-interactive);
}

.btn-icon:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-error-subtle);
  color: var(--color-error);
}

.btn-danger:hover {
  background: var(--color-error);
  color: #fff;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-value {
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text);
  line-height: 1.1;
}

.card-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.card-trend.up {
  color: var(--color-success);
  background: var(--color-success-subtle);
}

.card-trend.down {
  color: var(--color-error);
  background: var(--color-error-subtle);
}

.card-trend.flat {
  color: var(--color-text-faint);
  background: var(--color-surface-dynamic);
}

/* ============================================
   KPI ROW
   ============================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-size: var(--text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   TEAM HERO
   ============================================ */

.team-hero {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
}

.team-score-big {
  font-size: var(--text-2xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
}

.team-score-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--space-1);
}

.team-hero-sparkline {
  flex: 1;
  max-width: 200px;
  height: 48px;
}

/* ============================================
   TABLE
   ============================================ */

.data-table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover {
  color: var(--color-text);
}

.data-table th.sorted {
  color: var(--color-primary);
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-interactive);
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--color-surface-offset);
}

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

/* ============================================
   AVATAR
   ============================================ */

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.avatar.lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-lg);
}

/* ============================================
   SCORE BADGE
   ============================================ */

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score-badge.high {
  background: var(--color-success-subtle);
  color: var(--color-success);
}

.score-badge.mid {
  background: var(--color-warning-subtle);
  color: var(--color-warning);
}

.score-badge.low {
  background: var(--color-error-subtle);
  color: var(--color-error);
}

/* ============================================
   DIMENSION BARS (mini inline bars)
   ============================================ */

.dim-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 24px;
}

.dim-bar {
  width: 16px;
  border-radius: 2px;
  transition: height 400ms var(--ease-golden);
  position: relative;
}

.dim-bar[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

/* ============================================
   TREND ARROW
   ============================================ */

.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trend-indicator.up { color: var(--color-success); }
.trend-indicator.down { color: var(--color-error); }
.trend-indicator.flat { color: var(--color-text-faint); }

.trend-indicator svg {
  width: 14px;
  height: 14px;
}

/* ============================================
   TABS (for scorecard view)
   ============================================ */

.tab-bar {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--space-6);
}

.tab-item {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-interactive),
              border-color var(--transition-interactive);
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--color-text);
}

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

/* ============================================
   FORMS (Setup tab)
   ============================================ */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  max-width: 60ch;
}

.form-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: border-color var(--transition-interactive),
              box-shadow var(--transition-interactive);
}

.form-input::placeholder {
  color: var(--color-text-faint);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
  align-items: end;
}

/* ============================================
   ENGINEER ROWS in setup
   ============================================ */

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

.engineer-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
}

.engineer-row .form-input {
  background: var(--color-surface);
}

/* ============================================
   SCORECARD
   ============================================ */

.scorecard-header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.scorecard-info {
  flex: 1;
}

.scorecard-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.scorecard-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.scorecard-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.radar-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dimension-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.dim-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.dim-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.dim-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.dim-card-score {
  font-size: var(--text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sub-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) 0;
  font-size: var(--text-xs);
}

.sub-metric-label {
  color: var(--color-text-muted);
}

.sub-metric-value {
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* ============================================
   ACTIVITY FEED
   ============================================ */

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.activity-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  font-size: var(--text-sm);
}

.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon svg {
  width: 14px;
  height: 14px;
}

.activity-icon.github {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.activity-icon.slack {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.activity-icon.linear {
  background: var(--color-purple-highlight);
  color: var(--color-purple);
}

.activity-text {
  color: var(--color-text-muted);
  flex: 1;
}

.activity-text strong {
  color: var(--color-text);
  font-weight: 600;
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
}

/* ============================================
   CHART CONTAINERS
   ============================================ */

.chart-container {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
}

.chart-container canvas {
  width: 100% !important;
  max-height: 300px;
}

.chart-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

/* ============================================
   METHODOLOGY
   ============================================ */

.methodology-content {
  max-width: 72ch;
}

.methodology-content h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.methodology-content h2:first-child {
  margin-top: 0;
}

.methodology-content h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

.methodology-content p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  line-height: 1.7;
}

.methodology-content ul {
  padding-left: var(--space-5);
  margin-bottom: var(--space-4);
}

.methodology-content li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  line-height: 1.6;
}

.methodology-content li strong {
  color: var(--color-text);
}

.weight-bar {
  display: flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 8px;
  background: var(--color-surface-dynamic);
  margin: var(--space-3) 0 var(--space-6);
}

.weight-segment {
  height: 100%;
  transition: width 600ms var(--ease-golden);
}

/* ============================================
   SKELETON LOADERS
   ============================================ */

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

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-offset) 25%,
    var(--color-surface-dynamic) 50%,
    var(--color-surface-offset) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-heading {
  height: 2em;
  width: 30%;
  margin-bottom: var(--space-4);
}

.skeleton-card {
  height: 100px;
  border-radius: var(--radius-lg);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 300ms var(--ease-golden);
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast.info { border-left: 3px solid var(--color-primary); }

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

.toast-exit {
  animation: toast-out 200ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}

/* ============================================
   EXPANDABLE RAW DATA
   ============================================ */

.expandable {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.expandable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-offset);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  transition: background var(--transition-interactive);
}

.expandable-header:hover {
  background: var(--color-surface-dynamic);
}

.expandable-header svg {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  transition: transform var(--transition-interactive);
}

.expandable.open .expandable-header svg {
  transform: rotate(180deg);
}

.expandable-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms var(--ease-golden);
}

.expandable.open .expandable-body {
  max-height: 600px;
}

.expandable-inner {
  padding: var(--space-4);
  font-size: var(--text-xs);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-4);
  color: var(--color-text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 48px;
  height: 48px;
}

.empty-state h3 {
  color: var(--color-text);
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
}

.empty-state p {
  max-width: 36ch;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

/* ============================================
   VIEW PANELS (hide/show)
   ============================================ */

.view-panel {
  display: none;
  opacity: 0;
}

.view-panel.active {
  display: block;
  animation: fade-panel 300ms var(--ease-golden) forwards;
}

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

/* ============================================
   STAGGER ANIMATION
   ============================================ */

.stagger-in > * {
  opacity: 0;
  animation: stagger-fade-in 400ms var(--ease-golden) forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-in > *:nth-child(2) { animation-delay: 50ms; }
.stagger-in > *:nth-child(3) { animation-delay: 100ms; }
.stagger-in > *:nth-child(4) { animation-delay: 150ms; }
.stagger-in > *:nth-child(5) { animation-delay: 200ms; }
.stagger-in > *:nth-child(6) { animation-delay: 250ms; }
.stagger-in > *:nth-child(7) { animation-delay: 300ms; }
.stagger-in > *:nth-child(8) { animation-delay: 350ms; }

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

/* ============================================
   SETUP SECTION STYLES
   ============================================ */

.setup-section {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.setup-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.setup-section-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.token-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

.mobile-toggle {
  display: none;
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    width: 260px;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    display: flex;
  }

  .mobile-toggle {
    display: flex;
  }

  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: oklch(0 0 0 / 0.5);
    z-index: 99;
  }

  .mobile-overlay.open {
    display: block;
  }

  .main-content {
    grid-column: 1;
    padding: var(--space-4);
  }

  .top-bar {
    grid-column: 1;
  }

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

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

  .engineer-row {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

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

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

  .team-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .data-table-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   MISC UTILITIES
   ============================================ */

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

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-primary { color: var(--color-primary); }

.font-mono {
  font-family: var(--font-mono);
}

.tabular-nums {
  font-variant-numeric: tabular-nums lining-nums;
}

/* Back button in scorecard */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  margin-bottom: var(--space-4);
  transition: color var(--transition-interactive);
  background: none;
  border: none;
}

.back-btn:hover {
  color: var(--color-primary);
}

.back-btn svg {
  width: 16px;
  height: 16px;
}
