/* AIN — ASEAN Intelligence Network · application styles (kiosk-first, 1920x1080) */

/* rem scales with viewport width: 16px at 1920w, min 11px so dev screens stay usable */
html { font-size: clamp(11px, 0.8333vw, 18px); }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Kiosk: no text selection, no callouts, controlled touch */
body.kiosk, body.kiosk * {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
body.kiosk { touch-action: pan-x pan-y; }

a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
i[data-lucide] { width: 1.25em; height: 1.25em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 5px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 1.75rem 2rem 2.5rem; max-width: 100%; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-sunk);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { padding: 1.5rem 1.25rem 1.25rem; border-bottom: 1px solid var(--border); }
.brand-mark { display: flex; align-items: center; gap: 0.75rem; }
.brand-mark__logo {
  width: 2.6rem; height: 2.6rem; border-radius: 0.7rem; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent) 0%, #0E9F6E 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  box-shadow: var(--glow);
}
.brand-mark__name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: 0.04em; }
.brand-mark__sub { font-size: 0.68rem; color: var(--text-tertiary); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 0.1rem; }

.nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.nav__group { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); padding: 1.1rem 0.75rem 0.45rem; font-weight: 600; }
.nav__item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.85rem 0.9rem; margin: 0.15rem 0;
  border-radius: var(--radius); color: var(--text-secondary);
  font-weight: 500; font-size: 1rem; min-height: 3.2rem;
  border: 1px solid transparent;
}
.nav__item i { color: var(--text-tertiary); }
.nav__item:active, .nav__item.active { background: var(--accent-dim); color: var(--text); border-color: var(--accent-line); }
.nav__item.active i { color: var(--accent); }
.nav__badge { margin-left: auto; font-size: 0.65rem; padding: 0.15rem 0.5rem; border-radius: 99px; background: var(--accent-dim); color: var(--accent); font-weight: 700; letter-spacing: 0.08em; }

.sidebar__foot { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 0.7rem; }
.user-chip__avatar { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border-light); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); font-size: 0.95rem; }
.user-chip__meta { min-width: 0; }
.user-chip__name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip__links { font-size: 0.75rem; color: var(--text-tertiary); }
.user-chip__links a { color: var(--text-tertiary); }
.user-chip__links a:active { color: var(--accent); }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 2rem; border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 11, 0.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.topbar__title { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; }
.topbar__spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.45rem 0.9rem; border-radius: 99px;
}
.chip i { width: 1em; height: 1em; color: var(--accent); }
.chip--live::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }

/* ---------- Page head ---------- */
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { color: var(--text-secondary); font-size: 1.05rem; margin-top: 0.35rem; max-width: 72rem; }
.page-head .dim { color: var(--text-tertiary); font-size: 0.9rem; }

/* ---------- Grid & cards ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.span-2 { grid-column: span 2; }
.mb-lg { margin-bottom: 1.5rem; }
.mb-xl { margin-bottom: 2rem; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; display: flex; align-items: center; gap: 0.6rem; }
.card__title i { color: var(--accent); }
.card__sub { color: var(--text-tertiary); font-size: 0.82rem; }

/* ---------- Stat tiles ---------- */
.stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.3rem 1.5rem;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 65%);
  opacity: 0.7;
}
.stat__label { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; }
.stat__value { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1.15; margin-top: 0.3rem; font-variant-numeric: tabular-nums; }
.stat__value--accent { color: var(--accent); }
.stat__delta { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.15rem; }
.stat--hero .stat__value { font-size: 3.6rem; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tbl th { text-align: left; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); }
.tbl td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.tappable { cursor: pointer; }
.tbl tr.tappable:active { background: var(--bg-hover); }
.tbl .num { text-align: right; }
.tbl .pos { color: var(--success); }
.tbl .rank { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.85rem; width: 2.2rem; }

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 3.2rem; padding: 0.7rem 1.5rem;
  border-radius: var(--radius); border: 1px solid var(--border-light);
  background: var(--bg-elevated); color: var(--text);
  font-family: var(--font-body); font-size: 1rem; font-weight: 600;
  cursor: pointer;
}
.btn:active { background: var(--bg-hover); transform: scale(0.985); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:active { background: var(--accent-press); }
.btn--ghost { background: transparent; }
.btn--lg { min-height: 4rem; font-size: 1.15rem; padding: 0.9rem 2.2rem; border-radius: var(--radius-lg); }
.btn--block { width: 100%; }

.segmented { display: inline-flex; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.25rem; gap: 0.25rem; }
.segmented a, .segmented button {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.1rem; min-height: 2.8rem; border-radius: calc(var(--radius) - 4px);
  color: var(--text-secondary); font-size: 0.95rem; font-weight: 600;
  border: none; background: transparent; cursor: pointer; font-family: var(--font-body);
}
.segmented .active { background: var(--accent-dim); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }

/* Big touch pills (vertical picker etc.) */
.pills { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pill {
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 3rem; padding: 0.55rem 1.15rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 99px; color: var(--text-secondary); font-weight: 600; font-size: 0.95rem;
  cursor: pointer;
}
.pill i { width: 1.1em; height: 1.1em; }
.pill.active { background: var(--accent-dim); border-color: var(--accent-line); color: var(--text); }
.pill.active i { color: var(--accent); }
.pill:active { transform: scale(0.97); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.3rem 0.7rem; border-radius: 99px; }
.badge--live { background: var(--success-dim); color: var(--success); }
.badge--onboarding { background: var(--warning-dim); color: var(--warning); }
.badge--expanding { background: var(--bg-elevated); color: var(--text-tertiary); }
.badge--pro { background: var(--accent-dim); color: var(--accent); }

/* ---------- Callout ---------- */
.callout { display: flex; gap: 0.9rem; background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.callout i { color: var(--accent); flex-shrink: 0; margin-top: 0.15rem; }
.callout__title { font-weight: 700; font-size: 0.98rem; }
.callout__body { color: var(--text-secondary); font-size: 0.92rem; margin-top: 0.15rem; }

/* ---------- Insight list ---------- */
.insights { display: flex; flex-direction: column; gap: 0.85rem; }
.insight { display: flex; gap: 0.85rem; align-items: flex-start; }
.insight__dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); margin-top: 0.55rem; flex-shrink: 0; box-shadow: 0 0 8px var(--accent-line); }
.insight__text { color: var(--text-secondary); font-size: 0.98rem; }
.insight__text strong { color: var(--text); }

/* ---------- Charts ---------- */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { max-width: 100%; }
.h-sm { height: 13rem; } .h-md { height: 17rem; } .h-lg { height: 22rem; }

/* ---------- Map ---------- */
.map-wrap { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--bg-sunk); position: relative; }
.leaflet-container { background: #0B0E0D; font-family: var(--font-body); }
.map-legend { position: absolute; bottom: 0.9rem; left: 0.9rem; z-index: 500; background: rgba(10,12,11,0.85); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.9rem; font-size: 0.78rem; color: var(--text-secondary); backdrop-filter: blur(6px); }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-bg { position: absolute; inset: 0; background:
  radial-gradient(60rem 30rem at 75% -10%, rgba(16,185,129,0.09), transparent),
  radial-gradient(40rem 24rem at 10% 110%, rgba(56,189,248,0.06), transparent); }
.login-card { width: 26rem; max-width: 92vw; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.5rem 2.25rem; position: relative; box-shadow: var(--shadow); }
.login-card .brand-mark { justify-content: center; margin-bottom: 0.75rem; }
.login-head { text-align: center; margin-bottom: 1.75rem; }
.login-head h1 { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: 0.02em; }
.login-head p { color: var(--text-tertiary); font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 0.3rem; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.4rem; }
.input {
  width: 100%; min-height: 3.2rem; padding: 0.7rem 1rem;
  background: var(--bg-sunk); color: var(--text);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1rem;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
textarea.input { min-height: 6rem; resize: vertical; }
.form-error { background: var(--danger-dim); color: var(--danger); border-radius: var(--radius); padding: 0.7rem 1rem; font-size: 0.9rem; margin-bottom: 1rem; }
.form-ok { background: var(--success-dim); color: var(--success); border-radius: var(--radius); padding: 0.7rem 1rem; font-size: 0.9rem; margin-bottom: 1rem; }
.login-foot { text-align: center; color: var(--text-dim); font-size: 0.75rem; margin-top: 1.5rem; }
.forgot-link { display: block; text-align: right; font-size: 0.85rem; margin: -0.4rem 0 1rem; color: var(--text-tertiary); }

/* ---------- Attract screen ---------- */
.attract { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.attract__bg { position: absolute; inset: 0; }
.attract__brand { position: relative; text-align: center; z-index: 2; }
.attract__brand .brand-mark { justify-content: center; }
.attract__brand .brand-mark__logo { width: 5rem; height: 5rem; font-size: 2.2rem; border-radius: 1.2rem; }
.attract__title { font-family: var(--font-display); font-size: 4.2rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 1.5rem; }
.attract__title em { font-style: normal; color: var(--accent); }
.attract__sub { color: var(--text-secondary); font-size: 1.5rem; margin-top: 0.6rem; }
.attract__counters { display: flex; gap: 3.5rem; margin-top: 3rem; justify-content: center; }
.attract__counter { text-align: center; }
.attract__counter .v { font-family: var(--font-display); font-size: 3.4rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.attract__counter .l { color: var(--text-tertiary); font-size: 0.85rem; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 0.2rem; }
.attract__cta { position: absolute; bottom: 3.5rem; left: 0; right: 0; text-align: center; color: var(--text-secondary); font-size: 1.2rem; letter-spacing: 0.06em; animation: bob 2.4s ease-in-out infinite; z-index: 2; }
.attract__cta i { color: var(--accent); vertical-align: -0.2em; }

/* ---------- Network map ---------- */
.network-stage { position: relative; }
.network-svg { width: 100%; height: auto; display: block; }
.cnode { cursor: pointer; }
.cnode__ring { fill: none; stroke: var(--accent); stroke-opacity: 0.5; }
.cnode--live .cnode__core { fill: var(--accent); }
.cnode--onboarding .cnode__core { fill: var(--warning); }
.cnode--expanding .cnode__core { fill: var(--text-dim); }
.cnode__label { fill: var(--text); font-family: var(--font-display); font-weight: 600; }
.cnode__sub { fill: var(--text-tertiary); font-family: var(--font-body); }
.net-link { stroke: var(--accent); stroke-opacity: 0.16; stroke-width: 1.2; fill: none; }

/* ---------- Country cards ---------- */
.country-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.1rem 1.3rem; cursor: pointer; min-height: 5.4rem;
}
.country-card:active { background: var(--bg-hover); transform: scale(0.99); }
.country-card__flag { font-size: 2rem; }
.country-card__name { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.country-card__meta { color: var(--text-tertiary); font-size: 0.85rem; }
.country-card__right { margin-left: auto; text-align: right; }
.country-card__places { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--accent); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1.4rem; min-height: 3.4rem;
  color: var(--text-secondary); font-weight: 600; font-size: 1rem;
  border: none; background: none; cursor: pointer; font-family: var(--font-body);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab.active i { color: var(--accent); }
.tab .badge { margin-left: 0.3rem; }

/* ---------- Ask AIN ---------- */
.ask-wrap { display: grid; grid-template-columns: 1fr 22rem; gap: 1.5rem; align-items: start; }
.ask-thread { display: flex; flex-direction: column; gap: 1rem; min-height: 24rem; }
.msg { max-width: 88%; padding: 1rem 1.3rem; border-radius: var(--radius-lg); font-size: 1.02rem; }
.msg--user { align-self: flex-end; background: var(--accent-dim); border: 1px solid var(--accent-line); }
.msg--ai { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); }
.msg--ai .sql { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); margin-top: 0.6rem; white-space: pre-wrap; word-break: break-all; }
.msg--thinking { color: var(--text-tertiary); font-style: italic; }
.msg--thinking .dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
.ask-chips { display: flex; flex-direction: column; gap: 0.6rem; }
.ask-chip {
  text-align: left; padding: 0.9rem 1.1rem; min-height: 3.4rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-secondary); font-size: 0.92rem; cursor: pointer; font-family: var(--font-body);
}
.ask-chip:active { border-color: var(--accent-line); color: var(--text); }
.ask-bar { display: flex; gap: 0.75rem; margin-top: 1.25rem; position: sticky; bottom: 1rem; }
.ask-bar .input { flex: 1; min-height: 3.8rem; font-size: 1.1rem; }

/* ---------- Vertical Explorer (choropleth + panels) ---------- */
.map-metric { position: absolute; top: 0.9rem; right: 0.9rem; z-index: 500; background: rgba(10,12,11,0.85); backdrop-filter: blur(6px); }
.map-metric button { min-height: 2.4rem; font-size: 0.85rem; }
.legend-grad { width: 11rem; height: 0.5rem; border-radius: 4px; margin-bottom: 0.35rem; }
.legend-swatches { display: flex; gap: 2px; width: 11rem; margin-bottom: 0.35rem; }
.legend-swatches span { flex: 1; height: 0.55rem; border-radius: 2px; }
.legend-lbls { display: flex; justify-content: space-between; gap: 0.8rem; font-size: 0.72rem; color: var(--text-tertiary); }
.legend-note { margin-top: 0.4rem; font-size: 0.72rem; color: var(--text-tertiary); }
.hbars { display: flex; flex-direction: column; gap: 0.55rem; }
.hbar { display: grid; grid-template-columns: 8.5rem 1fr 3.2rem; gap: 0.7rem; align-items: center; }
.hbar__label { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar__track { background: var(--bg-elevated); border-radius: 0 4px 4px 0; height: 0.7rem; }
.hbar__fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar__fill--soft { background: var(--accent-line); }
.hbar__val { font-size: 0.85rem; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.share-bar { background: var(--bg-elevated); border-radius: 0 3px 3px 0; height: 0.55rem; }
.share-bar div { height: 100%; background: var(--accent-line); border-radius: 0 3px 3px 0; min-width: 2px; }
.card__scroll { max-height: 17rem; overflow-y: auto; }
.card__scroll .tbl th { position: sticky; top: 0; background: var(--bg-card); z-index: 2; box-shadow: 0 1px 0 var(--border-light); }

/* Topbar country switcher must survive 8+ live countries without wrapping */
.topbar .segmented { overflow-x: auto; scrollbar-width: none; flex-shrink: 1; min-width: 0; }
.topbar .segmented a { white-space: nowrap; padding: 0.55rem 0.8rem; font-size: 0.9rem; }

/* ---------- Voice input (Ask AIN mic button) ---------- */
.voice-btn { width: 4.6rem; padding: 0.9rem; flex-shrink: 0; transition: width 0.15s ease; }
.voice-btn[hidden] { display: none; }
.voice-btn svg { width: 1.5rem; height: 1.5rem; color: var(--accent); flex-shrink: 0; }
.voice-btn .voice-btn__stop, .voice-btn .voice-btn__spin { display: none; }
.voice-btn.rec { width: 7.2rem; background: var(--danger); border-color: var(--danger); animation: voicePulse 1.2s ease-out infinite; }
.voice-btn.rec svg { color: #fff; }
.voice-btn.rec .voice-btn__mic { display: none; }
.voice-btn.rec .voice-btn__stop { display: block; }
.voice-btn__timer { color: #fff; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.voice-btn__timer:empty { display: none; }
.voice-btn.busy .voice-btn__mic { display: none; }
.voice-btn.busy .voice-btn__spin { display: block; width: 1.4rem; height: 1.4rem; border: 3px solid var(--accent-dim); border-top-color: var(--accent); border-radius: 50%; animation: voiceSpin 0.8s linear infinite; }
@keyframes voicePulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); } 100% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); } }
@keyframes voiceSpin { to { transform: rotate(360deg); } }

/* ---------- On-screen keyboard ---------- */
.osk { position: fixed; left: 0; right: 0; bottom: 0; z-index: 200; background: var(--bg-sunk); border-top: 1px solid var(--border-light); padding: 0.9rem 1.2rem 1.2rem; transform: translateY(105%); transition: transform 0.22s ease; box-shadow: 0 -10px 40px rgba(0,0,0,0.5); }
.osk.open { transform: translateY(0); }
.osk__rows { max-width: 78rem; margin: 0 auto; display: flex; flex-direction: column; gap: 0.55rem; }
.osk__row { display: flex; gap: 0.55rem; justify-content: center; }
.osk__key {
  flex: 1; max-width: 5.4rem; min-height: 3.9rem;
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1.25rem; font-weight: 600; cursor: pointer;
}
.osk__key:active { background: var(--accent); color: var(--accent-ink); }
.osk__key--wide { max-width: 9rem; font-size: 0.95rem; }
.osk__key--space { max-width: 26rem; flex: 4; }
.osk__key--go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- QR overlay ---------- */
.qr-fab { position: fixed; right: 1.6rem; bottom: 1.6rem; z-index: 90; }
.qr-fab .btn { border-radius: 99px; box-shadow: var(--shadow), var(--glow); }
.overlay { position: fixed; inset: 0; z-index: 300; background: rgba(4, 6, 5, 0.82); display: none; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.overlay.open { display: flex; }
.overlay__card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 2.5rem; text-align: center; max-width: 30rem; }
.overlay__card h2 { font-family: var(--font-display); margin-bottom: 0.5rem; }
.overlay__card p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.qr-holder { background: #fff; padding: 1.2rem; border-radius: var(--radius); display: inline-block; }
.qr-holder canvas, .qr-holder img { display: block; }

/* ---------- Compare ---------- */
.vs-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.vs-head .vs { font-family: var(--font-display); font-size: 2rem; color: var(--text-dim); font-weight: 700; text-align: center; }
.vs-col { text-align: center; }
.vs-col .flag { font-size: 3rem; }
.vs-col h2 { font-family: var(--font-display); font-size: 1.6rem; }
.vs-metric { display: grid; grid-template-columns: 1fr 12rem 1fr; align-items: center; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.vs-metric:last-child { border-bottom: none; }
.vs-metric .m-label { text-align: center; color: var(--text-tertiary); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.vs-metric .m-val { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.vs-metric .m-val.win { color: var(--accent); }
.vs-metric .m-val:first-child { text-align: right; }
.vs-bar { height: 0.5rem; border-radius: 99px; background: var(--bg-elevated); overflow: hidden; display: flex; }
.vs-bar > div { height: 100%; }

/* ---------- Data Engine ---------- */
.engine-grid { display: grid; grid-template-columns: 1.15fr 0.95fr 1fr; gap: 4.5rem; position: relative; align-items: center; }
.engine-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.engine-col { display: flex; flex-direction: column; gap: 1.1rem; position: relative; z-index: 1; }
.engine-col--hub { align-items: center; }
.src-card, .out-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem; cursor: pointer; min-height: 5.6rem;
  box-shadow: var(--shadow);
}
.src-card:active, .out-card:active { transform: scale(0.985); border-color: var(--accent-line); }
.src-card__icon {
  width: 3.1rem; height: 3.1rem; border-radius: var(--radius); flex-shrink: 0;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.src-card__icon i { width: 1.5rem; height: 1.5rem; }
.src-card__icon.out { background: var(--info-dim); color: var(--info); }
.src-card__name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.src-card__desc { color: var(--text-tertiary); font-size: 0.82rem; margin-top: 0.1rem; }
.src-card__stats { color: var(--text-secondary); font-size: 0.88rem; margin-top: 0.3rem; font-variant-numeric: tabular-nums; }
.src-card__stats span { color: var(--accent); font-weight: 700; }
.src-card > .badge { margin-left: auto; flex-shrink: 0; }
.hub {
  background: var(--bg-card); border: 1px solid var(--accent-line); border-radius: var(--radius-lg);
  padding: 1.75rem 1.6rem; text-align: center; width: 100%; max-width: 21rem;
  box-shadow: var(--shadow), var(--glow);
}
.hub__core {
  width: 4.2rem; height: 4.2rem; margin: 0 auto 0.9rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #0E9F6E 100%); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  animation: hubPulse 3s ease-in-out infinite;
}
.hub__core i { width: 2rem; height: 2rem; }
.hub__name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }
.hub__desc { color: var(--text-tertiary); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.2rem; }
.hub__facts { margin-top: 1.1rem; text-align: left; }
@keyframes hubPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.35); } 50% { box-shadow: 0 0 0 14px rgba(16,185,129,0); } }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--text-tertiary); padding: 3rem 1rem; }
.empty i { width: 2.6rem; height: 2.6rem; margin-bottom: 0.6rem; color: var(--text-dim); }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-secondary); }
.kv .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }
.muted { color: var(--text-tertiary); }
.accent { color: var(--accent); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.5rem); } }
@keyframes dots { to { width: 1.6em; } }
@keyframes ringPulse { 0% { r: 10; opacity: 0.65; } 100% { r: 34; opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(0.8rem); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp 0.45s ease both; }

/* Public /connect page (phones) */
body.public { font-size: 16px; }
body.public .login-card { width: 30rem; }

@media (max-width: 900px) {
  .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr 1fr; }
  .grid-2, .ask-wrap { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
