@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* brand — ONE deep institutional green, used as an accent over neutrals */
  --green: #0B6B53;
  --green-d: #084C3B;
  --green-l: #E8F3EF;
  --green-ink: #063b2d;       /* text on green tints — AA contrast */
  /* neutrals */
  --ink: #0C1A14;            /* headings / near-black */
  --body: #2A3B33;           /* body text tone */
  --muted: #5E6E66;
  --line: #E6ECE9;           /* hairline borders */
  --line-strong: #D5DEDA;    /* slightly firmer hairline for emphasis */
  --bg: #FBFCFB;             /* page background */
  --card: #FFFFFF;           /* surface */
  --surface-2: #F4F7F5;      /* subtle alternate surface */
  --header: rgba(251,252,251,.78);
  /* semantic status — kept SEPARATE from brand green */
  --success: #1A8F5E;
  --success-bg: #ECF8F1;
  --warn: #B87514;
  --warn-bg: #FCF4E6;
  --danger: #C0392B;
  --danger-bg: #FCEDEB;
  --gold: #B8902F;
  /* legacy aliases retained so existing rules keep resolving */
  --red: #C0392B;
  --amber: #B87514;
  /* shape + elevation */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-lg: 16px;          /* large feature surfaces only (checker, modal) */
  /* layered, soft shadows — institutional depth, never heavy */
  --shadow-xs: 0 1px 2px rgba(12,26,20,.05);
  --shadow-sm: 0 1px 2px rgba(12,26,20,.04), 0 2px 6px rgba(12,26,20,.04);
  --shadow: 0 1px 2px rgba(12,26,20,.04), 0 6px 16px -8px rgba(12,26,20,.10);
  --shadow-lg: 0 2px 4px rgba(12,26,20,.04), 0 16px 40px -12px rgba(12,26,20,.16);
  /* focus ring token (used on inputs + interactive surfaces) */
  --ring: 0 0 0 3px var(--green-l);
  /* motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: .14s var(--ease);
  --t: .16s var(--ease);
  /* type scale — tightened for a crafted hierarchy */
  --fs-h1: 44px;
  --fs-h2: 28px;
  --fs-h3: 20px;
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-label: 13px;
  /* spacing scale (4/8px multiples) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 56px;
  --space-9: 96px;
}
body.dark {
  color-scheme: dark;            /* native select/options/inputs render dark */
  --green: #2FA784;              /* brighter deep-green accent for contrast on dark */
  --green-d: #5BC79F;            /* hover/brighter step */
  --green-l: #16322A;            /* deep tint for badges/dropdown hover */
  --green-ink: #BFEEDA;          /* readable text on dark green tints */
  --ink: #EEF4F1;
  --body: #C6D4CD;
  --muted: #9DB1A8;
  --line: #2A3A33;
  --line-strong: #36473F;
  --bg: #0E1512;                 /* near-black neutral */
  --card: #18211D;               /* surface */
  --surface-2: #1F2A25;
  --header: rgba(14,21,18,.82);
  /* semantic status — re-pointed for dark surfaces */
  --success: #57D49B;
  --success-bg: #143023;
  --warn: #E0A94B;
  --warn-bg: #33280F;
  --danger: #F1857A;
  --danger-bg: #341A17;
  --gold: #D7B25A;
  --red: #F1857A;
  --amber: #E0A94B;
  --ring: 0 0 0 3px rgba(91,199,159,.22);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.35);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 16px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.45), 0 16px 40px -12px rgba(0,0,0,.6);
}
body.dark .lang-btn { color: var(--ink); }
body.dark select.lang-btn option { background: var(--card); color: var(--ink); }
body.dark .brand { color: var(--green-d); }
/* dark-mode overrides for boxes that otherwise keep light backgrounds
   (light bg + light text = invisible). Tint them dark, keep text readable. */
body.dark .result.halal { background: #10271d; border-color: #1d4633; }
body.dark .result.not_halal { background: #2b1614; border-color: #5a2a25; }
body.dark .result.questionable { background: #2a2410; border-color: #5a4a1e; }
body.dark .riskbox { background: #2a2410; border-color: #5a4a1e; color: #e6cf8f; }
body.dark .tag.pass { background: #16412e; color: #7fe0ad; }
body.dark .tag.fail { background: #4a1f1a; color: #f1a59c; }
body.dark .tag.na { background: #24332c; color: var(--muted); }
body.dark .dd-item .ty.etf { background: #142B22; color: var(--green-d); }
body.dark .dd-item .ty { background: #1c2b24; }
body.dark .dd-item .ty.etf { background: #10261d; }
body.dark #symInput::placeholder, body.dark input::placeholder { color: #6f837a; }
body.dark .btn.ghost { background: var(--card); }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--body); background: var(--bg);
  font-size: var(--fs-body); font-weight: 400; line-height: 1.6;
  font-feature-settings: "cv11", "ss01";   /* refined Inter alternates (single-story a, etc.) */
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body[dir="rtl"] { font-family: "Inter", "Segoe UI", Tahoma, system-ui, sans-serif; }
h1, h2, h3, h4 { color: var(--ink); }
p { margin: 0 0 1em; }
a { color: var(--green); text-decoration: none; transition: color var(--t-fast); }
strong, b { color: var(--ink); }
/* visible keyboard focus ring for accessibility (mouse clicks stay clean) */
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--green-l); color: var(--green-d); }
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* nav — single centered flex row: [brand]  [links]  [right cluster].
   `gap` provides even spacing; the links group takes the slack between the
   left logo and the right cluster (account / dark toggle / language). */
header { position: sticky; top: 0; background: var(--header); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); z-index: 50; }
nav { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { flex: 0 0 auto; display: inline-flex; align-items: center; margin-inline-end: 12px; font-weight: 700; font-size: 20px; color: var(--ink); letter-spacing: -.02em; white-space: nowrap; }
.brand span { color: var(--green); }
.nav-links { flex: 1 1 auto; display: flex; gap: 30px; align-items: center; }
.nav-links a { color: var(--body); font-weight: 500; font-size: 15px; white-space: nowrap; transition: color var(--t-fast); }
.nav-links a:hover { color: var(--green); }
.nav-controls { flex: 0 0 auto; display: flex; gap: 10px; align-items: center; }
/* .lang-btn is used on real <button>/<select> AND on the #navAuth <a>; inline-flex
   + centering keeps the anchor on the same baseline as the controls and stops its
   label from wrapping to two lines. */
.lang-btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm); padding: 6px 14px; min-height: 40px; cursor: pointer; font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap; color: var(--ink); transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); }
.lang-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
#navAuth { white-space: nowrap; }
.menu-toggle { display: none; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm); padding: 4px 12px; min-height: 40px; cursor: pointer; font-size: 22px; line-height: 1; color: var(--ink); transition: border-color var(--t-fast), background var(--t-fast); }
.menu-toggle:hover { border-color: var(--line-strong); background: var(--surface-2); }

/* hero */
.hero { padding: 96px 0 64px; text-align: center; }
.hero h1 { font-size: var(--fs-h1); font-weight: 700; line-height: 1.05; letter-spacing: -.02em; margin: 0 0 22px; color: var(--ink); }
.hero h1 .hl { color: var(--green); }
.hero p.sub { font-size: 19px; color: var(--muted); line-height: 1.55; max-width: 600px; margin: 0 auto 32px; letter-spacing: -.005em; }
.badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.badge { background: var(--green-l); color: var(--green-ink); border: 1px solid transparent; border-radius: 999px; padding: 6px 14px; font-size: var(--fs-label); font-weight: 600; letter-spacing: -.005em; max-width: 100%; overflow-wrap: anywhere; }

/* checker */
.checker { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 36px; max-width: 760px; margin: 36px auto 0; text-align: center; }
.checker h3 { margin: 0 0 18px; font-size: var(--fs-label); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
/* big search bar with the Check button next to it (flips L/R with language) */
.check-row { display: flex; gap: 12px; align-items: stretch; }
.search-wrap { flex: 1 1 auto; position: relative; min-width: 0; }
#symInput { width: 100%; min-height: 44px; padding: 12px 18px; font-size: 15px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); outline: none; background: var(--card); color: var(--ink); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
#symInput:hover { border-color: var(--muted); }
#symInput:focus { border-color: var(--green); box-shadow: var(--ring); }
.check-btn { flex: 0 0 auto; white-space: nowrap; font-size: 17px; padding: 0 30px; }
.dropdown { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; display: none; }
.dropdown.show { display: block; }
.dropdown { max-height: 340px; overflow-y: auto; }
.dd-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; cursor: pointer; border-top: 1px solid var(--line); text-align: start; transition: background var(--t-fast); }
.dd-item:first-child { border-top: 0; }
.dd-item:hover, .dd-item.active { background: var(--green-l); }
/* the name/symbol block takes the room and truncates; the type badge never shrinks
   or overlaps (this was making long company names collide on the dropdown) */
.dd-item > span:first-child { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.dd-item .nm { font-weight: 600; font-size: 14px; color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-item .sy { font-size: 12px; color: var(--muted); }
.dd-item .ty { flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dd-item .ty.etf { background: var(--green-l); color: var(--green-d); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; background: var(--green); color: #fff; border: 1px solid var(--green); border-radius: var(--radius-sm); padding: 0 20px; font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1; letter-spacing: -.01em; cursor: pointer; box-shadow: var(--shadow-xs); transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.btn:hover { background: var(--green-d); border-color: var(--green-d); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--green-l), 0 0 0 4px var(--green); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.lg { min-height: 50px; padding: 0 26px; font-size: 16px; }
.btn.ghost { background: #fff; color: var(--green-d); border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--green); color: var(--green-d); }
.examples { margin-top: 16px; font-size: var(--fs-label); color: var(--muted); }
.examples a { display: inline-block; padding: 6px 12px; margin: 2px 4px; font-weight: 600; border-radius: 999px; transition: background var(--t-fast), color var(--t-fast); }
.examples a:hover { background: var(--green-l); color: var(--green-d); }

/* result card */
.result { margin-top: 22px; text-align: start; border-radius: var(--radius); padding: 26px; border: 1px solid var(--line); display: none; }
.result.show { display: block; }
.result.halal { background: var(--success-bg); border-color: #C2E6D2; }
.result.not_halal { background: var(--danger-bg); border-color: #F2C9C3; }
.result.questionable { background: var(--warn-bg); border-color: #F0DDB0; }
.result .verdict { font-size: var(--fs-h3); font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 10px; letter-spacing: -.02em; }
.result.halal .verdict { color: var(--success); }
.result.not_halal .verdict { color: var(--danger); }
.result.questionable .verdict { color: var(--warn); }
.result .score { font-size: 15px; color: var(--muted); margin: 6px 0 18px; }
.ratios { list-style: none; padding: 0; margin: 0; }
.ratios li { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: var(--fs-small); }
.tag { font-weight: 600; font-size: 12px; padding: 3px 9px; border-radius: 999px; letter-spacing: -.005em; }
.tag.pass { background: var(--success-bg); color: var(--green-ink); }
.tag.fail { background: var(--danger-bg); color: var(--danger); }
.tag.na { background: var(--surface-2); color: var(--muted); }
.riskbox { background: var(--warn-bg); border: 1px solid #F0DDB0; border-radius: var(--radius-sm); padding: 16px 18px; margin: 18px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--body); }
.riskbox b { display: block; margin-bottom: 6px; color: var(--warn); }
.riskbox ul { margin: 0; padding: 0 0 0 18px; }
body[dir="rtl"] .riskbox ul { padding: 0 18px 0 0; }
.reasons { margin: 18px 0 0; padding: 0 0 0 18px; font-size: var(--fs-small); line-height: 1.6; color: var(--body); }
body[dir="rtl"] .reasons { padding: 0 18px 0 0; }
.spinner { display: none; margin: 20px auto 0; width: 26px; height: 26px; border: 3px solid var(--green-l); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* data tables (screener / results) — institutional, tabular */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-transform: uppercase; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line-strong); text-align: start; padding: 12px; letter-spacing: .04em; }
.data-table td { padding: 12px; border-top: 1px solid var(--line); color: var(--body); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table th.num, .data-table td.num { text-align: end; font-variant-numeric: tabular-nums; }

/* sections */
section { padding: 96px 0; }
section h2 { font-size: var(--fs-h2); font-weight: 700; color: var(--ink); text-align: center; margin: 0 0 14px; letter-spacing: -.025em; line-height: 1.12; }
section .lead { text-align: center; color: var(--muted); font-size: 17px; line-height: 1.55; max-width: 600px; margin: 0 auto 52px; letter-spacing: -.005em; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; align-items: stretch; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.four { grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid > .card { height: 100%; }   /* boxes in a row are equal height */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; padding: 28px; transition: box-shadow var(--t), border-color var(--t), transform var(--t); }
.card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); transform: translateY(-1px); }
.card h4 { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.card .ico { font-size: 26px; margin-bottom: 14px; }

/* pricing — compact cards in two clearly-labelled groups (investor vs developer).
   Each group is its own equal-height grid; cards are tightened (less padding,
   smaller price + list type) so a full row reads clean and uncluttered. */
.price-group-label {
  text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 700;
  color: var(--muted); text-align: center; margin: 8px 0 16px;
}
.price-group-label-dev { margin-top: 40px; }
.pricing { display: grid; gap: 16px; align-items: stretch; margin: 0 auto; }
/* 2-up investor row, narrower so two small cards centre rather than stretch wide */
.pricing-investor { grid-template-columns: repeat(2, 1fr); max-width: 560px; }
/* 3-up developer row */
.pricing-dev { grid-template-columns: repeat(3, 1fr); }
/* all three plans in ONE row, side by side */
.pricing-three { grid-template-columns: repeat(3, 1fr); }
/* equal-height plan cards: stretch to the tallest, CTA pinned to the bottom */
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; padding: 22px 18px; text-align: center; transition: box-shadow var(--t), border-color var(--t), transform var(--t); display: flex; flex-direction: column; height: 100%; }
.plan ul { flex: 1 1 auto; }
.plan > a, .plan > .btn { margin-top: auto; }
.plan:hover { box-shadow: var(--shadow); border-color: var(--line-strong); transform: translateY(-1px); }
.plan.featured { position: relative; border: 1.5px solid var(--green); box-shadow: var(--shadow); transform: translateY(-4px); }
.plan.featured:hover { transform: translateY(-5px); }
.plan.featured::before {
  content: "MOST POPULAR"; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  border-radius: 999px; padding: 3px 11px; white-space: nowrap;
}
.plan h4 { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.plan .price { font-size: 30px; font-weight: 700; color: var(--ink); letter-spacing: -.03em; margin: 8px 0 2px; }
.plan .price small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 14px 0 18px; font-size: 13px; line-height: 1.45; color: var(--body); text-align: start; }
.plan ul li { padding: 7px 0; border-top: 1px solid var(--line); }

/* code */
/* Code blocks are a fixed dark "terminal" in BOTH themes. Must NOT use var(--ink)
   for the background: in dark mode --ink flips to near-white, turning the box white
   while the light text stays — making the code unreadable (dark-mode bug). */
pre { background: #0c1a14; color: #d7f5e8; border-radius: var(--radius-sm); padding: 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; direction: ltr; text-align: left; }
pre code { color: #d7f5e8; }
code { font-family: "SF Mono", Menlo, Consolas, monospace; }
.codeblock h4 { margin: 0 0 10px; }

/* signup */
.signup { background: linear-gradient(135deg, var(--green-d), #06382a); color: #fff; border-radius: var(--radius); padding: 52px 40px; text-align: center; box-shadow: var(--shadow); }
.signup h2 { color: #fff; letter-spacing: -.025em; }
.signup .lead { color: #CFE9DF; }
.signup-row { display: flex; gap: 10px; max-width: 480px; margin: 0 auto; }
.signup-row input { flex: 1; padding: 0 16px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-family: inherit; font-size: 15px; transition: box-shadow var(--t-fast); }
.signup-row input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.signup .btn { background: #fff; color: var(--green-d); border-color: #fff; }
.signup .btn:hover { background: var(--green-l); border-color: var(--green-l); color: var(--green-d); }
.keybox { background: rgba(0,0,0,.22); border: 1px dashed rgba(255,255,255,.35); border-radius: var(--radius-sm); padding: 16px; margin-top: 18px; display: none; font-family: monospace; word-break: break-all; }
.keybox.show { display: block; }

/* checkout modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(12,26,20,.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; max-width: 420px; width: 100%; position: relative; box-shadow: var(--shadow-lg); text-align: start; }
.modal h3 { margin: 0 0 6px; font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.modal-sub { color: var(--muted); font-size: var(--fs-small); line-height: 1.55; margin: 0 0 18px; }
.modal input { width: 100%; min-height: 44px; padding: 12px 16px; font-family: inherit; font-size: 15px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); margin-bottom: 12px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.modal input:focus { border-color: var(--green); outline: none; box-shadow: var(--ring); }
.modal .btn { width: 100%; }
.modal-x { position: absolute; top: 14px; right: 16px; background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); border-radius: 8px; transition: color var(--t-fast), background var(--t-fast); }
.modal-x:hover { color: var(--ink); background: var(--surface-2); }
body[dir="rtl"] .modal-x { right: auto; left: 16px; }
.modal-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.modal-trust { color: var(--muted); font-size: 12px; text-align: center; margin: 12px 0 0; }

footer { border-top: 1px solid var(--line); padding: 48px 0; color: var(--muted); font-size: var(--fs-small); text-align: center; }
.disclaimer { font-size: 12.5px; color: var(--muted); line-height: 1.6; max-width: 720px; margin: 16px auto 0; text-align: center; }

@media (max-width: 1024px) {
  html, body { overflow-x: hidden; }   /* belt-and-suspenders against horizontal scroll on phones */
  .grid, .grid.two { grid-template-columns: 1fr; }
  /* tablet: use-case row wraps to a tidy 2-up before stacking on phones */
  .grid.four { grid-template-columns: repeat(2, 1fr); }
  /* tablet: developer tiers wrap to a tidy 2-up; investor stays 2-up centred */
  .pricing-dev { grid-template-columns: repeat(2, 1fr); }
  .pricing-investor { max-width: 100%; }
  .hero { padding: 60px 0 44px; }
  .hero h1 { font-size: 34px; line-height: 1.1; letter-spacing: -.025em; }
  .hero p.sub { font-size: 17px; }
  .menu-toggle { display: inline-flex; min-height: 44px; }
  /* on phones the nav wraps to multiple rows: brand stays left, controls hug
     the right, and the brand no longer needs to stretch the links group */
  nav { gap: 12px; }
  .nav-links { flex-basis: 100%; }
  nav { flex-wrap: wrap; height: auto; min-height: 64px; padding: 8px 0; }
  /* keep the top control row from overflowing off-screen on phones (was the
     root cause of "buttons don't appear"): let it wrap + shrink the lang select */
  .nav-controls { flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 0; }
  .lang-btn { min-height: 44px; }
  #langSel { max-width: 132px; min-width: 0; }
  /* collapsible mobile menu: hidden until the hamburger opens it */
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    order: 3;
    margin-top: 6px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 6px; border-top: 1px solid var(--line); font-size: 16px; }
  /* search + button stack vertically on phones so neither gets squeezed */
  .check-row { flex-direction: column; }
  .check-btn { width: 100%; }
  .signup-row { flex-direction: column; }
  .signup-row input { width: 100%; }
  .checker { padding: 26px 20px; }
  section { padding: 60px 0; }
  section h2 { font-size: 27px; }
  .signup { padding: 38px 24px; }
}

/* phones: every plan stacks to a single clean column */
@media (max-width: 640px) {
  .pricing-investor, .pricing-dev, .pricing-three, .grid.four { grid-template-columns: 1fr; }
  .plan.featured { transform: none; }
  .plan.featured:hover { transform: translateY(-1px); }
}

/* very small phones */
@media (max-width: 380px) {
  .hero h1 { font-size: 28px; }
  section h2 { font-size: 23px; }
  .container { padding: 0 16px; }
  .checker { padding: 22px 16px; }
  /* dashboard on tiny screens: cards full-bleed within padding, stat boxes
     shorter, and the key/code rows never push the layout wider than the
     viewport. The stat cards are still equal width (single 1fr column). */
  .auth-card { padding: 28px 20px; }
  .dash-card { padding: 16px; }
  .dash-stat { min-height: 0; padding: 18px; }
  .dash-stat-big { font-size: 26px; }
  .dash-h1 { font-size: 24px; }
  .keyrow { gap: 6px; }
  .keybtn { padding: 0 12px; }
  /* long API keys / curl examples scroll inside their box, never overflow */
  .keycode, .curlbox { max-width: 100%; }
}

/* belt-and-suspenders: nothing in the dashboard main panel may force a wider
   layout than the viewport (long unbroken tokens scroll inside their own box). */
.dash-main, .dash-grid, .dash-card { max-width: 100%; min-width: 0; }
.dash-card pre, .dash-card code.keycode { max-width: 100%; }

/* =====================================================================
   ACCOUNT DASHBOARD (FMP-style) — added block, do not interleave above.
   Signed-out auth card + signed-in sidebar dashboard. Uses the site's
   existing CSS variables; RTL-safe via logical properties.
   ===================================================================== */

/* ---- signed-out: clean centered auth card ---- */
.auth-card {
  max-width: 440px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 38px 34px;
}
.auth-title { margin: 0 0 6px; font-size: 25px; font-weight: 700; color: var(--ink); text-align: center; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 24px; font-size: 14px; line-height: 1.55; color: var(--muted); text-align: center; }
.auth-google { width: 100%; align-items: center; justify-content: center; gap: 10px; padding: 12px; font-weight: 600; }
.auth-or { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0; text-transform: uppercase; letter-spacing: .08em; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field-input {
  width: 100%; min-height: 44px; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 15px; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field-input:focus { outline: none; border-color: var(--green); box-shadow: var(--ring); }
.field-pw { position: relative; }
.field-pw .field-input { padding-inline-end: 64px; }
.field-pw-toggle {
  position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 8px; border-radius: 6px;
  transition: color var(--t-fast), background var(--t-fast);
}
.field-pw-toggle:hover { color: var(--ink); background: var(--surface-2); }
.auth-hint { font-size: 12px; margin: 6px 0 0; color: var(--muted); }
.auth-submit { width: 100%; margin-top: 18px; }
.auth-toggle { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-toggle a { color: var(--green-d); font-weight: 600; }
.auth-forgot { text-align: center; margin-top: 8px; font-size: 13px; }
.auth-forgot a { color: var(--muted); }
.auth-details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.auth-details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.auth-msg { font-size: 13px; margin-top: 10px; text-align: center; color: var(--green-d); }

/* ---- signed-in: shell = sidebar + main ---- */
.dash-shell { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }

/* sidebar */
.dash-sidebar {
  position: sticky; top: 88px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  /* single clean vertical flow: every direct child is a stacked flex row, so
     nothing can ever render on top of anything else. The footer group is
     pushed to the bottom via margin-top:auto (NOT position:absolute), with a
     small bottom pad so the last item never touches the panel edge. */
  padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 2px;
  min-height: 0;
}
.dash-side-brand {
  flex: 0 0 auto;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: 6px 12px 12px;
}
/* height:auto + align-items:stretch OVERRIDE the global `nav { height:68px;
   align-items:center }` header rule — without these the dashboard's <nav>
   inherits the 68px header height, its 8 items overflow, and the margin-top:auto
   footer lands on top of "Usage"/"My stocks". (Recurring overlap bug — locked.) */
.dash-nav { display: flex; flex-direction: column; align-items: stretch; gap: 2px; height: auto; flex: 0 0 auto; min-width: 0; }
.dash-nav-item {
  position: static;                      /* defensive: never pulled out of flow */
  display: flex; align-items: center; gap: 10px; width: 100%;
  flex: 0 0 auto;                        /* each item keeps its own full row, never collapses */
  min-height: 40px; box-sizing: border-box;
  background: none; border: 0; border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: inherit; font-size: 14.5px; font-weight: 500;
  color: var(--ink); cursor: pointer; text-align: start; text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.dash-nav-item span:first-child { flex: 0 0 18px; font-size: 15px; line-height: 1; width: 18px; text-align: center; }
.dash-nav-item:hover { background: var(--surface-2); }
.dash-nav-item.active { background: var(--green-l); color: var(--green-ink); font-weight: 600; }
/* pinned footer group — bottom of the column, own stacked rows */
.dash-nav-foot { display: flex; flex-direction: column; gap: 2px; margin-top: auto; padding-top: 8px; flex: 0 0 auto; }
.dash-nav-link { border-top: 1px solid var(--line); border-radius: 0; padding-top: 14px; }
.dash-nav-signout { color: var(--muted); }

/* main panel */
.dash-main { min-width: 0; }
.dash-header { margin-bottom: 24px; }
.dash-h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: -.025em; }
.dash-welcome { margin: 0; font-size: 14px; color: var(--muted); }
.dash-welcome b { color: var(--ink); font-weight: 600; }

/* cards */
.dash-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 26px; text-align: start;
}
.dash-card + .dash-card { margin-top: 20px; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.dash-card-title { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.dash-card-head .dash-card-title { margin: 0; }
.dash-card-desc { margin: 0 0 16px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.dash-card-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dash-card-link { font-size: 13px; font-weight: 600; color: var(--green-d); white-space: nowrap; transition: color var(--t-fast); }
.dash-card-link:hover { color: var(--green); }
.dash-subhead { margin: 22px 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dash-msg { font-size: 12.5px; margin: 8px 0 0; color: var(--green-d); }
.dash-btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.dash-btn-row .btn { min-height: 44px; padding: 0 18px; font-size: 14px; }

/* overview stat grid — three identical boxes: equal WIDTH (repeat(3,1fr)) and
   equal HEIGHT (align-items:stretch + shared min-height). Each card is a flex
   column so its bottom row (link / usage bar) pins to the same baseline even
   when the cards carry different content. */
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }
.dash-stat {
  display: flex; flex-direction: column;
  padding: 22px; min-height: 132px; min-width: 0; box-sizing: border-box;
}
.dash-stat .dash-card-link, .dash-stat .usage-bar { margin-top: auto; }
.dash-stat-big { font-size: 30px; font-weight: 700; color: var(--ink); margin: 8px 0; line-height: 1.05; letter-spacing: -.02em; }
.dash-stat-sub { font-size: 14px; font-weight: 500; color: var(--muted); }

/* API key block */
.keyrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.keycode {
  flex: 1; min-width: 0; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 13px; font-family: monospace; white-space: nowrap; color: var(--ink);
}
.keybtn { min-height: 44px; padding: 0 16px; font-size: 13px; }
.curlbox {
  margin: 0; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto;
}
.curlbox code { font-family: monospace; font-size: 12.5px; color: var(--ink); white-space: pre; }

/* usage panel */
.usage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 12px; }
.usage-plan { font-size: 15px; font-weight: 600; color: var(--ink); }
.usage-count { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.usage-bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.usage-bar-lg { height: 12px; }
.usage-bar-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width .4s var(--ease); }
.usage-bar-fill.usage-bar-hot { background: #b42318; }
.usage-pct { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* billing */
.dash-plan { margin: 8px 0 16px; font-size: 15px; color: var(--ink); line-height: 1.6; }
.dash-plan-note { color: var(--muted); font-size: 13px; }

/* security */
.sec-methods { margin: 14px 0 18px; display: flex; flex-direction: column; gap: 6px; }
.sec-methods > div { font-size: 13.5px; color: var(--ink); }

/* danger zone */
.dash-danger { border-color: #e0b4b4; }
body.dark .dash-danger { border-color: #5a2a2a; }
.dash-delete-btn { background: #b42318; border-color: #b42318; min-height: 44px; padding: 0 18px; font-size: 14px; }
.dash-delete-btn:hover { background: #962012; border-color: #962012; }

/* responsive: sidebar -> horizontal tab strip, stats stack */
@media (max-width: 1024px) {
  .dash-shell { grid-template-columns: 1fr; gap: 18px; }
  .dash-sidebar {
    position: static; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 6px;
    padding: 10px; overflow-x: auto; scrollbar-width: none; margin-bottom: 4px;
  }
  .dash-sidebar::-webkit-scrollbar { display: none; }
  .dash-side-brand { display: none; }
  .dash-nav { flex-direction: row; flex-wrap: nowrap; gap: 6px; }
  /* footer group joins the same horizontal strip — no margin-top:auto in a row */
  .dash-nav-foot { flex-direction: row; flex-wrap: nowrap; gap: 6px; margin-top: 0; padding-top: 0; }
  .dash-nav-item { width: auto; min-height: 0; padding: 9px 12px; font-size: 13.5px; white-space: nowrap; }
  .dash-nav-link { margin-top: 0; border-top: 0; border-radius: var(--radius-sm); padding-top: 9px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card { padding: 20px; }
}

/* respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   ACCOUNT VISIBILITY — bulletproof state machine.
   The /account page has TWO mutually-exclusive top-level states
   (#acctSignedOut auth card / #acctDash sidebar dashboard) and the
   dashboard has 7 mutually-exclusive sections. If more than one of
   either group is visible at once they stack and read as "text on top
   of each other". To make overlap STRUCTURALLY impossible:

   • Both wrappers and ALL sections are force-hidden with !important.
   • The ONLY thing that can reveal one is the explicit reveal class
     (.is-shown / .is-active), also !important so it wins regardless of
     cascade order, source specificity, a stale partial cache, leftover
     inline display, or any future generic `section{}` rule.

   Result: at most one wrapper and at most one section can ever show —
   and before JS runs (no reveal class yet) the page is cleanly blank,
   never a stacked wall. JS (acctShow/acctNav) toggles the reveal class.
   ===================================================================== */
#acctSignedOut, #acctDash { display: none !important; }
#acctSignedOut.is-shown, #acctDash.is-shown { display: block !important; }

#acctDash .dash-section { display: none !important; }
#acctDash .dash-section.is-active { display: block !important; }
