:root {
  --bg: #f3f7f9;
  --bg-elevated: #edf5f8;
  --surface: #ffffff;
  --surface-alt: #f8fafb;
  --surface-strong: #eaf4f6;
  --text: #17212f;
  --text-soft: #465669;
  --muted: #6e8190;
  --border: #dfe9ee;
  --border-strong: #cfe1e8;
  --primary: #1f7a8c;
  --primary-strong: #145a6b;
  --primary-soft: #dff5f7;
  --success: #1d8c63;
  --success-soft: #e8f8f1;
  --warning: #c98700;
  --warning-soft: #fff2d8;
  --danger: #cf4f4f;
  --danger-soft: #fdecec;
  --shadow-sm: 0 6px 18px rgba(18, 33, 49, 0.04);
  --shadow-md: 0 14px 30px rgba(18, 33, 49, 0.08);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", "Segoe UI", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden; /* prevent accidental horizontal scroll on small devices */
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
a {
  transition: all 0.2s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.nav-link:focus-visible,
.auth-link:focus-visible,
.logout-btn:focus-visible {
  outline: 3px solid rgba(31, 122, 140, 0.24);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  color: var(--primary-strong);
  font-size: 0.72rem;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.78rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 122, 140, 0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 13px 24px rgba(20, 90, 107, 0.24);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.btn-logout {
  background: linear-gradient(135deg, #f0d7d8, var(--danger-soft));
  color: #773337;
  border-color: rgba(207, 79, 79, 0.12);
}

.btn-logout:hover:not(:disabled) {
  background: var(--danger-soft);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
   radial-gradient(circle at top left, rgba(31, 122, 140, 0.09), transparent 28%),
   linear-gradient(180deg, #f6fafb 0%, var(--bg) 100%);
}

.auth-card {
  width: min(100%, 480px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(223, 233, 238, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem 1.75rem;
}

.branding {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #6ab2be);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 20px rgba(31, 122, 140, 0.18);
}

.branding h1 {
  font-size: clamp(1.7rem, 2vw, 2.2rem);
  line-height: 1.2;
}

.auth-subtitle,
.auth-intro {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.5rem;
}

.form-field label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-soft);
}

.form-field input,
.form-field select {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.form-field input::placeholder {
  color: var(--muted);
}

.form-field input:hover,
.form-field select:hover {
  border-color: var(--border-strong);
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 140, 0.08);
  outline: none;
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(207, 79, 79, 0.08);
}

.auth-meta,
.auth-action {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.auth-link {
  color: var(--primary-strong);
  font-weight: 700;
}

.auth-link:hover {
  color: var(--primary);
}

.message {
  min-height: 1.25rem;
  margin-top: 1rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #132637 0%, #0f1d2b 100%);
  color: #edf3f7;
  padding: 1.75rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(223, 233, 238, 0.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.35rem 0.45rem 1.1rem;
}

.sidebar .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 0.68rem;
}

.sidebar-brand h2 {
  font-size: 1.18rem;
  line-height: 1.2;
}

.sidebar-brand p {
  color: rgba(237, 243, 247, 0.7);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: rgba(237, 243, 247, 0.8);
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  font-weight: 600;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-link.active {
  background: rgba(132, 197, 210, 0.12);
  border: 1px solid rgba(132, 197, 210, 0.2);
  color: #fff;
}

.logout-btn {
  margin-top: 1.2rem;
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: clamp(1.2rem, 2vw, 2.2rem);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 1rem 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 10;
}

.topbar-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.topbar-heading {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.topbar-heading .eyebrow {
  width: fit-content;
  margin-bottom: 0;
}

.dashboard-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.dashboard-brand-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.dashboard-brand-copy h2 {
  font-size: 1rem;
  line-height: 1.15;
  font-weight: 800;
  color: var(--text);
}

.topbar h1 {
  font-size: clamp(1.85rem, 2.5vw, 2.5rem);
  line-height: 1.08;
  margin: 0;
  letter-spacing: -0.03em;
}

.dashboard-brand-copy p,
.topbar-sub {
  color: var(--muted);
  font-size: 0.96rem;
}

.topbar-sub {
  max-width: 62ch;
  margin: 0;
}

.dashboard-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.dashboard-filters label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dashboard-filters select {
  min-width: 160px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  padding: 0.45rem 0.8rem;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
}

.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  width: 100%;
}

.new-merchant-state {
  display: grid;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(230, 246, 249, 0.9), rgba(255, 255, 255, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.new-merchant-state h2 {
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.new-merchant-state p,
.new-merchant-state small {
  color: var(--muted);
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), rgba(31, 122, 140, 0.15));
}

.stat-card .stat-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.stat-card .stat-value {
  display: block;
  font-size: clamp(2rem, 2.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.insight-card {
  display: grid;
  gap: 0.7rem;
  min-height: 160px;
  background: linear-gradient(180deg, #fff, #f9fbfc);
}

.insight-card .insight-label {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.insight-card .insight-value {
  font-size: clamp(1.2rem, 2vw, 1.9rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.insight-card .insight-caption {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-card .stat-caption,
.section-helper,
.segment-definition-text {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.activity-summary-grid,
.coverage-grid,
.customer-summary-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.activity-summary-card {
  margin-bottom: 1.5rem;
}

.activity-summary-card .activity-summary-grid {
  margin-top: 1rem;
  margin-bottom: 0;
}

.activity-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.activity-card,
.summary-mini-card,
.coverage-item {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  min-height: 110px;
}

.activity-card,
.coverage-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
}

.activity-label,
.coverage-label,
.summary-mini-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.activity-value,
.summary-mini-card strong,
.coverage-item strong {
  color: var(--text);
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  font-weight: 800;
}

.coverage-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.coverage-card {
  margin-bottom: 1.5rem;
}

.customer-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-mini-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-header h3,
.segment-panel h2,
.customer-section h4,
.segment-insight-panel h2 {
  font-size: 1.1rem;
  color: var(--text);
}

.section-header h3 {
  margin-bottom: 0;
}

.dashboard-load-status {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dashboard-load-status .section-helper {
  flex: 1 1 18rem;
  margin: 0;
}

.main-content .is-unavailable {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.chart-card {
  padding: 1.1rem 1.1rem 0.7rem;
}

.chart-container {
  position: relative;
  width: 100%;
  min-height: 300px;
  margin-top: 0.75rem;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 600;
}

.list-item,
.customer-segment-card,
.segment-row,
.recommendation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff 0%, #f8fafb 100%);
}

.list-item,
.customer-segment-card,
.recommendation-item {
  margin-bottom: 0.8rem;
}

.list-item .primary, .customer-segment-card .primary, .recommendation-item .primary {
  min-width: 0;
}

.list-item h4,
.customer-segment-card h4,
.recommendation-item h4 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.list-item p,
.customer-segment-card p,
.recommendation-item p {
  color: var(--muted);
  font-size: 0.88rem;
}

.recommendation-item {
  align-items: flex-start;
}

.recommendation-badge {
  white-space: nowrap;
}

.recommendation-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.recommendation-metrics span {
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.08);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.list-item small,
.customer-segment-card small {
  color: var(--primary-strong);
  font-weight: 700;
}

.customer-section {
  margin-top: 1.4rem;
}

.customer-section:first-of-type {
  margin-top: 0;
}

.customer-section .list-item {
  align-items: flex-start;
}

.customer-segment-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.customer-segment-meta strong {
  color: var(--text);
  font-size: 0.96rem;
}

.panel + .panel {
  margin-top: 1.4rem;
}

.empty-text {
  color: var(--muted);
  padding: 1rem 0.2rem;
  font-weight: 600;
}

.segment-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.segment-metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1rem;
  box-shadow: var(--shadow-sm);
}

.segment-metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.segment-metric-card h3 {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  margin-bottom: 0.4rem;
}

.segment-metric-card p {
  color: var(--muted);
  font-size: 0.82rem;
}

.segment-metric-card.warning {
  background: linear-gradient(180deg, #fff7ef 0%, #fff 100%);
}

.segment-metric-card.success {
  background: linear-gradient(180deg, #edfaf4 0%, #fff 100%);
}

.segment-insight-panel {
  background: linear-gradient(135deg, rgba(31, 122, 140, 0.06), rgba(255, 255, 255, 1));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
  margin-bottom: 1.5rem;
}

.segment-insight-panel p {
  color: var(--text-soft);
  line-height: 1.7;
}

.segments-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

.segment-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.2rem;
}

.segment-panel .segment-row {
  justify-content: space-between;
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  padding: 0.75rem 0.8rem;
}

.segment-row span,
.segment-row strong {
  color: var(--text);
}

.segment-panel.full-width {
  margin-bottom: 1.2rem;
}

.segment-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm);
}

.segment-filters label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.segment-filters select {
  min-width: 140px;
  min-height: 42px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text);
}

.customer-segment-card {
  align-items: center;
}

.customer-segment-card > div:first-child {
  min-width: 0;
}

@media (max-width: 1100px) {
  .insights-grid {
   grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-layout {
   flex-direction: column;
  }

  .sidebar {
   width: 100%;
   height: auto;
   position: relative;
   border-right: none;
   border-bottom: 1px solid rgba(223, 233, 238, 0.1);
  }

  .sidebar-nav {
   display: grid;
   grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-content {
   padding: 1.25rem;
  }

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

  .segment-topbar-actions {
   width: 100%;
  }
}

@media (max-width: 640px) {
  .auth-shell {
   padding: 1rem;
  }

  .auth-card {
   padding: 1.4rem 1rem;
  }

  .sidebar-nav {
   grid-template-columns: 1fr;
  }

  .cards-grid,
  .insights-grid,
  .segment-summary-grid {
   grid-template-columns: 1fr;
  }

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

  .topbar-copy {
   grid-template-columns: 1fr;
   gap: 0.75rem;
  }

  .topbar-heading {
   gap: 0.25rem;
  }

  .dashboard-filters {
   width: 100%;
   justify-content: space-between;
  }

  .dashboard-filters select {
   min-width: 0;
   flex: 1;
  }

  .onboarding-actions {
   flex-direction: column;
   align-items: stretch;
  }

  .btn {
   width: 100%;
  }

  .chart-container {
   min-height: 240px;
  }
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
   animation-duration: 0.01ms !important;
   animation-iteration-count: 1 !important;
   transition-duration: 0.01ms !important;
   scroll-behavior: auto !important;
  }
}

/* Layout basics */
.dashboard-layout{display:flex;min-height:100vh}

/* Sidebar */
.sidebar{width:260px;background:linear-gradient(180deg,#04232f,#08323b);color:#fff;padding:20px;box-shadow:var(--shadow-md);transition:width 240ms cubic-bezier(.2,.9,.3,1)}
.sidebar.collapsed{width:72px}
.sidebar .sidebar-brand{display:flex;align-items:center;gap:12px;padding-bottom:16px}
.brand-mark{width:44px;height:44px;border-radius:10px;background:linear-gradient(90deg,#0ea5a6,#047481);display:grid;place-items:center;font-weight:700;color:#fff}
.sidebar-nav{display:flex;flex-direction:column;gap:6px;margin-top:12px}
.sidebar-nav .nav-link{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:8px;color:rgba(255,255,255,0.95);text-decoration:none;font-weight:600}
.sidebar-nav .nav-link:hover{background:rgba(255,255,255,0.04)}
.sidebar-nav .nav-link .nav-icon{width:20px;height:20px;display:inline-block;opacity:0.9}
.sidebar.collapsed .nav-link{justify-content:center;padding:10px}
.sidebar.collapsed .nav-link .label{display:none}
.sidebar.collapsed .brand-mark{width:44px;height:44px}

/* Sidebar tooltip when collapsed */
.sidebar.collapsed .nav-link[title]{position:relative}
.sidebar.collapsed .nav-link[title]:hover::after{content:attr(title);position:absolute;left:72px;top:50%;transform:translateY(-50%);background:var(--surface);color:var(--text);padding:6px 10px;border-radius:8px;box-shadow:var(--shadow-sm);white-space:nowrap}

/* Mobile sidebar overlay (opened via toggle on small screens) */
.sidebar.mobile-open{position:fixed;left:0;top:0;height:100vh;width:260px;z-index:1500;box-shadow:0 20px 40px rgba(2,6,23,0.4);transform:translateX(0);transition:transform 240ms cubic-bezier(.2,.9,.2,1);display:block !important;}
.sidebar-mobile-overlay{position:fixed;inset:0;background:rgba(6,10,15,0.45);z-index:1400;opacity:0;pointer-events:none;transition:opacity 200ms ease}
.sidebar-mobile-overlay.visible{opacity:1;pointer-events:auto}

/* Main content */
.main-content{flex:1;min-width:0;padding:24px}
.topbar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);gap:1rem 1.25rem;align-items:start;margin-bottom:18px}
.topbar-copy{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:16px;min-width:0;max-width:100%}
.topbar-heading{display:grid;gap:6px;min-width:0}
.sidebar-toggle{display:inline-grid;gap:4px;padding:8px;border-radius:8px;border:0;background:transparent;cursor:pointer}
.sidebar-toggle .bar{width:18px;height:2px;background:var(--text-soft);display:block;border-radius:2px}
.breadcrumbs .eyebrow{font-size:12px;color:var(--muted)}
.breadcrumbs h1{margin:0;font-size:20px}
.topbar-sub{color:var(--text-soft);margin:0;max-width:62ch}

.topbar-actions{display:flex;align-items:center;justify-content:flex-end;min-width:0;max-width:100%}
.topbar-tools{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:12px;width:100%}
.dashboard-filters label{font-size:12px;color:var(--muted);margin-right:8px}
.dashboard-filters{flex:1 1 220px;min-width:0}
.dashboard-filters select{padding:8px;border-radius:8px;border:1px solid var(--border);background:var(--surface);max-width:100%}

/* Merchant profile */
.merchant-profile{position:relative}
.merchant-btn{display:flex;align-items:center;gap:10px;padding:6px 10px;border-radius:10px;border:1px solid rgba(2,6,23,0.06);background:transparent;color:var(--text);cursor:pointer;min-height:40px;max-width:100%}
.avatar{width:36px;height:36px;border-radius:50%;display:inline-grid;place-items:center;background:var(--surface);color:var(--text);font-weight:700}
.merchant-name{font-weight:600;color:var(--text-soft);min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.merchant-menu{position:absolute;right:0;top:calc(100% + 8px);background:var(--surface);border-radius:10px;box-shadow:var(--shadow-md);padding:8px;border:1px solid var(--border);min-width:160px;z-index:2200}
.merchant-menu .menu-item{display:block;padding:8px 10px;color:var(--text);text-decoration:none;border-radius:8px}
.merchant-menu .menu-item:hover{background:var(--surface-alt)}
.hidden{display:none}

/* Cards & grids */
.cards-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:18px}
.card{background:var(--surface);border-radius:12px;padding:16px;border:1px solid var(--border);box-shadow:var(--shadow-sm)}
.stat-card .stat-label{display:block;color:var(--text-soft);font-size:13px}
.stat-card .stat-value{font-size:20px;font-weight:800}

/* Product table and detail drawer */
.product-controls{display:flex;gap:0.6rem;align-items:center;margin-bottom:0.8rem}
.product-controls input[type="search"]{min-width:240px;padding:0.5rem 0.7rem;border-radius:10px;border:1px solid var(--border);background:var(--surface)}
.product-controls select{min-width:140px;padding:0.46rem 0.6rem;border-radius:10px;border:1px solid var(--border);background:var(--surface)}
.product-table{border-radius:10px;overflow:hidden;background:linear-gradient(180deg,#fff,#fbfdfe);border:1px solid var(--border)}
.product-row{display:grid;grid-template-columns:2fr 1fr 1fr 0.8fr 0.8fr 0.9fr 1fr 0.8fr;gap:0.5rem;padding:0.65rem 0.9rem;align-items:center;border-bottom:1px solid rgba(15,23,42,0.03)}
.product-row--head{background:var(--surface-strong);color:var(--text-soft);font-weight:700}
.product-row--body{cursor:pointer}
.product-row--body:hover{background:rgba(14,165,166,0.03)}
.product-row--body:focus{outline: none;box-shadow: 0 0 0 4px rgba(14,165,166,0.08);border-radius:8px}
.product-row--body[aria-pressed="true"]{background:rgba(14,165,166,0.04)}
.product-row .col{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.product-table-wrapper .empty-text,.product-table-wrapper .loading-text{padding:1.2rem;color:var(--muted);font-weight:700}
.product-skeleton-row{display:grid;grid-template-columns:2fr 1fr 1fr 0.8fr 0.8fr 0.9fr 1fr 0.8fr;gap:0.5rem;padding:0.65rem 0.9rem;align-items:center;border-bottom:1px solid rgba(15,23,42,0.02)}
.product-skeleton-row .skeleton{height:14px;border-radius:6px}

/* detail drawer */
.product-detail-drawer{position:fixed;inset:0;display:grid;place-items:center;z-index:1200}
.product-detail-drawer .drawer-backdrop{position:absolute;inset:0;background:rgba(6,10,15,0.45);display:grid;place-items:center;padding:1rem}
.product-detail-drawer .drawer-panel{position:relative;width:min(760px,96%);background:var(--surface);border-radius:14px;padding:1.2rem;border:1px solid var(--border);box-shadow:var(--shadow-md)}
.drawer-close{position:absolute;right:10px;top:10px;background:none;border:0;color:var(--muted);font-size:1.4rem;cursor:pointer}
.drawer-content h3{margin:0 0 0.6rem 0}
.drawer-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:0.8rem;margin-top:0.6rem}
.drawer-grid div{background:var(--surface-alt);padding:0.6rem;border-radius:8px;border:1px solid var(--border)}

/* Skeleton and toast */
.skeleton{background:linear-gradient(90deg,#f3f4f6,#e9f0f1,#f3f4f6);background-size:200% 100%;animation:shimmer 1.2s linear infinite;border-radius:8px}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
.toast{position:fixed;right:20px;bottom:20px;background:#111827;color:#fff;padding:10px 14px;border-radius:8px;box-shadow:var(--shadow-md);z-index:2000}

/* Focus and accessible outlines */
:focus{outline: none}
:focus-visible{outline:2px solid rgba(14,165,166,0.18);outline-offset:3px;border-radius:6px}
button:focus, a:focus, input:focus, select:focus{box-shadow:0 0 0 3px rgba(14,165,166,0.06)}

/* Buttons */
.btn{padding:8px 12px;border-radius:8px;border:1px solid transparent;cursor:pointer;font-weight:700}
.btn-primary{background:linear-gradient(90deg,#0ea5a6,#047481);color:#fff}
.btn-primary:hover{transform:translateY(-1px)}
.btn-secondary{background:transparent;border:1px solid var(--border);color:var(--text)}
.btn-logout{background:#fbdada;color:var(--danger);border-radius:10px;padding:10px 12px}

@media (max-width:900px){
  .product-row{grid-template-columns:1.6fr 1fr 1fr 0.8fr 0.8fr 0.9fr 1fr 0.6fr}
  .drawer-grid{grid-template-columns:repeat(2,1fr)}
  .cards-grid{grid-template-columns:repeat(2,1fr)}
  .activity-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .coverage-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .customer-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (min-width: 901px) {
  .topbar-copy {
    position: relative;
    padding-left: 56px;
    min-height: 40px;
    align-items: start;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 1rem;
  }

  .topbar-copy .sidebar-toggle {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    z-index: 2;
  }

  .topbar-actions {
    align-self: start;
  }

}

@media (max-width:640px){
  .product-controls{flex-direction:column;align-items:stretch}
  .product-row{grid-template-columns:1fr 0.8fr 0.8fr 0.7fr;grid-auto-rows:minmax(44px,auto)}
  .product-row .col:nth-child(n+5){display:none}
  .drawer-grid{grid-template-columns:1fr}
  .sidebar{display:none}
  .topbar-copy{gap:8px}
  .activity-summary-grid,
  .coverage-grid,
  .customer-summary-grid{grid-template-columns:1fr}
  .recommendation-item{flex-direction:column}
}


.dashboard-filters select {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  background: white;
  color: #111827;
  cursor: pointer;
}

.dashboard-filters select:focus {
  outline: none;
  border-color: #111827;
}

.empty-state {
  padding: 18px;
  border: 1px dashed #d1d5db;
  border-radius: 14px;
  background: #f9fafb;
  color: #6b7280;
  font-size: 14px;
  text-align: center;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-header h3 {
  margin-bottom: 0;
}

.badge {
  background: #eef2ff;
  color: #3730a3;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.signup-link {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: #6b7280;
}

.signup-link a {
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.new-merchant-state {
  background: #ffffff;
  border-radius: 14px;
  padding: 28px;
  margin: 24px 0;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.new-merchant-state h2 {
  margin-bottom: 8px;
  color: #0f172a;
}

.new-merchant-state p {
  color: #64748b;
  margin-bottom: 20px;
}

.onboarding-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.onboarding-actions button {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff;
}

.onboarding-actions .secondary-btn {
  background: #e2e8f0;
  color: #334155;
  cursor: not-allowed;
}

.new-merchant-state small {
  color: #64748b;
}

.sidebar nav a {
  display: block;
  color: #ffffff;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: #1f2937;
}

.page-header {
  margin-bottom: 24px;
}

/* Final responsive overrides to beat legacy duplicate rules above */
@media (max-width: 900px) {
  body:not([data-di-active-nav]) .dashboard-layout {
    flex-direction: column !important;
  }

  body:not([data-di-active-nav]) .sidebar {
    width: 100% !important;
  }

  body:not([data-di-active-nav]) .main-content {
    padding: 1.25rem !important;
  }
}

@media (max-width: 640px) {
  body:not([data-di-active-nav]) .sidebar {
    display: none !important;
  }

  body:not([data-di-active-nav]) .sidebar.mobile-open {
    display: flex !important;
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: min(260px, 86vw) !important;
    height: 100vh !important;
    z-index: 1500 !important;
  }

  body:not([data-di-active-nav]) .main-content {
    padding: 1rem !important;
  }

  body:not([data-di-active-nav]) .topbar-actions,
  body:not([data-di-active-nav]) .topbar-copy {
    width: 100%;
  }

  body:not([data-di-active-nav]) .topbar-actions {
    justify-content: stretch;
  }

  body:not([data-di-active-nav]) .topbar-tools {
    width: 100%;
    justify-content: space-between;
  }
}

.page-header h1 {
  font-size: 34px;
  margin-bottom: 6px;
  color: #020617;
}

.page-header p {
  color: #64748b;
}

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

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

.segment-panel {
  background: #ffffff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.segment-panel.full-width {
  margin-bottom: 30px;
}

.segment-panel h2 {
  font-size: 18px;
  margin-bottom: 18px;
  color: #0f172a;
}

.segment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

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

.customer-segment-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #e5e7eb;
}

.customer-segment-card:last-child {
  border-bottom: none;
}

.customer-segment-card h4 {
  margin-bottom: 4px;
  color: #0f172a;
}

.customer-segment-card p {
  color: #64748b;
  font-size: 14px;
}

.customer-segment-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.customer-segment-meta span {
  background: #eef2ff;
  color: #3730a3;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.customer-segment-meta strong {
  color: #0f172a;
}

.empty-text {
  color: #64748b;
  font-size: 14px;
}

@media (max-width: 900px) {
  .segment-summary-grid,
  .segments-grid {
    grid-template-columns: 1fr;
  }

  .customer-segment-card {
    flex-direction: column;
  }

  .customer-segment-meta {
    justify-content: flex-start;
  }
}

/* Shared dashboard layout polish */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .sidebar {
    min-height: auto;
  }
}

.sidebar nav {
  margin-top: 40px;
  flex: 1;
}

.logout-btn,
#logoutBtn {
  margin-top: auto;
}

/* Segments page polish */

.segments-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.segments-toolbar h1 {
  font-size: 34px;
  color: #020617;
  margin-bottom: 6px;
}

.segments-toolbar p {
  color: #64748b;
}

.segment-filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  background: #ffffff;
  padding: 14px;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.segment-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.segment-filters select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
}

/* Keep Segments controls in normal flow; long merchant names must not
   squeeze the filter panel below the dropdowns' usable width. */
body[data-di-active-nav="segments"] .segment-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

body[data-di-active-nav="segments"] .segment-topbar-actions > .segment-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1 1 20rem;
  width: auto;
  min-width: 0;
  max-width: 100%;
  grid-area: auto;
}

body[data-di-active-nav="segments"] .segment-topbar-actions .segment-filters label {
  min-width: 0;
}

body[data-di-active-nav="segments"] .segment-topbar-actions .segment-filters select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
}

body[data-di-active-nav="segments"] .segment-topbar-actions > .merchant-profile {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 18rem);
  grid-area: auto;
}

body[data-di-active-nav="segments"] .segment-topbar-actions .avatar,
body[data-di-active-nav="segments"] .segment-topbar-actions .chev {
  flex-shrink: 0;
}

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

.segment-metric-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
  border-left: 5px solid #2563eb;
}

.segment-metric-card span {
  display: block;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.segment-metric-card h3 {
  color: #020617;
  font-size: 34px;
  margin-bottom: 8px;
}

.segment-metric-card p {
  color: #64748b;
  font-size: 13px;
}

.segment-metric-card.warning {
  border-left-color: #f59e0b;
}

.segment-metric-card.success {
  border-left-color: #16a34a;
}

.segment-insight-panel {
  background: #0f172a;
  color: #ffffff;
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}

.segment-insight-panel h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: #f8fafc;
}

.segment-insight-body {
  display: grid;
  gap: 0.7rem;
}

.segment-insight-body p,
.segment-insight-panel p {
  color: #cbd5e1;
  line-height: 1.6;
  margin: 0;
}

.segment-definition-text {
  margin-top: 0.95rem;
  color: #e2e8f0;
}

.segment-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.segment-panel h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #020617;
}

.segment-row {
  display: flex;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid #e5e7eb;
}

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

.segment-row span {
  color: #0f172a;
  font-weight: 500;
}

.segment-row strong {
  color: #020617;
}

.customer-segment-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid #e5e7eb;
}

.customer-segment-card:last-child {
  border-bottom: none;
}

.customer-segment-card h4 {
  color: #020617;
  margin-bottom: 4px;
}

.customer-segment-card p {
  color: #64748b;
  font-size: 14px;
}

.customer-segment-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.customer-segment-meta span {
  background: #eef2ff;
  color: #3730a3;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.customer-segment-meta strong {
  color: #020617;
  font-weight: 800;
}

@media (max-width: 1000px) {
  .segments-toolbar {
    flex-direction: column;
  }

  .segment-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 700px) {
  .segment-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
  }

  .customer-segment-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .customer-segment-meta {
    justify-content: flex-start;
  }
}

/* Final desktop sidebar polish overrides */
@media (min-width: 901px) {
  .topbar-copy .sidebar-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 12px;
    flex: 0 0 40px;
    line-height: 0;
  }

  .sidebar.collapsed .sidebar-nav {
    align-items: center;
  }

  .sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .sidebar.collapsed .sidebar-brand h2,
  .sidebar.collapsed .sidebar-brand p {
    display: none;
  }

  .sidebar.collapsed .sidebar-brand .brand-mark {
    margin: 0 auto;
  }

  .sidebar.collapsed .nav-link {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 0;
  }

  .sidebar.collapsed .nav-link .nav-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    margin: 0;
  }

  .sidebar.collapsed #logoutBtn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0 auto 0.25rem;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 0;
    color: transparent;
    overflow: hidden;
  }

  .sidebar.collapsed #logoutBtn::before {
    content: "⎋";
    font-size: 1rem;
    line-height: 1;
    color: #fff;
  }
}

/* Imports preview */
.imports-upload-card,
.imports-result-card {
  margin-bottom: 1rem;
}

.imports-upload-card h2,
.imports-result-card h2 {
  margin-bottom: 0.45rem;
}

.imports-hint {
  color: var(--text-soft);
  margin-bottom: 1rem;
}

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

.imports-actions {
  grid-column: 1 / -1;
}

.imports-meta {
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-soft);
}

.imports-meta-success {
  border-color: rgba(29, 140, 99, 0.2);
  background: var(--success-soft);
  color: var(--success);
}

.imports-meta-error {
  border-color: rgba(207, 79, 79, 0.2);
  background: var(--danger-soft);
  color: var(--danger);
}

.imports-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.imports-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.imports-table th,
.imports-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.9rem;
}

.imports-table th {
  background: var(--surface-strong);
  color: var(--text-soft);
  font-weight: 700;
}

.imports-preview-errors {
  margin-top: 1rem;
}

.imports-preview-errors h3 {
  font-size: 1rem;
  margin-bottom: 0.45rem;
}

.imports-errors-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-soft);
}

.imports-success {
  margin-top: 1rem;
  color: var(--success);
  font-weight: 600;
}

@media (max-width: 760px) {
  .imports-form {
    grid-template-columns: 1fr;
  }
}

/* Responsive foundation overrides */
body[data-di-active-nav] .main-content,
body[data-di-active-nav] .topbar,
body[data-di-active-nav] .topbar-copy,
body[data-di-active-nav] .topbar-actions,
body[data-di-active-nav] .topbar-tools,
body[data-di-active-nav] .dashboard-filters,
body[data-di-active-nav] .segment-filters,
body[data-di-active-nav] .card,
body[data-di-active-nav] .chart-container {
  min-width: 0;
}

body[data-di-active-nav] .chart-container,
body[data-di-active-nav] .chart-container canvas {
  max-width: 100%;
}

@media (max-width: 900px), (max-width: 1024px) and (max-height: 500px) and (orientation: landscape) {
  body[data-di-active-nav] {
    --mobile-sidebar-width: min(82vw, 300px);
  }

  body[data-di-active-nav] .dashboard-layout {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
  }

  body[data-di-active-nav] .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: var(--mobile-sidebar-width) !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    z-index: 2200;
    border-right: 1px solid rgba(223, 233, 238, 0.1);
    border-bottom: none;
    display: flex !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: none;
    visibility: hidden;
  }

  body[data-di-active-nav] .sidebar.mobile-open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
  }

  body[data-di-active-nav] .sidebar-mobile-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--mobile-sidebar-width);
    z-index: 2100;
    opacity: 0;
    pointer-events: none;
  }

  body[data-di-active-nav] .sidebar-mobile-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-drawer-open {
    overflow: hidden;
  }

  body[data-di-active-nav] .sidebar.collapsed {
    width: min(82vw, 300px) !important;
  }

  body[data-di-active-nav] .sidebar.collapsed .sidebar-brand {
    justify-content: flex-start;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  body[data-di-active-nav] .sidebar.collapsed .sidebar-brand h2,
  body[data-di-active-nav] .sidebar.collapsed .sidebar-brand p,
  body[data-di-active-nav] .sidebar.collapsed .nav-link .label {
    display: block;
  }

  body[data-di-active-nav] .sidebar.collapsed .nav-link {
    justify-content: flex-start;
    width: 100%;
    padding: 0.75rem 0.8rem;
  }

  body[data-di-active-nav] .sidebar.collapsed .nav-link[title]:hover::after,
  body[data-di-active-nav] .sidebar.collapsed #logoutBtn::before {
    content: none;
  }

  body[data-di-active-nav] .sidebar.collapsed #logoutBtn {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 0.78rem 1.1rem;
    font-size: inherit;
    color: inherit;
  }

  body[data-di-active-nav] .main-content {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
      max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)) !important;
  }

  body[data-di-active-nav] .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "copy profile"
      "controls controls";
    gap: 0.75rem;
    align-items: start;
    position: relative;
  }

  body[data-di-active-nav] .topbar-copy {
    grid-area: copy;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "toggle heading"
      "sub sub";
    align-items: start;
    gap: 0.5rem 0.75rem;
    min-width: 0;
  }

  body[data-di-active-nav] .topbar-copy .sidebar-toggle {
    grid-area: toggle;
  }

  body[data-di-active-nav] .topbar-copy .topbar-heading,
  body[data-di-active-nav] .topbar-copy .breadcrumbs {
    grid-area: heading;
    min-width: 0;
  }

  body[data-di-active-nav] .topbar-copy .topbar-sub {
    grid-area: sub;
    max-width: none;
  }

  body[data-di-active-nav] .topbar-actions:not(.segment-topbar-actions) {
    display: contents;
  }

  body[data-di-active-nav] .segment-topbar-actions {
    grid-area: controls;
  }

  body[data-di-active-nav] .topbar-actions > .merchant-profile,
  body[data-di-active-nav] .topbar-tools .merchant-profile {
    grid-area: profile;
    position: relative;
    justify-self: end;
    align-self: start;
    z-index: 2050;
  }

  body[data-di-active-nav] .topbar-actions > .topbar-tools {
    display: contents;
  }

  body[data-di-active-nav] .topbar-actions > .segment-filters,
  body[data-di-active-nav] .topbar-tools .dashboard-filters {
    grid-area: controls;
    width: 100%;
    min-width: 0;
  }

  body[data-di-active-nav] .merchant-profile {
    width: auto;
  }

  body[data-di-active-nav] .merchant-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 6px 10px;
  }

  body[data-di-active-nav] .merchant-menu {
    right: 0;
    left: auto;
    top: calc(100% + 8px);
    z-index: 2150;
    min-width: 180px;
    max-width: min(92vw, 260px);
  }

  body[data-di-active-nav] .dashboard-filters,
  body[data-di-active-nav] .segment-filters {
    width: 100%;
  }

  body[data-di-active-nav] .dashboard-filters select,
  body[data-di-active-nav] .segment-filters select {
    max-width: 100%;
  }

  body[data-di-active-nav] .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-di-active-nav] .insights-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  body[data-di-active-nav] .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toggle heading profile"
      "sub sub sub"
      "controls controls controls";
    gap: 0.85rem 1rem;
  }

  body[data-di-active-nav] .topbar-copy,
  body[data-di-active-nav] .topbar-actions:not(.segment-topbar-actions),
  body[data-di-active-nav] .topbar-actions > .topbar-tools {
    display: contents;
  }

  body[data-di-active-nav] .topbar-copy .sidebar-toggle {
    grid-area: toggle;
    align-self: start;
  }

  body[data-di-active-nav] .topbar-copy .topbar-heading,
  body[data-di-active-nav] .topbar-copy .breadcrumbs {
    grid-area: heading;
    min-width: 0;
  }

  body[data-di-active-nav] .topbar-copy .topbar-sub {
    grid-area: sub;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  body[data-di-active-nav] .topbar-tools .merchant-profile {
    grid-area: profile;
    justify-self: end;
  }

  body[data-di-active-nav] .topbar-tools .dashboard-filters,
  body[data-di-active-nav] .topbar-actions > .segment-filters {
    grid-area: controls;
    width: min(100%, 320px);
    min-width: 0;
    justify-self: start;
  }
}

@media (min-width: 901px) and (max-width: 1240px) {
  body[data-di-active-nav] .topbar {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, auto);
    grid-template-areas:
      "toggle heading actions"
      "sub sub sub";
    align-items: start;
  }

  body[data-di-active-nav] .topbar-copy {
    display: contents;
  }

  body[data-di-active-nav] .topbar-copy .sidebar-toggle {
    grid-area: toggle;
    position: static;
    left: auto;
    top: auto;
    align-self: start;
  }

  body[data-di-active-nav] .topbar-copy .topbar-heading,
  body[data-di-active-nav] .topbar-copy .breadcrumbs {
    grid-area: heading;
    min-width: 0;
  }

  body[data-di-active-nav] .topbar-copy .topbar-sub {
    grid-area: sub;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  body[data-di-active-nav] .topbar-actions {
    grid-area: actions;
    min-width: 0;
    align-self: start;
  }

  body[data-di-active-nav] .topbar-tools {
    width: auto;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  body[data-di-active-nav] .merchant-btn .merchant-name {
    display: none;
  }

  body[data-di-active-nav] .merchant-btn .chev {
    display: inline-block;
  }

  body[data-di-active-nav] .topbar {
    gap: 0.6rem;
  }

  body[data-di-active-nav] .chart-container {
    min-height: 220px;
  }
}

@media (max-width: 420px) {
  body[data-di-active-nav] .cards-grid {
    grid-template-columns: 1fr;
  }
}

.auth-shell {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(0.75rem, 2.5vw, 1.5rem);
}

.auth-shell .auth-topbar {
  max-width: 480px;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-shell .auth-topbar .topbar-copy {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.auth-shell .auth-topbar .topbar-actions {
  display: none;
}

.merchant-menu .menu-item {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}

.merchant-menu .menu-item:hover {
  background: var(--surface-alt);
}

.merchant-menu .menu-item:focus-visible {
  outline: 2px solid rgba(31, 122, 140, 0.24);
  outline-offset: 2px;
}

.auth-shell .auth-card {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: clamp(1rem, 3.5vw, 1.75rem);
}

.auth-shell .branding > div {
  min-width: 0;
}

.auth-shell .branding h1 {
  font-size: clamp(1.35rem, 6vw, 2rem);
}

.auth-shell .form-field input,
.auth-shell .form-field select,
.auth-shell .btn {
  font-size: 16px;
}

@media (max-height: 430px) and (orientation: landscape) {
  .auth-shell {
    padding-top: max(0.6rem, env(safe-area-inset-top));
    padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
  }

  .auth-shell .auth-topbar {
    margin-bottom: 0.5rem;
  }

  .auth-shell .auth-card {
    padding: 0.95rem 0.9rem;
  }
}
/* Store connection controls share the existing card and button styling. */
.shopify-card { max-width: 960px; margin-bottom: 24px; }
.shopify-connect-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0; }
.shopify-connect-form .form-field { flex: 1 1 260px; min-width: 0; }
.shopify-connect-form input { width: 100%; min-width: 0; box-sizing: border-box; }
.shopify-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.shopify-card p { overflow-wrap: anywhere; }

/* ==========================================================================
   Pilot refresh (Dec 2026)
   Idea: a trading review you can check. Quiet surfaces, one strong figure
   (revenue), and provenance — "Why this number?" — as the signature detail.
   Palette: ink #1E2A2F · paper #F4F6F3 · eucalyptus #2F6B5F · moss #E3EEEA
            plum #6E4A73 (provenance, "not provided") · line #D9E0DC
   No web fonts: system faces only, so no third-party requests and no IP leak.
   ========================================================================== */
:root {
  --bg: #f4f6f3;
  --bg-elevated: #eef2ef;
  --surface: #ffffff;
  --surface-alt: #f8faf8;
  --surface-strong: #e3eeea;
  --text: #1e2a2f;
  --text-soft: #3e4d52;
  --muted: #5d6c70;
  --border: #d9e0dc;
  --border-strong: #c3cfc9;
  --primary: #2f6b5f;
  --primary-strong: #234f46;
  --primary-soft: #e3eeea;
  --provenance: #6e4a73;
  --provenance-soft: #f1ebf2;
  --shadow-sm: none;
  --shadow-md: 0 1px 2px rgba(30, 42, 47, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --focus: 0 0 0 3px #ffffff, 0 0 0 5px #2f6b5f;
}

* { font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
body { font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); }
h1, h2, h3, h4 { letter-spacing: -0.015em; font-weight: 650; color: var(--text); }

/* Figures line up when compared across tiles and table rows. */
.stat-value, .activity-value, .insight-value, .coverage-item strong, table td, .why-list dd { font-variant-numeric: tabular-nums; }

/* Labels in sentence case: they are read, not shouted. */
.eyebrow, .badge, .stat-label, .insight-label, .activity-label, .coverage-label, .sidebar-brand p,
.dashboard-filters label { text-transform: none; letter-spacing: 0; }
.eyebrow { background: none; padding: 0; color: var(--muted); font-size: 0.8rem; font-weight: 600; margin-bottom: 0.25rem; }
.badge { background: var(--surface-alt); color: var(--muted); border: 1px solid var(--border); font-weight: 600; font-size: 0.78rem; min-height: 0; padding: 0.15rem 0.55rem; border-radius: 999px; }

/* Surfaces: borders carry structure; no floating shadows or gradient washes. */
.card, .stat-card, .insight-card, .activity-card, .coverage-item, .chart-card, .auth-card {
  background: var(--surface); border: 1px solid var(--border); box-shadow: none; border-radius: var(--radius-md);
}
.stat-card::before, .stat-card::after, .insight-card::before { display: none !important; }
.stat-label, .insight-label, .activity-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.insight-value { font-size: 1.2rem; line-height: 1.3; }
.stat-caption, .insight-caption { color: var(--muted); font-size: 0.82rem; }

/* The one bold element: revenue leads the row. */
.cards-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 12px; }
.cards-grid .stat-card-accent { grid-column: 1; grid-row: 1; background: var(--primary); border-color: var(--primary); color: #fff; }
.stat-card-accent .stat-label, .stat-card-accent .stat-caption { color: rgba(255,255,255,0.82); }
.stat-card-accent .stat-value { color: #fff; font-size: 2.5rem; }

/* Buttons: solid, no gradients. */
.btn-primary { background: var(--primary); border: 1px solid var(--primary); color: #fff; box-shadow: none; }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); transform: none; box-shadow: none; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); box-shadow: none; }

/* Sidebar: full height, calm. */
.dashboard-layout { align-items: stretch; }
.sidebar { background: #1e2a2f; box-shadow: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; align-self: flex-start; }
.sidebar .brand-mark, .brand-mark { background: var(--primary); box-shadow: none; border-radius: 8px; }
.sidebar-nav .nav-link { font-weight: 550; color: rgba(255,255,255,0.86); }
.sidebar-nav .nav-link[aria-current="page"], .sidebar-nav .nav-link.active { background: rgba(255,255,255,0.09); color: #fff; box-shadow: inset 3px 0 0 #8fc2b4; }

/* Provenance: "Why this number?" */
.why-number { margin-top: 0.75rem; border-top: 1px dashed rgba(255,255,255,0.35); padding-top: 0.6rem; font-size: 0.85rem; }
.stat-card:not(.stat-card-accent) .why-number { border-top-color: var(--border); }
.why-number summary { cursor: pointer; font-weight: 600; color: var(--provenance); list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 4px; }
.stat-card-accent .why-number summary { color: #fff; }
.why-number summary::-webkit-details-marker { display: none; }
.why-number summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; border: 1px solid currentColor; border-radius: 50%; font-size: 0.8rem; line-height: 1; }
.why-number[open] summary::before { content: "\2212"; }
.why-list { display: grid; gap: 0.35rem; margin: 0.6rem 0; }
.why-list div { display: flex; justify-content: space-between; gap: 1rem; }
.why-list dt { color: inherit; opacity: 0.8; }
.why-list dd { font-weight: 600; text-align: right; }
.why-note { opacity: 0.85; font-size: 0.8rem; line-height: 1.45; }

/* Coverage: collapsed by default, one click away. */
.coverage-card > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.coverage-card > summary::-webkit-details-marker { display: none; }
.coverage-card > summary h3::after { content: " +"; color: var(--provenance); }
.coverage-card[open] > summary h3::after { content: " \2212"; }
.coverage-hint { color: var(--provenance); font-size: 0.85rem; font-weight: 600; }
.coverage-card[open] > summary { margin-bottom: 0.75rem; }

/* Auth pages: one quiet card, brand once. */
.auth-shell { background: var(--bg); }
.auth-card { backdrop-filter: none; padding: 2.25rem 2rem; width: min(100%, 420px); }
.auth-card .branding { gap: 0.6rem; margin-bottom: 1.75rem; }
.auth-card .branding .brand-mark { width: 34px; height: 34px; font-size: 0.8rem; }
.brand-name { font-weight: 650; letter-spacing: -0.01em; }
.auth-card > h1 { font-size: 1.6rem; margin-bottom: 0.35rem; }
.auth-card .branding h1 { font-size: 1.6rem; }
.auth-subtitle, .auth-intro { color: var(--text-soft); max-width: 36ch; }
input, select { border-color: var(--border-strong); }

/* Quality floor: visible focus, reduced motion. */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, .nav-link:focus-visible {
  outline: none; box-shadow: var(--focus);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 1100px) {
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .cards-grid .stat-card-accent { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .sidebar { position: static; height: auto; }
  .sidebar.mobile-open { position: fixed; height: 100vh; }
}
@media (max-width: 560px) {
  .cards-grid { grid-template-columns: 1fr; }
  .stat-card-accent .stat-value { font-size: 2.1rem; }
  .coverage-card > summary { flex-direction: column; gap: 0.2rem; }
}

/* Refresh: specificity follow-ups */
.stat-card .stat-label, .insight-card .insight-label, .summary-mini-card span, .segment-metric-card span,
.segment-filters label { text-transform: none; letter-spacing: 0; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.sidebar .sidebar-brand h2 { color: #fff; }
.sidebar .sidebar-brand p { color: rgba(255,255,255,0.7); }
.auth-shell { min-height: 100vh; display: grid; place-content: center; }
.stat-card.stat-card-accent .stat-label { color: rgba(255,255,255,0.86); }
.sidebar .btn-logout, .sidebar .logout-btn { background: transparent; color: rgba(255,255,255,0.86); border: 1px solid rgba(255,255,255,0.25); box-shadow: none; }
.sidebar .btn-logout:hover:not(:disabled), .sidebar .logout-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cards-grid { align-items: start; }
.why-list dt { flex-shrink: 0; white-space: nowrap; }
.main-content ol, .main-content ul:not(.sidebar-nav):not([class]) { padding-left: 1.4rem; }
.main-content p a:not(.btn), .main-content li a:not(.btn), .auth-meta a, .why-note a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.main-content details > summary { cursor: pointer; }
.segment-metric-card, .segment-metric-card.warning, .segment-metric-card.success { border: 1px solid var(--border); border-left: 1px solid var(--border); background: var(--surface); box-shadow: none; }
.segment-insight-panel { background: var(--text); border-radius: var(--radius-md); }
.segment-coverage { color: var(--provenance); font-size: 0.85rem; font-weight: 600; margin: 0 0 0.6rem; }
.segment-row { background: var(--surface-alt); border-color: var(--border); }
.sidebar:not(.collapsed):not(.mobile-open) { width: 248px; flex: 0 0 248px; }

/* Focus on the dark sidebar: the default ring is too faint there, and the
   logout button rule above removed it entirely. */
.sidebar a:focus-visible, .sidebar button:focus-visible,
.sidebar .btn-logout:focus-visible, .sidebar .logout-btn:focus-visible {
  outline: none; box-shadow: 0 0 0 2px #1e2a2f, 0 0 0 4px #8fc2b4;
}

/* ==========================================================================
   Design pass 2 (Dec 2026): scope bands, less repetition, phone density.
   One band heading states the time scope ("This period" / "All time"), so
   cards no longer repeat it. Revenue stays the one bold element.
   ========================================================================== */
.period-band, .alltime-band { display: grid; gap: 12px; margin: 0 0 32px; }
.band-header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; flex-wrap: wrap; padding: 0 2px; }
.band-header h2 { font-size: 1.2rem; margin: 0; }
.band-meta { margin: 0; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.period-band > .card, .alltime-band > .card,
body[data-di-active-nav] .period-band > .cards-grid,
body[data-di-active-nav] .alltime-band > .insights-grid { margin: 0; }

/* This period: four figures, equal height, "Why this number?" pinned low. */
body[data-di-active-nav] .kpi-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; align-items: stretch; grid-auto-flow: row dense; }
body[data-di-active-nav] .kpi-grid .stat-card-accent { grid-column: auto; grid-row: auto; }
.kpi-grid .stat-card { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.kpi-grid .stat-caption { margin-bottom: 0.5rem; }
.kpi-grid .why-number { margin-top: auto; }
.stat-card-text .stat-value { font-size: 1.3rem; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }

/* View-to-purchase strip: one card with ruled cells, not cards in a card. */
.activity-summary-card .section-header { margin-bottom: 0.5rem; }
body[data-di-active-nav] .funnel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 0 0.75rem; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.funnel-grid .activity-card { border: 0; border-radius: 0; box-shadow: none; background: var(--surface-alt); padding: 12px 16px; min-height: 0; gap: 4px; }
.funnel-grid .activity-value { font-size: 1.5rem; }
.activity-summary-card .section-helper, .chart-card .section-helper { margin: 0; font-size: 0.82rem; }
.chart-card .section-helper { margin-bottom: 0.75rem; }

/* All time: quieter cards, figures still easy to compare. */
body[data-di-active-nav] .alltime-band .insights-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.alltime-band .insight-card { min-height: 0; gap: 6px; background: var(--surface); }
.alltime-band .insight-value { font-size: 1.5rem; }

/* Coverage is a reference panel: dates read as text, not headlines. */
.coverage-item strong { font-size: 1.05rem; line-height: 1.35; }

.section-link { color: var(--primary); font-weight: 600; font-size: 0.85rem; text-decoration: underline; text-underline-offset: 2px; }

/* Line icons in the sidebar take the link colour. */
.nav-icon { display: inline-grid; place-items: center; flex: 0 0 20px; opacity: 0.8; }
.nav-link.active .nav-icon, .nav-link[aria-current="page"] .nav-icon, .nav-link:hover .nav-icon { opacity: 1; }

/* Status pills on customer lists: palette colours, not stock indigo. */
.customer-segment-meta span { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }

/* Imports: empty result areas take no space until there is something to show. */
.imports-meta:empty, .imports-preview-rows:empty, .imports-preview-errors:empty { display: none; }

@media (min-width: 901px) {
  body[data-di-active-nav] .topbar-tools { flex-wrap: nowrap; width: auto; }
}
@media (max-width: 1100px) {
  body[data-di-active-nav] .kpi-grid { grid-template-columns: 1fr 1fr; }
  body[data-di-active-nav] .alltime-band .insights-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  /* Phones: revenue and the rate (with its explanation) span the width;
     the two short figures pair up beside each other. */
  body[data-di-active-nav] .kpi-grid .stat-card-accent,
  body[data-di-active-nav] .kpi-grid .stat-card-wide { grid-column: 1 / -1; }
  body[data-di-active-nav] .funnel-grid { grid-template-columns: 1fr 1fr; }
  body[data-di-active-nav] .customer-summary-grid { grid-template-columns: 1fr 1fr; }
  .stat-card-text .stat-value { font-size: 1.1rem; }
  .alltime-band .insight-value, .funnel-grid .activity-value { font-size: 1.3rem; }
  .kpi-grid .stat-card, .alltime-band .insight-card { padding: 14px; }
}
.activity-card[hidden] { display: none; }
.dashboard-filters label { white-space: nowrap; }
@media (min-width: 901px) {
  body[data-di-active-nav] .merchant-btn .merchant-name { max-width: 200px; }
  body[data-di-active-nav] .merchant-btn { flex-shrink: 0; }
}
/* Top bar: the tools column sizes to its content, so the merchant name isn't cut. */
@media (min-width: 1241px) {
  body[data-di-active-nav] .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  body[data-di-active-nav] .dashboard-filters { flex: 0 0 auto; }
}
.customer-segment-meta { flex-shrink: 0; }
.customer-segment-meta span { white-space: nowrap; }
/* The universal font rule above also hit <code>; restore monospace for code. */
code, kbd, pre, samp { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

/* Password recovery: the fieldset only exists to disable the form while it loads. */
.recovery-fields { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 16px; }
