/* =========================================================
   ExpatGuideME – shared site styles
   Used by every page. Page-specific styles stay in each page.
   ========================================================= */

:root {
  --ink: #14213d;
  --muted: #5c6b80;
  --brand: #0b6e4f;
  --brand-dark: #08563e;
  --brand-soft: #e6f4ee;
  --on-brand: #ffffff;
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e3e8ef;
  --warn-bg: #fff8e6;
  --warn-ink: #8a5a00;
  --err-bg: #fdecea;
  --err-ink: #a12a1c;
  --shadow: 0 8px 30px rgba(20, 33, 61, 0.10);
  --header-h: 60px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --ink: #e6edf3;
  --muted: #9aa7b5;
  --brand: #3ccf9b;
  --brand-dark: #6ee0b8;
  --brand-soft: #143a2d;
  --on-brand: #04120d;
  --bg: #0f141a;
  --card: #171e26;
  --line: #2a3440;
  --warn-bg: #3a2e10;
  --warn-ink: #f2c36b;
  --err-bg: #3d1915;
  --err-ink: #ff9b8f;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

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

html { scroll-padding-top: calc(var(--header-h) + 12px); }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  transition: background-color 0.2s, color 0.2s;
}
html[lang="ar"] body { font-family: "Cairo", "Inter", Tahoma, sans-serif; line-height: 1.8; }
html[lang="bn"] body { font-family: "Noto Sans Bengali", "Inter", sans-serif; line-height: 1.75; }
html[lang="ur"] body { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Cairo", Tahoma, sans-serif; line-height: 2.2; }
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3 { line-height: 1.9; }
html[lang="hi"] body,
html[lang="ne"] body { font-family: "Noto Sans Devanagari", "Inter", sans-serif; line-height: 1.8; }
html[lang="ml"] body { font-family: "Noto Sans Malayalam", "Inter", sans-serif; line-height: 1.8; }

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

h1 { font-size: 1.8rem; line-height: 1.3; margin: 28px 0 8px; }
h2 { font-size: 1.2rem; line-height: 1.4; margin: 22px 0 12px; }
.lead { color: var(--muted); font-size: 1.05rem; margin-bottom: 20px; }

main { display: block; }
main:focus { outline: none; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; inset-inline-start: 12px; top: -80px; z-index: 100;
  background: var(--brand); color: var(--on-brand);
  padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 12px; color: var(--on-brand); }

/* ---------- Scroll progress ---------- */
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.scroll-progress span {
  display: block; height: 100%; width: 100%; background: var(--brand);
  transform-origin: 0 50%; transform: scaleX(0);
}
html[dir="rtl"] .scroll-progress span { transform-origin: 100% 50%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
/* Glass header: the blur sits on a pseudo-element, so the header itself never becomes
   a containing block and the fixed mobile menu sheet can still escape it. */
.site-header { background: transparent; isolation: isolate;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .06), 0 6px 20px -12px rgba(15, 23, 42, .25); }
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--card);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header::before {
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%);
  }
  html[data-theme="dark"] .site-header::before { background: rgba(15, 23, 42, .72); }
}
.site-header { border-bottom: 1px solid rgba(15, 23, 42, .08); }
html[data-theme="dark"] .site-header { border-bottom-color: rgba(255, 255, 255, .12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 8px 24px -14px rgba(0, 0, 0, .7); }
.header-row { display: flex; align-items: center; gap: 12px; min-height: var(--header-h); }

.logo {
  font-family: "Inter", sans-serif; font-weight: 700; font-size: 1.25rem;
  color: var(--ink); text-decoration: none; direction: ltr; white-space: nowrap;
}
.logo span { color: var(--brand); }
.logo:hover { color: var(--ink); opacity: 0.8; }

.site-nav { display: flex; gap: 4px; margin-inline-start: auto; }
.site-nav a {
  padding: 8px 12px; border-radius: 8px; color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover { background: var(--brand-soft); color: var(--brand); }
.site-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }

.header-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--ink);
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

html[data-theme="dark"] .i-moon,
html:not([data-theme="dark"]) .i-sun { display: none; }

.menu-btn { display: none; }
.menu-btn[aria-expanded="true"] .i-menu,
.menu-btn[aria-expanded="false"] .i-close { display: none; }

/* Language menu */
.lang-menu { position: relative; }
.lang-current { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.langs {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 70;
  display: flex; flex-direction: column; gap: 2px; min-width: 170px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  animation: fade 0.12s ease;
}
.langs button {
  text-align: start; font: inherit; font-size: 0.95rem; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; border: 0;
  background: transparent; color: var(--ink); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.langs button:hover { background: var(--brand-soft); color: var(--brand); }
.langs button.active { background: var(--brand); color: var(--on-brand); }
.langs button[lang="ar"] { font-family: "Cairo", sans-serif; }
.langs button[lang="bn"] { font-family: "Noto Sans Bengali", sans-serif; }
.langs button[lang="ur"] { font-family: "Noto Nastaliq Urdu", "Cairo", sans-serif; }
.langs button[lang="hi"], .langs button[lang="ne"] { font-family: "Noto Sans Devanagari", sans-serif; }
.langs button[lang="ml"] { font-family: "Noto Sans Malayalam", sans-serif; }

@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .header-actions { margin-inline-start: auto; }
  .lang-current { display: none; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px; margin: 0; padding: 10px 16px 16px;
    background: var(--card); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; animation: fade 0.15s ease; }
  .site-nav a { padding: 12px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); color: var(--on-brand); box-shadow: 0 4px 14px rgba(11, 110, 79, 0.25); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn[disabled] { opacity: 0.65; cursor: wait; }
.btn svg { width: 18px; height: 18px; }

/* ---------- Form fields ---------- */
input[type="email"], input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 110, 79, 0.18); }
textarea { min-height: 140px; resize: vertical; }
.field-label { display: block; font-weight: 600; font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
.hp { display: none; }

/* ---------- Cards, ads, last updated ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 18px; }
.ad-slot {
  min-height: 100px; border: 1px dashed var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.85rem; margin: 24px 0;
}
.last-updated { color: var(--muted); font-size: 0.85rem; margin: 8px 0 24px; }

/* ---------- FAQ ---------- */
.faq { margin: 28px 0; }
.faq h2 { font-size: 1.25rem; margin-bottom: 12px; }
.faq details {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 10px; overflow: hidden; transition: border-color 0.15s;
}
.faq details:hover, .faq details[open] { border-color: var(--brand); }
.faq summary {
  cursor: pointer; list-style: none; padding: 14px 16px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  transition: color 0.15s;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--brand); transition: transform 0.2s; flex-shrink: 0; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--brand); }
.faq .answer { padding: 0 16px 16px; color: var(--muted); }
.faq details[open] .answer { animation: rise 0.25s ease; }

/* ---------- Footer & newsletter ---------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--card); padding: 32px 0 calc(110px + var(--nl-badge, 0px)); }
.newsletter { max-width: 560px; margin: 0 auto 28px; text-align: center; }
.newsletter h2 { margin: 0 0 4px; }
.newsletter > p { color: var(--muted); margin-bottom: 14px; }
.nl-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.nl-form input[type="email"] { flex: 1 1 240px; width: auto; }
.form-msg { width: 100%; font-size: 0.9rem; min-height: 1.4em; color: var(--err-ink); margin-top: 4px; }
.success-box {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
  font-weight: 600; animation: pop 0.35s ease;
}
.success-box:focus { outline: none; }
.success-box .check {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand); color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center;
}
.footer-links { text-align: center; margin-bottom: 10px; }
.footer-links a { color: var(--muted); margin: 0 8px; font-size: 0.9rem; text-decoration: none; }
.footer-links a:hover { color: var(--brand); text-decoration: underline; }
.disclaimer, .credit { text-align: center; color: var(--muted); font-size: 0.82rem; }
.credit { margin-top: 6px; }
.credit a { color: var(--muted); }

/* ---------- Floating buttons ---------- */
.fab-contact {
  position: fixed; inset-inline-end: 16px; bottom: calc(16px + var(--cookie-h, 0px) + var(--nl-badge, 0px)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px;
  background: var(--brand); color: var(--on-brand); font-weight: 600; text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s, background 0.15s, bottom 0.2s;
}
.fab-contact:hover { background: var(--brand-dark); color: var(--on-brand); transform: translateY(-2px); }
.fab-contact svg { width: 20px; height: 20px; }
body[data-page="contact"] .fab-contact { display: none; }

.to-top {
  position: fixed; inset-inline-end: 16px; bottom: calc(78px + var(--cookie-h, 0px) + var(--nl-badge, 0px)); z-index: 40;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, color 0.15s, bottom 0.2s;
  animation: fade 0.2s ease;
}
.to-top:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }
.to-top svg { width: 20px; height: 20px; }
body[data-page="contact"] .to-top { bottom: calc(16px + var(--cookie-h, 0px) + var(--nl-badge, 0px)); }

@media (max-width: 520px) {
  .fab-contact span { display: none; }
  .fab-contact { padding: 13px; }
  .to-top { bottom: calc(76px + var(--cookie-h, 0px) + var(--nl-badge, 0px)); }
}

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--nl-badge, 0px)); z-index: 45;
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); animation: rise 0.3s ease;
}
.cookie-banner p { flex: 1 1 260px; font-size: 0.9rem; }
.cookie-banner a { font-size: 0.9rem; font-weight: 600; }
.cookie-banner .btn { padding: 8px 18px; }

/* ---------- Search ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(8, 12, 20, 0.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px; animation: fade 0.15s ease;
}
.search-box {
  width: 100%; max-width: 560px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.search-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.search-head > svg { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; margin-inline-start: 4px; }
.search-head input, .search-head input:hover, .search-head input:focus { border: 0; box-shadow: none; font-size: 1.05rem; padding: 10px 6px; }
.search-results { list-style: none; max-height: 60vh; overflow: auto; padding: 6px; }
.search-results a {
  display: block; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--ink); transition: background 0.12s;
}
.search-results a:hover, .search-results a.active { background: var(--brand-soft); }
.search-results strong { display: block; }
.search-results small { color: var(--muted); font-size: 0.85rem; }
.search-empty { padding: 16px; color: var(--muted); }

/* ---------- Loading & motion ---------- */
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  display: inline-block; border-radius: 8px; color: transparent !important;
  background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
.reveal { animation: rise 0.45s ease both; animation-delay: calc(var(--i, 0) * 60ms); }
.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 15mm; }
  html, body { background: #fff !important; color: #000 !important; }
  .site-header, .skip-link, .scroll-progress, .fab-contact, .to-top, .cookie-banner,
  .search-overlay, .ad-slot, .newsletter, .footer-links, .langs, button, .btn, .no-print { display: none !important; }
  .site-footer { background: #fff !important; border: 0; padding: 12px 0 0; margin: 0; }
  .card, .faq details { border: 1px solid #bbb !important; box-shadow: none !important; background: #fff !important; break-inside: avoid; }
  .faq summary::after { content: ""; }
  .faq .answer, .lead, .muted, .last-updated, .disclaimer, .credit { color: #333 !important; }
  a { color: #000 !important; text-decoration: underline; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; word-break: break-all; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Footer columns ---------- */
.footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 6px; }
.footer-cols h3 { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.footer-cols .footer-links { margin: 0; }
@media (max-width: 520px) { .footer-cols { grid-template-columns: 1fr; } }
.footer-cols .footer-links { text-align: start; display: flex; flex-direction: column; gap: 6px; }
.footer-cols .footer-links a { margin: 0; }

/* ---------- AdSense ---------- */
/* Auto ads: Google places ads itself, so reserved boxes are hidden. */
body[data-ads="auto"] .ad-slot, body[data-ads="auto"] .ad-note { display: none; }
/* Live ad units: fixed minimum height so the page does not jump while an ad loads. */
.ad-slot.ad-live { display: block; border: 0; min-height: 280px; text-align: center; }
.ad-slot.ad-live .ad-label { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 4px; }
.ad-slot.ad-live ins.adsbygoogle { min-height: 250px; }
@media (max-width: 520px) { .ad-slot.ad-live { min-height: 300px; } }

/* ---------- Answer boxes, summary tables, conversion pages ---------- */
.answer-box { background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--brand); border-radius: 16px; padding: 20px; margin: 18px 0; }
.answer-box h2 { margin-top: 0; font-size: 1.2rem; }
.answer-big { font-size: 1.6rem; margin: 6px 0 10px; color: var(--brand-dark); }
.summary-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-variant-numeric: tabular-nums; }
.summary-table caption { text-align: start; color: var(--muted); font-size: .9rem; padding-bottom: 6px; }
.summary-table th, .summary-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: start; }
.summary-table th { background: var(--brand-soft); font-weight: 600; }
.summary-table tbody tr:last-child td { border-bottom: 0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.crumbs { font-size: .9rem; color: var(--muted); margin: 12px 0 4px; }
.crumbs a { color: inherit; }
.conv-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; padding: 0; list-style: none; }
.conv-links a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-decoration: none; }
.disclaimer-note { color: var(--muted); font-size: .85rem; margin: 18px 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.answer-box .summary-table th[scope="row"] { background: transparent; white-space: nowrap; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.preset:hover { border-color: var(--brand); }
.preset.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---------- App: coming-soon pills, mobile bar ---------- */
.store-pills { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 16px; }
.store-pill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 12px; background: #111; color: #fff; font: inherit; font-weight: 600; font-size: .92rem; text-decoration: none; border: 1px solid #111; min-height: 44px; cursor: pointer; }
.store-pill:hover { background: #222; }
.store-pill.store-install { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
[data-theme="dark"] .store-pill:not(.store-install) { background: #fff; color: #111; border-color: #fff; }
.store-ico { font-size: 1.05rem; line-height: 1; }
.footer-app { margin: 18px 0 6px; }
.footer-app h3 { margin: 0 0 4px; font-size: 1rem; }
.app-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--brand-soft); border-bottom: 1px solid var(--line); padding: 10px 14px; }
.app-bar img { border-radius: 8px; flex: none; }
.app-bar p { flex: 1 1 160px; margin: 0; font-size: .9rem; font-weight: 600; }
.app-bar .btn { min-height: 38px; padding: 6px 12px; font-size: .88rem; }
.app-bar-close { margin-inline-start: auto; font-size: 1.4rem; line-height: 1; background: none; border: 0; color: var(--ink); width: 38px; height: 38px; cursor: pointer; }
@media (display-mode: standalone) { .app-bar, .footer-app { display: none; } }
.send-via { white-space: nowrap; }
.aff-note a { font-weight: 600; }
.app-priv { border-inline-start: 4px solid var(--brand); }

/* ---------- Sponsored rows, essentials card ---------- */
.sponsored { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #fff4d6; color: #7a5200; border: 1px solid #f0d68a; vertical-align: middle; }
[data-theme="dark"] .sponsored { background: #3a2f12; color: #f3d27a; border-color: #5c4a1a; }
tr.sponsored-row td { background: rgba(240, 214, 138, .12); }
.xlink-row { display: flex; flex-wrap: wrap; gap: 8px; }
.essentials { margin: 18px 0 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.essentials h3 { margin: 0 0 10px; font-size: 1rem; }
.ess-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.ess-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.ess-item:hover { border-color: var(--brand); }
.ess-ico { font-size: 1.3rem; line-height: 1; }
.ess-d { display: block; color: var(--muted); font-size: .85rem; }
.ess-note { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }

/* ---------- Header country switcher ---------- */
.country-menu { position: relative; }
.country-btn { font-size: 1.25rem; line-height: 1; border: 2px solid var(--brand-soft); background: linear-gradient(135deg, var(--brand-soft), var(--card)); }
.country-btn:hover { border-color: var(--brand); }
.countries {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 70;
  display: flex; flex-direction: column; gap: 2px; min-width: 190px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.countries-title { margin: 4px 10px 6px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.countries button { display: flex; gap: 8px; align-items: center; text-align: start; font: inherit; font-size: .95rem; font-weight: 600; padding: 9px 12px; min-height: 42px; border-radius: 8px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.countries button:hover { background: var(--brand-soft); color: var(--brand); }
.countries button.active { background: var(--brand); color: var(--on-brand); }

/* Small-phone header fit (audit 2026-11-14): 5 header buttons + logo must fit 320–420px */
@media (max-width: 420px) {
  .header-row { gap: 6px; }
  .logo { font-size: 1.05rem; }
  .header-actions { gap: 2px; }
  .header-actions .icon-btn { min-width: 38px; padding: 0 6px; }
  .country-btn { font-size: 1.1rem; }
}
@media (max-width: 350px) {
  .logo { font-size: .95rem; }
  .header-actions .icon-btn { min-width: 34px; padding: 0 4px; }
  .icon-btn svg { width: 18px; height: 18px; }
}
/* App promo bar is for phones only */
@media (min-width: 761px) { .app-bar { display: none !important; } }
@media (max-width: 350px) {
  .wrap { padding: 0 12px; }
  .header-actions { gap: 0; }
  .header-actions .icon-btn { min-width: 32px; padding: 0 3px; }
}
h1, h2 { overflow-wrap: anywhere; }
.app-hero h1 { min-width: 0; }

/* Rate timestamps and live-feed fallback warning */
.rate-stamp { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.rate-warn { display: block; color: var(--warn-ink); background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; font-weight: 600; }
caption time { font-weight: 600; }

/* =========================================================
   Colour system (2026-11): 5 crisp topic colours, one per group of tools.
   Each colour passes WCAG AA (≥4.5:1) with white text.
   ========================================================= */
:root {
  --c-money: #047857;   /* exchange rate, send money */
  --c-gold: #b45309;    /* gold rate */
  --c-work: #2563eb;    /* end of service, vacation */
  --c-family: #be185d;  /* family visa, ID & residency, family cost, embassy */
  --c-phone: #7c3aed;   /* SIM & internet */
  --c-deals: #c2410c;   /* bank card offers */
  --accent: var(--brand);
}
html[data-theme="dark"] {
  --c-money: #34d399; --c-gold: #fbbf24; --c-work: #60a5fa; --c-family: #f472b6; --c-phone: #a78bfa; --c-deals: #fb923c;
}
body[data-page="exchange"], body[data-page="send"] { --accent: var(--c-money); }
body[data-page="gold"] { --accent: var(--c-gold); }
body[data-page="eos"], body[data-page="vac"] { --accent: var(--c-work); }
body[data-page="visa"], body[data-page="id"], body[data-page="family"], body[data-page="embassy"] { --accent: var(--c-family); }
body[data-page="sim"] { --accent: var(--c-phone); }
body[data-page="offers"] { --accent: var(--c-deals); }
:root { --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--card)); }
body { --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--card)); }

/* Tool pages: a crisp colour bar above the title, coloured section edges */
body:not([data-page="home"]) main .wrap > h1::before {
  content: ""; display: block; width: 56px; height: 6px; border-radius: 6px;
  background: var(--accent); margin-bottom: 14px;
}
body:not([data-page="home"]) main .card { border-top: 4px solid var(--accent); }
body:not([data-page="home"]) main h2 { color: var(--ink); }
body:not([data-page="home"]) main h2::after {
  content: ""; display: block; width: 32px; height: 3px; border-radius: 3px; background: var(--accent); margin-top: 6px; opacity: .85;
}
.summary-table th { background: var(--accent-soft); }
.rate-stamp:not(.rate-warn) { color: var(--muted); }
.cc-tabs button[aria-selected="true"], .kind-tabs button[aria-selected="true"] { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
html[data-theme="dark"] .cc-tabs button[aria-selected="true"], html[data-theme="dark"] .kind-tabs button[aria-selected="true"] { color: #0b0f14 !important; }
.kinds li { background: var(--accent-soft) !important; color: var(--accent) !important; }

/* ---------- Navigation 2026-11: menu extras + mobile bottom bar ---------- */
.nav-more { display: none; }
.bottom-nav { display: none; }
.ic { width: 22px; height: 22px; }
@media (max-width: 760px) {
  .site-nav { max-height: calc(100vh - var(--header-h) - 80px); overflow-y: auto; }
  .site-nav.open .nav-more { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
  .nav-theme { text-align: start; font: inherit; font-weight: 600; padding: 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; }
  .nav-theme:hover { background: var(--brand-soft); color: var(--brand); }
  #themeToggle, .menu-btn { display: none !important; }
  .fab-contact { display: none !important; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(20, 33, 61, .08);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; padding: 4px 2px; border: 0; border-radius: 12px; background: transparent;
    color: var(--muted); font: inherit; font-size: .72rem; font-weight: 600; text-decoration: none; cursor: pointer;
  }
  .bottom-nav .bn-ic { width: 22px; height: 22px; }
  .bottom-nav a[aria-current="page"], .bottom-nav button[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .to-top { bottom: calc(84px + var(--cookie-h, 0px) + env(safe-area-inset-bottom)) !important; width: 42px; height: 42px; }
  .cookie-banner { bottom: calc(78px + env(safe-area-inset-bottom)) !important; }
}
@media print { .bottom-nav { display: none !important; } }
@media (max-width: 760px) {
  /* Menu opens as a sheet just above the bottom bar, near the thumb */
  .site-nav { position: fixed; top: auto; bottom: calc(68px + env(safe-area-inset-bottom)); left: 8px; right: 8px; z-index: 47;
    border: 1px solid var(--line); border-radius: 16px; max-height: 70vh; }
}
@media (max-width: 760px) {
  /* The menu sheet gets its own glass (blur on the sheet only affects the sheet) */
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .site-nav { background: rgba(255, 255, 255, .9) !important;
      -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%);
      box-shadow: 0 18px 40px -16px rgba(15, 23, 42, .35); }
    html[data-theme="dark"] .site-nav { background: rgba(15, 23, 42, .9) !important; border-color: rgba(255, 255, 255, .12) !important; }
    .bottom-nav { background: rgba(255, 255, 255, .82) !important;
      -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%); }
    html[data-theme="dark"] .bottom-nav { background: rgba(15, 23, 42, .78) !important; border-top-color: rgba(255, 255, 255, .12) !important; }
  }
}

/* ---------- Trend charts ---------- */
.trend-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.trend-stats span { font-weight: 700; }
.trend-stats b { font-weight: 600; color: var(--muted); font-size: .85rem; margin-inline-end: 4px; }
.trend-stats .up { color: #047857; } .trend-stats .down { color: #b91c1c; }
html[data-theme="dark"] .trend-stats .up { color: #34d399; } html[data-theme="dark"] .trend-stats .down { color: #f87171; }
.trend-canvas { position: relative; height: 220px; }
.trend-note { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
@media (max-width: 520px) { .trend-canvas { height: 190px; } }
.trend-sub { margin: -4px 0 8px; color: var(--muted); font-size: .9rem; }

/* ---------- Section tabs (gold, exchange) ---------- */
.sec-tabs {
  position: sticky; top: var(--header-h); z-index: 30; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 6px -4px 14px; padding: 8px 4px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.sec-tabs::-webkit-scrollbar { display: none; }
.sec-tabs a {
  flex: 0 0 auto; padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 999px;
  font-weight: 600; font-size: .92rem; color: var(--ink); text-decoration: none; background: var(--card); border: 1px solid var(--line);
}
.sec-tabs a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .sec-tabs a.on { color: #0b0f14; }
section[id] { scroll-margin-top: calc(var(--header-h) + 64px); }

/* ---------- Page entry, refresh bar and live-rate pulse (transform + opacity only) ---------- */
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#main { animation: pageIn 300ms ease-out both; }

.page-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; pointer-events: none; opacity: 0;
  transition: opacity .25s ease .15s; }
.page-bar span { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--c-money, #047857), #10b981 60%, var(--c-gold, #b45309));
  box-shadow: 0 0 10px rgba(16, 185, 129, .55); }
html[dir="rtl"] .page-bar span { transform-origin: 100% 50%; }
.page-bar.run { opacity: 1; transition: opacity .1s; }
.page-bar.run span { transform: scaleX(.82); transition: transform 1.6s cubic-bezier(.1, .7, .2, 1); }
.page-bar.done { opacity: 0; }
.page-bar.done span { transform: scaleX(1); transition: transform .22s ease-out; }

@keyframes liveIn { from { opacity: .15; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes liveGlow { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
.live-in { display: inline-block; animation: liveIn .45s cubic-bezier(.2, .8, .2, 1) both; }
td.live-in, th.live-in { display: table-cell; }
.live-hl { position: relative; }
.live-hl::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: rgba(16, 185, 129, .16); box-shadow: inset 0 0 0 1px rgba(16, 185, 129, .45);
  animation: liveGlow 1.4s ease-out both; }
.live-gold .live-hl::after, .live-hl.is-gold::after { background: rgba(217, 119, 6, .16); box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .5); }

@media (prefers-reduced-motion: reduce) {
  #main, .live-in { animation: none !important; }
  .live-hl::after { display: none; }
  .page-bar { display: none; }
}
