/*
 * Chaincore — Design System v3
 * Responsive, fluid, dark/light, mobile-first, bold typography
 */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/manrope-cyr-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/manrope-cyr.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --color-1: #FFFFFF;
  --color-2: #F5F6F7;
  --color-4: #1A1A1B;
  --color-5: #2772F5;
  --color-6: #8E8E93;
  --color-10: #1a60e0;
  --color-11: #EBF3FF;
  --color-12: #D6E8FF;
  --color-13: #0BB867;
  --color-14: #f87171;
  --color-15: #fbbf24;
  --color-16: #f59e0b;
  --color-17: #4ade80;
  --color-18: #00abc2;
  --color-19: #ffec2d;

  --bg: var(--color-1);
  --bg-soft: var(--color-2);
  --accent: var(--color-5);
  --accent-soft: rgba(39,114,245,0.08);
  --accent-2: var(--color-13);
  --text: var(--color-4);
  --muted: var(--color-6);
  --border-subtle: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.15);
  --shadow-soft: 0 2px 16px rgba(0,0,0,0.08);
  --radius-lg: 1.5rem;
  --radius-md: 0.75rem;
  --radius-sm: 62.5rem;
  --max-width: 70rem;

  --text-2xs: 0.625rem;
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-md: 0.875rem;
  --text-base: 0.9375rem;

  --fw-normal: 500;
  --fw-medium: 600;
  --fw-bold: 700;
  --fw-black: 800;
}

/* ── Dark mode ─────────────────────────────────── */
html.dark {
  --color-1: #0f0f11;
  --color-2: #18181b;
  --color-4: #f4f4f5;
  --color-6: #71717a;
  --color-10: #60a5fa;
  --color-11: rgba(39,114,245,0.12);
  --color-12: rgba(39,114,245,0.2);
  --shadow-soft: 0 4px 24px rgba(0,0,0,0.5);
  --border-subtle: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
}
html.dark body { background: var(--color-1); color: var(--color-4); }
html.dark .card { background: var(--color-2); border-color: rgba(255,255,255,0.06); }
html.dark header, html.dark [data-include="header"] {
  background: rgba(15,15,17,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(255,255,255,0.06);
}
html.dark .btn-tint { background: rgba(39,114,245,0.14); color: #60a5fa; }
html.dark .btn-ghost { color: var(--color-4); border-color: rgba(255,255,255,0.12); }
html.dark .pricing { background: var(--color-2); }
html.dark .chains { background: rgba(255,255,255,0.02); }
html.dark .chain-pill-card { background: var(--color-1); }
html.dark .pricing-card { background: var(--color-1); }
html.dark .chain-card { background: var(--color-1); }
html.dark .hero-panel { background: var(--color-2); }
html.dark .faq-item { background: var(--color-2); }
html.dark .benefit-card { background: var(--color-2); }
html.dark .hero-stats { background: var(--color-1); }
html.dark .logo-text-main { color: var(--color-4); }
html.dark .btn-dropdown-list { background: var(--color-2); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
html.dark .mobile-drawer { background: var(--color-1); }

html { background-color: var(--bg); color-scheme: light dark; }
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: var(--fw-normal);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { border: none; }
.page { min-height: 100vh; }

/* ── Header ───────────────────────────────────── */
[data-include="header"] {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

header {
  background: transparent;
  position: relative;
  font-weight: var(--fw-normal);
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.2s;
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.nav-left { display: flex; align-items: center; gap: 0.75rem; }

.logo-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--accent);
  flex-shrink: 0;
}

.logo-inner {
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: var(--fw-black);
  font-size: var(--text-md);
  letter-spacing: 0.04em;
}

.logo-text-main {
  font-weight: var(--fw-black);
  font-size: 1.375rem;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1;
}

.logo-text-sub {
  font-size: var(--text-2xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: var(--fw-medium);
  line-height: 1;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-md);
  color: var(--text);
}

.nav-links a {
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  font-weight: var(--fw-medium);
  transition: color 0.15s, background 0.15s;
  color: var(--muted);
}

.nav-links a:hover { background: var(--bg-soft); color: var(--text); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-right > * { flex-shrink: 0; }

/* ── Theme toggle ─────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { background: var(--bg-soft); border-color: var(--border-strong); color: var(--text); }
.theme-toggle svg { display: block; pointer-events: none; }
.theme-toggle .icon-sun { display: none; }
html.dark .theme-toggle .icon-moon { display: none; }
html.dark .theme-toggle .icon-sun { display: block; }

/* ── Buttons ─────────────────────────────────── */
.btn {
  border-radius: 1rem;
  font-size: var(--text-sm);
  height: 2.375rem;
  padding: 0 1.125rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.15s ease-out;
  white-space: nowrap;
  font-weight: var(--fw-medium);
  font-family: inherit;
}

.btn-primary { background: var(--accent); color: #fff; font-weight: var(--fw-bold); }
.btn-primary:hover { background: var(--color-10); transform: translateY(-1px); }

.btn-tint { background: var(--bg-soft); color: var(--accent); font-weight: var(--fw-medium); }
.btn-tint:hover { background: var(--color-11); }

.btn-ghost { color: var(--text); border: 1px solid var(--border-subtle); }
.btn-ghost:hover { background: var(--border-subtle); border-color: var(--border-strong); }

/* ── Dropdown button ──────────────────────────── */
.btn-dropdown {
  position: relative;
  font-size: var(--text-md);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

.btn-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: var(--fw-medium);
  font-size: var(--text-md);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.btn-dropdown-toggle:hover { background: var(--bg-soft); color: var(--text); }

.btn-dropdown:not(.mega-dropdown)::before {
  content: '';
  position: absolute;
  top: 100%;
  left: -16px;
  right: -16px;
  height: 12px;
}

.btn-dropdown-list {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 160px;
  background: var(--bg);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  z-index: 100;
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

.btn-dropdown.open .btn-dropdown-list,
.btn-dropdown:hover .btn-dropdown-list {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.08s ease, visibility 0s linear 0s;
}

.btn-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  transition: background 0.1s;
  cursor: pointer;
  font-weight: var(--fw-normal);
}

.btn-dropdown-item:hover { background: var(--bg-soft); }
.btn-dropdown-item.selected { color: var(--accent); font-weight: var(--fw-medium); }
.btn-dropdown-item input[type="radio"] { display: none; }

/* ── Mega dropdown ──────────────────────────── */
.mega-dropdown { position: static; }
.mega-panel {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  box-shadow: var(--shadow-soft);
  z-index: 100;
  transition: opacity 0.15s, visibility 0s linear 0.15s;
}
.mega-panel.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.1s, visibility 0s linear 0s;
}
.mega-inner { max-width: var(--max-width); margin: 0 auto; padding: 20px 16px; display: flex; gap: 0; }
.mega-sidebar { width: 200px; flex-shrink: 0; padding-right: 12px; margin-right: 24px; display: flex; flex-direction: column; gap: 2px; }
.mega-tab { display: block; padding: 10px 12px; cursor: pointer; font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text); transition: background 0.1s; user-select: none; border-radius: 8px; }
.mega-tab:hover, .mega-tab.active { background: var(--bg-soft); }
.mega-content { flex: 1; }
.mega-label { font-size: var(--text-xs); font-weight: var(--fw-bold); color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 12px; padding: 0 4px; }
.mega-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 15rem)); gap: 2px 4px; }
.mega-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 10px; color: var(--text); transition: background 0.1s; }
.mega-item:hover { background: var(--bg-soft); }
.mega-item::after { display: none; }
.mega-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; background: var(--bg-soft); color: var(--text); }
.mega-item-label { font-size: var(--text-sm); font-weight: var(--fw-medium); white-space: nowrap; }

main { flex: 1; }

.section { padding: 3.5rem 1rem; }
.section-inner { max-width: var(--max-width); margin: 0 auto; }

/* ── Icon ─────────────────────────────────────── */
.icon {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  flex-shrink: 0;
}

/* ── Tag ─────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-2xs);
  font-weight: var(--fw-medium);
}

.tag-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--accent-2); }

.tag-accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tag-lg { gap: 8px; padding: 4px 10px; font-size: var(--text-xs); }
.chain-head .tag { margin-left: auto; }

.circle { border-radius: 999px; }

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  display: inline-block;
  margin-right: 4px;
  flex-shrink: 0;
  vertical-align: middle;
}

.tag.ok { background: rgba(34,197,94,0.14); color: var(--color-17); }
.tag.warn { background: rgba(245,158,11,0.14); color: var(--color-15); }
.text-ok { color: var(--color-17); }
.text-warn { color: var(--color-15); }

/* ── Card ─────────────────────────────────────── */
.card { border-radius: var(--radius-md); }

/* ── Hero ─────────────────────────────────────── */
.hero {
  min-height: 56vh;
  display: flex;
  align-items: center;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  padding: 4px 12px 4px 4px;
  background: var(--bg-soft);
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-subtle);
}

.hero-kicker-text { font-size: var(--text-sm); color: var(--muted); font-weight: var(--fw-medium); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr);
  gap: 2.5rem;
  align-items: center;
}

.hero-title {
  font-size: clamp(2rem, 3.5vw, 2.875rem);
  line-height: 1.07;
  margin: 0 0 1rem;
  letter-spacing: -0.04em;
  font-weight: var(--fw-black);
}

.hero-title span { color: var(--accent); }

.hero-subtitle {
  margin: 0 0 1.25rem;
  font-size: 1.0625rem;
  color: var(--muted);
  max-width: 500px;
  line-height: 1.6;
  font-weight: var(--fw-normal);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 1rem;
}

.hero-hint { font-size: var(--text-sm); color: var(--muted); font-weight: var(--fw-normal); }
.hero-hint strong { color: var(--text); font-weight: var(--fw-bold); }

.hero-meta {
  margin-top: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.hero-meta span::before { content: "•"; margin-right: 6px; color: var(--muted); }

.hero-right { flex: 1; }

/* ── Hero panel ───────────────────────────────── */
.hero-panel { background: var(--bg-soft); padding: 1rem 1rem 0.875rem; border: 1px solid var(--border-subtle); }
.hero-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.625rem; font-size: var(--text-sm); color: var(--muted); }
.hero-panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.card.hero-panel { background: var(--bg-soft); }
.chain-card { padding: 10px 11px 9px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); border: 1px solid var(--border-subtle); }
.chain-head { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: var(--fw-medium); }
.chain-logo { width: 22px; height: 22px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: var(--fw-black); }
.chain-meta { font-size: var(--text-xs); color: var(--muted); }
.chain-foot { display: flex; justify-content: space-between; align-items: center; font-size: var(--text-xs); color: var(--muted); }
.hero-panel-footer { padding-top: 8px; margin-top: 6px; font-size: var(--text-xs); color: var(--muted); display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border-subtle); }
.hero-panel-footer strong { color: var(--text); }

/* ── Hero stats bar ────────────────────────────── */
.hero-stats { background: var(--bg-soft); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.hero-stats-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.hero-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.hero-stat:not(:last-child) { margin-right: 2rem; padding-right: 2rem; border-right: 1px solid var(--border-subtle); }
.hero-stat-val { font-size: 1rem; font-weight: var(--fw-black); color: var(--text); display: block; }

/* ── Section titles ───────────────────────────── */
.section-title { margin: 0 0 0.5rem; letter-spacing: -0.03em; font-weight: var(--fw-black); font-size: clamp(1.5rem, 2.8vw, 2.125rem); }
.section-subtitle { font-size: var(--text-md); color: var(--muted); margin: 0 0 1.5rem; max-width: 540px; line-height: 1.6; font-weight: var(--fw-normal); }

/* ── Chains section ───────────────────────────── */
.chains { background: var(--bg-soft); }

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.chain-pill-card {
  padding: 1rem 0.875rem;
  font-size: var(--text-sm);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: var(--radius-md);
  transition: box-shadow 0.15s;
}
.chain-pill-card:hover { box-shadow: var(--shadow-soft); }
.chain-pill-card > :first-child { display: flex; align-items: center; justify-content: space-between; font-weight: var(--fw-bold); }
.chain-pill-card > :last-child { font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }

/* ── Latency table ──────────────────────────── */
.latency-table-wrap { overflow-x: auto; margin-top: 1.25rem; }
.latency-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.latency-table th, .latency-table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--bg-soft); }
.latency-table th { font-size: var(--text-xs); color: var(--muted); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.06em; }
.latency-table .accent-col { color: var(--accent); font-weight: var(--fw-bold); }
.latency-table .ok-col { color: var(--accent-2); font-weight: var(--fw-bold); }
.latency-table .muted { color: var(--muted); }
.latency-footnote { font-size: var(--text-xs); color: var(--muted); margin-top: 10px; }

/* ── Pricing ──────────────────────────────────── */
.pricing { background: var(--bg-soft); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pricing-card {
  background: var(--bg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.pricing-header { display: flex; justify-content: space-between; align-items: center; }
.pricing-name { font-size: 1rem; font-weight: var(--fw-bold); }
.pricing-note { font-size: var(--text-xs); color: var(--muted); margin: 0; }
.pricing-price { font-weight: var(--fw-black); font-size: 1.375rem; }
.pricing-price span { font-size: var(--text-xs); color: var(--muted); font-weight: var(--fw-normal); }
.pricing-features { list-style: none; padding: 0; margin: 4px 0 8px; font-size: var(--text-sm); color: var(--muted); }
.pricing-features li { display: flex; gap: 8px; margin-bottom: 6px; align-items: flex-start; }
.pricing-bullet { width: 8px; height: 8px; border-radius: 999px; margin-top: 5px; flex-shrink: 0; }
.pricing-cta { margin-top: auto; display: flex; }
.pricing-footnote { margin-top: 1rem; font-size: var(--text-xs); color: var(--muted); }
.pricing-footnote strong { color: var(--text); }

/* ── Benefits ─────────────────────────────────── */
.benefit-card {
  background: var(--bg-soft);
  padding: 1rem;
  font-size: var(--text-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: box-shadow 0.15s;
}
.benefit-card:hover { box-shadow: var(--shadow-soft); }
.benefit-card > :first-child { font-weight: var(--fw-bold); margin-bottom: 6px; font-size: 0.9375rem; }
.benefit-card > :last-child { font-size: var(--text-sm); color: var(--muted); line-height: 1.5; }

/* ── FAQ ──────────────────────────────────────── */
.faq-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.25rem;
  font-size: var(--text-sm);
}

.faq-item {
  background: var(--bg-soft);
  padding: 0.875rem 1rem;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.faq-item > :first-child { font-weight: var(--fw-bold); margin-bottom: 4px; font-size: 0.9375rem; }
.faq-item > :last-child { color: var(--muted); line-height: 1.5; }

/* ── Footer ───────────────────────────────────── */
footer {
  background: var(--bg-soft);
  padding: 1.25rem 1rem;
  font-size: var(--text-xs);
  color: var(--muted);
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: var(--fw-medium);
}

.footer-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.footer-links a { color: var(--muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* ── Flag banner ──────────────────────────────── */
.flag-banner { max-width: var(--max-width); margin: 1rem auto 0; padding: 0 1rem; }
.flag-banner-inner { display: grid; grid-template-columns: 1fr 724px; border-radius: var(--radius-lg); overflow: hidden; background: var(--color-18); height: 480px; }
.flag-panel { padding: 3rem; display: flex; flex-direction: column; justify-content: center; color: #fff; }
.flag-panel h1 { font-size: 2.45rem; line-height: 2.8rem; font-weight: var(--fw-black); margin: 0; }
.flag-cta { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.flag-cta .btn { font-size: var(--text-md); padding: 0.625rem 1.25rem; }
.flag-cta .btn-ghost { background: transparent; color: #fff; }
.flag-cta .btn-ghost:hover { background: rgba(255,255,255,0.15); color: #fff; }
.flag-panel mark { background: var(--color-18); color: var(--color-19); cursor: pointer; }
.flag-banner img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 10% 35%; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-right { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .faq-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── Mobile menu ──────────────────────────────── */
.menu-btn {
  display: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  border: none;
}
.menu-btn:hover { background: var(--accent-soft); }

.mobile-drawer {
  display: none;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border-top: 1px solid var(--border-subtle);
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.mobile-drawer.open { display: flex; }
.mobile-nav { display: flex; flex-direction: column; gap: 4px; }
.mobile-nav a {
  font-size: 1rem;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-weight: var(--fw-medium);
  transition: color 0.15s, background 0.15s;
}
.mobile-nav a:hover { color: var(--text); background: var(--bg-soft); }
.mobile-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding-top: 0.5rem; border-top: 1px solid var(--border-subtle); }
.mobile-actions .btn { width: 100%; text-align: center; justify-content: center; font-size: var(--text-md); }

@media (max-width: 720px) {
  .menu-btn { display: block; }
  .nav-links { display: none; }
  .nav-right { display: none; }
  /* keep theme toggle in mobile area */
  .theme-toggle-mobile { display: inline-flex !important; }
  .hero { padding-top: 1.5rem; padding-bottom: 2rem; }
  .hero-title { font-size: clamp(1.75rem, 7.5vw, 2.4rem); }
  .hero-stats-inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-stat:not(:last-child) { margin-right: 0; padding-right: 0; border-right: none; }
  .section { padding: 2.5rem 1rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

@media (max-width: 400px) {
  .hero-title { font-size: 1.65rem; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .hero-stat-val { font-size: var(--text-sm); }
}

/* ── Modal ────────────────────────────────────── */
.modal { display: none; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-box {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 380px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
}
.modal-box h2 { margin: 0 0 1.2rem; font-size: 1.2rem; font-weight: var(--fw-bold); }
.modal-box label { font-size: var(--text-sm); color: var(--muted); display: block; margin-top: .6rem; }
.modal-box input, .modal-box select {
  width: 100%; padding: .5rem; margin: .3rem 0; border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: .9rem; border: 1px solid var(--border-subtle);
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.2rem; }

/* ── Login / Register ─────────────────────────── */
.login { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100vh; }
.login-box {
  background: var(--bg);
  padding: 2rem;
  border-radius: var(--radius-lg);
  width: 340px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}
.login-box h1 { margin-bottom: 1rem; font-size: 1.375rem; font-weight: var(--fw-black); }
.login-box label { font-size: var(--text-sm); color: var(--muted); font-weight: var(--fw-medium); }
.login-box select, .login-box input, .login-box button {
  width: 100%; padding: .5rem; margin: .3rem 0; border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: .9rem; border: 1px solid var(--border-subtle);
}
.login-box button {
  background: var(--accent); border-color: transparent; color: #fff;
  font-weight: var(--fw-bold); cursor: pointer; margin-top: .6rem; font-family: inherit;
}
.login-box button:hover { filter: brightness(1.05); }

/* ── Panel ───────────────────────────────────── */
.panel-nav { width: 200px; background: var(--bg); padding: 1rem; flex-shrink: 0; border-right: 1px solid var(--border-subtle); }
.panel-nav h2 { font-size: 1rem; margin-bottom: 1rem; color: var(--accent); font-weight: var(--fw-bold); }
.panel-nav a { display: block; padding: .4rem .6rem; border-radius: 8px; margin-bottom: .2rem; color: var(--muted); font-size: var(--text-md); font-weight: var(--fw-medium); }
.panel-nav a:hover, .panel-nav a.active { background: var(--accent-soft); color: var(--text); }
.panel-nav .logout { margin-top: 2rem; color: var(--color-14); }

.panel-main { flex: 1; padding: 1.5rem; overflow-x: auto; }
.panel-main h1 { font-size: 1.2rem; margin-bottom: 1rem; font-weight: var(--fw-bold); }
.panel-section { margin-bottom: 2rem; }

table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--border-subtle); }
th { color: var(--muted); font-weight: var(--fw-bold); text-transform: uppercase; font-size: .75rem; }
tr:hover { background: rgba(30,30,31,0.03); }

.create-row input, .create-row select {
  padding: 4px 8px; font-size: var(--text-sm); border-radius: 6px;
  background: var(--bg); color: var(--text); font-family: inherit; width: 100%; border: 1px solid var(--border-subtle);
}
.create-row td { padding: 6px; }
.edit-input { padding: 3px 6px; font-size: var(--text-sm); border-radius: 4px; background: var(--bg); color: var(--text); font-family: inherit; border: 1px solid var(--border-subtle); }

.balance-card { padding: 10px 8px; margin-bottom: 12px; background: var(--bg); font-size: var(--text-sm); border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
.balance-card .amount { font-size: 1.125rem; font-weight: var(--fw-black); margin: 4px 0; }

.btn-sm {
  padding: 2px 8px; font-size: var(--text-xs); border-radius: 6px;
  background: var(--bg); color: var(--muted); cursor: pointer; font-family: inherit;
  border: 1px solid var(--border-subtle);
}
.btn-sm:hover { color: var(--text); border-color: var(--accent); }
.btn-sm.warn { border-color: rgba(245,158,11,0.3); color: var(--color-15); }
.btn-sm.warn:hover { border-color: var(--color-16); }

.actions { white-space: nowrap; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator { opacity: 1; }

/* ── Language toggle ─────────────────────────── */
.lang-toggle { display: flex; gap: 2px; align-items: center; padding-right: 10px; margin-right: 2px; }
.lang-btn { background: none; color: var(--muted); padding: 2px 6px; border-radius: 4px; cursor: pointer; font-size: var(--text-xs); font-family: inherit; font-weight: var(--fw-medium); border: none; }
.lang-btn:hover { color: var(--text); }
.lang-btn.active { color: var(--text); }

/* ── Mobile panel ─────────────────────────────── */
@media (max-width: 720px) {
  .panel-nav { width: 100%; padding: .5rem; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .panel-nav h2 { margin: 0 .5rem 0 0; font-size: .9rem; }
  .panel-nav a { padding: .3rem .5rem; margin: 0; }
  .panel-nav .balance-card { width: 100%; margin-bottom: .3rem; }
  .panel-nav .logout { margin-top: 0; margin-left: auto; }
  div[style*="display:flex;flex:1"] { flex-direction: column; }
  .panel-main { padding: .75rem; }
  .modal-box { width: calc(100vw - 2rem); }
}

/* ── Scalar API docs ──────────────────────────── */
#app {
  --scalar-font: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --scalar-color-accent: var(--color-5);
  --scalar-background-accent: var(--accent-soft);
  --scalar-background-1: var(--bg);
  --scalar-background-2: var(--bg-soft);
  --scalar-color-1: var(--text);
  --scalar-color-2: var(--muted);
  --scalar-border-color: var(--bg-soft);
}

/* ── Grid.js ──────────────────────────────────── */
.gridjs *, .gridjs :after, .gridjs :before { box-sizing: border-box; }
.gridjs-container { color: var(--text); display: inline-block; overflow: hidden; padding: 2px; position: relative; width: 100%; z-index: 0; font-size: .85rem; }
.gridjs-wrapper { border-radius: 8px; overflow: auto; position: relative; width: 100%; z-index: 1; }
table.gridjs-table { border-collapse: collapse; display: table; margin: 0; max-width: 100%; overflow: auto; padding: 0; table-layout: fixed; text-align: left; width: 100%; background: transparent; color: var(--text); font-size: .8rem; }
th.gridjs-th { background: transparent; color: var(--muted); font-size: .7rem; font-weight: var(--fw-bold); text-transform: uppercase; padding: .4rem .6rem; position: relative; user-select: none; vertical-align: middle; white-space: nowrap; outline: none; border-bottom: 1px solid var(--border-subtle); }
th.gridjs-th .gridjs-th-content { float: left; overflow: hidden; text-overflow: ellipsis; width: 100%; }
th.gridjs-th-sort { cursor: pointer; }
th.gridjs-th-sort .gridjs-th-content { width: calc(100% - 15px); }
th.gridjs-th-sort:hover { background: rgba(30,30,31,0.04); }
td.gridjs-td { background: transparent; padding: .35rem .6rem; white-space: nowrap; font-size: .8rem; line-height: 1.3; border-bottom: 1px solid var(--border-subtle); }
td.gridjs-message { text-align: center; color: var(--muted); }
.gridjs-tr { background: transparent; }
.gridjs-tr:hover td.gridjs-td { background: rgba(30,30,31,0.03); }
button.gridjs-sort { background-color: transparent; background-position-x: center; background-repeat: no-repeat; background-size: contain; cursor: pointer; float: right; height: 24px; margin: 0; outline: none; padding: 0; width: 13px; border: none; }
button.gridjs-sort-neutral { opacity: .3; background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDEuOTk4IiBoZWlnaHQ9IjQwMS45OTgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQwMS45OTggNDAxLjk5OCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTczLjA5MiAxNjQuNDUyaDI1NS44MTNjNC45NDkgMCA5LjIzMy0xLjgwNyAxMi44NDgtNS40MjQgMy42MTMtMy42MTYgNS40MjctNy44OTggNS40MjctMTIuODQ3cy0xLjgxMy05LjIyOS01LjQyNy0xMi44NUwyMTMuODQ2IDUuNDI0QzIxMC4yMzIgMS44MTIgMjA1Ljk1MSAwIDIwMC45OTkgMHMtOS4yMzMgMS44MTItMTIuODUgNS40MjRMNjAuMjQyIDEzMy4zMzFjLTMuNjE3IDMuNjE3LTUuNDI0IDcuOTAxLTUuNDI0IDEyLjg1IDAgNC45NDggMS44MDcgOS4yMzEgNS40MjQgMTIuODQ3IDMuNjIxIDMuNjE3IDcuOTAyIDUuNDI0IDEyLjg1IDUuNDI0ek0zMjguOTA1IDIzNy41NDlINzMuMDkyYy00Ljk1MiAwLTkuMjMzIDEuODA4LTEyLjg1IDUuNDIxLTMuNjE3IDMuNjE3LTUuNDI0IDcuODk4LTUuNDI0IDEyLjg0N3MxLjgwNyA5LjIzMyA1LjQyNCAxMi44NDhMMTg4LjE0OSAzOTYuNTdjMy42MjEgMy42MTcgNy45MDIgNS40MjggMTIuODUgNS40MjhzOS4yMzMtMS44MTEgMTIuODQ3LTUuNDI4bDEyNy45MDctMTI3LjkwNmMzLjYxMy0zLjYxNCA1LjQyNy03Ljg5OCA1LjQyNy0xMi44NDggMC00Ljk0OC0xLjgxMy05LjIyOS01LjQyNy0xMi44NDctMy42MTQtMy42MTYtNy44OTktNS40Mi0xMi44NDgtNS40MnoiLz48L3N2Zz4="); background-position-y: center; }
button.gridjs-sort-asc { background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOTIuMzYyIiBoZWlnaHQ9IjI5Mi4zNjEiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDI5Mi4zNjIgMjkyLjM2MSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTI4Ni45MzUgMTk3LjI4NyAxNTkuMDI4IDY5LjM4MWMtMy42MTMtMy42MTctNy44OTUtNS40MjQtMTIuODQ3LTUuNDI0cy05LjIzMyAxLjgwNy0xMi44NSA1LjQyNEw1LjQyNCAxOTcuMjg3QzEuODA3IDIwMC45MDQgMCAyMDUuMTg2IDAgMjEwLjEzNHMxLjgwNyA5LjIzMyA1LjQyNCAxMi44NDdjMy42MjEgMy42MTcgNy45MDIgNS40MjUgMTIuODUgNS40MjVoMjU1LjgxM2M0Ljk0OSAwIDkuMjMzLTEuODA4IDEyLjg0OC01LjQyNSAzLjYxMy0zLjYxMyA1LjQyNy03Ljg5OCA1LjQyNy0xMi44NDdzLTEuODE0LTkuMjMtNS40MjctMTIuODQ3eiIvPjwvc3ZnPg=="); background-position-y: 35%; background-size: 10px; }
button.gridjs-sort-desc { background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOTIuMzYyIiBoZWlnaHQ9IjI5Mi4zNjIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDI5Mi4zNjIgMjkyLjM2MiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTI4Ni45MzUgNjkuMzc3Yy0zLjYxNC0zLjYxNy03Ljg5OC01LjQyNC0xMi44NDgtNS40MjRIMTguMjc0Yy00Ljk1MiAwLTkuMjMzIDEuODA3LTEyLjg1IDUuNDI0QzEuODA3IDcyLjk5OCAwIDc3LjI3OSAwIDgyLjIyOGMwIDQuOTQ4IDEuODA3IDkuMjI5IDUuNDI0IDEyLjg0N2wxMjcuOTA3IDEyNy45MDdjMy42MjEgMy42MTcgNy45MDIgNS40MjggMTIuODUgNS40MjhzOS4yMzMtMS44MTEgMTIuODQ3LTUuNDI4TDI4Ni45MzUgOTUuMDc0YzMuNjEzLTMuNjE3IDUuNDI3LTcuODk4IDUuNDI3LTEyLjg0NyAwLTQuOTQ4LTEuODE0LTkuMjI5LTUuNDI3LTEyLjg1eiIvPjwvc3ZnPg=="); background-position-y: 65%; background-size: 10px; }
button.gridjs-sort:focus { outline: none; }
.gridjs-head { padding: 0 0 8px; width: 100%; }
.gridjs-head:after { clear: both; content: ""; display: block; }
.gridjs-head:empty { padding: 0; }
.gridjs-head button { background: transparent; cursor: pointer; margin: 0; outline: none; padding: 0; border: none; }
.gridjs-search { float: left; }
.gridjs-search-input { width: 200px; }
input.gridjs-input { appearance: none; background: var(--bg); border-radius: 6px; color: var(--text); font-size: var(--text-xs); line-height: 1.45; outline: none; padding: 5px 10px; border: 1px solid var(--border-subtle); }
input.gridjs-input:focus { border-color: var(--accent); }
.gridjs-footer { padding: 6px 8px; width: 100%; }
.gridjs-footer:empty { padding: 0; }
.gridjs-pagination { color: var(--muted); }
.gridjs-pagination:after { clear: both; content: ""; display: block; }
.gridjs-pagination .gridjs-summary { float: left; margin-top: 5px; font-size: var(--text-xs); }
.gridjs-pagination .gridjs-pages { float: right; }
.gridjs-pagination .gridjs-pages button { background: var(--bg); color: var(--muted); outline: none; padding: 3px 10px; font-size: var(--text-xs); user-select: none; border: 1px solid var(--border-subtle); }
.gridjs-pagination .gridjs-pages button:hover { color: var(--text); border-color: var(--accent); }
.gridjs-pagination .gridjs-pages button:disabled { color: var(--muted); cursor: default; }
.gridjs-pagination .gridjs-pages button.gridjs-currentPage { color: var(--text); font-weight: var(--fw-bold); }
.gridjs-pagination .gridjs-pages button:last-child { border-radius: 0 6px 6px 0; }
.gridjs-pagination .gridjs-pages button:first-child { border-radius: 6px 0 0 6px; }
.gridjs-temp { position: relative; }
.gridjs-loading-bar { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: transparent; z-index: 10; }
.gridjs-loading-bar:after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-image: linear-gradient(90deg, transparent, rgba(59,130,246,.15) 20%, rgba(59,130,246,.3) 60%, transparent); transform: translateX(-100%); animation: shimmer 2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.gridjs-notfound, .gridjs-error { color: var(--muted); text-align: center; padding: 1rem; }
.gridjs-resizable { position: absolute; right: 0; top: 0; bottom: 0; width: 5px; cursor: ew-resize; }
.gridjs-resizable:hover { background: var(--accent); }
.col-menu { position: absolute; right: 0; top: 100%; background: var(--bg); border-radius: 8px; padding: 6px 8px; z-index: 30; min-width: 140px; border: 1px solid var(--border-subtle); }

/* ── Create form ─────────────────────────────── */
.create-form { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.create-form input, .create-form select {
  padding: 6px 10px; font-size: var(--text-sm); border-radius: 6px;
  background: var(--bg); color: var(--text); font-family: inherit; border: 1px solid var(--border-subtle);
}
/* v3.1 - 20260603192055 */
