: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%);
}

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__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;
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.25);
  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__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;
}

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

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

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

.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.75rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.plan {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.1);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.plan:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 70px rgba(79, 70, 229, 0.22);
}

.plan--highlighted {
  background: linear-gradient(150deg, rgba(79, 70, 229, 0.18), rgba(255, 255, 255, 0.94));
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 36px 80px rgba(79, 70, 229, 0.28);
}

.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 18px 40px rgba(79, 70, 229, 0.28);
}

.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.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.16);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.plan__price {
  font-size: 1.85rem;
  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.98rem;
}

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

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

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

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

.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-history-modal {
  width: min(760px, 100%);
  max-height: 90vh;
  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__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(9 14 32 / 92%));
  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;
  font-size: 0.95rem;
  color: var(--muted);
}

.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) {
  :root {
    --bg: #0f172a;
    --bg-alt: #111c36;
    --fg: #e2e8f0;
    --muted: #94a3b8;
    --accent: #818cf8;
    --accent-soft: #a5b4fc;
    --accent-contrast: #1e1b4b;
    --border: rgba(148, 163, 184, 0.24);
    --border-strong: rgba(148, 163, 184, 0.36);
    --surface: rgba(15, 23, 42, 0.72);
    --surface-strong: rgba(15, 23, 42, 0.82);
    --shadow: 0 24px 48px rgba(2, 6, 23, 0.72);
  }

  body {
    background: radial-gradient(120% 120% at 50% 0%, #1e293b 0%, #0f172a 55%, #020617 100%);
  }

  body::before {
    background:
      radial-gradient(60% 60% at 85% 15%, rgba(129, 140, 248, 0.24), transparent 72%),
      radial-gradient(40% 40% at 15% 10%, rgba(14, 165, 233, 0.18), transparent 80%);
  }

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

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

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

  .navbar a {
    color: var(--fg);
  }

  .navbar a:hover {
    background: rgba(129, 140, 248, 0.16);
    color: var(--accent);
  }

  .navbar button:hover {
    background: rgba(129, 140, 248, 0.16);
  }

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

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

  .hero-eyebrow {
    color: var(--accent-contrast);
  }

  .hero-pill {
    background: rgba(15, 23, 42, 0.78);
    color: var(--accent-soft);
  }

  .plan {
    background: var(--surface-strong);
    box-shadow: 0 26px 55px rgba(2, 6, 23, 0.68);
  }

  .plan--highlighted {
    background: linear-gradient(150deg, rgba(129, 140, 248, 0.32), rgba(15, 23, 42, 0.85));
    border-color: rgba(129, 140, 248, 0.4);
  }

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

  .account-table thead th {
    background: rgba(129, 140, 248, 0.14);
  }

  .account-table tbody tr:nth-child(even) {
    background: rgba(129, 140, 248, 0.08);
  }

  .account-table tbody tr:hover {
    background: rgba(129, 140, 248, 0.16);
  }
}
