:root {
  color-scheme: light dark;
  --bg: #eef2ff;
  --bg-alt: #f9fbff;
  --fg: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-soft: #6366f1;
  --accent-contrast: #eef2ff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --shadow: 0 24px 60px rgba(79, 70, 229, 0.18);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Base type scale: allow a bit of downscaling on small screens */
html { font-size: 16px; }
@media (max-width: 430px) { html { font-size: 12.5px; } }
@media (max-width: 380px) { html { font-size: 12.5px; } }

html, body {
  /* Avoid text auto-zooming and control touch behavior */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 120% at 50% 0%, #eef2ff 0%, #ffffff 55%, #dee8ff 100%);
  color: var(--fg);
  line-height: 1.6;
  font-family: inherit;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 60% at 85% 15%, rgba(79, 70, 229, 0.16), transparent 72%),
    radial-gradient(40% 40% at 15% 10%, rgba(59, 130, 246, 0.16), transparent 80%);
  z-index: 0;
  pointer-events: none;
}

body[data-theme='dark'] {
  --bg: #0b1120;
  --bg-alt: #111827;
  --fg: #e2e8f0;
  --muted: #cbd5f5;
  --accent: #818cf8;
  --accent-soft: #a5b4fc;
  --accent-contrast: #111827;
  --border: rgba(148, 163, 184, 0.35);
  --border-strong: rgba(148, 163, 184, 0.5);
  --surface: rgba(15, 23, 42, 0.62);
  --surface-strong: rgba(15, 23, 42, 0.86);
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.48);
  background: radial-gradient(120% 120% at 50% 0%, #0f172a 0%, #0b1120 55%, #020617 100%);
  color-scheme: dark;
}

body[data-theme='dark']::before {
  background:
    radial-gradient(60% 60% at 85% 15%, rgba(99, 102, 241, 0.18), transparent 72%),
    radial-gradient(40% 40% at 15% 10%, rgba(14, 165, 233, 0.18), transparent 80%);
}

/* Explicit light theme overrides (force light even when OS is dark) */
body[data-theme='light'] {
  --bg: #eef2ff;
  --bg-alt: #f9fbff;
  --fg: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-soft: #6366f1;
  --accent-contrast: #eef2ff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --shadow: 0 24px 60px rgba(79, 70, 229, 0.18);
  background: radial-gradient(120% 120% at 50% 0%, #eef2ff 0%, #ffffff 55%, #dee8ff 100%);
  color-scheme: light;
}

body[data-theme='light']::before {
  background:
    radial-gradient(60% 60% at 85% 15%, rgba(79, 70, 229, 0.16), transparent 72%),
    radial-gradient(40% 40% at 15% 10%, rgba(59, 130, 246, 0.16), transparent 80%);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 120ms ease;
}

a:hover {
  color: var(--accent-soft);
}

.app-header {
  position: sticky;
  top: 0;
  padding: 1.25rem 0 0.75rem;
  z-index: 5;
  backdrop-filter: blur(18px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.4rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  max-width: 960px;
  margin: 0 auto;
  backdrop-filter: blur(18px);
}

.navbar .brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.navbar .links {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0.45rem;
}

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

.navbar__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 70px;
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  color: var(--fg);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.navbar__item:hover,
.navbar__item:focus-visible {
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent);
  outline: none;
}

.navbar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  position: relative;
}

.navbar__icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}

.navbar__item[data-support-unread="true"] .navbar__icon::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--surface);
}

body[data-theme='dark'] .navbar__item[data-support-unread="true"] .navbar__icon::after {
  box-shadow: 0 0 0 2px var(--bg);
}

.navbar__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.navbar .inline-form {
  display: flex;
  margin: 0;
}

.navbar__item--button {
  border: none;
  background: none;
  cursor: pointer;
}

.navbar__item--button:focus-visible {
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.35);
}

.navbar-bottom {
  display: none;
}

.navbar-bottom__form {
  display: flex;
  flex: 1 1 0;
  margin: 0;
}

.navbar-bottom__item--button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  width: 100%;
  color: inherit;
}

.navbar-bottom__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 1 1 0;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  transition: color 120ms ease;
}

.navbar-bottom__item:focus-visible,
.navbar-bottom__item:hover {
  color: var(--accent);
}

.navbar-bottom__icon {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  color: inherit;
  position: relative;
}

.navbar-bottom__icon svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
}

.navbar-bottom__item[data-support-unread="true"] .navbar-bottom__icon::after {
  content: '';
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--bg);
}

body[data-theme='dark'] .navbar-bottom__item[data-support-unread="true"] .navbar-bottom__icon::after {
  box-shadow: 0 0 0 2px var(--surface);
}

.navbar-bottom__label {
  line-height: 1;
  font-size: 0.85rem;
  font-weight: 600;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  min-width: 70vw;
  padding: 3rem 1.25rem 4rem;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

@media (max-width: 1200px) {
  .container {
    max-width: 100%;
    min-width: 100%;
    padding: 2.75rem 1.5rem 3.5rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 2.25rem 1.1rem 2.75rem;
    gap: 1.6rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1.75rem 0.75rem 2.25rem;
    gap: 1.4rem;
  }
}

/* Swagger page styling */
.swagger-surface {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.swagger-surface .swagger-ui {
  background: transparent;
}

.container h1 {
  text-align: center;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.4rem, 5.2vw, 1.9rem);
}

h2 {
  font-size: clamp(1.1rem, 4.2vw, 1.35rem);
}

h3 {
  font-size: clamp(0.95rem, 3.6vw, 1.1rem);
}

p {
  margin: 0;
  color: var(--muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--fg);
}

label.checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 500;
}

label.checkbox input[type='checkbox'] {
  margin-top: 0.2rem;
}

input,
select,
textarea {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  font: inherit;
  font-size: 1rem; /* Prevent iOS auto-zoom on focus */
  color: var(--fg);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.9rem 1.4rem;
  border-radius: 12px;
  border: none;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #4338ca);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.3);
}

button:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.4);
  outline-offset: 2px;
}

button:disabled,
.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(79, 70, 229, 0.28);
  box-shadow: none;
}

.button--ghost:hover {
  background: rgba(79, 70, 229, 0.08);
  box-shadow: none;
}

.button--soft {
  background: rgba(79, 70, 229, 0.16);
  color: var(--accent);
  border: 1px solid rgba(79, 70, 229, 0.3);
  box-shadow: none;
}

.button--soft:hover {
  background: rgba(79, 70, 229, 0.22);
  box-shadow: none;
}

.button--compact {
  padding: 0.45rem 0.85rem;
  font-size: 0.95rem;
  line-height: 1.1;
}

.button__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.button__icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.button__icon--badge {
  padding: 0.25rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
}

.button--soft .button__icon--badge {
  background: rgba(79, 70, 229, 0.24);
}

.button--ghost .button__icon--badge {
  background: rgba(79, 70, 229, 0.2);
}

body[data-theme='dark'] .button__icon--badge {
  background: rgba(255, 255, 255, 0.32);
}

body[data-theme='dark'] .button--soft {
  color: #e0e7ff;
  background: rgba(79, 70, 229, 0.26);
  border-color: rgba(129, 140, 248, 0.45);
}

body[data-theme='dark'] .button--soft:hover {
  background: rgba(79, 70, 229, 0.32);
}

body[data-theme='dark'] .button--soft .button__icon--badge {
  background: rgba(129, 140, 248, 0.38);
}

body[data-theme='dark'] .button--ghost .button__icon--badge {
  background: rgba(79, 70, 229, 0.28);
}

.button--full {
  width: 100%;
}

.button--danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.25);
}

.button--danger:hover {
  box-shadow: 0 18px 36px rgba(239, 68, 68, 0.32);
}

.card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  margin: 10px 0;
  justify-content: space-evenly;
}

/* Header grid for welcome + daily usage */
.account-header {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  align-items: stretch;
}

@media (min-width: 960px) {
  .account-header {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

.card--narrow {
  width: min(420px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.card--disabled {
  border-style: dashed;
  background: rgba(148, 163, 184, 0.08);
  filter: grayscale(1);
}

body[data-theme='dark'] .card--disabled {
  background: rgba(148, 163, 184, 0.12);
}

.card--disabled h2,
.card--disabled p,
.card--disabled span {
  color: var(--muted);
}

.card--disabled .option {
  cursor: not-allowed;
  border-style: dashed;
  background: transparent;
}

.card--disabled .option:hover {
  border-color: var(--border);
  background: transparent;
}

.card--disabled .option input[type='radio'] {
  accent-color: var(--muted);
  cursor: not-allowed;
}

.card--disabled .option span {
  color: var(--muted);
}

.card--disabled .option-list {
  pointer-events: none;
}

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

.card.warning {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.token-card {
  gap: 1.75rem;
}

.pro-stats {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 960px) {
  .pro-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.history-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-entry {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease;
  flex-wrap: wrap;
}

.history-entry:hover,
.history-entry:focus-within {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.18);
}

.history-entry__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 1.4rem;
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent);
}

.history-entry__content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.history-entry__address {
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  word-break: break-word;
}

.history-entry__address:hover,
.history-entry__address:focus-visible {
  color: var(--accent);
  outline: none;
}

.history-entry__time {
  font-size: 0.85rem;
  color: var(--muted);
}

.history-entry .compare-button {
  margin-left: auto;
}

@media (max-width: 640px) {
  .history-entry {
    flex-direction: column;
    align-items: stretch;
  }

  .history-entry__icon {
    align-self: flex-start;
  }

  .history-entry .compare-button {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

body[data-theme='dark'] .history-entry {
  background: var(--surface-strong);
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.6);
}

body[data-theme='dark'] .history-entry__icon {
  background: rgba(129, 140, 248, 0.18);
  color: var(--accent-soft);
}

.token-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.token-card__title p {
  margin-top: 0.35rem;
}

.token-card__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent);
}

.token-card__pill--muted {
  background: rgba(148, 163, 184, 0.18);
  color: var(--muted);
}

.token-card__pill--success {
  background: rgba(34, 197, 94, 0.18);
  color: #166534;
}

body[data-theme='dark'] .token-card__pill--success {
  color: #bbf7d0;
}

.token-card__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.token-card__value {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.15rem;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: var(--surface);
}

.token-card__value-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.token-card__mask {
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 1.05rem;
  color: var(--fg);
  word-break: break-all;
}

.token-card__mask--empty {
  color: var(--muted);
  font-style: italic;
}

.token-card__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.token-card__note {
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-card {
  gap: 1.75rem;
}

.chart-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.chart-card__actions {
  display: inline-flex;
  gap: 0.5rem;
  background: var(--surface);
  border-radius: 999px;
  padding: 0.25rem;
  border: 1px solid var(--border);
}

.chart-card__actions button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.chart-card__actions button.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.28);
}

.chart-card__actions button:hover:not(.is-active) {
  color: var(--accent);
}

.chart-container {
  position: relative;
  width: 100%;
  min-height: 280px;
}

.chart-legend {
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-legend__summary {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.chart-legend__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  background: var(--surface);
  color: var(--text);
}

.chart-legend__dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--legend-color, var(--accent));
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.25);
}

.chart-legend__label {
  font-weight: 500;
}

.chart-legend__value {
  font-size: 0.8rem;
  color: var(--muted);
}

.chart-legend__empty {
  margin: 0;
  color: var(--muted);
}

.admin-analytics__controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.admin-analytics__controls label {
  font-weight: 600;
}

.admin-analytics__controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-analytics__controls select,
.admin-analytics__controls input[type='search'] {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  padding: 0.6rem;
  font-size: 0.9rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.admin-analytics__controls select:focus-visible,
.admin-analytics__controls input[type='search']:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .admin-analytics__controls {
    gap: 0.6rem;
  }

  .admin-analytics__controls select,
  .admin-analytics__controls input[type='search'] {
    max-width: 100%;
  }

  .admin-analytics__controls p {
    margin-bottom: 0.2rem;
  }
}

.combo-select {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.combo-select input[type='search'] {
  max-width: none;
}

.combo-select__dropdown {
  position: absolute;
  top: 45px;
  left: 0;
  right: 0;
  z-index: 25;
  background: var(--surface-strong);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  max-height: 280px;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .combo-select__dropdown {
    position: static;
    max-height: 220px;
  }
}

.combo-select__dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.combo-select__dropdown li {
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  transition: background 120ms ease;
}

.combo-select__dropdown li:hover,
.combo-select__dropdown li[aria-selected='true'] {
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent);
}

.combo-select__dropdown li.is-disabled {
  opacity: 0.5;
  cursor: default;
}

.combo-select__dropdown li.is-disabled:hover,
.combo-select__dropdown li.is-disabled[aria-selected='true'] {
  background: transparent;
  color: inherit;
}

.combo-select__footer {
  padding: 0.5rem 0.8rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.combo-select__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.5rem;
}

.combo-select__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.combo-select__tag button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.75rem;
}

.radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.radio input[type='radio'] {
  margin: 0;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.table-controls input[type='search'] {
  flex: 1 1 240px;
  max-width: 320px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.table-controls__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.table-pagination {
  display: inline-flex;
  gap: 0.5rem;
}

.table-pagination button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  background: var(--surface);
  color: var(--fg);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.table-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-pagination button:not(:disabled):hover {
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent);
}

.table-sort {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
}

.table-sort::after {
  content: '';
  border: 4px solid transparent;
  border-top-color: currentColor;
  transform: translateY(2px);
  opacity: 0.2;
}

/* App footer (discreet) */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.app-footer__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.app-footer__link {
  color: inherit;
  text-decoration: none;
}

.app-footer__link:hover,
.app-footer__link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.table-sort.is-active::after {
  opacity: 1;
}

.table-sort[data-sort-direction='asc']::after {
  border-top-color: transparent;
  border-bottom-color: currentColor;
  transform: translateY(-2px);
}

.table-sort[data-sort-direction='']::after {
  opacity: 0.2;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 120;
}

.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast__inner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  padding: 0.65rem 1.1rem;
  color: var(--fg);
  font-weight: 600;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.toast[data-tone='success'] .toast__inner {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

body[data-theme='dark'] .toast[data-tone='success'] .toast__inner {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
}

.toast[data-tone='error'] .toast__inner {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
}

body[data-theme='dark'] .toast[data-tone='error'] .toast__inner {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.38);
}

.toast[data-tone='info'] .toast__inner {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}

body[data-theme='dark'] .toast[data-tone='info'] .toast__inner {
  background: rgba(99, 102, 241, 0.18);
}

@media (max-width: 768px) {
  .chart-card header {
    flex-direction: column;
    align-items: flex-start;
  }
  .chart-card__actions {
    width: 100%;
  }
  .chart-card__actions button {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Compact layout for small phones (iPhone 11/XR/SE width) */
@media (max-width: 430px) {
  .card {
    border-radius: 16px;
    padding: 1rem;
  }

  .stats {
    gap: 0.75rem;
  }
  .stats div {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    gap: 0.25rem;
  }
  .stats dt { font-size: 0.78rem; }
  .stats dd { font-size: 1.35rem; }

  .account-table { font-size: 0.88rem; }
  .account-table thead th { padding: 0.65rem 0.8rem; }
  .account-table tbody td { padding: 0.6rem 0.8rem; }

  h1 { letter-spacing: -0.01em; }

  /* Reflow account tables into stacked cards */
  .table-wrapper { overflow: visible; }
  .account-table { border-collapse: separate; border-spacing: 0; }
  .account-table thead { display: none; }
  .account-table tbody tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.9rem;
    border-bottom: 1px solid var(--border);
    background: transparent;
  }
  .account-table tbody td {
    padding: 0;
    border: 0;
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: baseline;
    gap: 0.35rem;
  }

  .account-table--purchases tbody td:nth-child(1)::before { content: 'Adresse'; font-weight: 600; color: var(--muted); }
  .account-table--purchases tbody td:nth-child(2)::before { content: 'Statut'; font-weight: 600; color: var(--muted); }
  .account-table--purchases tbody td:nth-child(3)::before { content: 'Crédits'; font-weight: 600; color: var(--muted); }
  .account-table--purchases tbody td:nth-child(4)::before { content: 'Acheté le'; font-weight: 600; color: var(--muted); }
  .account-table--purchases tbody td:nth-child(5)::before { content: 'Expiration'; font-weight: 600; color: var(--muted); }

  .account-table--history tbody td:nth-child(1)::before { content: 'Date'; font-weight: 600; color: var(--muted); }
  .account-table--history tbody td:nth-child(2)::before { content: 'Montant'; font-weight: 600; color: var(--muted); }
  .account-table--history tbody td:nth-child(3)::before { content: 'Prix payé'; font-weight: 600; color: var(--muted); }
  .account-table--history tbody td:nth-child(4)::before { content: 'Origine'; font-weight: 600; color: var(--muted); }
  .account-table--history tbody td:nth-child(5)::before { content: 'Validité'; font-weight: 600; color: var(--muted); }
  .account-table--history tbody td:nth-child(6)::before { content: 'Facture'; font-weight: 600; color: var(--muted); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 1.5rem;
}

.modal {
  width: min(520px, 100%);
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 2rem;
}

.admin-associations-modal {
  width: 90vw;
}

.modal h3 {
  margin-bottom: 0.4rem;
}

.modal pre {
  margin: 0;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-x: auto;
}

.modal .button-row {
  justify-content: flex-end;
}

.option-list {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  flex-wrap: wrap;
}

.option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.option:hover {
  border-color: var(--accent);
  background: rgba(79, 70, 229, 0.08);
}

.option input[type='radio'] {
  accent-color: var(--accent);
}

.chat-card {
  gap: 1.75rem;
}

.support-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.support-card__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-top: 1.1rem;
}

.support-metric {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(79, 70, 229, 0.08);
  color: var(--fg);
}

.support-metric__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.support-metric__value {
  font-size: 1.1rem;
  font-weight: 600;
}

.support-card__cta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.support-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.04);
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.support-card__cta:hover,
.support-card__cta:focus {
  border-color: rgba(79, 70, 229, 0.4);
  background: rgba(79, 70, 229, 0.12);
  transform: translateY(-1px);
}

.support-card__cta::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.65;
}

.support-card__cta:focus-visible {
  outline: 2px solid rgba(79, 70, 229, 0.6);
  outline-offset: 2px;
}

.chat-window {
  position: relative;
  max-height: 420px;
  overflow-y: auto;
  padding: 1.25rem 1.35rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.04);
  scrollbar-gutter: stable both-edges;
}

.chat-window::-webkit-scrollbar {
  width: 10px;
}

.chat-window::-webkit-scrollbar-thumb {
  background: rgba(79, 70, 229, 0.24);
  border-radius: 999px;
}

.chat-window::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chat-divider::before,
.chat-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  opacity: 0.65;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 520px;
}

.chat-message__sender {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.chat-message__bubble {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-message__meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.chat-message--user .chat-message__meta {
  align-self: flex-end;
}

.chat-message--support .chat-message__meta {
  align-self: flex-start;
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.table-scroll th,
.table-scroll td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  transition: background 120ms ease, color 120ms ease;
}

.table-scroll th {
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.12), rgba(79, 70, 229, 0.05));
}

body[data-theme='dark'] .table-scroll th {
  background: linear-gradient(180deg, rgba(129, 140, 248, 0.2), rgba(30, 41, 59, 0.8));
}

.table-scroll tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.06);
}

.table-scroll tbody tr:hover {
  background: rgba(99, 102, 241, 0.12);
}

.table-scroll td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

.table-scroll td.is-numeric,
.table-scroll th.is-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-scroll td.is-actions,
.table-scroll th.is-actions {
  text-align: right;
  white-space: nowrap;
}

.table-scroll td.is-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.table-scroll tbody tr:last-child td {
  border-bottom: 0;
}

.support-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 1.5rem;
}

.support-threads {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.support-threads::-webkit-scrollbar {
  width: 8px;
}

.support-threads::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.support-threads::-webkit-scrollbar-track {
  background: transparent;
}

.support-thread {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.support-thread:hover {
  border-color: var(--accent);
  background: rgba(79, 70, 229, 0.08);
}

.support-thread--pending {
  border-color: rgba(239, 68, 68, 0.4);
}

.support-thread--active {
  border-color: rgba(79, 70, 229, 0.55);
  background: rgba(79, 70, 229, 0.14);
  box-shadow: 0 18px 38px rgba(79, 70, 229, 0.18);
}

.support-thread__email {
  font-weight: 600;
}

.support-thread__preview {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.support-thread__meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.support-thread__status {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.support-thread__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(34, 197, 94, 0.18);
  color: #047857;
}

.support-thread--pending .support-thread__badge {
  background: rgba(248, 113, 113, 0.24);
  color: #b91c1c;
}

.support-thread--unseen {
  border-color: rgba(59, 130, 246, 0.65);
  background: rgba(59, 130, 246, 0.08);
}

.support-thread--unseen .support-thread__meta {
  color: #1d4ed8;
}

.support-thread--unseen .support-thread__badge {
  background: rgba(59, 130, 246, 0.25);
  color: #1d4ed8;
}

.support-thread--closed {
  opacity: 0.7;
}

.support-thread--closed.support-thread--active {
  opacity: 1;
}

.support-thread--closed .support-thread__badge {
  background: rgba(148, 163, 184, 0.24);
  color: #475569;
}

.support-conversation {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (max-width: 960px) {
  .support-layout {
    grid-template-columns: 1fr;
  }

  .support-card__meta {
    grid-template-columns: 1fr;
  }

  .table-scroll table {
    min-width: 520px;
  }
}

@media (max-width: 540px) {
  .table-scroll table {
    min-width: 480px;
  }
}

.chat-message--user {
  align-self: flex-end;
}

.chat-message--user .chat-message__bubble {
  background: rgba(79, 70, 229, 0.16);
  border-color: rgba(79, 70, 229, 0.24);
}

.chat-message--support .chat-message__bubble {
  background: rgba(15, 23, 42, 0.06);
}

.chat-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 1.75rem 1rem;
}

.chat-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.chat-header__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.chat-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.chat-header__subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(99, 102, 241, 0.16);
  color: #4338ca;
}

.chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

.chat-status--positive {
  background: rgba(34, 197, 94, 0.22);
  color: #047857;
}

.chat-status--positive::before {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.chat-status--alert {
  background: rgba(248, 113, 113, 0.22);
  color: #b91c1c;
}

.chat-status--alert::before {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

.support-conversation__header {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.support-conversation__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.support-conversation__meta strong {
  color: var(--fg);
}

.support-conversation__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.03);
}

.support-conversation__empty {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.support-conversation__empty strong {
  color: var(--fg);
  font-size: 1rem;
}

.chat-input {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-input textarea {
  resize: vertical;
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
}

.card h1,
.card h2,
.card h3 {
  color: var(--fg);
}

.card-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card--hero {
  background: linear-gradient(150deg, rgba(79, 70, 229, 0.12), rgba(255, 255, 255, 0.88));
  border-color: rgba(79, 70, 229, 0.22);
  box-shadow: 0 32px 70px rgba(79, 70, 229, 0.2);
  gap: 1.5rem;
}

.card--note {
  background: var(--surface);
  border-style: dashed;
  border-color: rgba(79, 70, 229, 0.24);
  color: var(--muted);
}

.api-callout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-callout__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.api-callout__title {
  margin: 0;
  color: var(--fg);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.api-callout__grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.api-callout__item {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px dashed rgba(79, 70, 229, 0.22);
}

.api-callout__endpoint {
  display: block;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.95rem;
  color: var(--accent);
}

.api-callout__desc {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.16);
  color: #312e81;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-text {
  max-width: 520px;
  font-size: 1.05rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid rgba(79, 70, 229, 0.22);
}

.pricing-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.6rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 14px 32px rgba(31, 27, 110, 0.12);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.plan:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 44px rgba(31, 27, 110, 0.16);
  border-color: rgba(79, 70, 229, 0.22);
}

.plan--highlighted {
  background: var(--surface);
  border-color: rgba(79, 70, 229, 0.28);
  box-shadow: 0 22px 48px rgba(31, 27, 110, 0.18);
}

.plan--highlighted .plan__badge {
  background: rgba(79, 70, 229, 0.22);
  color: var(--accent-contrast);
}

.plan--highlighted .plan__feature {
  color: var(--fg);
}

.plan--highlighted .plan__feature::before {
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.plan--highlighted .button {
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.18);
}

.plan--disabled {
  opacity: 0.75;
  border-style: dashed;
  box-shadow: none;
}

.plan__header {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.plan__badge {
  align-self: flex-start;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.14);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.plan__price {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
}

.plan__hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.plan__hint--secondary,
.product-card__note {
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.85;
}

.product-card__note {
  margin: 0;
}

.plan__description {
  color: var(--muted);
  font-size: 0.95rem;
}

.plan__features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.plan__feature {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
}

.plan__feature::before {
  content: '';
  flex: 0 0 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  opacity: 0.9;
}

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

.stats div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  justify-content: space-around;
}

.stats dt {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats dd {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
}

.stats-note {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.admin-users-actions .button {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.admin-users-actions .button--ghost {
  border-color: rgba(79, 70, 229, 0.32);
  background: rgba(99, 102, 241, 0.04);
}

.admin-users-actions .button--ghost:hover,
.admin-users-actions .button--ghost:focus-visible {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(79, 70, 229, 0.48);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.24);
}

body[data-theme='dark'] .admin-users-actions .button--ghost {
  border-color: rgba(129, 140, 248, 0.45);
  background: rgba(129, 140, 248, 0.08);
}

body[data-theme='dark'] .admin-users-actions .button--ghost:hover,
body[data-theme='dark'] .admin-users-actions .button--ghost:focus-visible {
  background: rgba(129, 140, 248, 0.2);
  border-color: rgba(129, 140, 248, 0.65);
  box-shadow: 0 6px 18px rgba(129, 140, 248, 0.32);
}

.admin-robots__input {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.admin-robots__input input[type='text'] {
  flex: 1 1 auto;
}

.admin-robots__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.admin-robots__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.admin-robots__item code {
  font-size: 0.9rem;
  word-break: break-all;
}

.admin-robots__empty {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.admin-robots__preview {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  background: rgba(99, 102, 241, 0.04);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-x: auto;
  color: var(--fg);
}

.admin-robots__preview pre {
  margin: 0;
  white-space: pre-wrap;
}

.admin-robots__preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.admin-robots__preview-header h3 {
  margin: 0;
  font-size: 1rem;
}

body[data-theme='dark'] .admin-robots__item {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.32);
}

body[data-theme='dark'] .admin-robots__preview {
  background: rgba(129, 140, 248, 0.08);
  border-color: rgba(129, 140, 248, 0.28);
}

.admin-ua__controls {
  align-items: center;
}

.admin-ua__controls input[type='search'] {
  max-width: 420px;
}

.admin-ua__controls select {
  flex: 0 0 auto;
  min-width: 140px;
}

.admin-ua__reason {
  font-size: 0.78rem;
  margin-top: 0.35rem;
  color: var(--muted);
  word-break: break-word;
}

.admin-ua__violation {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  text-align: right;
}

.admin-ua-rule-form {
  gap: 1.25rem;
}

.admin-ua-rule-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

body[data-theme='dark'] .admin-ua__reason {
  color: rgba(226, 232, 240, 0.75);
}

.admin-ip-form {
  gap: 1rem;
}

.admin-ip-form__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-route-stats {
  margin-bottom: 1rem;
}

.admin-route-stats h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.admin-route-chip {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--fg);
  font-size: 0.75rem;
  margin: 0 0.25rem 0.25rem 0;
}

.admin-route-chip code {
  font-size: 0.75rem;
}

.boolean-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  background: rgba(148, 163, 184, 0.18);
  color: var(--fg);
}

.boolean-icon > span:first-child {
  line-height: 1;
}

.boolean-icon--true {
  background: rgba(34, 197, 94, 0.18);
  color: #166534;
}

.boolean-icon--false {
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
}

body[data-theme='dark'] .boolean-icon--true {
  background: rgba(34, 197, 94, 0.28);
  color: #4ade80;
}

body[data-theme='dark'] .boolean-icon--false {
  background: rgba(248, 113, 113, 0.28);
  color: #fca5a5;
}

.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;
}

.legal-withdrawal-form {
  display: block;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(99, 102, 241, 0.04);
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

body[data-theme='dark'] .legal-withdrawal-form {
  background: rgba(129, 140, 248, 0.12);
  border-color: rgba(129, 140, 248, 0.32);
}

.admin-history-modal {
  width: min(760px, 100%);
  max-height: 90vh;
  max-width: 90vw !important;
  overflow-y: auto;
  position: relative;
}

.admin-history__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-history__header h3 {
  margin: 0;
}

.admin-history__header .text-muted {
  margin: 0.35rem 0 0;
}

.admin-history__loading {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.admin-history__body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-history__stats {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-history__stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.admin-history__stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.admin-history__stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
}

.admin-history__stat-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-history__sections {
  display: grid;
  gap: 1rem;
}

.admin-history__section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-history__section h4 {
  margin: 0;
  font-size: 1.05rem;
}

.admin-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.admin-history__entry {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-history__entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

.admin-history__amount {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
}

.admin-history__type {
  font-size: 0.92rem;
  color: var(--muted);
}

.admin-history__entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-history__entry-meta a {
  color: var(--accent);
  text-decoration: none;
}

.admin-history__entry-meta a:hover,
.admin-history__entry-meta a:focus-visible {
  text-decoration: underline;
}

.admin-history__empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

body[data-theme='dark'] .admin-history__stat {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.6);
}

body[data-theme='dark'] .admin-history__section {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.6);
}

@media (max-width: 640px) {
  .admin-history__sections {
    gap: 0.75rem;
  }
}

@media (min-width: 960px) {
  .admin-history-modal {
    margin-top: 2.5rem;
  }
}

.product-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.product-card {
  border: 1px solid rgb(0 0 0 / 18%);
  border-radius: 18px;
  padding: 1.5rem;
  background: linear-gradient(160deg, rgb(255 255 255 / 12%), rgb(228 232 247 / 55%));
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 24px 45px rgb(0 0 0 / 18%);
  color: var(--fg);
  margin: 10px 0;
}

.product-card__title {
  margin: 0;
  font-size: 1.1rem;
}

.product-card__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.product-card__price-main {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--fg);
}

.product-card__price-note {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  opacity: 0.85;
  line-height: 1.2;
}

.product-card__details {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.product-card__btn {
  width: 100%;
  margin-top: auto;
}

.table-wrapper {
  border-radius: 18px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  overflow: auto;
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.account-table thead th {
  text-align: left;
  padding: 0.9rem 1.1rem;
  background: rgba(79, 70, 229, 0.12);
  color: var(--fg);
  font-weight: 600;
}

.account-table tbody td {
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.purchase-coordinates {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--fg-subtle, var(--muted));
}

.account-table tbody tr:nth-child(even) {
  background: rgba(79, 70, 229, 0.04);
}

.account-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.08);
}

.account-table tr.is-active td {
  background: rgb(16 185 129 / 3%);
  color: #dbdbdb;
}

.account-table tr.is-expired td {
  background: rgba(248, 113, 113, 0.12);
  color: #9d1212;
}

.amount {
  font-weight: 600;
}

.amount-positive {
  color: #047857;
}

.amount-negative {
  color: #b91c1c;
}

.history-expiry {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.08);
  color: var(--fg, #111827);
}

.history-expiry--active {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

.history-expiry--expired {
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
}

body[data-theme='dark'] .history-expiry {
  background: rgba(148, 163, 184, 0.2);
  color: #f8fafc;
}

body[data-theme='dark'] .history-expiry--active {
  background: rgba(16, 185, 129, 0.3);
  color: #bbf7d0;
}

body[data-theme='dark'] .history-expiry--expired {
  background: rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

.invoice-link {
  color: var(--accent);
  font-weight: 600;
}

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

.empty-state {
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.form-error {
  color: #dc2626;
  font-weight: 500;
}

.form-success {
  color: #16a34a;
  font-weight: 500;
}

.promo-redeem {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.promo-redeem input[type='text'] {
  flex: 1 1 220px;
}

.promo-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.promo-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.promo-status--active {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

.promo-status--archived,
.promo-status--exhausted {
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
}

.promo-status--expired {
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
}

.pack-options {
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0;
}

.pack-options legend {
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.pack-option {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
  background: rgba(255, 255, 255, 0.92);
}

.pack-option:hover {
  border-color: var(--accent);
  box-shadow: 0 16px 35px rgba(79, 70, 229, 0.14);
  background: rgba(79, 70, 229, 0.06);
}

.pack-option input[type='radio'] {
  margin-top: 0.35rem;
}

.pack-option__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pack-option__title {
  font-weight: 600;
}

.pack-option__details {
  color: var(--muted);
  font-size: 0.9rem;
}

.pack-option input[type='radio']:checked + .pack-option__body {
  color: var(--fg);
}

.pack-option input[type='radio']:checked + .pack-option__body .pack-option__title {
  color: var(--accent);
}

#register-form .checkbox {
  flex-direction: row;
}

.account-badge__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.78rem;
  transition: filter 0.2s ease;
  gap: 0.35rem;
}

.account-badge__cta:hover {
  filter: brightness(0.94);
}

.account-badge__cta--secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

@media (max-width: 768px) {
  body {
    /* Keep content clear of fixed navbar without wasting space */
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .app-header {
    position: static;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
  }

  .navbar--top {
    display: none;
  }

  .navbar-bottom {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.8rem 1.25rem calc(0.8rem + env(safe-area-inset-bottom));
    background: var(--surface-strong);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.18);
    z-index: 50;
  }

  .container {
    padding: 1.5rem 1rem 5.8rem;
    gap: 1.25rem;
  }

  /* Footer not needed on mobile (keeps UI uncluttered) */
  .app-footer { display: none; }

  /* Ensure a small visual gap between the footer and the fixed navbar */
  .app-footer { margin-bottom: 0; }

  .card {
    padding: 1.25rem;
    overflow: auto;
  }

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

  .plan {
    padding: 1.6rem;
  }

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

@media (prefers-color-scheme: dark) {
  /* Apply the exact same dark variables and backdrop as the forced dark theme */
  body:not([data-theme]) {
    --bg: #0b1120;
    --bg-alt: #111827;
    --fg: #e2e8f0;
    --muted: #cbd5f5;
    --accent: #818cf8;
    --accent-soft: #a5b4fc;
    --accent-contrast: #111827;
    --border: rgba(148, 163, 184, 0.35);
    --border-strong: rgba(148, 163, 184, 0.5);
    --surface: rgba(15, 23, 42, 0.62);
    --surface-strong: rgba(15, 23, 42, 0.86);
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.48);
  }

  body:not([data-theme]) {
    background: radial-gradient(120% 120% at 50% 0%, #0f172a 0%, #0b1120 55%, #020617 100%);
  }

  body:not([data-theme])::before {
    background:
      radial-gradient(60% 60% at 85% 15%, rgba(99, 102, 241, 0.18), transparent 72%),
      radial-gradient(40% 40% at 15% 10%, rgba(14, 165, 233, 0.18), transparent 80%);
  }

  body:not([data-theme]) .navbar {
    background: var(--surface-strong);
    box-shadow: 0 20px 40px rgba(2, 6, 23, 0.7);
  }

  body:not([data-theme]) .navbar-bottom {
    background: var(--surface-strong);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 32px rgba(2, 6, 23, 0.6);
  }

  body:not([data-theme]) .navbar a {
    color: var(--fg);
  }

  body:not([data-theme]) .navbar a:hover {
    background: rgba(129, 140, 248, 0.16);
    color: var(--accent);
  }

  body:not([data-theme]) .navbar button:hover {
    background: rgba(129, 140, 248, 0.16);
  }

  body:not([data-theme]) .card {
    background: var(--surface-strong);
    box-shadow: 0 32px 60px rgba(2, 6, 23, 0.75);
  }

  body:not([data-theme]) .card--hero {
    background: linear-gradient(150deg, rgba(129, 140, 248, 0.28), rgba(15, 23, 42, 0.85));
    border-color: rgba(129, 140, 248, 0.35);
  }

  body:not([data-theme]) .hero-eyebrow {
    color: var(--accent-contrast);
  }

  body:not([data-theme]) .hero-pill {
    background: rgba(15, 23, 42, 0.78);
    color: var(--accent-soft);
  }

  body:not([data-theme]) .plan {
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(31, 27, 110, 0.26);
  }

  body:not([data-theme]) .plan--highlighted {
    background: var(--surface);
    border-color: rgba(129, 140, 248, 0.36);
  }

  body:not([data-theme]) .table-wrapper {
    background: rgba(15, 23, 42, 0.86);
    box-shadow: 0 26px 55px rgba(2, 6, 23, 0.72);
  }

  body:not([data-theme]) .account-table thead th {
    background: rgba(129, 140, 248, 0.14);
  }

  body:not([data-theme]) .account-table tbody tr:nth-child(even) {
    background: rgba(129, 140, 248, 0.08);
  }

  body:not([data-theme]) .account-table tbody tr:hover {
    background: rgba(129, 140, 248, 0.16);
  }
}

/* ========================================
   Address Comparison Styles
   ======================================== */

.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ========================================
   Shadow tuning (softer, blue‑tinted)
   ======================================== */

/* Light theme overrides */
body[data-theme='light'] .navbar { box-shadow: 0 12px 28px rgba(31, 27, 110, 0.14); }
body[data-theme='light'] .navbar-bottom { box-shadow: 0 -10px 24px rgba(31, 27, 110, 0.14); }
body[data-theme='light'] .card { box-shadow: 0 16px 36px rgba(31, 27, 110, 0.12); }
body[data-theme='light'] .plan { box-shadow: 0 18px 42px rgba(31, 27, 110, 0.16); }
body[data-theme='light'] .table-wrapper { box-shadow: 0 16px 34px rgba(31, 27, 110, 0.12); }
body[data-theme='light'] .compare-address-suggestions { box-shadow: 0 10px 18px rgba(31, 27, 110, 0.12); }

@media (prefers-color-scheme: light) {
  body:not([data-theme]) .navbar { box-shadow: 0 12px 28px rgba(31, 27, 110, 0.14); }
  body:not([data-theme]) .navbar-bottom { box-shadow: 0 -10px 24px rgba(31, 27, 110, 0.14); }
  body:not([data-theme]) .card { box-shadow: 0 16px 36px rgba(31, 27, 110, 0.12); }
  body:not([data-theme]) .plan { box-shadow: 0 18px 42px rgba(31, 27, 110, 0.16); }
  body:not([data-theme]) .table-wrapper { box-shadow: 0 16px 34px rgba(31, 27, 110, 0.12); }
  body:not([data-theme]) .compare-address-suggestions { box-shadow: 0 10px 18px rgba(31, 27, 110, 0.12); }
}

/* Dark theme overrides */
body[data-theme='dark'] .navbar { box-shadow: 0 14px 32px rgba(31, 27, 110, 0.28); }
body[data-theme='dark'] .navbar-bottom { box-shadow: 0 -12px 28px rgba(31, 27, 110, 0.26); }
body[data-theme='dark'] .card { box-shadow: 0 22px 46px rgba(31, 27, 110, 0.3); }
body[data-theme='dark'] .plan { box-shadow: 0 22px 48px rgba(31, 27, 110, 0.32); }
body[data-theme='dark'] .table-wrapper { box-shadow: 0 18px 40px rgba(31, 27, 110, 0.28); }
body[data-theme='dark'] .compare-address-suggestions { box-shadow: 0 10px 18px rgba(31, 27, 110, 0.24); }

@media (prefers-color-scheme: dark) {
  body:not([data-theme]) .navbar { box-shadow: 0 14px 32px rgba(31, 27, 110, 0.28); }
  body:not([data-theme]) .navbar-bottom { box-shadow: 0 -12px 28px rgba(31, 27, 110, 0.26); }
  body:not([data-theme]) .card { box-shadow: 0 22px 46px rgba(31, 27, 110, 0.3); }
  body:not([data-theme]) .plan { box-shadow: 0 22px 48px rgba(31, 27, 110, 0.32); }
  body:not([data-theme]) .table-wrapper { box-shadow: 0 18px 40px rgba(31, 27, 110, 0.28); }
  body:not([data-theme]) .compare-address-suggestions { box-shadow: 0 10px 18px rgba(31, 27, 110, 0.24); }

  /* Auto(dark) parity with forced dark for key components */
  body:not([data-theme]) .card { box-shadow: 0 22px 46px rgba(31, 27, 110, 0.3); }
  body:not([data-theme]) .history-entry { background: var(--surface-strong); box-shadow: 0 14px 38px rgba(15, 23, 42, 0.6); }
  body:not([data-theme]) .history-entry__icon { background: rgba(129, 140, 248, 0.18); color: var(--accent-soft); }
  body:not([data-theme]) .toast[data-tone='success'] .toast__inner { color: #bbf7d0; background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.35); }
  body:not([data-theme]) .toast[data-tone='error'] .toast__inner { color: #fecaca; background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.38); }
  body:not([data-theme]) .toast[data-tone='info'] .toast__inner { background: rgba(99, 102, 241, 0.18); }
  body:not([data-theme]) .table-scroll th { background: linear-gradient(180deg, rgba(129, 140, 248, 0.2), rgba(30, 41, 59, 0.8)); }
  body:not([data-theme]) .navbar__item[data-support-unread="true"] .navbar__icon::after { box-shadow: 0 0 0 2px var(--bg); }
  body:not([data-theme]) .navbar-bottom__item[data-support-unread="true"] .navbar-bottom__icon::after { box-shadow: 0 0 0 2px var(--surface); }
  body:not([data-theme]) .button__icon--badge { background: rgba(255, 255, 255, 0.32); }
  body:not([data-theme]) .button--soft { color: #e0e7ff; background: rgba(79, 70, 229, 0.26); border-color: rgba(129, 140, 248, 0.45); }
  body:not([data-theme]) .button--soft:hover { background: rgba(79, 70, 229, 0.32); }
  body:not([data-theme]) .button--soft .button__icon--badge { background: rgba(129, 140, 248, 0.38); }
  body:not([data-theme]) .button--ghost .button__icon--badge { background: rgba(79, 70, 229, 0.28); }
}

/* Product/Plan backgrounds: light vs dark */
/* Light (default and forced) */
body[data-theme='light'] .plan,
body[data-theme='light'] .plan--highlighted {
  background: linear-gradient(160deg, rgb(255 255 255 / 12%), rgb(223 227 255 / 92%));
}

@media (prefers-color-scheme: light) {
  body:not([data-theme]) .plan,
  body:not([data-theme]) .plan--highlighted {
    background: linear-gradient(160deg, rgb(255 255 255 / 12%), rgb(223 227 255 / 92%));
  }
}

/* Dark (forced) */
body[data-theme='dark'] .product-card {
  background: linear-gradient(160deg, rgb(255 255 255 / 8%), rgb(9 14 32 / 92%));
}

/* Respect system dark when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  body:not([data-theme]) .product-card {
    background: linear-gradient(160deg, rgb(255 255 255 / 8%), rgb(9 14 32 / 92%));
  }
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .compare-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.compare-card {
  display: flex;
  flex-direction: column;
}

.compare-card__header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.compare-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--accent);
}

.compare-card__body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.compare-field {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem 1rem;
  align-items: baseline;
}

.compare-field--full {
  grid-template-columns: 1fr;
}

.compare-field__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.compare-field__value {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--fg);
}

.compare-field__value--address {
  font-weight: 500;
  word-break: break-word;
}

.compare-field__value--number {
  font-weight: 600;
  color: var(--accent);
  font-size: 1.125rem;
}

.compare-sections {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.compare-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-alt);
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
}

.compare-section__label {
  flex: 1;
  font-weight: 500;
}

.compare-section__count {
  font-weight: 600;
  color: var(--accent);
}

.compare-section__credits {
  color: var(--muted);
  font-size: 0.8125rem;
}

.compare-diff--higher {
  font-weight: 600;
  color: var(--accent);
}

.compare-diff--lower {
  color: var(--muted);
}

/* Modal for address selection */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: var(--surface-strong);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.modal__header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fg);
}

.modal__body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.address-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.address-list-item {
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 120ms ease;
  background: var(--bg-alt);
}

.address-list-item:hover {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateX(4px);
}

.address-list-item--selected {
  border-color: var(--accent);
  background: var(--accent-contrast);
}

.address-list-item__address {
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--fg);
  word-break: break-word;
}

.address-list-item__time {
  font-size: 0.8125rem;
  color: var(--muted);
}

.compare-button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--accent);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 120ms ease;
  font-weight: 500;
}

.compare-button:hover {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.compare-button__icon {
  font-size: 1rem;
}

@media (max-width: 640px) {
  .modal {
    max-height: 90vh;
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding: 1rem;
  }

  .compare-header {
    flex-direction: column;
    align-items: stretch;
  }

  .compare-header .button {
    width: 100%;
    text-align: center;
  }
}

/* ========================================
   Comparison Summary Styles
   ======================================== */

.compare-subtitle {
  color: var(--muted);
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
}

.compare-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.compare-card__header--primary .compare-card__title {
  color: var(--accent);
}

.compare-card__header--secondary .compare-card__title {
  color: var(--accent-soft);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge--success {
  background: rgba(34, 197, 94, 0.15);
  color: rgb(22, 163, 74);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

body[data-theme='dark'] .badge--success {
  background: rgba(34, 197, 94, 0.2);
  color: rgb(134, 239, 172);
  border-color: rgba(34, 197, 94, 0.3);
}

.compare-field__value--warning {
  color: rgb(234, 179, 8);
  font-weight: 600;
}

body[data-theme='dark'] .compare-field__value--warning {
  color: rgb(250, 204, 21);
}

.comparison-summary {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1.5rem;
}

.comparison-stat {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comparison-stat__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.comparison-stat__values {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.comparison-stat__value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.comparison-stat__number {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.comparison-stat__value--primary .comparison-stat__number {
  color: var(--accent);
}

.comparison-stat__value--secondary .comparison-stat__number {
  color: var(--accent-soft);
}

.comparison-stat__caption {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.comparison-stat__separator {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.5;
}

.compare-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

@media (max-width: 640px) {
  .comparison-stat__values {
    flex-direction: column;
    gap: 1.5rem;
  }

  .comparison-stat__separator {
    transform: rotate(90deg);
  }

  .compare-actions {
    flex-direction: column;
  }

  .compare-actions .button {
    width: 100%;
  }
}

/* ========================================
   Comparison Page - Real Estate Data
   ======================================== */

.loading-state,
.error-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.error-state {
  color: rgb(239, 68, 68);
}

body[data-theme='dark'] .error-state {
  color: rgb(252, 165, 165);
}

.error-message {
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.compare-addresses-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
  overflow: visible;
}

.compare-address-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  backdrop-filter: blur(20px);
  overflow: visible;
  position: relative;
  z-index: 5;
  align-items: center;
}

.compare-address-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--accent);
  word-break: break-word;
}

.compare-address-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.compare-address-edit {
  margin-top: 0.5rem;
  position: relative;
  overflow: visible;
  min-height: 50px;
}

.compare-address-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--background);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
}

.compare-address-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.compare-address-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin-top: 0.25rem;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body[data-theme='dark'] .compare-address-suggestions {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

.compare-address-suggestion {
  padding: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s;
  font-size: 0.875rem;
}

.compare-address-suggestion:hover {
  background: var(--background);
}

.compare-address-suggestion:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.button--sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.compare-section {
  margin-bottom: 1.5rem;
}

.compare-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compare-grid-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 420px) {
  .compare-grid-data {
    gap: 0.9rem;
  }
  .compare-data-label { font-size: 0.8rem; }
  .compare-data-field { gap: 0.6rem; }
}

.compare-data-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.compare-data-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}

/* Column headers inside each compare section */
.compare-cols-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: -0.5rem 0 0.5rem;
}
.compare-col-title { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.compare-col-title--right { text-align: right; }

.compare-data-label {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.compare-data-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  padding: 6px 10px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

/* Comparison color indicators */
.compare-data-value.compare-better {
  background-color: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
  border-left: 3px solid #2e7d32;
}

.compare-data-value.compare-worse {
  background-color: rgba(198, 40, 40, 0.1);
  color: #c62828;
  border-left: 3px solid #c62828;
}

.compare-data-value.compare-neutral {
  background-color: transparent;
  color: var(--accent);
  border-left: none;
}
