/* GoldKH - app styles (brand kit v3). Royal red #7A0000 + gold #D4AF37 + burgundy #4A0E0E on champagne #F8E6C9,
   Playfair Display headings, Inter / Noto Sans Khmer text. Clean surfaces: no texture behind pages or cards.
   Self-contained (admin.html uses it without brand.css); image urls point into brand/. */
:root {
  --red: #7A0000; --red-hi: #B5121B; --red-deep: #4A0E0E; --burgundy: #4A0E0E;
  --ok: #0A8F4F; --warn: #F59E0B; --err: #EF4444; --charcoal: #1A1A1A;
  --gold: #D4AF37; --gold-hi: #F7E7A1; --gold-dk: #9A7413; --gold-ink: #7A5A12;
  --champ: #F8E6C9; --bg: #FBF3E3; --card: #FFFDF9; --card-2: #FCF4E6;
  --ink: #1A1A1A; --ink-2: #3A2A20; --muted: #6B7280; --heading: #7A0000;
  --line: rgba(122, 0, 0, .09); --line-gold: rgba(212, 175, 55, .34);
  --up: #0A8F4F; --down: #C81E1E; --side: #A0700F;
  --shadow: 0 1px 2px rgba(74, 14, 14, .05), 0 8px 24px rgba(74, 14, 14, .07);
  --shadow-lg: 0 2px 6px rgba(74, 14, 14, .06), 0 22px 50px rgba(74, 14, 14, .16);
  --shadow-red: 0 6px 16px rgba(122, 0, 0, .26);
  --red-grad: linear-gradient(180deg, #B5121B 0%, #7A0000 55%, #610303 100%);
  --gold-btn: linear-gradient(180deg, #FAEDB4 0%, #E9C95E 55%, #D4AF37 100%);
  --gold-text: linear-gradient(180deg, #FBEFB8 0%, #E6C458 48%, #B8892A 100%);
  --radius: 18px; --tab-h: 62px; --side-w: 0px;
  --icon: #C8141C;                     /* mockup line-icon red (tabs, card heads, quick actions) */
  --font: 'Inter', 'Noto Sans Khmer', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-km: 'Noto Sans Khmer', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-disp: 'Playfair Display', 'Noto Serif Khmer', Georgia, 'Times New Roman', serif;
  --font-disp-km: 'Noto Serif Khmer', 'Playfair Display', Georgia, serif;
  --wb-veil: 252, 245, 232;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #140707; --card: #221010; --card-2: #2C1513; --ink: #F6EEE4; --ink-2: #E9DCCB; --muted: #BFAFA3; --heading: #F3D98A;
    --line: rgba(243, 217, 138, .12); --line-gold: rgba(212, 175, 55, .3); --gold-ink: #E9CF7A;
    --up: #4ADE80; --down: #FF7070; --side: #E9C766; --wb-veil: 30, 12, 11; --icon: #F3D98A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35); --shadow-lg: 0 2px 6px rgba(0, 0, 0, .45), 0 24px 56px rgba(0, 0, 0, .5);
    --shadow-red: 0 6px 18px rgba(0, 0, 0, .45); color-scheme: dark; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; color: var(--ink); font: 15.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { position: relative; min-height: 100vh; }
body.km { --font: var(--font-km); --font-disp: var(--font-disp-km); line-height: 1.62; }
/* plain champagne backdrop, soft cream at the top (Alex: clean, no pattern behind the app) */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before { background: radial-gradient(120% 70% at 50% 0%, #FDF7EC 0%, rgba(253, 247, 236, 0) 70%), linear-gradient(180deg, #FCF4E6 0%, var(--champ) 100%); }
body::after { background: none; opacity: 0; }   /* clean page background (Alex) */
@media (prefers-color-scheme: dark) {
  body::before { background: radial-gradient(120% 70% at 50% 0%, #2A0E0C 0%, rgba(42, 14, 12, 0) 70%), linear-gradient(180deg, #170808 0%, #0F0505 100%); }
  body::after { opacity: .07; }
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--red); }
@media (prefers-color-scheme: dark) { a { color: var(--gold-hi); } }
img { max-width: 100%; }

/* ---------- top bar: lotus + GoldKH + tagline, language chip */
.topbar { display: flex; align-items: center; gap: 10px; max-width: 1120px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 10px) 16px 8px; }
.inst + .topbar { padding-top: 10px; }
.logo { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo img { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 1px 1px rgba(110, 80, 16, .25)); }
.logo b { display: block; font: 700 22px/1.05 'Playfair Display', 'Noto Serif Khmer', Georgia, serif; color: var(--heading); letter-spacing: .005em; white-space: nowrap; }
.logo small { display: block; margin-top: 3px; font: 600 8.6px/1.3 'Inter', sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.km .logo small { font: 600 11px/1.35 var(--font-km); letter-spacing: 0; text-transform: none; }
.spacer { flex: 1; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; border: 1px solid var(--line-gold); background: var(--card); color: var(--heading); border-radius: 999px; padding: 6px 12px 6px 9px; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(74, 14, 14, .06); }
.chip-btn svg { width: 16px; height: 16px; flex: none; }
.chip-btn:hover { border-color: var(--gold); }
@media (prefers-color-scheme: dark) { .chip-btn { color: var(--gold-hi); } }

/* ---------- install banner (only when the browser offers it, or iOS Safari) */
.inst { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 9px 8px 9px 10px; border-radius: 16px;
  color: #FFF6E0; background: radial-gradient(120% 140% at 0% 0%, #3A2C22 0%, #1C1612 60%, #120E0B 100%); border: 1px solid rgba(212, 175, 55, .4); box-shadow: 0 10px 26px rgba(26, 10, 0, .22); }
.inst-logo { display: flex; flex-direction: column; align-items: center; width: 48px; flex: none; }
.inst-logo img { width: 34px; height: 34px; }
.inst-logo span { font: 700 10.5px/1 'Playfair Display', Georgia, serif; background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent; margin-top: 1px; white-space: nowrap; }
.inst-t { flex: 1; min-width: 0; }
.inst-t b { display: block; font-size: 14.5px; line-height: 1.3; }
.inst-t small { display: block; font-size: 12px; color: rgba(255, 240, 210, .72); line-height: 1.35; }
.inst-go { flex: none; border: 1px solid rgba(154, 116, 19, .5); background: var(--gold-btn); color: #3B2A00; border-radius: 11px; padding: 8px 15px; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55); }
.inst-x { flex: none; width: 32px; height: 32px; border: 0; background: none; color: rgba(255, 240, 210, .8); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 50%; }
.inst-x:hover { background: rgba(255, 255, 255, .08); }
.how { list-style: none; counter-reset: s; padding: 0; margin: 12px 0 16px; }
.how li { counter-increment: s; display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.how li:first-child { border-top: 0; }
.how li::before { content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--red-grad); color: #fff; font-weight: 700; font-size: 14px; }
.how li svg { width: 22px; height: 22px; flex: none; color: #2563EB; margin-left: auto; }
.sheet-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 0 6px; }
.sheet-brand img { width: 52px; height: 52px; }
.sheet-brand b { font: 700 18px 'Playfair Display', Georgia, serif; color: var(--gold-dk); }

/* ---------- page */
main { padding: 4px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); max-width: 760px; margin: 0 auto; }
.title-lg { font: 700 30px/1.15 var(--font-disp); letter-spacing: -.01em; color: var(--heading); margin: 8px 4px 16px; }
.title-lg::after { content: ""; display: block; width: 64px; height: 2px; margin-top: 8px; border-radius: 1px; background: linear-gradient(90deg, var(--gold), rgba(212, 175, 55, 0)); }
body.km .title-lg { font-size: 26px; line-height: 1.5; letter-spacing: 0; }
.card { position: relative; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line-gold); }
.card h2 { margin: 0 0 12px; font: 700 16px/1.3 var(--font); color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }   /* card titles: the Home card-head style on every tab */
body.km .card h2 { font-size: 15.5px; line-height: 1.6; }
.card h2 .tag { margin-left: auto; font-family: var(--font); }
.muted { color: var(--muted); font-size: 13px; }
.tiny { font-size: 12px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cell { background: linear-gradient(180deg, #FFFCF4, var(--card-2)); border: 1px solid rgba(212, 175, 55, .3); border-radius: 14px; padding: 10px 10px 9px; min-width: 0; }
.cell .lbl { font-size: 12px; color: var(--gold-ink); font-weight: 600; }
.cell .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; line-height: 1.3; }
.cell .k { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { .cell { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .22); } }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; border: 1px solid transparent; line-height: 1.5; }
.tag.high { background: rgba(200, 30, 30, .08); border-color: rgba(200, 30, 30, .22); color: var(--down); }
.tag.medium { background: rgba(212, 175, 55, .16); border-color: rgba(212, 175, 55, .42); color: var(--gold-ink); }
.tag.low { background: rgba(107, 114, 128, .1); border-color: rgba(107, 114, 128, .18); color: var(--muted); }
.tag.ok { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .26); color: var(--up); }
.macro-pill { margin-top: 10px; border: 1px solid transparent; border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 700; cursor: pointer; }
.macro-pill.confirms { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .25); color: var(--up); }
.macro-pill.disagrees { background: rgba(200, 30, 30, .08); border-color: rgba(200, 30, 30, .22); color: var(--down); }
.macro-pill.mixed { background: rgba(212, 175, 55, .15); border-color: rgba(212, 175, 55, .4); color: var(--side); }
.check-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 4px; }
.check-arrow { color: var(--gold-dk); font-size: 18px; }
.drow { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.drow:first-child { border-top: 0; }
.dn { font-weight: 600; font-size: 15px; } .dv { text-align: right; font-variant-numeric: tabular-nums; } .dval { font-weight: 700; font-size: 16px; }
.ev-row { padding: 9px 0; border-top: 1px solid var(--line); } .ev-row:first-of-type { border-top: 0; }
.bar { height: 6px; border-radius: 3px; background: rgba(122, 0, 0, .08); margin-top: 6px; overflow: hidden; } .bar i { display: block; height: 100%; background: linear-gradient(90deg, #E9C95E, var(--gold-dk)); border-radius: 3px; }

/* segmented controls: champagne track, white active; the Shop part switch and chart timeframes are royal red */
.seg { display: flex; background: rgba(212, 175, 55, .12); border: 1px solid rgba(212, 175, 55, .28); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-width: 0; border: 0; background: transparent; padding: 7px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; color: #6B5A45; cursor: pointer; line-height: 1.35; }
.seg button.on { background: var(--card); color: var(--red); box-shadow: 0 1px 3px rgba(74, 14, 14, .12), inset 0 0 0 1px rgba(212, 175, 55, .45); }
.seg-lg button, #tfseg button { padding: 9px 4px; font-size: 14px; }
.seg-lg button.on, #tfseg button.on { background: var(--red-grad); color: #fff; box-shadow: var(--shadow-red); }
@media (prefers-color-scheme: dark) {
  .seg { background: rgba(212, 175, 55, .08); border-color: rgba(212, 175, 55, .2); } .seg button { color: var(--muted); }
  .seg button.on { background: linear-gradient(180deg, rgba(212, 175, 55, .32), rgba(212, 175, 55, .18)); color: #FFF1C4; box-shadow: inset 0 0 0 1px rgba(212, 175, 55, .7); }
  .seg-lg button.on, #tfseg button.on { background: var(--red-grad); color: #fff; }
}

/* outlook (styled like a signal card, honest words only) */
.ol-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ol-head h2 { margin: 0; flex: 1; min-width: 0; }
.ol-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--red); background: rgba(122, 0, 0, .07); border: 1px solid rgba(122, 0, 0, .12); }
.ol-ico svg { width: 21px; height: 21px; }
@media (prefers-color-scheme: dark) { .ol-ico { color: var(--gold-hi); background: rgba(212, 175, 55, .1); border-color: rgba(212, 175, 55, .25); } }
.dir-pill { display: inline-flex; align-items: center; gap: 6px; flex: none; border-radius: 999px; padding: 6px 13px 6px 10px; font-weight: 700; font-size: 14.5px; color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); white-space: nowrap; }
.dir-pill svg { width: 18px; height: 18px; }
.dir-pill.dir-up { background: linear-gradient(180deg, #16A862, #0A8F4F); }
.dir-pill.dir-down { background: linear-gradient(180deg, #D8302F, #A3161B); }
.dir-pill.dir-side { background: var(--gold-btn); color: #3B2A00; border: 1px solid rgba(154, 116, 19, .4); }
.ol-stats { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); border: 1px solid rgba(212, 175, 55, .28); border-radius: 14px; background: linear-gradient(180deg, #FFFCF4, var(--card-2)); }
.ol-stats > div { padding: 10px 12px; min-width: 0; }
.ol-stats > div + div { border-left: 1px solid rgba(212, 175, 55, .3); }
.ol-stats .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.ol-stats .v { font-size: 18px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { .ol-stats { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .22); } }
.meter { display: flex; gap: 4px; margin-top: 6px; }
.meter i { flex: 1; height: 6px; border-radius: 3px; background: rgba(122, 0, 0, .1); }
.meter.m1 i:nth-child(-n+1), .meter.m2 i:nth-child(-n+2), .meter.m3 i:nth-child(-n+3) { background: linear-gradient(90deg, #E9C95E, var(--gold-dk)); }
@media (prefers-color-scheme: dark) { .meter i { background: rgba(243, 217, 138, .14); } }
.reasons { list-style: none; margin: 12px 0 0; padding: 0; }
.reasons li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.reasons li:first-child { border-top: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.dot.p { background: #16A34A; } .dot.n { background: #DC2626; } .dot.z { background: var(--gold); }

/* quick tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 11px; border-radius: 16px; border: 1px solid var(--line-gold); background: var(--card); box-shadow: var(--shadow); cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 1.3; min-width: 0; }
.tile::before, .tile::after { content: ""; position: absolute; width: 30px; height: 30px; opacity: .5; pointer-events: none; background: url(brand/kbach-corner.svg) 0 0 / 100% 100% no-repeat; }
.tile::before { left: 3px; top: 3px; } .tile::after { right: 3px; bottom: 3px; transform: scale(-1, -1); }
.tile > * { position: relative; z-index: 1; }
.tile svg { width: 30px; height: 30px; color: var(--icon); stroke-width: 1.6; }
.tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.km .tile span { line-height: 1.75; }   /* Khmer subscripts stay inside the clipped label box */
@media (max-width: 600px) { .tile::before, .tile::after { width: 20px; height: 20px; opacity: .35; } }
.tile:hover { border-color: var(--gold); }
.tile:active { transform: translateY(1px); }


.dir-word { font: 700 24px/1.25 var(--font-disp); color: var(--heading); letter-spacing: -.01em; margin: 2px 0 6px; }   /* Pro tab: track-record score */
body.km .dir-word { font-size: 21px; line-height: 1.6; letter-spacing: 0; }

/* ---------- Home hero (phones + tablets, mockup 1): Angkor art, title, Explore insights */
.hero { position: relative; overflow: hidden; border-radius: 18px; min-height: 232px; padding: 22px 16px 18px; margin: 0 0 12px; border: 1px solid var(--line-gold); box-shadow: var(--shadow);
  background:
    linear-gradient(90deg, rgba(var(--wb-veil), .97) 0%, rgba(var(--wb-veil), .88) 40%, rgba(var(--wb-veil), .3) 62%, rgba(var(--wb-veil), 0) 78%),
    url(brand/hero-angkor-mobile.jpg) 58% 62% / cover no-repeat,
    url(brand/angkor-sunset.svg) 75% 55% / cover no-repeat,
    var(--champ); }
.hero::before { content: ""; position: absolute; left: 0; bottom: 0; width: 120px; height: 120px; opacity: .45; pointer-events: none; transform: scaleY(-1);
  background: url(brand/kbach-corner.svg) 0 0 / 100% 100% no-repeat; }
.hero-txt { position: relative; z-index: 1; max-width: 64%; }
.hero-t { margin: 0; font: 700 clamp(25px, 7.5vw, 38px)/1.08 var(--font-disp); color: #7E0A10; letter-spacing: -.01em; }
body.km .hero-t { font-size: clamp(22px, 6.6vw, 30px); line-height: 1.5; letter-spacing: 0; }
.hero-s { margin: 10px 0 14px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); max-width: 260px; }
.hero-go { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 15px 10px 17px; background: linear-gradient(180deg, #E3262E, #B3121A); color: #fff;
  font-weight: 700; font-size: 14px; line-height: 1.3; box-shadow: 0 6px 14px rgba(179, 18, 26, .32), inset 0 1px 0 rgba(255, 255, 255, .22); cursor: pointer; }
.hero-go svg { width: 17px; height: 17px; flex: none; }
.hero-badge { position: absolute; right: 12px; bottom: 12px; width: 112px; text-align: center; font: 600 8.6px/1.45 'Inter', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: #FFF6E0; text-shadow: 0 1px 3px rgba(40, 10, 0, .65); }
.hero-badge::after { content: ""; display: block; height: 10px; margin-top: 3px; background: url(brand/divider.svg) center / contain no-repeat; }
body.km .hero-badge { font: 600 11px/1.5 var(--font-km); letter-spacing: 0; text-transform: none; }
@media (max-width: 600px) {   /* phones: the hero runs edge to edge like mockup 1, 'Brighter Future' on one line */
  .hero { margin: 0 -16px 12px; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; min-height: 210px; padding-top: 18px; }
  .hero-t { font-size: clamp(24px, 7vw, 34px); } .hero-txt { max-width: 70%; } .hero-badge { width: 96px; }
}
.hero-t, .wb-sub, .k-q p, .wq p { text-wrap: balance; }   /* Khmer lines never leave one word alone */
@media (min-width: 601px) { .hero { min-height: 250px; padding: 26px 24px 22px; background-image: linear-gradient(90deg, rgba(var(--wb-veil), .97) 0%, rgba(var(--wb-veil), .86) 36%, rgba(var(--wb-veil), .2) 58%, rgba(var(--wb-veil), 0) 72%), url(brand/hero-angkor.jpg), url(brand/angkor-sunset.svg); background-position: 0 0, 70% 55%, 80% 55%; } .hero-txt { max-width: 56%; } }
@media (prefers-color-scheme: dark) { .hero-t { color: transparent; background: var(--gold-text); -webkit-background-clip: text; background-clip: text; } }

/* ---------- desktop welcome banner (mockup 3): name, sub line, Angkor + red silk + lotus, Phnom Penh date + time */
.wb { display: none; }
.wb-hi { font-size: 19px; font-weight: 500; color: var(--ink); }
.wb-name { font: 700 50px/1.05 var(--font-disp); color: var(--heading); margin: 2px 0 6px; overflow-wrap: anywhere; }
body.km .wb-name { font-size: 36px; line-height: 1.5; }
.wb-name.solo { font-size: 38px; }
body.km .wb-name.solo { font-size: 26px; }
body.km .wb-hi { font-size: 16px; }
.wb-sub { margin: 0; font-size: 15.5px; font-weight: 500; color: #B3121A; }
.wb-silk { position: absolute; z-index: 1; top: 0; bottom: 0; right: 156px; width: 380px; pointer-events: none; }   /* the red silk drape (brand/silk-drape.png) */
.wb-drape { position: absolute; right: -6px; bottom: -8px; width: 100%; height: 120%; max-width: none; object-fit: fill; filter: drop-shadow(-4px 6px 10px rgba(60, 0, 0, .22)); }
.wb-flame { position: absolute; right: 8px; top: 50%; width: auto; height: 66%; max-width: none; transform: translateY(-36%); filter: drop-shadow(0 3px 6px rgba(50, 0, 0, .45)); }
.wb-silk-t { position: absolute; right: 116px; bottom: 30px; font: 500 13px/1.7 'Playfair Display', Georgia, serif; letter-spacing: .13em; text-transform: uppercase; color: #FFF3DD; text-align: right; white-space: nowrap; text-shadow: 0 1px 4px rgba(50, 0, 0, .6); }
body.km .wb-silk-t { font: 700 13px/1.75 var(--font-disp-km); letter-spacing: 0; text-transform: none; }
.wb-orn { position: absolute; z-index: 0; pointer-events: none; background: url(brand/kbach-flame-light-sm.png) center / contain no-repeat; }   /* very faint gold line ornaments */
.wb-orn-l { left: -34px; top: -46px; width: 120px; height: 150px; opacity: .2; transform: rotate(-38deg); }
.wb-orn-r { right: -36px; top: -52px; width: 190px; height: 250px; opacity: .25; transform: rotate(22deg); }
.wb-when { position: absolute; z-index: 2; right: 20px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.wb-when .wb-d { font-size: 14px; font-weight: 600; color: #8B1A1A; }
.wb-when b { font-size: 30px; line-height: 1.15; color: var(--ink); }
.wb-when .wb-tz { font-size: 12px; color: var(--muted); }
@media (prefers-color-scheme: dark) { .wb-hi { color: #E9DCCB; } .wb-name { color: transparent; background: var(--gold-text); -webkit-background-clip: text; background-clip: text; } .wb-sub, .wb-when .wb-d { color: #F3D98A; } .wb-when b { color: #FFF6E0; } }

/* ---------- KPI cards (phone: gold price + AI outlook side by side; desktop: 5 cards) */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
.kpi { margin: 0; padding: 12px 12px 11px; min-width: 0; overflow: hidden; }
.kpi[role="link"] { cursor: pointer; transition: border-color .15s; }
.kpi[role="link"]:hover { border-color: var(--gold); }
.kpi[role="link"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.k-rg, .k-tr, .k-q { display: none; }
.kh { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 7px; min-width: 0; }
.kh .k-t { flex: 1 1 0; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--ink-2); }
.kh > svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.k-gb { display: inline-flex; flex: none; } .k-gb svg { width: 30px; height: 23px; display: block; }
.k-ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--icon); background: rgba(200, 20, 28, .07); border: 1px solid rgba(200, 20, 28, .14); }
.k-ic svg { width: 18px; height: 18px; }
.k-ic.tr-up { color: var(--up); background: rgba(22, 163, 74, .08); border-color: rgba(22, 163, 74, .2); }
.k-big { margin: 8px 0 6px; font: 700 clamp(21px, 6.6vw, 30px)/1.12 'Inter', var(--font); letter-spacing: -.025em; font-variant-numeric: tabular-nums; color: var(--ink); }
.k-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.k-art { flex: none; width: 58px; height: 44px; margin: -6px -4px -4px 0; } .k-art svg { width: 100%; height: 100%; }
.k-sub { margin-top: 8px; font-size: 11.5px; line-height: 1.45; color: var(--muted); font-variant-numeric: tabular-nums; }
.k-sub b { color: var(--ink-2); font-weight: 700; white-space: nowrap; }
.k-ol .kh .k-t { flex-basis: calc(100% - 44px); }   /* the outlook chip takes its own line */
.k-chip { margin-top: 2px; }
.k-ol-s { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.k-ol-s .lbl { font-size: 11.5px; color: var(--muted); font-weight: 600; line-height: 1.35; }
.k-ol-s .v { font-size: 16px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.k-ol-s .meter { margin-top: 5px; max-width: 120px; }
@media (min-width: 600px) { .k-ol-s { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 0; } .k-ol-s > div + div { border-left: 1px solid var(--line); padding-left: 12px; } .k-ol-s > div:first-child { padding-right: 10px; } }
@media (max-width: 599px) {   /* phones: label and value share a line (as on desktop), so the two KPI cards stay short */
  .k-ol-s { gap: 6px; } .k-ol-s > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; }
  .k-ol-s .v { font-size: 14.5px; } .k-ol-s .meter { flex-basis: 100%; max-width: none; margin-top: 2px; }
}
.dchip { display: inline-flex; align-items: center; gap: 5px; flex: none; border-radius: 9px; padding: 5px 10px 5px 8px; font-weight: 700; font-size: 13px; line-height: 1.25; color: #fff; white-space: nowrap; box-shadow: 0 3px 8px rgba(0, 0, 0, .12); }
.dchip svg { width: 15px; height: 15px; flex: none; }
.dchip.d-up { background: linear-gradient(180deg, #16A862, #0A8F4F); }
.dchip.d-down { background: linear-gradient(180deg, #E0342F, #B3161B); }
.dchip.d-side { background: var(--gold-btn); color: #3B2A00; box-shadow: inset 0 0 0 1px rgba(154, 116, 19, .4); }
.dchip.sm { padding: 3px 7px; font-size: 10.5px; border-radius: 7px; box-shadow: none; }
.dchip.sm svg { display: none; }
.k-mid { margin: 10px 0 4px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.k-dl { display: grid; gap: 3px; font-size: 12px; font-variant-numeric: tabular-nums; }
.k-dl div { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }   /* label over value: no half-wrapped labels */ .k-dl span { color: var(--muted); } .k-dl b { white-space: nowrap; }
.up, .tr-up { color: var(--up); } .down, .tr-down { color: var(--down); }
.k-tr .k-mid { display: flex; align-items: center; gap: 10px; font-size: 28px; }
.k-tr .k-mid svg { width: 40px; height: 40px; flex: none; }
.k-q { position: relative; cursor: default; color: #FFF8EA; border-color: rgba(154, 116, 19, .5); background: linear-gradient(135deg, #EBC36C 0%, #D9A040 42%, #B06C1E 100%); }   /* quote card (mockup 3) */
.k-q::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 60%; height: 88%; pointer-events: none; background: url(brand/angkor-gold-sm.png) right bottom / contain no-repeat; opacity: .5; mix-blend-mode: multiply; }
.q-ic { position: relative; z-index: 1; display: block; color: #7A0000; } .q-ic svg { width: 30px; height: 23px; display: block; filter: drop-shadow(0 1px 1px rgba(90, 40, 0, .3)); }
.k-q p { position: relative; z-index: 1; margin: 8px 0 0; max-width: 78%; font: 500 16px/1.45 'Playfair Display', Georgia, serif; color: #4A0E0E; text-shadow: none; }   /* 6.7-9:1 on the gold */
body.km .k-q p { font: 700 14px/1.75 var(--font-disp-km); }
.q-rule { position: relative; z-index: 1; display: block; width: 54px; height: 8px; margin-top: 10px;
  background: linear-gradient(90deg, rgba(255, 240, 200, 0), rgba(255, 240, 200, .85)) 0 50% / 22px 1.4px no-repeat, linear-gradient(90deg, rgba(255, 240, 200, .85), rgba(255, 240, 200, 0)) 100% 50% / 22px 1.4px no-repeat; }
.q-rule::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; transform: rotate(45deg); background: #FFF0C8; }

/* ---------- dashboard cards: card head, chart, news, watchlist, AI analysis, quick actions */
.dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.dash > .card, .dash > .tiles { margin: 0; }
.ch { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 10px; min-width: 0; }
.ch h2 { margin: 0; flex: 1 1 0; min-width: 0; font: 700 15.5px/1.3 var(--font); color: var(--ink); }
@media (max-width: 420px) { .cc .ch h2 { font-size: 14.5px; letter-spacing: -.01em; } }
body.km .ch h2 { font-size: 15px; line-height: 1.6; }
.ch-ic { display: inline-grid; place-items: center; flex: none; color: var(--icon); } .ch-ic svg { width: 21px; height: 21px; }
.ch-ic.sq { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(180deg, #E3262E, #B3121A); color: #fff; } .ch-ic.sq svg { width: 16px; height: 16px; }
.ch-ic.star svg { width: 22px; height: 22px; }
.lnk { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 0; color: var(--icon); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.lnk svg { width: 14px; height: 14px; }
.tfs { display: flex; gap: 3px; margin-left: auto; }
.tfs button { min-width: 33px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 4px 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; line-height: 1.4; }
.tfs button.on { background: linear-gradient(180deg, #E3262E, #B3121A); border-color: transparent; color: #fff; box-shadow: 0 3px 8px rgba(179, 18, 26, .3); }
.cc { padding: 12px 10px 8px 12px; }
#chart.chart-home { height: 200px; min-height: 0; border-radius: 10px; overflow: hidden; }   /* id + class: beats the Market chart's #chart rule below */
.dash .tiles { gap: 8px; }
.ni { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; }
.ni:first-of-type { border-top: 0; padding-top: 0; }
.ni img { width: 62px; height: 62px; flex: none; border-radius: 9px; object-fit: cover; background: var(--champ); box-shadow: 0 1px 3px rgba(74, 14, 14, .15); }
.ni-b { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ni-b small { font-size: 11.5px; color: var(--muted); }
.ni-b b { font-size: 14px; line-height: 1.32; font-weight: 700; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ni-s { font-size: 12.5px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
body.km .ni-s { line-height: 1.65; }
.ni:hover b { color: var(--red); }
.ni.full { padding: 12px 0; } .ni.full:first-of-type { padding-top: 0; } .ni.full img { width: 84px; height: 84px; }
.ni.full .ni-b b { -webkit-line-clamp: 3; font-size: 15px; } .ni.full .ni-s { -webkit-line-clamp: 3; font-size: 13.5px; }
.ni .tag { font-size: 11px; padding: 0 8px; }
@media (max-width: 1023px) { .d-news .ni:nth-of-type(n+4) { display: none; } }   /* phone: 3 headlines, desktop: 4 */
.wt { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.wt th { padding: 6px 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: right; background: rgba(212, 175, 55, .09); }
.wt th:first-child { text-align: left; border-radius: 8px 0 0 8px; width: 33%; } .wt th:last-child { border-radius: 0 8px 8px 0; width: 25%; } .wt th:nth-child(2) { width: 22%; }
.wt td { padding: 7px 5px; border-top: 1px solid var(--line); text-align: right; vertical-align: middle; }
.wt tr:first-child td { border-top: 0; }
.wt td:first-child { text-align: left; }
.wt td b { display: block; font-size: 13px; line-height: 1.3; } .wt td small { display: block; font-size: 11px; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wt .up, .wt .down { font-weight: 700; }
.wl-n { margin: 8px 2px 0; }
.wq { position: relative; display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 12px 44px 12px 12px; border-radius: 12px; background: linear-gradient(135deg, #FDF4E2, #F8E6C9); border: 1px solid rgba(212, 175, 55, .3); color: #7A4A12; }
.wq .q-ic { color: #D9A33A; } .wq p { margin: 0; font: italic 600 15px/1.45 'Playfair Display', Georgia, serif; }
body.km .wq p { font: 700 13.5px/1.7 var(--font-disp-km); }
.wq-lotus { position: absolute; right: 8px; bottom: 6px; width: 34px; height: 34px; opacity: .85; }
.aa-r { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.aa-r:nth-of-type(odd) { background: rgba(212, 175, 55, .09); }
.aa-r > span:first-child { color: var(--ink-2); }
.schip { padding: 3px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 700; color: #fff; white-space: nowrap; }
.schip.s-in_buy { background: linear-gradient(180deg, #16A862, #0A8F4F); } .schip.s-in_sell { background: linear-gradient(180deg, #E0342F, #B3161B); } .schip.s-mid { background: var(--gold-btn); color: #3B2A00; }
.aa-cf { display: inline-flex; align-items: center; gap: 10px; }
.cbar { display: inline-block; width: 110px; height: 8px; border-radius: 4px; background: rgba(122, 0, 0, .08); overflow: hidden; }
.cbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #16A862, #0A8F4F); }
.cbar.c1 i { width: 33%; } .cbar.c2 i { width: 66%; } .cbar.c3 i { width: 100%; }
.d-qa { display: none; }
.qa-g { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.qa-t { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 14px 6px 12px; border-radius: 12px; border: 1px solid rgba(212, 175, 55, .24);
  background: linear-gradient(180deg, #FFFBF3, #FBF1E2); color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 1.3; text-align: center; cursor: pointer; transition: border-color .15s, transform .12s; }
.qa-t:hover { border-color: var(--gold); } .qa-t:active { transform: translateY(1px); }
.qa-t svg { width: 26px; height: 26px; color: var(--icon); flex: none; }
body.km .qa-t { line-height: 1.6; }
.seg-part { margin-bottom: 14px; }
.page-sub { margin: -8px 4px 14px; }
.news-full, .cal-full { max-width: 860px; }
#sec-est { max-width: 760px; }
.kpis.one { grid-template-columns: minmax(0, 420px); }
.gt-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .gt-h h2 { margin: 0; }
.gt-w { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gt-w b { font-size: 20px; font-weight: 700; color: var(--ink); }
@media (min-width: 600px) and (max-width: 1023px) { .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } .d-chart, .d-tiles, .d-ai { grid-column: 1 / -1; } #chart.chart-home { height: 260px; } }
.aa-cf { min-width: 0; } .cbar { flex: 0 1 auto; min-width: 44px; }   /* the confidence bar shrinks on small phones */
@media (max-width: 400px) { .wt th:first-child { width: 28%; } .wt th:last-child { width: 30%; } .wt .dchip.sm { white-space: normal; text-align: center; } }   /* the gold signal chip fits its column */
@media (max-width: 360px) { .seg-lg button { font-size: 12.5px; padding-left: 2px; padding-right: 2px; } }
@media (max-width: 360px) { .kpi { padding: 10px 9px; } .kh .k-t { font-size: 11.5px; } .k-art { display: none; } .tfs button { min-width: 32px; padding: 4px 5px; } .wt { font-size: 12px; } .wt td small { display: none; } }
@media (prefers-color-scheme: dark) {
  .k-ic { color: var(--gold-hi); background: rgba(212, 175, 55, .1); border-color: rgba(212, 175, 55, .25); }
  .tfs button { background: #2A1412; }
  .wt th { background: rgba(212, 175, 55, .08); }
  .wq { background: linear-gradient(135deg, #2E1712, #3A1F12); color: #F3D98A; border-color: rgba(212, 175, 55, .25); }
  .aa-r:nth-of-type(odd) { background: rgba(212, 175, 55, .06); }
  .qa-t { background: linear-gradient(180deg, #2A1412, #23100E); }
  .ni:hover b { color: var(--gold-hi); }
}

/* zone ladder */
.ladder { position: relative; margin: 4px 0 4px; }
.zone { border-radius: 12px; padding: 10px 12px; margin: 6px 0; display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-variant-numeric: tabular-nums; border-left-width: 4px !important; }
.zone.sell { background: rgba(200, 30, 30, .06); border: 1px solid rgba(200, 30, 30, .2); border-left-color: #C81E1E !important; }
.zone.buy { background: rgba(22, 163, 74, .07); border: 1px solid rgba(22, 163, 74, .22); border-left-color: #16A34A !important; }
.zone b { font-weight: 700; text-align: right; white-space: nowrap; }
@media (max-width: 480px) { .zone { flex-wrap: wrap; row-gap: 2px; } .zone span { flex: 1 1 100%; } .zone b { text-align: left; } }
.now-line { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-weight: 700; color: var(--gold-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.now-line::before, .now-line::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.verdict { border-radius: 14px; padding: 12px 14px; font-weight: 700; margin-top: 8px; border: 1px solid transparent; }
.verdict.in_buy { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .22); color: var(--up); }
.verdict.in_sell { background: rgba(200, 30, 30, .07); border-color: rgba(200, 30, 30, .2); color: var(--down); }
.verdict.mid { background: rgba(212, 175, 55, .14); border-color: rgba(212, 175, 55, .36); color: var(--side); }

.warn-ic { display: grid; flex: none; padding-top: 1px; } .warn-ic svg { width: 20px; height: 20px; color: #D97706; }   /* line icon like the alert strip */
.warn { background: linear-gradient(135deg, #FFF8E8, #FDEBC4); color: #6A3E00; border: 1px solid rgba(245, 158, 11, .5); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600; display: flex; gap: 10px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .warn { background: #33210A; color: #FFD99A; border-color: #6A4A14; } }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item .t { font-weight: 600; font-size: 15px; line-height: 1.4; color: var(--ink); }
.item .s { font-size: 14px; color: var(--muted); margin-top: 4px; }
.item .m { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
.item a:hover .t { color: var(--red); }
@media (prefers-color-scheme: dark) { .item a:hover .t { color: var(--gold-hi); } }
.day-h { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--heading); text-transform: uppercase; letter-spacing: .06em; margin: 16px 4px 8px; }
.day-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-gold), transparent); }
body.km .day-h { text-transform: none; letter-spacing: 0; }
.ev { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ev:first-child { border-top: 0; }
.ev .tm { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--heading); }
.ev .nums { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* buttons & forms */
.btn { display: block; width: 100%; border: 1.5px solid transparent; border-radius: 14px; padding: 13px 16px; font-weight: 700; font-size: 15.5px; line-height: 1.3; cursor: pointer; text-align: center; text-decoration: none; transition: filter .2s ease, transform .12s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold-btn); color: #3B2A00; border-color: rgba(154, 116, 19, .35); box-shadow: 0 6px 16px rgba(154, 116, 19, .22), inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn.red { background: var(--red-grad); color: #FFFFFF; box-shadow: var(--shadow-red), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.red:hover, .btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--red); border-color: var(--red); }
.btn.plain { background: rgba(26, 26, 26, .05); color: var(--ink); border-color: rgba(26, 26, 26, .05); }
.btn.plain:hover { background: rgba(26, 26, 26, .08); }
@media (prefers-color-scheme: dark) { .btn.ghost { color: var(--gold-hi); border-color: var(--gold); } .btn.plain { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .06); } }
.btn:disabled { opacity: .5; cursor: default; filter: grayscale(.2); transform: none; }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 4px 4px; }
.field input { width: 100%; border: 1px solid rgba(122, 0, 0, .14); background: var(--card); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .3); }
@media (prefers-color-scheme: dark) { .field input { border-color: rgba(243, 217, 138, .18); background: #1A0B0B; } }
.err { color: var(--down); font-size: 14px; min-height: 20px; margin: 4px 4px 8px; }

/* ---------- welcome (logged out), auth, loading */
.boot { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.boot img { width: 96px; height: 96px; animation: glow 1.6s ease-in-out infinite alternate; }
.boot b { font: 700 30px 'Playfair Display', Georgia, serif; color: var(--heading); }
@keyframes glow { from { opacity: .7; transform: scale(.97); } to { opacity: 1; transform: none; } }
.welcome { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
.welcome .topbar { padding-bottom: 6px; }
.wel { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wel-art { height: 210px; border-radius: 24px; border: 1px solid var(--line-gold); box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(var(--wb-veil), 0) 55%, rgba(var(--wb-veil), .55) 100%), url(brand/hero-angkor.jpg) 72% 58% / cover no-repeat, url(brand/angkor-sunset.svg) 78% 55% / cover no-repeat, var(--champ); }
.wel-body { text-align: center; max-width: 440px; margin: 0 auto; }
.wel-lotus { display: block; width: 92px; height: 92px; margin: -46px auto 6px; padding: 10px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1.5px rgba(212, 175, 55, .55), var(--shadow-lg); position: relative; }
.wel-name { margin: 0; font: 700 42px/1.1 'Playfair Display', Georgia, serif; color: var(--heading); letter-spacing: -.01em; }
.wel-tag { margin: 6px 0 0; font: 600 11px/1.4 'Inter', sans-serif; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-ink); }
body.km .wel-tag { font: 600 14px/1.5 var(--font-km); letter-spacing: 0; text-transform: none; }
.wel .kh-divider { margin: 10px auto 6px; }
.wel-line { margin: 0; font: 700 17px/1.6 var(--font-disp-km); color: var(--heading); }
.wel-line-en { margin: 0; font-size: 13px; color: var(--muted); font-style: italic; font-family: 'Playfair Display', Georgia, serif; }
.wel-lead { margin: 14px 0 0; font-size: 16px; font-weight: 600; color: var(--ink-2); }
.feats { list-style: none; padding: 6px 14px; margin: 14px 0 0; text-align: left; background: var(--card); border: 1px solid var(--line-gold); border-radius: 18px; box-shadow: var(--shadow); }
.feats li { display: flex; gap: 12px; align-items: center; padding: 10px 0; font-size: 14.5px; border-top: 1px solid var(--line); }
.feats li:first-child { border-top: 0; }
.feats i { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--red); background: rgba(122, 0, 0, .07); border: 1px solid rgba(122, 0, 0, .1); }
.feats i svg { width: 19px; height: 19px; }
@media (prefers-color-scheme: dark) { .feats i { color: var(--gold-hi); background: rgba(212, 175, 55, .1); border-color: rgba(212, 175, 55, .22); } .wel-line { color: #F3D98A; } }
.welcome .actions { margin-top: 18px; display: grid; gap: 10px; }
.welcome .actions .tiny { margin: 2px 0 0; }
.form-wrap { max-width: 440px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 14px) 16px 40px; }
.auth-card { padding: 20px 18px 18px; }
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.auth-brand img { width: 34px; height: 34px; }
.auth-brand b { font: 700 18px 'Playfair Display', Georgia, serif; color: var(--heading); }
.auth-card .title-lg { margin: 6px 0 14px; }
.back { border: 0; background: none; color: var(--red); font-weight: 600; padding: 8px 0; cursor: pointer; font-size: 16px; }
@media (prefers-color-scheme: dark) { .back { color: var(--gold-hi); } }

/* plans */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { border: 1.5px solid rgba(212, 175, 55, .3); border-radius: 16px; padding: 14px; background: linear-gradient(180deg, #FFFCF4, var(--card)); cursor: pointer; text-align: left; position: relative; transition: border-color .15s, transform .12s; }
.plan:hover { border-color: var(--gold); }
.plan.best { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .2), var(--shadow); }
.plan .pm { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.plan .pp { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--heading); }
.plan .pd { font-size: 12px; color: var(--muted); }
.plan .ribbon { position: absolute; top: -10px; right: 10px; background: var(--gold-btn); color: #3B2A00; border: 1px solid rgba(154, 116, 19, .4); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
@media (prefers-color-scheme: dark) { .plan { background: linear-gradient(180deg, #2A1412, var(--card)); } }
.avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #B31A1F, #7A0000 55%, #4A0E0E); box-shadow: inset 0 0 0 1.5px rgba(212, 175, 55, .6), var(--shadow-red); }
.avatar img { width: 32px; height: 32px; }
.lock { text-align: center; padding: 22px 16px; }
.lock .ic { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-hi); background: radial-gradient(circle at 35% 30%, #B31A1F, #7A0000 55%, #4A0E0E); box-shadow: inset 0 0 0 1.5px rgba(212, 175, 55, .6), var(--shadow-red); }
.lock .ic svg { width: 26px; height: 26px; }

.contact .btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.contact .btn svg { width: 18px; height: 18px; flex: none; }
.contact .btn + .btn { margin-top: 8px; }
.sheet .contact { margin: 4px 0 12px; }

/* chart */
#chart { height: 360px; min-height: 260px; border-radius: 14px; overflow: hidden; }

/* shop: prices, profit, AI estimate, calculator, price picture */
.seg-row { display: flex; gap: 8px; margin: 10px 0 12px; }
.seg-row .seg { flex: 1; min-width: 0; }
.num { width: 100%; min-width: 0; border: 1px solid rgba(122, 0, 0, .14); background: var(--card); border-radius: 12px; padding: 11px 12px; font-size: 16px; font-variant-numeric: tabular-nums; text-align: right; outline: none; }
.num:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .3); }
@media (prefers-color-scheme: dark) { .num { border-color: rgba(243, 217, 138, .18); background: #1A0B0B; } }
.inrow { display: flex; gap: 8px; align-items: center; }
.inrow .chip { flex: none; min-width: 48px; font-size: 18px; padding: 8px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid rgba(212, 175, 55, .35); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 700; cursor: pointer; max-width: 100%; }
.chip.on { background: var(--red-grad); border-color: var(--red); color: #fff; box-shadow: var(--shadow-red); }
@media (prefers-color-scheme: dark) { .chip { background: #2A1412; color: var(--ink); } }
.mgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; margin: 2px 0 4px; }
.mgrid .mh { font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; padding: 0 4px; }
.mgrid .mp { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; font-size: 14px; }
.mgrid .mp b { color: var(--heading); }
.ptab { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px; margin: 14px 0 6px; font-variant-numeric: tabular-nums; }
.ptab .cap { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.ptab .ph { font-size: 12px; font-weight: 700; color: var(--gold-ink); text-align: right; padding-bottom: 2px; }
.ptab .pn { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; }
.ptab .pn b { color: var(--heading); }
.ptab .pc { text-align: right; min-width: 0; }
.ptab .pc.full { grid-column: 1 / -1; text-align: left; }
.ptab .pc b { display: block; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.ptab .pc .tiny { display: block; overflow-wrap: anywhere; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 2px 12px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red); flex: none; }
.check small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.st { font-size: 13px; margin: 8px 4px 0; min-height: 18px; }
.st.ok { color: var(--up); font-weight: 600; } .st.err { color: var(--down); font-weight: 600; } .st.muted { color: var(--muted); }
.hint { background: rgba(212, 175, 55, .14); border: 1px solid rgba(212, 175, 55, .3); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 0 0 10px; }
.grid3.g2 { grid-template-columns: 1fr 1fr; }
.stbl { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
.stbl th, .stbl td { padding: 5px 3px; text-align: right; overflow-wrap: anywhere; border-top: 1px solid var(--line); }
.stbl th { color: var(--muted); font-weight: 700; border-top: 0; }
.stbl th:first-child, .stbl td:first-child { text-align: left; width: 24%; }
.stbl tr.grp td { font-weight: 700; color: var(--heading); padding-top: 9px; }
.fxtop { margin-top: 12px; background: linear-gradient(180deg, #FFFCF4, var(--card-2)); border: 1px solid rgba(212, 175, 55, .3); border-radius: 14px; padding: 2px 12px; }
@media (prefers-color-scheme: dark) { .fxtop { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .22); } }
.fxrow { display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(0, 46%); gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); cursor: text; }
.fxrow:first-child { border-top: 0; }
.fxrow .fl { font-size: 22px; line-height: 1; text-align: center; }
.fxrow .fc { min-width: 0; }
.fxrow .fc b { display: block; font-size: 15px; }
.fxrow .fc small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxrow.top { padding: 11px 0; }
.fxrow.top .fl { font-size: 28px; }
.fxrow.top .fc b { font-size: 18px; }
.fxrow.top .num { font-size: 20px; font-weight: 700; padding: 12px; }
.btn.sm { padding: 10px 12px; font-size: 14px; }
.billrow { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 46%); gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.billrow:first-child { border-top: 0; }
.billrow .fl { font-size: 22px; text-align: center; }
.billrow .fc { min-width: 0; }
.billrow .fc b { display: block; font-size: 14px; }
.billrow .fc small { display: block; font-size: 12px; color: var(--muted); }
.linkbtn { border: 0; background: none; padding: 4px 0 0; color: var(--red); font-size: 12px; font-weight: 700; cursor: pointer; text-align: left; }
.sheet-scroll { max-height: 56vh; max-height: max(150px, min(56dvh, calc(100dvh - 310px))); overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px 6px; padding: 0 4px; }
.opt { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-l { font-size: 13px; font-weight: 600; color: var(--muted); }
.postcv { display: block; width: 100%; height: auto; border-radius: 12px; margin: 12px 0; background: #610303; box-shadow: var(--shadow-lg); }
.post-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "o" "c" "b"; }
.post-grid > .po { grid-area: o; } .post-grid > .postcv { grid-area: c; } .post-grid > .pb { grid-area: b; }
.nw { white-space: nowrap; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .wide { grid-column: 1 / -1; }
.btn-row .btn { padding: 12px 8px; font-size: 15px; }
@media (prefers-color-scheme: dark) { .ptab .ph, .stbl tr.grp td, .mgrid .mp b, .ptab .pn b { color: var(--gold-hi); } .linkbtn { color: var(--gold-hi); } }
@media (max-width: 400px) { .opt { grid-template-columns: 1fr; gap: 4px; } .ptab .pc b { font-size: 13px; } }
@media (max-width: 360px) {   /* 320 px phones: big amounts get their own line, riel prices never split inside the number */
  .fxrow.top { grid-template-columns: 30px minmax(0, 1fr); row-gap: 6px; } .fxrow.top .num { grid-column: 1 / -1; }
  .fxrow:not(.top) { grid-template-columns: 30px minmax(0, 1fr) minmax(0, 52%); }
  .stbl { font-size: 11px; } .stbl td { overflow-wrap: normal; } .stbl th:first-child, .stbl td:first-child { width: 19%; }
}

/* ---------- app header (phone: lotus + GoldKH, bell, avatar + plan, menu | desktop: top nav, language, bell, user) */
.hd { position: relative; z-index: 25; display: flex; align-items: center; gap: 6px; max-width: 1180px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 9px) 10px 8px 14px; }
.hd-brand { display: flex; align-items: center; gap: 8px; min-width: 0; border: 0; background: none; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.hd-brand img { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 1px 1px rgba(110, 80, 16, .25)); }
.hd-brand b { display: block; font: 700 21px/1.05 'Playfair Display', 'Noto Serif Khmer', Georgia, serif; color: var(--heading); white-space: nowrap; }
.hd-brand small { display: block; margin-top: 3px; font: 600 8.5px/1.35 'Inter', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); }
body.km .hd-brand small { font: 600 10px/1.45 var(--font-km); letter-spacing: 0; text-transform: none; }
.hd-nav, .hd-title, .hd-lang { display: none; }
.hd-ic { position: relative; flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: none; border-radius: 50%; color: var(--ink-2); cursor: pointer; }
.hd-ic svg { width: 24px; height: 24px; }
.hd-ic:hover { background: rgba(122, 0, 0, .06); }
.hd-menu { color: var(--icon); } .hd-menu svg { width: 26px; height: 26px; }
.hd-bell .badge { position: absolute; top: 7px; right: 8px; width: 10px; height: 10px; padding: 0; border-radius: 50%; background: #E11D2A; border: 1.5px solid var(--bg); }   /* red dot (the count is in the bell's label) */
.hd-user { display: flex; align-items: center; gap: 7px; min-width: 0; border: 0; background: none; padding: 2px 2px 2px 0; color: inherit; text-align: left; cursor: pointer; }
.av { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--gold-btn); color: #5A3A00; font: 700 17px/1 'Playfair Display', 'Noto Serif Khmer', Georgia, serif;
  box-shadow: inset 0 0 0 1.5px rgba(154, 116, 19, .55), 0 2px 6px rgba(154, 116, 19, .25); }
.av.lg { width: 48px; height: 48px; font-size: 21px; box-shadow: inset 0 0 0 2px rgba(255, 236, 190, .7), 0 3px 10px rgba(0, 0, 0, .3); }
.hd-u { min-width: 0; max-width: 96px; }
.hd-u b { display: block; font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-u small { display: block; font-size: 10.5px; line-height: 1.25; color: var(--muted); }
.hd-u .pl-s { display: none; }
@media (max-width: 599px) { .hd-u .pl-f { display: none; } .hd-u .pl-s { display: inline; white-space: nowrap; } }   /* phones: the short plan line ('5 days left') stays on one line */
@media (max-width: 374px) { .hd { padding-left: 10px; gap: 2px; } .hd-u { display: none; } .hd-brand b { font-size: 19px; } }
@media (max-width: 330px) { .hd-brand small { display: none; } }
@media (prefers-color-scheme: dark) { .hd-ic { color: var(--ink-2); } .hd-ic:hover { background: rgba(255, 255, 255, .06); } }

/* bell: upcoming high-impact news (no push notifications) */
.bell-wrap { position: relative; flex: none; }
.bell-dd { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 62px); z-index: 30; max-height: 70vh; overflow-y: auto; padding: 12px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line-gold); box-shadow: var(--shadow-lg); animation: up .18s ease-out; }
.bell-dd[hidden] { display: none; }
.bell-h { font-weight: 700; font-size: 14px; color: var(--heading); margin: 0 2px 6px; }
.bell-l { list-style: none; margin: 0; padding: 0; }
.bell-l li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 8px 2px; border-top: 1px solid var(--line); font-size: 13.5px; }
.bell-l li:first-child { border-top: 0; }
.bl-tm { font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.bl-t small { display: block; color: var(--muted); font-size: 12px; }
.bell-none { margin: 4px 2px 8px; color: var(--muted); font-size: 13.5px; }
.bell-go { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 8px; border: 1px solid var(--line-gold); background: rgba(212, 175, 55, .1); border-radius: 10px; padding: 9px; font-weight: 700; font-size: 13.5px; color: var(--red); cursor: pointer; }
.bell-go svg { width: 17px; height: 17px; }
@media (prefers-color-scheme: dark) { .bell-go { color: var(--gold-hi); } }

/* slim warning strip under the header: US high-impact news within 24 h */
.alert-strip { display: flex; align-items: center; gap: 9px; width: calc(100% - 32px); max-width: 1148px; margin: 0 auto 10px; padding: 8px 10px 8px 12px; border-radius: 12px; cursor: pointer; text-align: left;
  border: 1px solid rgba(245, 158, 11, .5); background: linear-gradient(135deg, #FFF8E8, #FDEBC4); color: #6A3E00; font-size: 12.5px; line-height: 1.4; box-shadow: 0 2px 8px rgba(160, 90, 0, .08); }
.alert-strip > i { flex: none; display: grid; } .alert-strip > i svg { width: 18px; height: 18px; color: #D97706; }
.alert-strip > span { flex: 1; min-width: 0; }
.alert-strip .as-e { font-weight: 500; white-space: nowrap; }
.alert-strip > svg { width: 16px; height: 16px; flex: none; color: #B45309; }
@media (prefers-color-scheme: dark) { .alert-strip { background: #33210A; color: #FFD99A; border-color: #6A4A14; } .alert-strip > svg { color: #FFD99A; } }

/* ---------- phone bottom bar: 5 tabs, line icons, royal-red active (Home house filled) */
.bt { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 2px env(safe-area-inset-bottom);
  background: rgba(255, 253, 249, .95); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border-top: 1px solid var(--line-gold); box-shadow: 0 -8px 24px rgba(74, 14, 14, .06); }
.bt button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 0 4px; border: 0; background: none;
  font-size: 11px; font-weight: 600; line-height: 1.25; color: #7C746C; cursor: pointer; }
.bt i { display: grid; place-items: center; height: 28px; }
.bt svg { width: 25px; height: 25px; stroke-width: 1.6; }
.bt span { max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt button.on { color: var(--icon); }
.bt button.on svg { stroke-width: 1.9; }
.bt button.on .f { fill: currentColor; }
body.km .bt button { line-height: 1.75; font-size: 10.5px; }
@media (max-width: 340px) { .bt button { font-size: 10px; } .bt svg { width: 23px; height: 23px; } }
@media (prefers-color-scheme: dark) { .bt { background: rgba(26, 11, 11, .93); } .bt button { color: var(--muted); } }

/* ---------- phone drawer (menu button): every section, language, install, log out */
.drawer { position: fixed; inset: 0; z-index: 45; }
.drawer[hidden] { display: none; }
.dr-bg { position: absolute; inset: 0; background: rgba(26, 6, 4, .46); opacity: 0; transition: opacity .2s ease; }
.dr-p { position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); display: flex; flex-direction: column; background: var(--card); box-shadow: -14px 0 40px rgba(0, 0, 0, .25);
  transform: translateX(100%); transition: transform .22s ease-out; }
.drawer.open .dr-bg { opacity: 1; } .drawer.open .dr-p { transform: none; }
.dr-top { display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top) + 16px) 10px 16px 16px; color: #FFF3DD;
  background: linear-gradient(180deg, rgba(142, 10, 14, .5), rgba(74, 14, 14, .5)), linear-gradient(160deg, #B5121B, #610303); }
.dr-u { min-width: 0; flex: 1; } .dr-u b { display: block; font-size: 16px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dr-u small { display: block; font-size: 12px; color: rgba(255, 236, 200, .88); }
.dr-x { color: #FFF3DD; } .dr-x:hover { background: rgba(255, 255, 255, .1); }
.dr-s { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 10px calc(env(safe-area-inset-bottom) + 18px); }
.dr-g { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.dr-gh { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); }
body.km .dr-gh { letter-spacing: 0; text-transform: none; font-size: 12.5px; }
.dr-i { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
.dr-i:hover { background: rgba(122, 0, 0, .05); }
.dr-i i { display: grid; flex: none; } .dr-i i svg { width: 21px; height: 21px; color: var(--icon); }
.dr-i b { color: var(--red); }
body.noscroll { overflow: hidden; }
@media (prefers-color-scheme: dark) { .dr-i:hover { background: rgba(255, 255, 255, .05); } .dr-i b { color: var(--gold-hi); } }

/* ---------- desktop side bar (hidden on phones) */
.side { display: none; }
.sa-en { margin: 0; font: 600 13px/1.5 'Playfair Display', Georgia, serif; letter-spacing: .14em; text-transform: uppercase; color: #F3D98A; text-shadow: 0 1px 4px rgba(40, 0, 0, .7); }
.sa-km { margin: 6px 0 0; font: 700 12px/1.65 'Noto Serif Khmer', serif; color: rgba(247, 231, 161, .92); text-shadow: 0 1px 4px rgba(40, 0, 0, .7); text-wrap: balance; }

/* sheet (checkout, bill rates, iPhone install how-to) */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(26, 6, 4, .48); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet .panel { background: var(--card); width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 18px 20px calc(env(safe-area-inset-bottom) + 22px); box-shadow: 0 -10px 40px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(212, 175, 55, .55); animation: up .28s ease-out; }
.sheet .panel { max-height: 100vh; max-height: 100dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }   /* tall sheets scroll, never go off the top */
.sheet .panel h2 { font: 700 20px/1.3 var(--font-disp); color: var(--heading); display: flex; gap: 8px; align-items: center; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: rgba(212, 175, 55, .45); margin: 0 auto 14px; }
.qr { display: block; width: 240px; height: 240px; margin: 10px auto; border-radius: 14px; background: #fff; padding: 8px; box-shadow: 0 0 0 1.5px rgba(212, 175, 55, .5); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(212, 175, 55, .25); border-top-color: var(--red); margin: 20px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { text-align: center; }
.count { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--heading); }
.paid-lotus { display: block; width: 72px; height: 72px; margin: 4px auto 6px; }
.skel { height: 14px; border-radius: 7px; background: linear-gradient(90deg, rgba(212, 175, 55, .16), rgba(212, 175, 55, .04), rgba(212, 175, 55, .16)); background-size: 200% 100%; animation: sh 1.2s infinite; margin: 8px 0; }
@keyframes sh { to { background-position: -200% 0; } }
.lanes { display: flex; flex-wrap: wrap; gap: 6px; }
.lane { border-radius: 10px; padding: 4px 10px; font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.lane.LONG { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .24); color: var(--up); }
.lane.SHORT { background: rgba(200, 30, 30, .08); border-color: rgba(200, 30, 30, .2); color: var(--down); }
.foot { text-align: center; font-size: 12px; color: var(--muted); margin: 18px 10px 0; }
@media (max-width: 420px) { .cell { padding: 9px 8px 8px; } .cell .v { font-size: 15.5px; letter-spacing: -.02em; } .cell .k { font-size: 11.5px; } }
@media (max-width: 380px) { .grid3 { grid-template-columns: 1fr 1fr; } .cell .v { font-size: 17px; } }
@media (max-width: 340px) { .tiles { gap: 6px; } .tile { font-size: 12px; } }

/* ---------- wider screens */
@media (min-width: 760px) {
  .wel-art { height: 280px; }
}
@media (min-width: 1024px) {
  :root { --side-w: 208px; }   /* mockup 3 proportions */
  .wel { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 44px; align-items: center; padding: 0 28px; }
  .wel-art { height: min(660px, calc(100vh - 110px)); min-height: 480px; background-position: 0 0, 74% 50%, 78% 50%, 0 0; }
  .wel-lotus { margin-top: 0; width: 84px; height: 84px; }
  .feats li { padding: 8px 0; }
  .topbar { padding: 18px 28px 6px; }
  .shell { margin-left: var(--side-w); }
  main { max-width: 1200px; padding: 4px 24px 40px; }
  main.narrow { max-width: 860px; }
  .bt, .hero, .d-tiles, .wq, .inst { display: none; }
  .tg2 { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
  /* top bar: nav links (or the page title), language, bell, user */
  .hd { max-width: 1200px; margin: 0 auto; padding: 14px 24px 12px; gap: 10px; }
  .hd-brand, .hd-menu { display: none; }
  .hd-title { display: block; margin: 0 0 0 4px; font: 700 24px/1.2 var(--font-disp); color: var(--heading); }
  body.km .hd-title { font-size: 20px; line-height: 1.6; }
  .hd-lang { display: block; }
  .hd-user { padding: 3px 10px 3px 3px; border-radius: 999px; }
  .hd-user:hover { background: rgba(122, 0, 0, .05); }
  .hd-u { max-width: 170px; } .hd-u b { font-size: 14.5px; } .hd-u small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bell-dd { position: absolute; left: auto; right: -8px; top: calc(100% + 8px); width: 340px; }
  .alert-strip { width: calc(100% - 48px); max-width: 1152px; margin: 0 auto 12px; font-size: 13px; }
  /* home: welcome banner, 5 KPI cards (3 + 2 below 1280 px), chart + news, AI analysis + watchlist + quick actions */
  .wb { display: block; position: relative; overflow: hidden; height: 176px; margin-bottom: 14px; border-radius: 18px; border: 1px solid var(--line-gold); box-shadow: var(--shadow);
    background: linear-gradient(90deg, #FDF6EA 0%, #FBF0DE 45%, var(--champ) 100%); }   /* plain champagne, no lattice (Alex) */
  .wb::before { content: ""; position: absolute; z-index: 0; top: 0; bottom: 0; left: 28%; right: 30%; background: url(brand/hero-angkor.jpg) 50% 44% / cover no-repeat, url(brand/angkor-sunset.svg) 50% 50% / cover no-repeat;
    -webkit-mask: linear-gradient(90deg, transparent 0, #000 24%, #000 84%, transparent 100%); mask: linear-gradient(90deg, transparent 0, #000 24%, #000 84%, transparent 100%); }
  .wb-txt { position: relative; z-index: 2; max-width: 44%; padding: 22px 28px; }
  body.km .wb-when .wb-d { max-width: 130px; }   /* the longer Khmer date wraps (weekday + day / month + year), never over the photo or the silk */
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
  .k-gold, .k-ol, .k-rg { grid-column: span 2; } .kpis.one { grid-template-columns: minmax(0, 420px); } .kpis.one > .kpi { grid-column: auto; } .k-tr, .k-q { grid-column: span 3; }
  .k-rg, .k-tr, .k-q { display: block; }
  .kpi { padding: 14px 16px 13px; }
  .kh .k-t { font-size: 13.5px; }
  .k-gold .k-big { color: var(--heading); font-size: 30px; }
  .k-ol-s { grid-template-columns: minmax(0, 1fr); gap: 7px; } .k-ol-s > div, .k-ol-s > div + div, .k-ol-s > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; border: 0; padding: 0; }
  .k-ol-s .v { font-size: 15px; } .k-ol-s .meter { flex-basis: 100%; max-width: none; margin-top: 2px; }
  .k-ol .k-chip { font-size: 15px; padding: 6px 14px 6px 11px; margin-top: 6px; } .k-ol .k-chip svg { width: 17px; height: 17px; }
  .dash { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
  .d-chart { grid-column: span 8; order: 1; } .d-news { grid-column: span 4; order: 2; }
  .d-ai { grid-column: span 4; order: 3; } .d-watch { grid-column: span 4; order: 4; } .d-qa { display: block; grid-column: span 4; order: 5; }
  .cc { padding: 14px 14px 10px 16px; }
  .d-chart { display: flex; flex-direction: column; } #chart.chart-home { height: auto; flex: 1 1 268px; min-height: 268px; }   /* the chart fills its card (row height = the news card) */
  .d-news .ni { padding: 8px 0; } .d-news .ni:first-of-type { padding-top: 0; }
  .post-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-areas: "o c" "b c"; grid-template-rows: auto 1fr; gap: 0 22px; align-items: start; }
  .post-grid .postcv { margin-top: 0; }
  .seg-part { max-width: 680px; }
  /* the desktop side bar (mockup 3): clean royal-red gradient (no pattern, no scrollbar), the logo in its own darker block whose rounded
     bottom-right corner curves into the page (the notch), the active item a raised red pill that reaches the bar's right edge and meets the
     page with the same concave curve, a thin gold kbach rail down the right edge, the Apsara framed by gold kbach corners at the bottom */
  .side { --pg: #FCF4E6; --rail: 11px; --nr: 18px; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; width: var(--side-w); display: flex; flex-direction: column;
    overflow: hidden auto; scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain;
    background: linear-gradient(180deg, #8C0A10 0%, #7A0000 36%, #620606 72%, #4A0E0E 100%); box-shadow: 6px 0 26px rgba(74, 14, 14, .18); }
  .side::-webkit-scrollbar { width: 0; height: 0; display: none; }
  .side-rail { position: fixed; top: 0; bottom: 0; left: calc(var(--side-w) - var(--rail)); width: var(--rail); z-index: 2; pointer-events: none;
    background: linear-gradient(180deg, #F7E7A1, #D4AF37 34%, #B8892A 68%, #F0D57E) right top / 2.5px 100% no-repeat,
      linear-gradient(rgba(243, 217, 138, .5), rgba(243, 217, 138, .5)) 1px 0 / 1px 100% no-repeat,
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='26' viewBox='0 0 10 26'%3E%3Cg fill='none' stroke='%23E9C766' stroke-width='.9' stroke-linejoin='round'%3E%3Cpath d='M5 2.5c1.7 2.6 2.4 4.8 0 8.5-2.4-3.7-1.7-5.9 0-8.5z'/%3E%3Cpath d='M5 15.4l2.1 2.8L5 21l-2.1-2.8z'/%3E%3C/g%3E%3Ccircle cx='5' cy='13.2' r='.9' fill='%23E9C766'/%3E%3Ccircle cx='5' cy='23.6' r='.8' fill='%23E9C766'/%3E%3C/svg%3E") 0 0 / 10px 26px repeat-y; }
  .side-brand { position: relative; z-index: 3; flex: none; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 14px 20px;
    background: linear-gradient(180deg, #600808 0%, #4A0E0E 100%); border-radius: 0 0 14px var(--nr); box-shadow: 0 8px 16px -6px rgba(30, 0, 0, .45); }
  .side-brand::after { content: ""; position: absolute; right: 0; bottom: 0; width: var(--nr); height: var(--nr); pointer-events: none;   /* the notch: the page curves into the corner */
    background: radial-gradient(circle at 0 0, transparent calc(var(--nr) - 1.2px), #E9C766 calc(var(--nr) - .9px), #E9C766 var(--nr), var(--pg) calc(var(--nr) + .6px)); }
  .side-brand img { width: 64px; height: 64px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .35)); }
  .side-brand b { margin-top: 6px; font: 700 28px/1.1 'Playfair Display', Georgia, serif; letter-spacing: .01em; color: transparent; background: var(--gold-text); -webkit-background-clip: text; background-clip: text; }
  .side-km { margin-top: 2px; font: 700 15px/1.5 'Noto Serif Khmer', serif; color: #F3D98A; }
  .side-brand small { margin-top: 6px; font: 600 8.4px/1.55 'Playfair Display', Georgia, serif; letter-spacing: .14em; text-transform: uppercase; color: rgba(247, 231, 161, .9); }
  .side-brand .tg { display: block; white-space: nowrap; }
  body.km .side-brand small { font: 600 11.5px/1.55 var(--font-km); letter-spacing: 0; text-transform: none; }
  .side-nav { position: relative; z-index: 3; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 16px calc(var(--rail) + 2px) 4px 10px; }
  .side-nav button { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid transparent; border-radius: 12px; background: none; color: #FFEFD6;
    font: 600 13.5px/1.3 var(--font); text-align: left; cursor: pointer; }
  body.km .side-nav button { font-size: 14px; line-height: 1.6; padding: 8px 14px; }
  .side-nav button:hover { background: rgba(255, 255, 255, .08); }
  .side-nav i { display: grid; flex: none; } .side-nav i svg { width: 21px; height: 21px; color: #F3D98A; }
  .side-nav button.on { margin-right: calc(-2px - var(--rail)); color: #fff; background: linear-gradient(180deg, #B5121B 0%, #9A0B12 55%, #7A0000 100%);
    border-color: rgba(247, 222, 160, .85); box-shadow: inset 0 1px 0 rgba(255, 220, 190, .35), 0 6px 14px rgba(30, 0, 0, .35); }
  .side-nav button.on::before { content: ""; position: absolute; z-index: -1; right: -1px; top: calc(-1px - 12px); bottom: calc(-1px - 12px); width: 18px; pointer-events: none;   /* the page meets the pill */
    background: radial-gradient(circle at 0 0, transparent 11px, #E9C766 11.3px, #E9C766 12.2px, var(--pg) 12.8px) right top / 12px 12px no-repeat,
      radial-gradient(circle at 0 100%, transparent 11px, #E9C766 11.3px, #E9C766 12.2px, var(--pg) 12.8px) right bottom / 12px 12px no-repeat,
      linear-gradient(var(--pg), var(--pg)) right center / 12px calc(100% - 24px) no-repeat; }
  .side-nav button.on i svg { color: #FFF3D0; }
  .side-art { position: relative; flex: 1 0 250px; margin: 14px var(--rail) 0 0; padding-bottom: 6px;
    background: url(brand/apsara.png) center top 10px / auto calc(100% - 64px) no-repeat, radial-gradient(90% 60% at 60% 45%, rgba(212, 175, 55, .14), rgba(212, 175, 55, 0) 70%); }
  .side-art::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 46px; height: 46px; z-index: 2; pointer-events: none; background: url(brand/kbach-corner.svg) 0 0 / 100% 100% no-repeat; transform: scale(-1, -1); }   /* one gold kbach corner flourish, in the quote card's bottom-RIGHT corner (mirrored to point into it), below the text (Alex, batch 4) */
  .side-art-t { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 48px 20px 50px; border-bottom: 1.5px solid rgba(233, 199, 102, .8);
    background: linear-gradient(0deg, rgba(60, 6, 6, .94) 0%, rgba(66, 8, 8, .8) 55%, rgba(66, 8, 8, 0) 100%); }
  /* Quick Actions: 6 equal tiles that fill the card, icons level per row */
  .d-qa { display: flex; flex-direction: column; } .d-qa .qa-g { flex: 1; grid-auto-rows: 1fr; }
  .qa-t span { min-height: 2.7em; display: flex; align-items: center; justify-content: center; text-align: center; }
}
@media (min-width: 1024px) and (max-height: 840px) {   /* 720-840 px tall laptops: the Apsara shrinks, the quote stays whole */
  .side-art { flex: 1 1 150px; min-height: 150px; } .side-art-t { padding: 32px 16px 38px; } .side-nav { padding-top: 8px; }
  .side-art::after { width: 34px; height: 34px; right: 3px; bottom: 3px; }
}
@media (min-width: 1240px) {   /* banner with the red silk: the temple sits between the name and the silk, silk text on 2 lines */
  .wb::before { left: 27%; right: 31%; }
  .wb-sub { font-size: 14px; }
  .wb-silk { right: 158px; width: 400px; }
}
@media (min-width: 1440px) { .wb-silk { right: 168px; width: 440px; } .wb-silk-t { right: 124px; font-size: 13.5px; } .wb::before { left: 25%; right: 33%; } .wb-sub { font-size: 15.5px; } }
@media (min-width: 1280px) {
  .hd-nav { display: flex; gap: 4px; }
  .hd-title { display: none; }
  .hd-nav button { padding: 8px 14px; border: 0; border-radius: 10px; background: none; color: #B3121A; font: 600 14px/1.3 var(--font); cursor: pointer; white-space: nowrap; }
  body.km .hd-nav button { font-size: 13.5px; line-height: 1.6; padding: 6px 12px; }
  .hd-nav button:hover { background: rgba(179, 18, 26, .06); }
  .hd-nav button.on { color: #fff; background: linear-gradient(180deg, #E3262E, #B3121A); box-shadow: 0 4px 10px rgba(179, 18, 26, .3); }
  .kpis { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.15fr); }
  .kpis > .kpi { grid-column: auto; }
  .kpis.one { grid-template-columns: minmax(0, 420px); }
}
@media (min-width: 1024px) and (max-width: 1239px) {   /* two narrow dashboard columns: price cells keep each amount on one line */
  .tg2 .cell { padding: 9px 8px 8px; } .tg2 .cell .v { font-size: 15.5px; letter-spacing: -.02em; } .tg2 .cell .k { font-size: 11.5px; }
  .wb-silk { right: 140px; width: 290px; } .wb-flame { height: 54%; right: 6px; } .wb-silk-t { right: 84px; bottom: 26px; font-size: 10.5px; letter-spacing: .1em; }   /* a smaller silk */
  body.km .wb-silk-t { font-size: 11px; } .wb-txt { max-width: 42%; } .wb::before { left: 30%; right: 34%; }
  body.km .wb-silk { right: 150px; }   /* room for the longer Khmer date */
  .d-chart { grid-column: span 7; } .d-news { grid-column: span 5; } .d-ai, .d-watch { grid-column: span 6; } .d-qa { grid-column: 1 / -1; }
  .qa-g { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pc-in { grid-template-columns: minmax(0, 1fr); }   /* narrow right column: the unit buttons get the full width */
}
@media (min-width: 1024px) and (prefers-color-scheme: dark) {
  .wb { background: linear-gradient(90deg, #1E0C0B, #2A1210); } .wb-orn { opacity: .1; }
  .side { --pg: #170808; }   /* the notches show the dark page */
  .hd-nav button { color: #F3D98A; } .hd-user:hover { background: rgba(255, 255, 255, .05); }
}
/* ---------- Jewelry tab (Prices | Estimate | Post | Calculator) + Account tab (profile, plan, the shop settings moved here).
   Same language as the dashboard: .ch card heads with a red line icon, champagne table heads, gold / red segs. */
.ch .tag { flex: none; font-size: 11.5px; padding: 1px 9px; }
.ch > .seg { flex: none; }
.ch > .seg button { flex: none; padding: 6px 14px; }
.ch-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; flex: none; margin-left: auto; padding: 8px 14px; border-radius: 11px; font-size: 13.5px; line-height: 1.3; }
.ch-btn svg { width: 16px; height: 16px; flex: none; }
.my .ch h2 { flex: 0 1 auto; }   /* the Auto / Manual tag sits next to the title */
.gold-today .ch { margin-bottom: 6px; }
.jw-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 14px; align-items: start; }
.jw-one, #sec-est.jw-one { max-width: 860px; }
.my-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 10px; }
.my-bar .seg { flex: none; } .my-bar .seg button { flex: none; padding: 5px 14px; font-size: 12.5px; }
.my-bar .tiny { flex: 1 1 140px; min-width: 0; }
.my-n { margin: 8px 2px 0; }
.my .st { margin-top: 6px; }

/* clean price table: purity · buy in · sell out · profit (Account > Price settings adds the other currency, world price and % vs world) */
.pt { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.pt th { padding: 7px 6px; font-size: 11.5px; font-weight: 600; line-height: 1.35; color: var(--muted); text-align: right; background: rgba(212, 175, 55, .1); }
.pt th:first-child { width: 21%; text-align: left; border-radius: 8px 0 0 8px; } .pt th:last-child { border-radius: 0 8px 8px 0; }
.pt td { padding: 9px 6px; border-top: 1px solid var(--line); text-align: right; vertical-align: top; }
.pt tr:first-child td { border-top: 0; }
.pt td:first-child { text-align: left; }
.pt td b { display: block; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.pt td:first-child b { color: var(--heading); }
.pt td small { display: block; margin-top: 1px; font-size: 11.5px; line-height: 1.35; color: var(--muted); white-space: nowrap; }
.pt .pt-pf b { color: var(--up); }
.pt td.pt-none { text-align: left; color: var(--muted); font-size: 13px; }
.pt.det td { padding: 8px 5px; }
.pt.det td:first-child small { white-space: normal; }
.est-t th:first-child { width: 29%; }
.est-t td:first-child small { white-space: normal; }
.bs { display: flex !important; align-items: baseline; gap: 5px; } .bs::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.bs.mk { color: var(--up) !important; } .bs.mk::before { background: var(--up); }
body.km .pt th { line-height: 1.6; }

/* compact profit calculator: weight + unit on one row, purity, then striped result rows (like the AI analysis card) */
.pc-in { display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); gap: 8px; align-items: end; margin-bottom: 8px; }
.pc-w { display: block; min-width: 0; } .pc-w span { display: block; margin: 0 4px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pc-w .num { padding: 7px 10px; }
.pc-out { margin-top: 10px; }
.pc-out .aa-r { padding: 7px 10px; }
.pc-v { display: flex; flex-direction: column; align-items: flex-end; text-align: right; min-width: 0; }
.pc-v b { white-space: nowrap; } .pc-v small { font-size: 11.5px; line-height: 1.3; color: var(--muted); white-space: nowrap; }
.pc-pf .pc-v b { color: var(--up); }

/* folded blocks: See shops' prices, Picture options */
.fold { margin-top: 12px; border: 1px solid var(--line-gold); border-radius: 12px; background: rgba(212, 175, 55, .05); }
.fold > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 11px 12px; cursor: pointer; list-style: none; font-weight: 700; font-size: 14px; line-height: 1.4; color: var(--ink-2); border-radius: 12px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fold > summary > svg { width: 18px; height: 18px; flex: none; color: var(--icon); }
.fold > summary > svg:last-child { margin-left: auto; color: var(--muted); transition: transform .15s; }
.fold[open] > summary > svg:last-child { transform: rotate(90deg); }
.fold > summary small { font-size: 12px; font-weight: 500; color: var(--muted); }
.fold-b { padding: 0 12px 12px; }
.fold .po { padding: 2px 12px 6px; }
.fold .stbl { margin-top: 0; }

/* Estimate */
.est-ol { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: -2px 2px 10px; }
.est .reasons { margin-top: 8px; }
.est-act { margin-top: 12px; }
.est-act .tiny { margin: 6px 2px 0; }
.est-few { margin-top: 0; font-size: 13.5px; font-weight: 600; }
.est-foot { margin: 10px 2px 0; }

/* Post: picture, Share / Save / Copy, the options folded away */
.post-sub { margin: -4px 2px 10px; }
.post-grid { grid-template-areas: "h" "c" "b" "o"; }
.post-grid > .po-fold { grid-area: o; } .post-grid > .po-tips { grid-area: h; }
.pb .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pb .btn svg { width: 18px; height: 18px; flex: none; }
.post-empty { padding: 24px 18px; }
.pe-ic { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 6px; border-radius: 50%; color: var(--icon); background: rgba(200, 20, 28, .07); border: 1px solid rgba(200, 20, 28, .14); }
.pe-ic svg { width: 26px; height: 26px; }
.post-empty .btn { max-width: 320px; margin: 4px auto 0; }
.hint .linkbtn { padding: 0; font-size: 13px; }

/* Edit prices sheet */
.sh-t { margin: 0 0 8px; } .sh-t svg { width: 22px; height: 22px; flex: none; color: var(--icon); }
.sh-p { font-size: 14px; margin: 0 0 16px; }
.sheet .my-bar { margin-bottom: 4px; }
.sh-btns { margin-top: 4px; }

/* ---------- Account */
.set-sub { margin: -4px 2px 12px; }
.set-l { margin: 14px 4px 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.set-sub + .set-l { margin-top: 0; }
.set-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.set-auto { margin-top: 14px; }
.set-hint { margin: 14px 0 0; }
.sp-seg { margin-top: 6px; }
.fgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.set-foot { display: flex; flex-direction: column-reverse; gap: 2px; margin-top: 12px; }
.set-foot .st { margin: 4px 4px 0; }
.set-foot .st:empty, #sec-share .st:empty { min-height: 0; margin: 0; }
.acc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0 14px; align-items: stretch; }
.acc-row > .card { display: flex; flex-direction: column; justify-content: center; }
.set .ch { margin-bottom: 8px; }
.set .contact .btn { font-size: 15px; }
.set-out { padding: 10px; }
.out-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.out-btn svg { width: 19px; height: 19px; flex: none; }
.lock-s { width: 48px; height: 48px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-hi); background: radial-gradient(circle at 35% 30%, #B31A1F, #7A0000 55%, #4A0E0E); box-shadow: inset 0 0 0 1.5px rgba(212, 175, 55, .6); }
.lock-s svg { width: 22px; height: 22px; }
/* profile card: the drawer's red silk head, avatar initial, name, email, then the plan status */
.pf { padding: 0; overflow: hidden; }
.pf-top { display: flex; align-items: center; gap: 14px; padding: 18px 16px; color: #FFF3DD;
  background: linear-gradient(180deg, rgba(142, 10, 14, .5), rgba(74, 14, 14, .5)), linear-gradient(160deg, #B5121B, #610303); }
.av.xl { width: 64px; height: 64px; font-size: 28px; box-shadow: inset 0 0 0 2px rgba(255, 236, 190, .75), 0 4px 12px rgba(0, 0, 0, .3); }
.pf-u { min-width: 0; }
.pf-u b { display: block; font: 700 23px/1.2 var(--font-disp); color: #fff; overflow-wrap: anywhere; }
body.km .pf-u b { font-size: 19px; line-height: 1.55; }
.pf-u small { display: block; margin-top: 2px; font-size: 13px; color: rgba(255, 236, 200, .9); overflow-wrap: anywhere; }
.pf-b { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 14px 16px 16px; }
.pf-st { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 14px 6px 12px; font-weight: 700; font-size: 14px; line-height: 1.4; border: 1px solid transparent; }
.pf-st::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; }
.pf-st.trial { background: rgba(212, 175, 55, .16); border-color: rgba(212, 175, 55, .42); color: var(--gold-ink); }
.pf-st.on { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .26); color: var(--up); }
.pf-st.off { background: rgba(200, 30, 30, .08); border-color: rgba(200, 30, 30, .22); color: var(--down); }
/* share switch */
.tgl { position: relative; display: flex; align-items: center; gap: 14px; padding: 2px; cursor: pointer; }
.tgl-t { flex: 1; min-width: 0; font-size: 14px; line-height: 1.45; } .tgl-t b { display: block; font-weight: 600; } .tgl-t small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.tgl input { position: absolute; right: 0; top: 50%; width: 48px; height: 28px; margin: -14px 0 0; opacity: 0; cursor: pointer; }
.tgl-s { position: relative; flex: none; width: 48px; height: 28px; border-radius: 14px; background: rgba(107, 114, 128, .38); transition: background .15s; }
.tgl-s::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.tgl input:checked + .tgl-s { background: var(--red-grad); }
.tgl input:checked + .tgl-s::after { transform: translateX(20px); }
.tgl input:focus-visible + .tgl-s { outline: 2px solid var(--gold); outline-offset: 2px; }
.tgl input:disabled + .tgl-s { opacity: .6; }
/* bill rates editor */
.billrows { background: linear-gradient(180deg, #FFFCF4, var(--card-2)); border: 1px solid rgba(212, 175, 55, .3); border-radius: 14px; padding: 2px 12px; }
.bill-add { margin: 12px 0 6px; }
.bill-add input { width: 100%; }
@media (min-width: 600px) {
  .fgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .fgrid .full { grid-column: 1 / -1; }
  .set-foot { flex-direction: row; align-items: center; justify-content: flex-end; gap: 14px; }
  .set-foot .st { flex: 1; margin: 0; text-align: right; }
  .set-save { width: auto; min-width: 150px; padding: 11px 28px; }
  .set .contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; } .set .contact .btn + .btn { margin-top: 0; }
  .set-out .out-btn { width: auto; min-width: 220px; margin: 0 auto; }
  .est-act .btn { width: auto; min-width: 260px; padding: 12px 28px; }
}
@media (min-width: 760px) { #sec-plans .plans { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  .jw-g { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .post-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); grid-template-areas: "b c" "o c"; grid-template-rows: auto 1fr; gap: 0 22px; }
  .post-grid .po-fold { align-self: start; }
  .post-grid { grid-template-areas: "h c" "b c" "o c"; grid-template-rows: auto auto 1fr; }
  .post-grid:not(:has(.po-tips)) { grid-template-areas: "b c" "o c"; grid-template-rows: auto 1fr; }
}
@media (max-width: 400px) { .pt { font-size: 13px; } .pt th, .pt td { padding-left: 4px; padding-right: 4px; } .pc-in { grid-template-columns: minmax(0, 1fr); } }   /* weight on its own row: 'damlung' never runs into 'gram' */
.pt .rs { font-style: normal; }
@media (max-width: 480px) { .pt td b .rs { display: none; } }   /* phones: 8-digit riel amounts (per damlung) keep their own column */
@media (max-width: 360px) {   /* 320 px: riel amounts stay on one line */
  .pt { font-size: 12px; } .pt td small { font-size: 10.5px; } .pt th { font-size: 10.5px; } .pt th:first-child { width: 19%; }
  .ch-btn { padding: 7px 10px; font-size: 12.5px; }
  .my-bar .seg button { padding: 5px 10px; }
}
@media (prefers-color-scheme: dark) {
  .pt th { background: rgba(212, 175, 55, .08); }
  .pt td:first-child b { color: var(--gold-hi); }
  .fold { background: rgba(212, 175, 55, .04); }
  .billrows { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .22); }
  .tgl-s { background: rgba(255, 255, 255, .18); }
  .pe-ic { color: var(--gold-hi); background: rgba(212, 175, 55, .1); border-color: rgba(212, 175, 55, .25); }
}
/* ---------- purity chips (Gold price today, profit calculator, casting): 4 quick chips, the one picked from More, the own %, More.
   Phones: one row that scrolls sideways (never squeezed); from 600 px the chips wrap. */
.pchips { position: relative; display: flex; gap: 6px; margin: 12px -16px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.pchips::-webkit-scrollbar { display: none; }
.pchips button { flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 7px 13px; border: 1px solid rgba(212, 175, 55, .42); border-radius: 999px; background: var(--card); color: var(--ink-2);
  font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: pointer; box-shadow: 0 1px 2px rgba(74, 14, 14, .05); }
.pchips button:hover { border-color: var(--gold); }
.pchips button.on { background: var(--red-grad); border-color: var(--red); color: #fff; box-shadow: var(--shadow-red); }
.pchips button svg { width: 15px; height: 15px; flex: none; }
.pchips .pk-more { background: linear-gradient(180deg, #FFF8E4, #F6E7C0); border-style: dashed; border-color: rgba(176, 134, 30, .55); color: var(--gold-ink); }
@media (min-width: 600px) { .pchips { flex-wrap: wrap; overflow: visible; margin: 12px 0; padding: 0; } }
/* the purity sheet: the karat list (gold ring, bold karat, % gold), other metals (casting), Other... */
.sheet .kl.sheet-scroll { max-height: min(68dvh, calc(100dvh - 170px)); }
.kl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; padding-bottom: 4px; }
.kl-h { margin: 8px 4px 0; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); }
.kl-h:first-child { margin-top: 0; }
body.km .kl-h { font-size: 13px; letter-spacing: 0; text-transform: none; }
.kl-r { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border: 1px solid rgba(212, 175, 55, .32); border-radius: 14px;
  background: linear-gradient(180deg, #FFFDF8, #FCF5E7); color: var(--ink); text-align: left; cursor: pointer; }
.kl-r:hover { border-color: var(--gold); }
.kl-r.on { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.kl-ring { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 1px 1px rgba(110, 80, 16, .25)); }
.kl-t { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 10px; }
.kl-t b { min-width: 3.3em; font-size: 17px; font-weight: 800; line-height: 1.3; color: var(--heading); font-variant-numeric: tabular-nums; }
.kl-t small { font-size: 13px; line-height: 1.4; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kl-r > svg:last-child { width: 20px; height: 20px; flex: none; color: var(--red); }
.kl-o { margin-top: 8px; padding: 10px 12px 8px; border: 1px dashed rgba(176, 134, 30, .55); border-radius: 14px; background: rgba(212, 175, 55, .06); }
.kl-o.on { border-style: solid; border-color: var(--red); }
.kl-oh { display: flex; align-items: center; gap: 12px; }
.kl-oh .kl-t { display: block; } .kl-oh .kl-t small { display: block; color: var(--muted); }
.kl-oi { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.kl-oi .num { text-align: left; font-weight: 700; }
.kl-oi .btn { width: auto; padding: 10px 22px; }
.kl-pv { min-height: 18px; margin: 6px 4px 0; font-size: 13px; font-weight: 600; color: var(--gold-ink); }
.kl-n { margin: 2px 4px 0; }
.kl-o .st:empty { min-height: 0; margin: 0; }
.sheet .kl + .btn { margin-top: 8px; }
@media (min-width: 480px) { .kl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .kl-h, .kl-o { grid-column: 1 / -1; } }
/* Price by weight, on the Gold price today card */
.wp { margin-top: 14px; padding: 12px; border: 1px solid rgba(212, 175, 55, .3); border-radius: 14px; background: linear-gradient(180deg, #FFFCF4, var(--card-2)); }
.wp-h { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; font-size: 14.5px; color: var(--heading); }
.wp-h svg { width: 20px; height: 20px; flex: none; color: var(--icon); }
.wp-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "w go" "u u"; gap: 8px; align-items: center; }
.wp-w { grid-area: w; min-width: 0; } .wp-in > .seg { grid-area: u; }
.wp-w .num { padding: 9px 12px; font-size: 18px; font-weight: 700; }
.wp-go { grid-area: go; width: auto; padding: 10px 18px; font-size: 14.5px; white-space: nowrap; }
.wp-b { margin-top: 8px; }
.wp-out { margin-top: 10px; }
.wp-out:empty { display: none; }
.wp-res { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.wp-res b { font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.wp-res span { font-size: 16px; font-weight: 700; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.wp-line { margin: 4px 2px 0; font-size: 13.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wp-n { margin: 6px 2px 0; }
.wp-out .st { margin-top: 0; }
@media (min-width: 760px) { .wp-in { grid-template-columns: minmax(120px, 220px) minmax(0, 380px) auto; grid-template-areas: "w u go"; justify-content: start; } .wp-b { max-width: 620px; } }
/* Account > Price settings > Purities I sell */
.purs-sub { margin: -2px 4px 8px; }
.purs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.pck { position: relative; display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 6px 9px; border: 1px solid rgba(212, 175, 55, .32); border-radius: 12px; background: var(--card); cursor: pointer; }
.pck input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--red); cursor: pointer; }
.pck span { min-width: 0; line-height: 1.2; }
.pck b { display: block; font-size: 14px; color: var(--heading); font-variant-numeric: tabular-nums; }
.pck small { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pck:has(input:checked) { border-color: var(--red); background: rgba(122, 0, 0, .045); }
.pck:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Jewelry > Casting */
.cast-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.cf .seg span, .cf .pchips span { display: inline; margin: 0; font: inherit; color: inherit; }
.cast-g .seg button { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 7px 4px; line-height: 1.25; }
.cast-g .seg button small { font-size: 11px; font-weight: 500; opacity: .8; }
.cf .pchips { margin-top: 0; margin-bottom: 0; }
.cf-h { display: block; margin: 5px 4px 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.cast-need { margin: 8px 2px 0; }
.cast-t { margin-top: 6px; }
.cast-t th:first-child { width: 34%; }
.cast-t td:first-child b { white-space: normal; color: var(--ink-2); }
.cast-t tr.ct td { background: rgba(212, 175, 55, .1); } .cast-t tr.ct td b { color: var(--heading); }
.cast-cl { margin-top: 14px; }
.cast-c .aa-r { padding: 7px 10px; } .cast-c .ct .pc-v b { color: var(--heading); }
.cast-why { margin: 6px 2px 0; }
.cast-f { margin-top: 10px; }
.cast-note { margin: 10px 2px 0; font-weight: 600; }
@media (min-width: 600px) { .cast-g { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cast-g .full { grid-column: 1 / -1; } }
/* Jewelry parts (5): the row scrolls sideways when it does not fit (320 px) */
.seg-scroll { position: relative; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll button { flex: 1 0 auto; min-width: max-content; padding-left: 12px; padding-right: 12px; white-space: nowrap; }
.pchips.ovf:not(.end), .seg-scroll.ovf:not(.end) { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }   /* more to the right */
@media (prefers-color-scheme: dark) {
  .pchips button { background: #2A1412; color: var(--ink); }
  .pchips .pk-more { background: rgba(212, 175, 55, .1); border-color: rgba(212, 175, 55, .45); color: var(--gold-hi); }
  .kl-r { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .24); }
  .kl-t b, .pck b { color: var(--gold-hi); } .kl-t small { color: var(--ink-2); } .kl-h, .kl-pv { color: var(--gold-hi); }
  .kl-o { background: rgba(212, 175, 55, .05); }
  .kl-r.on, .kl-o.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); } .kl-r > svg:last-child { color: var(--gold-hi); }
  .wp { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .22); }
  .wp-res span { color: var(--gold-hi); }
  .pck { background: #2A1412; } .pck:has(input:checked) { border-color: var(--gold); background: rgba(212, 175, 55, .12); }
}
/* ---------- GoldKH wordmark bits: the two-line tagline, the Khmer wordmark line (shown only once BRAND_KM is set), the secondary line */
.tg { display: block; }
.hd-brand .tg, .boot .tg { white-space: nowrap; }
.hd-km, .wel-km, .boot-km { display: block; font: 700 12px/1.4 'Noto Serif Khmer', serif; color: var(--gold-ink); }
.wel-km { margin-top: 2px; font-size: 18px; color: var(--heading); } .boot-km { font-size: 16px; }
.wel-sub { margin: 8px 0 0; font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); }
body.km .wel-sub { font-size: 13.5px; letter-spacing: 0; text-transform: none; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Outlook record (Market > Chart): backtest | live side by side, never one number; marks toggle; past calls; Home badge */
.orec .ch { margin-bottom: 8px; }
.orec-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.orec-c { border: 1px solid rgba(212, 175, 55, .3); border-radius: 14px; padding: 11px 12px 10px; background: linear-gradient(180deg, #FFFCF4, var(--card-2)); min-width: 0; }
.orec-h { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.orec-h small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.orec-lt { font-size: 13.5px; color: var(--ink-2); }
.orec-big { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 4px; }
.orec-big b { font: 700 30px/1.1 'Inter', var(--font); letter-spacing: -.02em; color: var(--heading); font-variant-numeric: tabular-nums; }
.orec-big span { display: flex; flex-direction: column; font-size: 13.5px; font-weight: 700; line-height: 1.25; color: var(--ink-2); }
.orec-big small { font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.orec-dirs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.od { display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 9px; border-radius: 9px; font-size: 12.5px; background: rgba(212, 175, 55, .1); border: 1px solid rgba(212, 175, 55, .24); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.od i { font-style: normal; font-size: 10px; } .od-up i { color: var(--up); } .od-down i { color: var(--down); } .od-side i { color: var(--side); }
.od b { font-weight: 700; color: var(--ink); } .od small { font-size: 11px; color: var(--muted); }
.orec-base { margin: 8px 2px 0; font-size: 12.5px; font-weight: 600; color: var(--gold-ink); }
.orec-first { margin: 8px 0 2px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.orec-pend { margin: 4px 2px 0; }
.orec-dir1 { margin: 10px 2px 0; font-size: 13px; font-weight: 700; color: var(--ink); }
.orec-n { margin: 10px 2px 0; line-height: 1.5; }
.orec-retry { width: auto; margin-top: 6px; }
.mkc-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; }
.mkc-bar #tfseg { flex: 1 1 260px; }
.ptgl { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.ptgl input { position: absolute; left: 0; top: 50%; width: 40px; height: 24px; margin: -12px 0 0; opacity: 0; cursor: pointer; }
.ptgl .tgl-s { width: 40px; height: 24px; border-radius: 12px; }
.ptgl .tgl-s::after { width: 18px; height: 18px; }
.ptgl input:checked + .tgl-s { background: var(--red-grad); }
.ptgl input:checked + .tgl-s::after { transform: translateX(16px); }
.ptgl input:focus-visible + .tgl-s { outline: 2px solid var(--gold); outline-offset: 2px; }
.mkc-leg { margin: 8px 2px 0; }
.oht { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.oht th { padding: 6px 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: right; background: rgba(212, 175, 55, .1); }
.oht th:first-child { text-align: left; border-radius: 8px 0 0 8px; width: 24%; } .oht th:last-child { border-radius: 0 8px 8px 0; width: 14%; text-align: center; }
.oht th:nth-child(2) { text-align: left; width: 22%; }
.oht td { padding: 7px 5px; border-top: 1px solid var(--line); text-align: right; vertical-align: middle; }
.oht tr:first-child td { border-top: 0; }
.oht td:first-child, .oht td:nth-child(2) { text-align: left; } .oht td:last-child { text-align: center; }
.oht td:first-child b { display: block; font-size: 13px; white-space: nowrap; }
.oht td:first-child .tag { margin-top: 2px; padding: 0 7px; font-size: 10.5px; }
.oht td.o b { font-weight: 600; } .oht td small { display: block; font-size: 11.5px; color: var(--muted); }
.oht .up, .oht .down { font-weight: 700; }
.oht tr.lv td { background: rgba(10, 143, 79, .05); }
.oht .dchip.sm { white-space: normal; text-align: left; }
.oht .n-o { display: none; }
.ores { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: 14px; }
.ores.hit { color: #fff; background: var(--ok); } .ores.miss { color: #fff; background: var(--err); }
.ores.wait { min-width: 0; height: auto; border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 600; color: var(--muted); background: rgba(107, 114, 128, .12); }
@media (max-width: 599px) {   /* phones: open and close share a cell, the separate close column goes */
  .oht th.c, .oht td.c { display: none; } .oht .n-o { display: block; } .oht .w-o { display: none; }
  .oht th:first-child { width: 25%; } .oht th:nth-child(2) { width: 26%; } .oht th:nth-child(5) { width: 17%; } .oht th:last-child { width: 13%; }
  .oht { font-size: 12px; } .oht th, .oht td { padding-left: 3px; padding-right: 3px; }
  .oht td:first-child .tag { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: clip; padding: 0 5px; font-size: 9.5px; }
  body.km .oht td:first-child .tag { font-size: 8.5px; line-height: 1.7; }
}
@media (min-width: 760px) { .orec-g { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.cc-rec:empty { display: none; }
.cc-rec { margin-top: 8px; }
.orec-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid rgba(212, 175, 55, .45); background: rgba(212, 175, 55, .1); border-radius: 999px;
  padding: 5px 10px 5px 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; text-align: left; }
.orec-badge span { min-width: 0; white-space: normal; line-height: 1.35; overflow-wrap: anywhere; }
.orec-badge svg { width: 16px; height: 16px; flex: none; color: var(--icon); } .orec-badge svg:last-child { width: 13px; height: 13px; color: var(--muted); }
.orec-badge:hover { border-color: var(--gold); }
@media (prefers-color-scheme: dark) {
  .orec-c { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .22); }
  .od { background: rgba(212, 175, 55, .07); } .orec-base { color: var(--gold-hi); } .oht th { background: rgba(212, 175, 55, .08); }
  .orec-badge { color: var(--ink); background: rgba(212, 175, 55, .08); } .ptgl { color: var(--ink); }
}

/* ---- currency list: scrolling box + search drop-down (Alex 2026-10-01, live hotfix) ---- */
.fxsearch { position: relative; margin: 14px 0 6px; }
.fxsug { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--card, #fff); border: 1px solid rgba(212, 175, 55, .45);
  border-radius: 14px; box-shadow: 0 14px 34px rgba(74, 14, 14, .18); max-height: 290px; overflow-y: auto; padding: 4px; }
.fxsug-i { display: grid; grid-template-columns: 28px 52px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; border: 0; background: none;
  text-align: left; padding: 10px; border-radius: 10px; font: inherit; color: inherit; cursor: pointer; min-height: 44px; }
.fxsug-i:hover, .fxsug-i:focus-visible { background: rgba(212, 175, 55, .16); outline: none; }
.fxsug-i .fl { font-size: 20px; text-align: center; }
.fxsug-i small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxsug-none { padding: 14px; text-align: center; color: var(--muted); }
.fxlist { max-height: min(52vh, 430px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid rgba(212, 175, 55, .35); border-radius: 14px;
  padding: 0 12px; background: rgba(255, 255, 255, .35); }
.fxrow.flash { animation: fxflash 1.6s ease; border-radius: 10px; }
@keyframes fxflash { 0%, 45% { background: rgba(212, 175, 55, .24); } 100% { background: transparent; } }
/* ---- brand scrollbars: a thin gold thumb on no track (lists, sheets, page); none on the side bar ---- */
html, body, .fxlist, .fxsug, .sheet, .panel, .drawer, .sheet-scroll, .dr-s, .bell-dd { scrollbar-width: thin; scrollbar-color: rgba(212, 175, 55, .75) transparent; }
@supports not (scrollbar-color: red blue) {
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #F3D27A, #D4AF37 60%, #9A7413); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
}
.side { scrollbar-width: none; -ms-overflow-style: none; }
.side::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ---------- batch 4: log in / sign up (the owner's reference): clean cream page, language top right; a tall rounded Angkor photo card
   on the left, on the right the lotus badge, GoldKH wordmark, gold tagline, divider, Khmer + English line and the form in a white card.
   Phones: the photo is a short banner on top, everything stacks. */
.auth { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
.auth-top { padding-bottom: 8px; }
.auth-top .back { padding: 6px 0; }
.auth-g { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.auth-photo { height: 132px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line-gold); box-shadow: var(--shadow-lg); background: var(--champ) url(brand/angkor-sunset.svg) 70% 55% / cover no-repeat; }
.auth-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 70% 58%; }
.auth-col { max-width: 440px; margin: 0 auto; min-width: 0; }
.auth-hd { text-align: center; }
.auth-badge { position: relative; display: grid; place-items: center; width: 84px; height: 84px; margin: -42px auto 8px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 0 0 1.5px rgba(212, 175, 55, .55), var(--shadow-lg); }
.auth-badge img { width: 60px; height: 60px; }
.auth-name { font: 700 38px/1.1 'Playfair Display', Georgia, serif; color: #7A0000; letter-spacing: -.01em; }
.auth-tag { margin: 6px 0 0; font: 600 10.5px/1.55 'Inter', sans-serif; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-dk); }
body.km .auth-tag { font: 600 13.5px/1.6 var(--font-km); letter-spacing: 0; text-transform: none; }
.auth-div { max-width: 240px; margin: 10px auto 6px; }
.auth-km { margin: 0; font: 700 16.5px/1.75 'Noto Sans Khmer', var(--font-km); color: #8B0000; }
.auth-en { margin: 0; font: italic 400 13.5px/1.5 'Playfair Display', Georgia, serif; color: var(--muted); }
.auth-card { margin: 16px 0 0; padding: 20px 18px 18px; background: #FFFFFF; border: 1px solid rgba(212, 175, 55, .3); border-radius: 18px; box-shadow: var(--shadow); }
.auth-t { margin: 0 0 12px; font: 700 20px/1.3 var(--font-disp); color: var(--ink); }
body.km .auth-t { font-size: 18px; line-height: 1.6; }
.auth-card .err:empty { min-height: 0; margin: 0 4px 8px; }
.auth-alt { margin-top: 10px; }
.auth-note { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.ts-box { margin: 4px 0 8px; min-height: 65px; }
@media (prefers-color-scheme: dark) {
  .auth-card { background: var(--card); border-color: rgba(212, 175, 55, .22); }
  .auth-name { color: #F3D98A; } .auth-km { color: #F3D98A; } .auth-tag { color: var(--gold-ink); }
}
@media (min-width: 760px) {
  .auth-g { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: stretch; padding: 0 24px; }
  .auth-photo { height: auto; min-height: max(480px, min(720px, calc(100vh - 96px))); }   /* as tall as the form column, at least the screen */
  .auth-col { align-self: center; width: 100%; }
  .auth-badge { margin-top: 0; }
}
@media (min-width: 1024px) { .auth-g { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; padding: 0 28px; } .auth-name { font-size: 44px; } }

/* ---------- batch 4 item 8: Telegram sign-in ("or" divider + the widget), forgot password, Account > Log-in details */
.auth-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(212, 175, 55, 0), rgba(212, 175, 55, .6), rgba(212, 175, 55, 0)); }
body.km .auth-or { text-transform: none; letter-spacing: 0; font-size: 13.5px; }
.tg-box { display: flex; justify-content: center; min-height: 44px; }
.tg-box iframe { max-width: 100%; }
.auth-fp { margin: -4px 4px 8px; text-align: right; }
.auth-fp .linkbtn { padding: 2px 0; font-size: 13px; }
.auth-id { text-align: left; margin-top: -6px; }
.auth-id .linkbtn { font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-sub { margin: -6px 2px 14px; font-size: 13.5px; }
#fprf + .auth-fp { margin: 10px 4px 0; }
.fp-sent { margin: -4px 2px 12px; font-size: 13.5px; line-height: 1.5; }
.auth-note a { color: var(--red); font-weight: 600; }
.ph-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 10px; align-items: end; }
.ph-row .field { margin-bottom: 8px; }
.ph-legacy { margin: 4px 4px 0; }
.tg-sec { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); }
.tg-sec .set-sub { margin-top: 0; }
.tg-linked { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; border: 1px solid rgba(10, 143, 79, .25); border-radius: 12px; background: rgba(10, 143, 79, .06); }
.tg-linked b { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; }
.tg-ok { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #fff; flex: none; } .tg-ok svg { width: 15px; height: 15px; }
.tg-unlink { width: auto; padding: 7px 16px; }
.set .contact:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 600px) { .ph-row { grid-template-columns: minmax(0, 1fr) auto; } .ph-row .set-save { margin-bottom: 8px; } }
@media (prefers-color-scheme: dark) { .auth-note a { color: var(--gold-hi); } }

/* ---------- batch 4: Home "Outlook record" card (the /api/outlook_history data the chart record uses) */
.hrec .ch { margin-bottom: 8px; }
.hrec-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.hrec-s { min-width: 0; border: 1px solid rgba(212, 175, 55, .3); border-radius: 14px; padding: 11px 12px 12px; background: linear-gradient(180deg, #FFFCF4, var(--card-2)); }
.hrec-big b { font-size: 40px; }
.hrec-live { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 2px 0; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hrec-l { min-width: 0; }
.hrec-lh { margin: 0 4px 6px; }
.hrec-log { max-height: 252px; overflow-y: auto; overscroll-behavior: contain; contain: paint;   /* contain: without it the hidden rows still stretched the page (1,650 px of empty space at the bottom of Home) */
  border: 1px solid var(--line); border-radius: 12px; scrollbar-width: thin; scrollbar-color: rgba(212, 175, 55, .75) transparent; }
.hlog { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.hlog th { position: sticky; top: 0; z-index: 1; padding: 6px 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: left; background: #FBF1DC; }
.hlog th:first-child { width: 31%; } .hlog th:nth-child(2) { width: 27%; } .hlog th:nth-child(3) { text-align: right; } .hlog th:last-child { width: 58px; text-align: center; }
.hlog td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.hlog tr:first-child td { border-top: 0; }
.hlog td:nth-child(3) { text-align: right; white-space: nowrap; } .hlog td:last-child { text-align: center; }
.hlog td:first-child b { display: block; font-size: 13px; white-space: nowrap; }
.hlog td .tag { padding: 0 6px; font-size: 10px; line-height: 1.5; }
.hlog tr.lv td { background: rgba(10, 143, 79, .05); }
.hlog i { font-style: normal; font-size: 10px; }
.hlog .up, .hlog .down { font-weight: 700; }
.hl-d { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 600; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.hlog .ores { min-width: 22px; height: 22px; font-size: 12.5px; }
.hlog .ores.wait { font-size: 10.5px; padding: 1px 5px; }
body.km .hlog td:first-child b { font-size: 12.5px; }
@media (max-width: 380px) { .hlog th, .hlog td { padding-left: 5px; padding-right: 5px; } .hlog { font-size: 12px; } .hlog th:last-child { width: 46px; } }
@media (min-width: 600px) and (max-width: 1023px) { .d-rec { grid-column: 1 / -1; } }
@media (min-width: 760px) { .hrec-g { grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr); align-items: start; } }
@media (min-width: 1024px) { .d-rec { grid-column: 1 / -1; order: 6; } }
@media (prefers-color-scheme: dark) { .hrec-s { background: linear-gradient(180deg, #2A1412, var(--card-2)); border-color: rgba(212, 175, 55, .22); } .hlog th { background: #2C1513; } .hl-d { color: var(--ink); } }

/* ---------- batch 4: bill rates, a currency the user added has a small remove button (KHR / VND / CNY are fixed) */
.billrow { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 42%) 30px; gap: 8px; }
.bill-dx { width: 30px; height: 30px; }
button.bill-dx { display: grid; place-items: center; padding: 0; border: 1px solid rgba(200, 30, 30, .22); border-radius: 50%; background: var(--card); color: var(--down); cursor: pointer; }
button.bill-dx svg { width: 14px; height: 14px; }
button.bill-dx:hover { border-color: var(--down); background: rgba(200, 30, 30, .06); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- iOS bottom bar (Alex 2026-10-02): no rubber-band bounce that lifts the fixed bar and shows a gap under it; the bar's
   background also reaches far below the screen edge, so a gap can never show content through it while Safari's toolbar animates */
html, body { overscroll-behavior-y: none; }
.bt { transform: translateZ(0); }
.bt::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 300px; background: inherit; pointer-events: none; }
@media (prefers-color-scheme: dark) { .bt::after { background: inherit; } }

/* ---- buy / sell win rate pair (Outlook record, Home + chart) */
.bswin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.bsw { min-width: 0; border-radius: 12px; padding: 8px 10px; border: 1px solid; display: flex; flex-direction: column; gap: 1px; }
.bsw small { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsw b { font-size: 26px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.bsw span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bsw-up { background: rgba(22, 163, 74, .08); border-color: rgba(22, 163, 74, .35); } .bsw-up small, .bsw-up b { color: #15803D; }
.bsw-down { background: rgba(200, 30, 30, .07); border-color: rgba(200, 30, 30, .32); } .bsw-down small, .bsw-down b { color: #B91C1C; }
@media (prefers-color-scheme: dark) { .bsw-up small, .bsw-up b { color: #4ADE80; } .bsw-down small, .bsw-down b { color: #F87171; } .bsw-up { background: rgba(22, 163, 74, .12); } .bsw-down { background: rgba(200, 30, 30, .12); } }

/* ---- fxlist dark (Alex 2026-10-02: the currency list looked grey on the dark theme) - warm dark card + gold edge, like the rest */
@media (prefers-color-scheme: dark) {
  .fxlist { background: linear-gradient(180deg, rgba(42, 20, 16, .92), rgba(28, 12, 10, .92)); border-color: rgba(212, 175, 55, .38); }
  .fxlist .fxrow + .fxrow, .fxlist .fxrow { border-color: rgba(212, 175, 55, .14); }
  .fxsug { background: #241210; border-color: rgba(212, 175, 55, .45); }
}
