:root {
  color-scheme: light;
  --brand: #0f3d6e;
  --brand-dark: #06223f;
  --brand-light: #1e6bb8;
  --accent: #f4a700;
  --accent-soft: rgba(244, 167, 0, 0.15);
  --text: #0f172a;
  --muted: #64748b;
  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(15, 61, 110, 0.1);
  --max: 1120px;
  --header-h: 3.25rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
body.nav-open { overflow: hidden; }

a { color: var(--brand-light); }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
img { max-width: 100%; height: auto; display: block; }

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  min-height: var(--header-h);
}
.site-header .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--brand);
  font-weight: 800;
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  min-width: 0;
  flex-shrink: 1;
}
.site-header .logo span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-header .logo img { height: 36px; width: 36px; flex-shrink: 0; }

.nav-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  color: var(--brand);
}
.nav-toggle-bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 20px;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover { background: var(--bg); color: var(--brand); }
.site-nav .btn-nav {
  background: var(--brand);
  color: #fff !important;
}
.site-nav .btn-nav:hover { background: var(--brand-light); }

@media (max-width: 767px) {
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top));
    left: var(--safe-left);
    right: var(--safe-right);
    z-index: 60;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem 1rem calc(1rem + var(--safe-bottom));
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 32px rgba(15, 61, 110, 0.12);
    max-height: calc(100dvh - var(--header-h) - var(--safe-top));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  }
  .site-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .site-nav a {
    width: 100%;
    justify-content: flex-start;
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }
  .site-nav .btn-nav {
    text-align: center;
    justify-content: center;
    margin-top: 0.35rem;
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(6, 34, 63, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
  }
  .nav-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 45%, #1a5085 100%);
  color: #fff;
  padding: 3.5rem 0 4rem;
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 20%, rgba(244, 167, 0, 0.2), transparent 45%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
}
.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero .lead {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  opacity: 0.94;
  max-width: 34rem;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}
.badge {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.hero-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.hero-card img { max-width: 220px; margin: 0 auto 1rem; }

/* Buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.35rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: var(--brand-dark);
  box-shadow: 0 4px 18px rgba(244, 167, 0, 0.45);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary {
  background: #fff;
  color: var(--brand);
}
.btn-secondary:hover { background: #f0f6fc; }
.btn-outline-light {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.1); }
.btn-dark { background: var(--brand); color: #fff; }
.btn-muted {
  background: var(--bg);
  color: var(--muted);
  border: 1px dashed var(--border);
  pointer-events: none;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: -2rem;
  position: relative;
  z-index: 2;
  padding-bottom: 2.5rem;
}
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat strong {
  display: block;
  font-size: 1.5rem;
  color: var(--brand);
  line-height: 1.2;
}
.stat span { font-size: 0.82rem; color: var(--muted); font-weight: 600; }

/* Sections */
section { padding: 3rem 0; }
.section-head {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto 2rem;
}
.section-head h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  color: var(--brand);
  font-weight: 800;
}
.section-head p { margin: 0; color: var(--muted); }

.grid-3 {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-4 {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: 0 4px 20px rgba(15, 61, 110, 0.05);
}
.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--brand);
}
.card p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.card .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.85rem;
}

/* Steps */
.steps { counter-reset: step; }
.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

/* Brands */
.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.85rem;
}
.brand-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 0.75rem;
  text-align: center;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.brand-tile img {
  max-height: 36px;
  max-width: 90px;
  object-fit: contain;
}
.brand-tile .initial {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-tile span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.brands-loading { text-align: center; color: var(--muted); padding: 2rem; }
.brands-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.95rem;
  grid-column: 1 / -1;
}
.brands-empty a { color: var(--brand-light); font-weight: 600; }

/* App CTA band */
.cta-band {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: #fff;
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  display: grid;
  gap: 1.5rem;
  align-items: center;
}
@media (min-width: 768px) {
  .cta-band { grid-template-columns: 1fr auto; padding: 2.5rem 2rem; }
}
.cta-band h2 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.cta-band p { margin: 0; opacity: 0.9; }

/* Categories chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.chip {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand);
}

/* Legacy page */
.page-legacy .hero { padding: 2.5rem 0; }
.legacy-banner {
  background: #fff8e6;
  border: 1px solid #f4d58a;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.92rem;
}
.timeline {
  border-left: 3px solid var(--brand);
  padding-left: 1.25rem;
  margin: 0;
  list-style: none;
}
.timeline li { margin-bottom: 1.25rem; }
.timeline strong { color: var(--brand); display: block; }

/* Footer */
.site-footer {
  background: var(--brand-dark);
  color: rgba(255, 255, 255, 0.85);
  padding: 2.5rem 0 2rem;
  margin-top: 2rem;
}
.site-footer a { color: #fff; }
.footer-grid {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 700px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
}
.site-footer h4 { margin: 0 0 0.75rem; color: #fff; font-size: 0.9rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.4rem; }
.site-footer .copy {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  text-align: center;
  opacity: 0.75;
}

/* Document pages (legal, account deletion) */
.page-doc .doc-header {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 1.75rem 0 2rem;
}
.page-doc .doc-header .container { width: min(100% - 1.5rem, 42rem); }
.page-doc .doc-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 5vw, 1.65rem);
  line-height: 1.2;
  font-weight: 800;
}
.page-doc .doc-header p { margin: 0; opacity: 0.92; font-size: 0.95rem; }
.page-doc .doc-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding: 0.35rem 0;
  min-height: 44px;
}
.page-doc .doc-back:hover { color: #fff; }
.page-doc .doc-main {
  width: min(100% - 1.5rem, 42rem);
  margin: 0 auto;
  padding: 1.25rem 0 calc(2.5rem + var(--safe-bottom));
}
.page-doc .doc-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin-bottom: 0.85rem;
}
.page-doc .doc-section h2 {
  font-size: 1.05rem;
  color: var(--brand);
  margin: 0 0 0.65rem;
  line-height: 1.3;
}
.page-doc .doc-section p { margin: 0 0 0.75rem; }
.page-doc .doc-section p:last-child { margin-bottom: 0; }
.page-doc .doc-section ol,
.page-doc .doc-section ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}
.page-doc .doc-section li { margin-bottom: 0.5rem; }
.page-doc .doc-section li:last-child { margin-bottom: 0; }
.page-doc .doc-section code {
  font-size: 0.88em;
  word-break: break-all;
}
.page-doc .doc-footer {
  width: min(100% - 1.5rem, 42rem);
  margin: 0 auto;
  padding: 0 0 calc(1.5rem + var(--safe-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.7;
}
.page-doc .doc-footer p { margin: 0 0 0.5rem; }
.page-doc .doc-footer a { font-weight: 600; }

/* Mobile layout refinements */
@media (max-width: 767px) {
  .container { width: min(100% - 1.25rem, var(--max)); }

  .hero {
    padding: 2rem 0 2.25rem;
  }
  .hero h1 { font-size: clamp(1.55rem, 6.5vw, 1.85rem); }
  .hero .lead { font-size: 1rem; }
  .hero-badges { margin-bottom: 1.25rem; }
  .hero-card {
    padding: 1.15rem;
    max-width: 20rem;
    margin-inline: auto;
  }
  .hero-card img { max-width: 96px; }

  .stats {
    margin-top: -1rem;
    gap: 0.65rem;
    padding-bottom: 2rem;
  }
  .stat {
    padding: 0.85rem 0.5rem;
  }
  .stat strong { font-size: 1.2rem; }
  .stat span { font-size: 0.72rem; line-height: 1.25; display: block; }

  section { padding: 2.25rem 0; }

  .grid-4 {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .grid-3 { gap: 0.85rem; }

  .btn-row {
    flex-direction: column;
    width: 100%;
  }
  .btn-row .btn {
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 1.25rem;
  }

  .cta-band {
    padding: 1.5rem 1.15rem;
    text-align: center;
  }
  .cta-band h2 { font-size: 1.25rem; }
  .cta-band .btn-row { align-items: stretch; }

  .brands-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
  .brand-tile {
    min-height: 88px;
    padding: 0.75rem 0.5rem;
  }
  .brand-tile span { font-size: 0.65rem; }

  .chips {
    justify-content: flex-start;
    gap: 0.4rem;
  }
  .chip {
    font-size: 0.78rem;
    padding: 0.45rem 0.75rem;
  }

  .legacy-banner {
    font-size: 0.88rem;
    padding: 0.9rem 1rem;
    line-height: 1.5;
  }
  .legacy-banner a { word-break: break-word; }

  .timeline {
    padding-left: 1rem;
    border-left-width: 2px;
  }

  .site-footer {
    padding: 2rem 0 calc(1.5rem + var(--safe-bottom));
  }
  .site-footer img { max-width: 100%; height: auto; }

  .page-legacy .hero { padding: 1.75rem 0; }
  .page-legacy .hero h1 { font-size: clamp(1.4rem, 5.5vw, 1.75rem); }
}

@media (max-width: 380px) {
  .hero-badges .badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
  }
  .stats { grid-template-columns: 1fr 1fr; }
}
