@layer reset, base, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
  button, input, select, textarea { font: inherit; }
  button, a, input, select { touch-action: manipulation; }
  button { cursor: pointer; }
  a { color: inherit; text-decoration: none; }
  img, svg { display: block; max-width: 100%; }
  table { border-collapse: collapse; width: 100%; }
  ul, ol { padding-left: 1.3rem; margin: 0; }
  summary { cursor: pointer; }
}

@layer base {
  :root {
    --bg: #f7f9f6;
    --surface: #ffffff;
    --border: #eef2eb;
    --border-dark: #e2e8df;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --green-primary: #1b4332;
    --green-accent: #15803d;
    --green-light: #edf7ed;
    --red-primary: #dc2626;
    --red-light: #fee2e2;
    --orange-primary: #ea580c;
    --orange-light: #ffedd5;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 4px 12px rgba(27, 67, 50, 0.04);
  }

  body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3 {
    color: var(--text-primary);
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.025em;
  }

  p { color: var(--text-secondary); }

  :focus-visible {
    outline: 2px solid var(--green-accent);
    outline-offset: 2px;
  }

  input, select, textarea {
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 13px;
  }

  input[type="checkbox"] {
    accent-color: var(--green-primary);
  }
}

/* ==========================================================================
   APP SHELL & SIDEBAR
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 230px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px 20px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 28px;
  padding-left: 6px;
}

.brand-mark {
  background: var(--green-primary);
  color: #c4e2b9;
  font-size: 20px;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-style: italic;
  padding-bottom: 2px;
}

.brand-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.sidebar-nav, .sidebar-nav-secondary {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: #f3f5f2;
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--green-light);
  color: #1a4d2e;
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: #1a4d2e;
}

.nav-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-privacy-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.sidebar-privacy-box svg {
  color: var(--green-accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.privacy-title {
  font-weight: 600;
  color: #374151;
}

.privacy-desc {
  color: var(--text-light);
  font-size: 10px;
}

.status-dot-green {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.sidebar-logout-form {
  margin: 0;
}

/* ---------- Error pages (404/500 — rendered without request context) ---------- */

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.error-card {
  max-width: 460px;
  text-align: center;
}

.error-card .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--green-primary);
  text-decoration: none;
  margin-bottom: 36px;
}

.error-code {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--green-accent);
  margin-bottom: 12px;
}

.error-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.error-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 26px;
}

.error-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.sidebar-logout-btn {
  background: none;
  border: 0;
  padding: 4px 12px;
  color: var(--text-light);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s ease;
}

.sidebar-logout-btn:hover {
  color: var(--red-primary);
}

.workspace {
  margin-left: 230px;
  flex: 1;
  min-width: 0;
  background: var(--bg);
  min-height: 100vh;
}

.mobile-bar {
  display: none;
}

.main-content {
  padding: 32px 40px;
  max-width: 1040px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ==========================================================================
   BUTTONS, NOTICES & UTILITIES
   ========================================================================== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.button.primary {
  background: var(--green-primary);
  color: #ffffff;
}
.button.primary:hover {
  background: #143527;
}

.button.secondary {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-dark);
}
.button.secondary:hover {
  background: #f9fafb;
}

.button.small {
  padding: 6px 12px;
  font-size: 12px;
}

.button.full {
  width: 100%;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--green-accent);
}
.eyebrow.light-green {
  color: #c4e2b9;
}

.notice {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.notice.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notice.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.notice.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.notice a { font-weight: 600; text-decoration: underline; }

.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.demo-pill {
  background: #ecfdf5;
  color: #065f46;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
}
.demo-banner-link {
  margin-left: auto;
  color: var(--green-accent);
  font-weight: 600;
  text-decoration: none;
}

/* ==========================================================================
   FEED / DASHBOARD (Mockup 01)
   ========================================================================== */
.feed-container {
  width: 100%;
}

.mock-hero-card {
  position: relative;
  background: linear-gradient(135deg, #f3f7f0 0%, #eaf3e5 60%, #f6faf4 100%);
  border: 1px solid #dfe9dc;
  border-radius: 18px;
  padding: 28px 32px 24px;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.mock-hero-card::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 440px;
  height: 300px;
  background: radial-gradient(ellipse at center, rgba(180, 220, 168, 0.45) 0%, rgba(232, 242, 228, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 5;
  margin-bottom: 16px;
}

.hero-greeting {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-date-pill, .date-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.hero-center-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
  margin-bottom: 24px;
  gap: 20px;
}

.hero-heading {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0;
}

.hero-heading .green-text {
  color: #166534;
}

.hero-subtext {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 8px 0 0 0;
}

.hero-floating-stat {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #e2ebd9;
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(27, 67, 50, 0.06);
  flex-shrink: 0;
}

.stat-circle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-primary);
}

.stat-amount {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.hero-filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 4;
  align-items: center;
}

.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  background: #ffffff;
  color: #374151;
  border: 1px solid var(--border-dark);
  transition: all 0.15s ease;
  cursor: pointer;
}

.pill-chip:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.pill-chip.active {
  background: var(--green-primary);
  color: #ffffff;
  border-color: var(--green-primary);
}

.chip-count {
  opacity: 0.75;
  font-size: 11px;
}

.priority-filter {
  position: relative;
  display: inline-block;
}

.priority-filter summary {
  list-style: none;
}
.priority-filter summary::-webkit-details-marker {
  display: none;
}

.priority-filter-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  z-index: 50;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.period-menu {
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
}

.period-option {
  display: block;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}

.period-option:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.period-option.active {
  background: var(--green-light);
  color: var(--green-primary);
  font-weight: 600;
}

.period-option.locked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
}

.period-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green-primary);
  white-space: nowrap;
}

.period-picker summary {
  cursor: pointer;
}

.empty-state-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Issue Rows List matching Mockup 01 */
.issues-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.issue-card {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 22px;
  text-decoration: none;
  box-shadow: var(--shadow-subtle);
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.issue-card:hover {
  background: #fafcf9;
  border-color: #dbe4d7;
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.issue-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 18px;
}

.issue-badge .severity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.severity-critical .issue-badge { background: var(--red-light); }
.severity-critical .severity-dot { background: var(--red-primary); }
.severity-critical .issue-amount { color: var(--red-primary); }

.severity-high .issue-badge { background: var(--orange-light); }
.severity-high .severity-dot { background: var(--orange-primary); }
.severity-high .issue-amount { color: var(--orange-primary); }

.severity-medium .issue-badge { background: #dcfce7; }
.severity-medium .severity-dot { background: #16a34a; }
.severity-medium .issue-amount { color: #15803d; }

.issue-main {
  flex: 1 1 auto;
  min-width: 0;
  margin-right: 24px;
}

.issue-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0 0 3px 0;
}
.issue-title a {
  color: var(--text-primary);
  text-decoration: none;
}
.issue-title a:hover {
  color: var(--green-accent);
}

.status-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  vertical-align: 2px;
  margin-left: 6px;
}

.status-chip.resolved {
  background: var(--green-light);
  color: var(--green-accent);
}

.status-chip.investigating {
  background: var(--orange-light);
  color: var(--orange-primary);
}

.status-chip.dismissed {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
}

.status-chip.locked-chip {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
}

.issue-card.locked {
  opacity: 0.85;
}

.issue-card.locked .issue-title {
  color: var(--text-muted);
}

.lock-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border-dark);
  color: var(--text-muted);
}

.lock-chevron {
  color: var(--text-muted);
}

.upgrade-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 20px 24px;
  background: var(--green-deep, #1b4332);
  color: #fff;
  border-radius: 16px;
}

.upgrade-card strong {
  display: block;
  font-size: 15px;
}

.upgrade-card span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.85;
  max-width: 560px;
}

.upgrade-card .button.primary {
  flex-shrink: 0;
  background: #fff;
  color: #1b4332;
}

.locked-panel {
  text-align: center;
  padding: 48px 32px;
}

.locked-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green-accent);
  margin-bottom: 16px;
}

.locked-panel h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

.locked-panel p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 520px;
  margin: 0 auto 18px;
  line-height: 1.6;
}

.locked-list {
  list-style: none;
  margin: 0 auto 24px;
  padding: 0;
  max-width: 360px;
  text-align: left;
}

.locked-list li {
  font-size: 13px;
  color: var(--text);
  padding: 7px 0 7px 24px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.locked-list li::before {
  content: "🔒";
  position: absolute;
  left: 0;
  font-size: 11px;
  top: 9px;
}

@media (max-width: 680px) {
  .upgrade-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

.issue-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.issue-category {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
  margin-right: 28px;
}

.category-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.issue-amount {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  text-align: right;
  min-width: 95px;
  margin-right: 16px;
}

.issue-chevron {
  color: var(--text-light);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.issue-card:hover .issue-chevron {
  color: var(--text-primary);
  transform: translateX(3px);
}

.feed-footer-notes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  font-size: 12px;
  color: var(--text-muted);
}

.feed-footer-notes a {
  color: var(--green-accent);
  font-weight: 600;
}

/* ==========================================================================
   FINDING DETAIL (Mockup 02)
   ========================================================================== */
.detail-container {
  width: 100%;
}

.detail-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.detail-breadcrumb-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.detail-header-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 22px;
}

.detail-severity-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}
.detail-severity-pill.severity-critical { background: var(--red-light); color: var(--red-primary); }
.detail-severity-pill.severity-high { background: var(--orange-light); color: var(--orange-primary); }
.detail-severity-pill.severity-medium { background: #dcfce7; color: #166534; }
.detail-severity-pill .severity-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.detail-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.detail-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.detail-impact-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  text-align: right;
  box-shadow: var(--shadow-subtle);
  min-width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.detail-impact-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.detail-impact-caption {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 12px;
}

.product-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #edf4e8;
  display: grid;
  place-items: center;
}

.detail-tab-bar {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.detail-tab {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding-bottom: 10px;
  text-decoration: none;
}
.detail-tab.active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 2px solid var(--green-primary);
}

.detail-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.detail-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-subtle);
  box-sizing: border-box;
}

.detail-panel + .detail-panel,
.finding-stat-strip + .detail-panel {
  margin-top: 16px;
}

.finding-stat-strip {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.fstat {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fstat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.fstat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.fstat-red {
  color: var(--red-primary);
}

.fstat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

.fstat-sub.fstat-red {
  font-weight: 600;
}

.finding-narrative {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 10px 0 0;
  max-width: 720px;
}

.driver-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.driver-tile {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #fdfefd;
}

.driver-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #fdeeee;
  color: #b91c1c;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.driver-tile-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.driver-tile-delta {
  font-size: 16px;
  font-weight: 700;
  color: var(--red-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.driver-tile-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Feed stat strip + breakdown */
.feed-stat-strip {
  margin: 16px 0;
}

.severity-mix {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-weight: 600;
}

.sev-critical { color: var(--red-primary); }
.sev-high { color: var(--orange-primary); }
.sev-medium { color: #15803d; }

.leak-breakdown {
  margin-bottom: 20px;
}

.breakdown-rows {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f5f1;
  text-decoration: none;
}

.breakdown-row:last-child {
  border-bottom: 0;
}

.breakdown-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #eef4ea;
  color: #4a6a55;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.breakdown-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 0 0 148px;
}

.breakdown-count {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 64px;
}

.breakdown-meter {
  flex: 1;
  min-width: 40px;
}

.breakdown-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--red-primary);
  font-variant-numeric: tabular-nums;
  min-width: 90px;
  text-align: right;
}

.breakdown-total {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-secondary);
}

.breakdown-total strong {
  color: var(--red-primary);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .breakdown-name {
    flex-basis: 104px;
    font-size: 12.5px;
  }

  .breakdown-amount {
    min-width: 70px;
  }
}

.look-first-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 22px 0 12px;
  flex-wrap: wrap;
}

.look-first-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.look-first-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.view-all-row {
  display: flex;
  justify-content: center;
  margin: 18px 0 4px;
}

.view-all-btn {
  min-width: 220px;
}

.panel-header-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.panel-title-mini, .panel-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.margin-shift {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}
.margin-prev { color: var(--text-primary); }
.margin-arrow { color: var(--text-light); }
.margin-curr { color: var(--red-primary); }

.margin-chart-wrap {
  width: 100%;
}
.margin-line-chart {
  width: 100%;
  height: 110px;
}
.chart-dates {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 8px;
}

.key-numbers-list {
  display: flex;
  flex-direction: column;
}

.key-number-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f3f5f1;
  font-size: 13px;
}
.key-number-label { color: var(--text-secondary); }
.key-number-value { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.key-number-row.highlight-loss { border-bottom: 0; padding-top: 12px; margin-top: 4px; }
.red-loss { color: var(--red-primary); font-size: 16px; font-weight: 700; }

.drivers-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

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

.driver-icon-pill {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--orange-light);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.driver-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.diagnosis-callout {
  background: #edf5ea;
  border: 1px solid #d4e5d0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 14px;
}

.callout-label {
  font-size: 11px;
  font-weight: 700;
  color: #1a4d2e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}
.diagnosis-callout p {
  margin: 0;
  font-size: 13px;
  color: #2d4a34;
  line-height: 1.45;
}

.steps-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.step-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #fafbfa;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.step-num-badge {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--border-dark);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.step-text-content { flex: 1; min-width: 0; }
.step-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border-radius: 99px;
  flex-shrink: 0;
}

.tag-check { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border-dark); }
.tag-fix { background: var(--green-light); color: var(--green-primary); }
.tag-keep { background: var(--orange-light); color: var(--orange-primary); }

.step-title-bold { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.step-detail-sub { font-size: 12px; color: var(--text-muted); line-height: 1.35; margin-top: 2px; }
.step-arrow-icon { color: var(--text-light); flex-shrink: 0; }

.finding-status-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.status-label { font-size: 12px; color: var(--text-muted); }

/* Audit Drawers */
.audit-drawers {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audit-drawer {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.audit-drawer summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.audit-drawer summary::-webkit-details-marker { display: none; }
.drawer-chevron { color: var(--text-light); transition: transform 0.15s ease; }
.audit-drawer[open] .drawer-chevron { transform: rotate(180deg); }

.drawer-content {
  padding: 0 20px 20px;
  border-top: 1px solid #f3f5f1;
}
.drawer-help { font-size: 12px; color: var(--text-muted); margin: 12px 0; }

.table-scroll {
  overflow-x: auto;
}
table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
table td {
  font-size: 13px;
  padding: 10px 12px;
  border-bottom: 1px solid #f3f5f1;
}
table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
table tr.total-row td {
  font-weight: 700;
  border-top: 1px solid var(--border-dark);
}

.formula-box {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
}
.formula-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}
.formula-box p { font-size: 12px; font-family: monospace; color: var(--text-secondary); margin: 0; }

.tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 12px;
}
.clean-list {
  list-style: none;
  padding: 0;
  margin-top: 6px;
}
.clean-list li {
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0;
}
.drawer-footer-actions {
  display: flex;
  gap: 18px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f3f5f1;
}
.text-link {
  color: var(--green-accent);
  font-weight: 600;
  font-size: 12px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   OVERVIEW (Mockup 03)
   ========================================================================== */
.overview-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-subtle);
}

.kpi-card-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 6px 0 4px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-card-sub {
  font-size: 11.5px;
  color: var(--text-light);
  margin: -2px 0 8px;
}

.kpi-card-change {
  font-size: 12px;
  font-weight: 600;
}
.kpi-card-change.delta-up { color: #15803d; }
.kpi-card-change.delta-down { color: var(--red-primary); }
.kpi-card-change.delta-flat { color: var(--text-muted); font-weight: 500; }

/* Full-width contribution chart */
.chart-card {
  margin-bottom: 20px;
}
.contrib-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-wrap {
  position: relative;
}

.chart-dot {
  fill: #1b4332;
  transition: r 0.12s ease;
}

.chart-dot.loss {
  fill: #dc2626;
}

.chart-dot.active {
  r: 6;
  stroke: #fff;
  stroke-width: 2;
}

.chart-zone {
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #1b4332;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  padding: 7px 11px;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  z-index: 5;
}

.chart-tooltip strong {
  font-size: 13px;
}

.chart-tooltip span {
  opacity: 0.75;
  font-size: 11px;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.chart-legend i {
  display: inline-block;
  vertical-align: -1px;
  margin-right: 5px;
}

.legend-line {
  width: 14px;
  height: 2px;
  background: #1b4332;
  border-radius: 2px;
}

.legend-avg {
  width: 14px;
  height: 0;
  border-top: 2px dashed rgba(27, 67, 50, 0.45);
}

.legend-loss {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #dc2626;
}

/* Bottom two-column row */
.overview-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

/* ==========================================================================
   SETUP / ONBOARDING (Mockup 04)
   ========================================================================== */
.setup-page {
  min-height: 100vh;
  background: radial-gradient(circle at 10% 20%, #ebf4e6 0%, #f7f9f6 40%);
  display: flex;
  flex-direction: column;
}

.setup-header {
  padding: 28px 40px;
}

.setup-center-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 24px 60px;
}

.setup-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 48px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(27, 67, 50, 0.05);
  text-align: center;
  box-sizing: border-box;
}

.setup-badge-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #edf7ed;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
}

.setup-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.setup-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.setup-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  position: relative;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.timeline-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3f5f2;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--text-muted);
}
.timeline-step.active .timeline-step-icon {
  background: var(--green-primary);
  color: #ffffff;
}

.timeline-step-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-step-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.timeline-step-arrow {
  color: var(--text-light);
  margin-top: -20px;
}

.setup-footnote-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 18px;
}

/* Overview page styles */
.overview-container {
  width: 100%;
}
.overview-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  position: relative;
  z-index: 5;
}
.overview-heading {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  letter-spacing: -0.025em;
}
.overview-subheading {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}
.overview-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 20px;
}
.overview-col-left, .overview-col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.overview-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow-subtle);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.card-header-clean {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.card-title-clean {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.card-subtitle-clean {
  font-size: 12px;
  color: var(--text-muted);
}
.card-meta-text {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.card-action-link {
  font-size: 12px;
  color: var(--green-accent);
  font-weight: 600;
}

/* Simple bar chart */
.barchart-container {
  padding: 12px 0 6px;
  width: 100%;
}
.barchart-svg {
  width: 100%;
  height: 130px;
}

.clean-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.clean-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f3f5f1;
  font-size: 13px;
}
.clean-table th:first-child,
.clean-table td:first-child {
  padding-left: 0;
}
.clean-table th:last-child,
.clean-table td:last-child {
  padding-right: 0;
}
.clean-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.clean-table tr.total-row td {
  font-weight: 700;
  border-top: 1px solid var(--border-dark);
}

.top-issues-mini-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mini-issue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s ease;
}
.mini-issue-row:hover {
  background: #f9fafb;
}
.mini-issue-tile {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.mini-issue-tile.severity-critical { background: var(--red-light); color: var(--red-primary); }
.mini-issue-tile.severity-high { background: var(--orange-light); color: var(--orange-primary); }
.mini-issue-tile.severity-medium { background: #dcfce7; color: #166534; }

.mini-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.mini-amount {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.mini-amount.severity-critical { color: var(--red-primary); }
.mini-amount.severity-high { color: var(--orange-primary); }
.mini-amount.severity-medium { color: var(--green-accent); }
.mini-chevron {
  color: var(--text-light);
  flex-shrink: 0;
}

/* Key takeaways */
.takeaways-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.takeaway-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.takeaway-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.takeaway-icon.tone-up { background: #dcfce7; color: #15803d; }
.takeaway-icon.tone-down { background: var(--orange-light); color: var(--orange-primary); }
.takeaway-icon.tone-warn { background: var(--red-light); color: var(--red-primary); }
.takeaway-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.takeaway-body {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 2px;
}

.coverage-stat-box {
  padding: 6px 0 10px;
}
.coverage-ratio {
  font-size: 26px;
  color: var(--text-primary);
}
.coverage-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.missing-items-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.missing-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.missing-list {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 18px;
  margin: 6px 0 12px;
}

.setup-install-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.setup-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  text-align: center;
  box-sizing: border-box;
}

/* Auth layout */
.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: #ffffff;
  width: 100%;
  box-sizing: border-box;
}
.auth-story {
  background: var(--green-primary);
  color: #ffffff;
  padding: 60px 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-story .brand-mark {
  background: rgba(255, 255, 255, 0.15);
  color: #c4e2b9;
}
.auth-story .brand-text {
  color: #ffffff;
}
.auth-story h1 {
  font-size: 38px;
  color: #ffffff;
  line-height: 1.2;
  margin: 16px 0;
  letter-spacing: -0.03em;
}
.auth-story p {
  color: #c1d5c7;
  font-size: 15px;
  line-height: 1.6;
}
.auth-story small {
  color: #8fa896;
  font-size: 12px;
}
.auth-form {
  padding: 60px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.auth-form h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 20px 0 6px 0;
}
.auth-form p.muted {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.auth-form form p {
  margin-bottom: 18px;
}
.auth-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.auth-form input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dark);
  box-sizing: border-box;
}
.auth-switch {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}
.auth-switch a {
  color: var(--green-accent);
  font-weight: 600;
}

/* ==========================================================================
   COSTS & DATA (Mockup 04)
   ========================================================================== */
.costs-container {
  width: 100%;
}

.costs-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.costs-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.costs-tab:hover {
  background: #eef2ea;
  color: var(--text-primary);
}

.costs-tab.active {
  background: var(--green-primary);
  color: #ffffff;
  font-weight: 600;
}

.cost-rows-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
}

.cost-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid #f3f5f1;
  text-decoration: none;
  transition: background 0.15s ease;
}

.cost-row:last-child {
  border-bottom: 0;
}

.cost-row:hover {
  background: #fafcf9;
}

.cost-icon-tile {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #eef4ea;
  color: #4a6a55;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cost-row-main {
  flex: 1;
  min-width: 0;
}

.cost-row-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.cost-row-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cost-row-status {
  text-align: right;
  flex-shrink: 0;
}

.cost-status {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.cost-status-ok { color: #15803d; }
.cost-status-missing { color: var(--orange-primary); }
.cost-status-optional { color: var(--text-muted); }

.cost-status-detail {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cost-row-chevron {
  color: var(--text-light);
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.cost-row:hover .cost-row-chevron {
  color: var(--text-primary);
  transform: translateX(3px);
}

.setting-details {
  border-bottom: 1px solid #f3f5f1;
}

.setting-details:last-child {
  border-bottom: 0;
}

.setting-details summary.cost-row {
  border-bottom: 0;
  cursor: pointer;
  list-style: none;
}

.setting-details summary.cost-row::-webkit-details-marker {
  display: none;
}

.setting-details[open] summary.cost-row {
  background: #fafcf9;
}

.setting-details[open] summary.cost-row .cost-row-chevron {
  transform: rotate(90deg);
  color: var(--text-primary);
}

.setting-row-body {
  padding: 0 22px 20px 76px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.setting-row-body p {
  margin: 0 0 8px;
  max-width: 560px;
}

.setting-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 0 0 10px;
}

.setting-facts div {
  min-width: 140px;
}

.setting-facts dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
}

.setting-facts dd {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-primary);
}

.text-link {
  color: var(--green-primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.text-link:hover {
  text-decoration: underline;
}

.text-link.danger {
  color: #b91c1c;
}

.setting-signout {
  margin: 10px 0 0;
}

.data-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 14px;
  background: #e8f4e4;
  border: 1px solid #d3e6cd;
}

.data-banner.warn {
  background: #fffbeb;
  border-color: #fde68a;
}

.banner-check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  display: grid;
  place-items: center;
  color: #15803d;
  flex-shrink: 0;
}

.data-banner.warn .banner-check {
  color: #d97706;
}

.banner-text {
  flex: 1;
  min-width: 0;
}

.banner-text h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.banner-text p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.data-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.billing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.billing-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 26px;
  box-shadow: var(--shadow-subtle);
}

.billing-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.billing-plan-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.billing-plan-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.billing-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.billing-pill.active {
  background: #dcfce7;
  color: #15803d;
}

.billing-pill.inactive {
  background: #f1f5f1;
  color: var(--text-muted);
}

.billing-price {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 12px 0 2px;
  letter-spacing: -0.02em;
}

.billing-price span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.billing-plan-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0 0;
  max-width: 320px;
}

.billing-actions {
  margin: 18px 0 12px;
}

.plan-tiers {
  list-style: none;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid #f3f5f1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-tiers li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-tiers strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.usage-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.usage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

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

.usage-meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eef2ec;
  border: 0;
}

.usage-meter::-webkit-meter-bar {
  background: #eef2ec;
  border: 0;
  border-radius: 999px;
  height: 8px;
}

.usage-meter::-webkit-meter-optimum-value,
.usage-meter::-webkit-meter-suboptimum-value,
.usage-meter::-webkit-meter-even-less-good-value {
  background: var(--green-primary);
  border-radius: 999px;
}

.usage-meter::-moz-meter-bar {
  background: var(--green-primary);
  border-radius: 999px;
}

.included-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.included-list li {
  font-size: 13.5px;
  color: var(--text-secondary);
  padding-left: 26px;
  position: relative;
}

.included-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #e8f4e4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='3.4'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 9px;
  background-repeat: no-repeat;
  background-position: center;
}

.billing-contact .billing-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #eef4ea;
  color: #4a6a55;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.billing-contact-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.billing-contact p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 18px;
  max-width: 280px;
}

.clean-list.spacious li {
  padding: 7px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.data-source-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f3f5f1;
}

.card-body-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.upload-form p {
  margin-bottom: 14px;
}

.upload-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f5f1;
  font-size: 13px;
  color: var(--text-secondary);
}

.history-row:last-child {
  border-bottom: 0;
}

.quality-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f0f4ee;
  color: #4a6a55;
  font-size: 11px;
  font-weight: 600;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

/* ==========================================================================
   UTILITY & LEGACY PAGE CLASSES
   ========================================================================== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--green-primary);
  color: #ffffff;
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 10px;
  top: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fine-print {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 18px;
  line-height: 1.5;
}

.fine-print a {
  color: var(--green-accent);
}

.panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow-subtle);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.panel-heading h2 {
  font-size: 15px;
  margin: 0;
}

.panel-heading p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.page-heading h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 4px 0 6px;
}

.page-heading p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 18px;
}

.table-panel {
  margin-top: 20px;
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-list {
  list-style: none;
  padding: 0;
}

.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid #f3f5f1;
  font-size: 13px;
}

.detail-list li:last-child {
  border-bottom: 0;
}

.data-list {
  list-style: none;
  padding: 0;
}

.data-list li {
  padding: 9px 0;
  border-bottom: 1px solid #f3f5f1;
  font-size: 13px;
  color: var(--text-secondary);
}

.data-list li:last-child {
  border-bottom: 0;
}

.onboarding-checklist {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-light);
  color: #1a4d2e;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.narrow {
  max-width: 560px;
}

.tinted {
  background: #f6f9f4;
}

.main-content form:not(.priority-filter-dropdown):not(.sidebar-logout-form) p {
  margin-bottom: 14px;
}

.main-content form:not(.priority-filter-dropdown):not(.sidebar-logout-form) label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

ul.errorlist {
  list-style: none;
  padding: 0;
  margin: 4px 0 10px;
  color: var(--red-primary);
  font-size: 12px;
}

.helptext {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   SETUP SHELL (onboarding flow)
   ========================================================================== */
.setup-brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
}

.setup-brand .brand {
  margin-bottom: 0;
  padding-left: 0;
}

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

.setup-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.setup-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-size: 12px;
  color: var(--text-muted);
}

.setup-progress span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.setup-progress b {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef2ea;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}

.setup-progress span.current {
  color: var(--text-primary);
  font-weight: 600;
}

.setup-progress span.current b {
  background: var(--green-primary);
  color: #ffffff;
}

.setup-progress span.complete b {
  background: #dcfce7;
  color: #166534;
}

.setup-progress i {
  width: 28px;
  height: 1px;
  background: var(--border-dark);
}

.setup-card h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  text-align: center;
}

.setup-intro {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 22px;
  text-align: center;
}

.setup-form p {
  margin-bottom: 14px;
  text-align: left;
}

.setup-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.setup-form input:not([type='checkbox']):not([type='hidden']),
.setup-form select,
.setup-form textarea {
  width: 100%;
  box-sizing: border-box;
}

.setup-note {
  background: #f6f9f4;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
  text-align: left;
}

.setup-skip {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--green-accent);
  font-weight: 600;
  margin-top: 14px;
}

.setup-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 14px;
  text-align: center;
  line-height: 1.5;
}

.setup-preview {
  margin-bottom: 18px;
}

.setup-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 16px 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  display: inline-block;
}

.setup-footnote {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  margin-top: 16px;
  max-width: 420px;
  line-height: 1.5;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .overview-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .overview-bottom-grid {
    grid-template-columns: 1fr;
  }
  .data-overview-grid {
    grid-template-columns: 1fr;
  }
  .billing-grid {
    grid-template-columns: 1fr;
  }
  .finding-stat-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .driver-tiles {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .hero-heading { font-size: 26px; }
  .detail-grid-row { grid-template-columns: 1fr; }
  .detail-header-card { flex-direction: column; }
  .detail-impact-box { width: 100%; align-items: flex-start; text-align: left; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .workspace {
    margin-left: 0;
  }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
  }
  .mobile-menu {
    background: none;
    border: 0;
    font-size: 20px;
  }
  .main-content {
    padding: 20px;
  }
  .hero-center-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .issue-card {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }
  .issue-category {
    margin-right: 0;
  }
  .overview-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-card-value {
    font-size: 20px;
  }

  .overview-main-grid,
  .overview-bottom-grid,
  .data-overview-grid,
  .two-columns {
    grid-template-columns: 1fr;
  }
  .billing-grid {
    grid-template-columns: 1fr;
  }
  .cost-row {
    flex-wrap: wrap;
  }
  .cost-row-status {
    text-align: left;
  }
  .setting-row-body {
    padding-left: 22px;
  }
  .setting-facts div {
    min-width: 120px;
  }
  .finding-stat-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .fstat {
    padding: 14px 16px;
  }
  .fstat-value {
    font-size: 20px;
  }
  .driver-tiles {
    grid-template-columns: 1fr;
  }
  .breakdown-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .breakdown-meter {
    flex-basis: 100%;
    order: 5;
  }
  .breakdown-amount {
    margin-left: auto;
    min-width: 0;
  }
  .breakdown-count {
    min-width: 0;
  }
  .look-first-head {
    flex-direction: column;
    gap: 2px;
  }
  .data-banner {
    flex-wrap: wrap;
  }
  .page-heading {
    flex-direction: column;
  }
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-story {
    display: none;
  }
  .auth-form {
    padding: 40px 20px;
    max-width: 100%;
  }
  .overview-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .overview-heading {
    font-size: 24px;
  }
  .demo-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .demo-banner-link {
    margin-left: 0;
  }
  .kpi-card-change {
    font-size: 11px;
  }
}

.plan-tier-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.plan-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  opacity: 0.7;
}

.locked-tile {
  background: var(--bg);
  border: 1px solid var(--border-dark);
  color: var(--text-muted);
}

/* Manual product-cost entry — the no-CSV path. */
.cost-entry-table td {
  vertical-align: middle;
}

.cost-missing td {
  background: rgba(176, 74, 36, 0.04);
}

.cost-needed {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--orange-primary);
}

.cost-input {
  width: 110px;
  padding: 6px 10px;
  border: 1px solid var(--border-dark);
  border-radius: 7px;
  font: inherit;
  text-align: right;
  background: var(--surface);
}

.cost-input:focus {
  outline: 2px solid var(--green-primary);
  outline-offset: -2px;
  border-color: var(--green-primary);
}

.cost-entry-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.cost-entry-date {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.cost-entry-date label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-secondary);
}

.cost-entry-date input {
  padding: 6px 10px;
  border: 1px solid var(--border-dark);
  border-radius: 7px;
  font: inherit;
  background: var(--surface);
}

.cost-entry-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* CSV import as a dropdown button — its fields bind to the #csv-upload form
   element so no forms are nested. */
.csv-inline {
  position: relative;
}

.csv-inline > summary {
  list-style: none;
  cursor: pointer;
}

.csv-inline > summary::-webkit-details-marker {
  display: none;
}

.csv-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 300px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 6;
}

.csv-panel-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.csv-field {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.csv-field select,
.csv-field input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 10px;
  border: 1px solid var(--border-dark);
  border-radius: 7px;
  font: inherit;
  font-weight: 400;
  background: var(--surface);
}

/* Refresh-analysis action bar — a container so the button isn't a loose orphan. */
.cost-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cost-actions-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Data-overview coverage rows — the cost-row look without link affordances. */
.data-rows {
  margin: 4px -24px 0;
}

.data-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid #f3f5f1;
}

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

.data-row .cost-row-status {
  text-align: right;
}

.data-row .cost-status {
  font-size: 12.5px;
  font-weight: 600;
}

/* Card footer holding an action — mirrors the Shopify connection meta row. */
.data-card-footer {
  justify-content: space-between;
  margin: 8px -24px -22px;
  padding: 12px 24px;
}

/* Plan comparison carousel on the billing page. */
.plans-carousel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.plans-carousel-sub {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.plans-nav {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.plans-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-dark);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, opacity 0.15s;
}

.plans-arrow:hover:not(:disabled) {
  border-color: var(--green-accent);
  color: var(--green-primary);
}

.plans-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.plans-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 24px;
  scrollbar-width: none;
  margin: 14px -24px 0;
  padding: 14px 24px 4px;
}

.plans-carousel::-webkit-scrollbar {
  display: none;
}

.plan-card {
  flex: 0 0 clamp(240px, calc((100% - 84px) / 3), 300px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.plan-card:hover {
  border-color: var(--border-dark);
}

.plan-card.featured {
  border-color: var(--green-accent);
  box-shadow: 0 8px 24px rgba(21, 128, 61, 0.08);
}

.plan-card.current {
  background: #f7faf6;
  border-color: var(--green-accent);
}

.plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}

.plan-card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.plan-pill {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.rec-pill {
  background: var(--green-primary);
  color: #ffffff;
}

.current-pill {
  background: #e3eee2;
  color: var(--green-primary);
}

.plan-card-price {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin: 10px 0 2px;
}

.plan-card-price span {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-left: 4px;
}

.plan-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  min-height: 38px;
  margin: 0 0 10px;
}

.plan-card-limit {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green-primary);
  margin-bottom: 4px;
}

.plan-card-features {
  list-style: none;
  margin: 0 0 16px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 2.1;
}

.plan-card-features li::before {
  content: '✓';
  font-size: 10.5px;
  font-weight: 700;
  color: var(--green-accent);
  margin-right: 7px;
}

.plan-card form {
  margin-top: auto;
}

.plan-card-cta {
  margin-top: auto;
  opacity: 0.65;
  cursor: default;
}

@media (max-width: 640px) {
  .plan-card {
    flex-basis: 76%;
  }
}

.plans-carousel-note {
  margin-top: 14px;
}

/* Current-plan hero — subtle green tint so the plan card reads as "yours". */
.billing-hero {
  background: linear-gradient(135deg, #f0f7ee 0%, #ffffff 60%);
  border-color: #cfe3cd;
}

.billing-hero-tile {
  margin-right: 2px;
}

/* Usage rows — icon tile + meter, warn/over states. */
.usage-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.usage-main {
  flex: 1;
  min-width: 0;
}

.usage-tile {
  flex-shrink: 0;
  margin-top: 1px;
}

.usage-value-warn {
  color: var(--orange-primary);
}

.usage-value-over {
  color: var(--orange-primary);
}

.usage-meter.meter-warn::-webkit-meter-optimum-value,
.usage-meter.meter-warn::-webkit-meter-suboptimum-value,
.usage-meter.meter-warn::-webkit-meter-even-less-good-value {
  background: var(--orange-primary);
}

.usage-meter.meter-warn::-moz-meter-bar {
  background: var(--orange-primary);
}

.usage-meter.meter-over::-webkit-meter-optimum-value,
.usage-meter.meter-over::-webkit-meter-suboptimum-value,
.usage-meter.meter-over::-webkit-meter-even-less-good-value {
  background: #c2410c;
}

.usage-meter.meter-over::-moz-meter-bar {
  background: #c2410c;
}

.usage-note {
  display: block;
  font-size: 11.5px;
  color: var(--orange-primary);
  margin-top: 6px;
}

/* Carousel edge fades + pill that can never be squeezed. */
.plans-carousel {
  --fade-l: 0px;
  --fade-r: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
}

.plans-carousel.can-scroll-left {
  --fade-l: 36px;
}

.plans-carousel.can-scroll-right {
  --fade-r: 56px;
}

.plan-pill {
  flex: none;
}

/* Setup progress — on narrow screens show circles + the current step's label. */
@media (max-width: 560px) {
  .setup-progress {
    justify-content: center;
    gap: 8px;
  }

  .setup-progress span:not(.current) {
    font-size: 0;
    gap: 0;
  }

  .setup-progress i {
    width: 16px;
    flex-shrink: 0;
  }
}

/* ── Motion — subtle entrance + feedback, disabled for reduced-motion ── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

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

  @keyframes menu-in {
    from { opacity: 0; transform: translateY(-5px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes draw-line {
    to { stroke-dashoffset: 0; }
  }

  @keyframes pop-dot {
    from { opacity: 0; transform: scale(0.3); }
    to { opacity: 1; transform: scale(1); }
  }

  @keyframes stat-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.28); }
    55% { box-shadow: 0 0 0 9px rgba(21, 128, 61, 0); }
  }

  /* Cards and panels ease in on page load */
  .overview-card, .detail-panel, .billing-card, .kpi-card,
  .issue-card, .setup-card, .upgrade-card, .step-card, .error-card,
  .panel, .detail-header-card, .driver-tile, .cost-rows-panel,
  .data-row, .notice, .plans-carousel {
    animation: rise-in 0.45s cubic-bezier(0.2, 0.6, 0.3, 1) both;
  }

  /* Finding-detail driver tiles and cost rows cascade */
  .driver-tile:nth-child(2) { animation-delay: 0.06s; }
  .driver-tile:nth-child(3) { animation-delay: 0.12s; }
  .data-rows .data-row:nth-child(2) { animation-delay: 0.05s; }
  .data-rows .data-row:nth-child(3) { animation-delay: 0.1s; }

  /* Stagger rows and grids so they cascade, not jump */
  .overview-kpi-row .kpi-card:nth-child(2) { animation-delay: 0.05s; }
  .overview-kpi-row .kpi-card:nth-child(3) { animation-delay: 0.1s; }
  .overview-kpi-row .kpi-card:nth-child(4) { animation-delay: 0.15s; }
  .billing-grid .billing-card:nth-child(2) { animation-delay: 0.06s; }
  .billing-grid .billing-card:nth-child(3) { animation-delay: 0.11s; }
  .billing-grid .billing-card:nth-child(4) { animation-delay: 0.16s; }
  .data-overview-grid .overview-card:nth-child(2) { animation-delay: 0.07s; }
  .issues-list .issue-card:nth-child(2) { animation-delay: 0.04s; }
  .issues-list .issue-card:nth-child(3) { animation-delay: 0.08s; }
  .issues-list .issue-card:nth-child(4) { animation-delay: 0.12s; }
  .issues-list .issue-card:nth-child(5) { animation-delay: 0.16s; }
  .issues-list .issue-card:nth-child(6) { animation-delay: 0.2s; }
  .issues-list .issue-card:nth-child(n+7) { animation-delay: 0.24s; }

  /* Dropdown menus spring open */
  details[open] .priority-filter-dropdown {
    animation: menu-in 0.16s ease-out;
    transform-origin: top right;
  }

  /* Contribution chart — line draws, area fades, dots pop */
  .contrib-chart .chart-line-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: draw-line 0.9s 0.15s ease-out forwards;
  }

  .contrib-chart .chart-area-path {
    opacity: 0;
    animation: fade-in 0.55s 0.6s ease-out forwards;
  }

  .contrib-chart .chart-dot {
    transform-box: fill-box;
    transform-origin: center;
    animation: pop-dot 0.3s 0.75s cubic-bezier(0.2, 0.6, 0.3, 1.4) both;
  }

  /* The floating "profit at risk" stat breathes gently */
  .stat-circle-dot {
    animation: stat-pulse 2.6s ease-in-out infinite;
  }

  /* Buttons lift a touch on hover */
  .button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.22);
  }

  .button.secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
  }
}

/* Stat-strip links act as quiet filters (severity mix + progress). */
.sev-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.sev-link:hover {
  border-bottom-color: currentColor;
}

.sev-link.active {
  font-weight: 700;
  border-bottom-color: currentColor;
}
