/* PakGold Global — components (GLOBAL_SPEC_V2.md §1–§2, Phase D0).
   Each block names the PK component it inherits from. Directives enforced here:
   numbers are the hero (tabular-nums, gold accent), sarafa-board density with zebra
   + highlighted convention column, grey zero change, accent-bar section headers,
   pulsing market dots, 44px tap targets, dark mode from tokens. */

* { box-sizing: border-box; }
html { height: 100%; }
html, body.gx-body { overflow-x: clip; }
body.gx-body {
    margin: 0; min-height: 100%;
    background: var(--gx-bg); color: var(--gx-ink);
    font-family: var(--gx-font);
    font-size: var(--gx-fs-base); line-height: var(--gx-lh-base);
    -webkit-font-smoothing: antialiased;
    transition: background .25s, color .25s;
}
b, strong, .gx-hero-price, .gx-bs-price, .gx-board td, .gx-mono { font-variant-numeric: tabular-nums; }
a { color: var(--gx-brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.gx-shell { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- header (PK sidebar brand + nav, horizontal) ---------- */
.gx-header { background: var(--gx-surface); border-bottom: 1px solid var(--gx-border); position: sticky; top: 0; z-index: 40; }
.gx-header-in { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.gx-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--gx-ink); }
.gx-brand img.gx-brand-logo { max-height: 34px; width: auto; }
html[data-theme="dark"] .gx-brand img.gx-brand-logo { background: #fff; border-radius: 8px; padding: 2px 8px; } /* PK dark-logo treatment */
.gx-brand .gx-brand-global {
    font-weight: 800; font-size: .95rem; color: var(--gx-brand);
    background: var(--gx-brand-soft); border: 1px solid var(--gx-brand);
    border-radius: 8px; padding: 2px 8px; letter-spacing: .02em;
}
.gx-nav { display: flex; gap: 4px; margin-inline-start: 8px; }
.gx-nav a {
    color: var(--gx-ink); font-size: .88rem; font-weight: 600;
    padding: 9px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center;
}
.gx-nav a:hover, .gx-nav a.on { background: var(--gx-brand-soft); color: var(--gx-brand); text-decoration: none; }
.gx-head-tools { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.gx-select, .gx-iconbtn {
    border: 1px solid var(--gx-border); background: var(--gx-surface-2); color: var(--gx-ink);
    border-radius: var(--gx-radius-chip); padding: 0 12px; font: inherit; font-size: .85rem; font-weight: 600;
    min-height: 44px; cursor: pointer;
}
.gx-iconbtn { width: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.gx-select:hover, .gx-iconbtn:hover { background: var(--gx-brand-soft); border-color: var(--gx-brand); }

/* ---------- section headers with brand accent bar (§2) ---------- */
.gx-h1 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; margin: 16px 0 4px; }
.gx-answer { color: var(--gx-mut); font-size: .95rem; margin: 0 0 14px; max-width: 860px; }
.gx-answer b { color: var(--gx-ink); }
.gx-h2 {
    display: flex; align-items: center; gap: 8px;
    font-size: .92rem; font-weight: 700; margin: 0;
}
.gx-h2::before {
    content: ""; width: 4px; height: 16px; border-radius: 2px;
    background: linear-gradient(180deg, var(--gx-gold-hi), var(--gx-brand));
}
.gx-crumbs { font-size: .8rem; color: var(--gx-mut); padding-top: 12px; }
.gx-crumbs a { color: var(--gx-mut); }

/* ---------- cards (.v2-card) ---------- */
.gx-card {
    background: var(--gx-surface); border: 1px solid var(--gx-border);
    border-radius: var(--gx-radius-card); box-shadow: var(--gx-shadow);
    padding: var(--gx-pad-card); min-width: 0; margin-bottom: 14px;
    transition: box-shadow .2s;
}
.gx-card:hover { box-shadow: var(--gx-shadow-lift); }
.gx-card-hero {
    background:
        radial-gradient(120% 160% at 100% 0%, var(--gx-gold-soft) 0%, transparent 42%),
        var(--gx-surface);
}
.gx-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.gx-ic {
    width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 800;
}
.gx-ic-gold { background: var(--gx-gold-soft); color: var(--gx-gold); }
.gx-ic-fx { background: var(--gx-brand-soft); color: var(--gx-brand); }
.gx-ic-silver { background: #eef1f5; color: #6b7684; }
html[data-theme="dark"] .gx-ic-silver { background: #232b35; color: #aab6c2; }

/* ---------- hero price (.v2-hero-*) ---------- */
.gx-hero-body { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.gx-hero-main { flex: 1 1 320px; min-width: 0; }
.gx-hero-side { flex: 0 1 250px; min-width: 220px; }
.gx-hero-label { font-size: var(--gx-fs-label); font-weight: 600; color: var(--gx-mut); }
.gx-hero-price {
    font-size: var(--gx-fs-hero); font-weight: var(--gx-fw-price);
    letter-spacing: var(--gx-ls-hero); line-height: 1.1; margin: 4px 0; white-space: nowrap;
    color: var(--gx-gold);
}
.gx-hero-price small { font-size: 1rem; color: var(--gx-mut); font-weight: 600; }
.gx-updown { font-weight: 800; font-size: .95rem; color: var(--gx-mut); } /* neutral grey default: zero is NEVER green */
.gx-updown.up { color: var(--gx-pos); }
.gx-updown.down { color: var(--gx-neg); }
.gx-hero-stat { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin: 2px 0 10px; font-size: .86rem; }
.gx-hero-stat em { font-style: normal; color: var(--gx-mut); margin-inline-end: 3px; }
.gx-asof { font-size: .76rem; color: var(--gx-mut); }
.gx-asof b { color: var(--gx-ink); font-weight: 700; }
.gx-fxline { font-size: .78rem; color: var(--gx-mut); margin-top: 3px; }
.gx-fxline b { color: var(--gx-ink); }

/* sub-price boxes (.v2-bs sell/buy pattern → karat boxes) */
.gx-bs-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 6px 0; }
.gx-bs { border: 1px solid var(--gx-border); border-radius: var(--gx-radius-box); padding: 6px 10px; min-width: 0; background: var(--gx-surface); }
.gx-bs > em { font-style: normal; display: block; font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gx-mut); }
.gx-bs-price { font-size: var(--gx-fs-price); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.gx-bs-price small { font-size: .58rem; opacity: .6; font-weight: 700; }
.gx-bs-hl { border-color: rgba(184, 134, 11, .5); background: var(--gx-gold-soft); }
.gx-bs-hl > em { color: var(--gx-gold); }

/* stale + live badges */
.gx-badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--gx-border); background: var(--gx-surface-2); border-radius: 999px; padding: 2px 9px; font-size: .72rem; font-weight: 700; }
.gx-badge-live { color: var(--gx-pos); border-color: rgba(10,138,77,.4); }
.gx-badge-stale { color: #b5850a; background: var(--gx-gold-soft); border-color: rgba(184,134,11,.4); }
.gx-badge-closed { color: var(--gx-mut); }

/* ---------- market-status strip (§2, every price page) ---------- */
.gx-market-strip {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    border-top: 1px dashed var(--gx-border); margin-top: 10px; padding-top: 9px;
    font-size: .78rem; color: var(--gx-mut);
}
.gx-mdot { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--gx-ink); }
.gx-mdot i { width: 8px; height: 8px; border-radius: 50%; background: var(--gx-mut); opacity: .5; }
.gx-mdot.open i { background: var(--gx-pos); opacity: 1; animation: gxpulse 1.6s infinite; }
@keyframes gxpulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .45; transform: scale(.8);} }

/* ---------- rate board: sarafa density (§2) ---------- */
.gx-boardwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gx-board { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
.gx-board th {
    text-align: end; color: var(--gx-mut); font-size: var(--gx-fs-th);
    text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
    padding: 6px 10px; border-bottom: 2px solid var(--gx-brand);
    background: var(--gx-surface);
}
.gx-board th:first-child { text-align: start; }
.gx-board td { padding: 7px 10px; font-weight: 600; text-align: end; border-bottom: 1px solid var(--gx-border); }
.gx-board td:first-child { text-align: start; font-weight: 700; }
.gx-board tbody tr:nth-child(even) { background: var(--gx-zebra); }
.gx-board .hl { background: var(--gx-gold-soft); color: var(--gx-gold); font-weight: 800; }
.gx-board th.hl { color: var(--gx-gold); border-bottom-color: var(--gx-gold); }
.gx-board-note { font-size: .76rem; color: var(--gx-mut); margin: 8px 0 0; }
@media (max-width: 640px) {
    .gx-board td:first-child, .gx-board th:first-child {
        position: sticky; inset-inline-start: 0; background: var(--gx-surface); z-index: 1;
        box-shadow: 2px 0 4px -2px rgba(0,0,0,.12);
    }
    .gx-board tbody tr:nth-child(even) td:first-child { background: var(--gx-zebra); }
}

/* ---------- chart card ---------- */
.gx-ranges { display: flex; gap: 4px; flex-wrap: wrap; }
.gx-chip {
    border: 1px solid var(--gx-border); background: var(--gx-surface-2); color: var(--gx-ink);
    border-radius: var(--gx-radius-chip); padding: 7px 12px; font-size: .78rem; font-weight: 600; cursor: pointer;
    min-height: 34px;
}
.gx-chip:hover { background: var(--gx-brand-soft); border-color: var(--gx-brand); }
.gx-chip.is-on { background: rgba(240, 195, 80, .25); border-color: rgba(224, 168, 0, .6); font-weight: 800; }
.gx-chart { position: relative; height: 230px; margin-top: 10px; }
.gx-chart svg { width: 100%; height: 100%; display: block; }
.gx-chart .gx-line { fill: none; stroke: var(--gx-gold-hi); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.gx-chart .gx-fill { fill: url(#gxgrad); opacity: .5; }
.gx-chart .gx-grid line { stroke: var(--gx-border); stroke-width: .5; vector-effect: non-scaling-stroke; }
.gx-chart-hll { display: flex; gap: 16px; font-size: .78rem; color: var(--gx-mut); margin-top: 6px; }
.gx-chart-hll b { color: var(--gx-ink); }
.gx-spark { width: 100%; height: 44px; }
.gx-spark polyline { fill: none; stroke: var(--gx-gold-hi); stroke-width: 1.4; vector-effect: non-scaling-stroke; }

/* ---------- FX / remittance ---------- */
.gx-fxgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gx-fxcell { background: var(--gx-surface-2); border: 1px solid var(--gx-border); border-radius: var(--gx-radius-box); padding: 9px 12px; }
.gx-fxcell em { font-style: normal; display: block; font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--gx-mut); }
.gx-fxval { font-size: 1.15rem; font-weight: 800; }
.gx-fxsub { font-size: .74rem; color: var(--gx-mut); margin-top: 2px; }

/* ---------- calculators strip ---------- */
.gx-calcstrip { display: flex; gap: 8px; flex-wrap: wrap; }
.gx-calcstrip a {
    background: var(--gx-surface-2); border: 1px solid var(--gx-border); border-radius: 999px;
    padding: 9px 14px; font-size: .82rem; font-weight: 600; color: var(--gx-ink);
    min-height: 44px; display: inline-flex; align-items: center;
}
.gx-calcstrip a:hover { background: var(--gx-brand-soft); border-color: var(--gx-brand); color: var(--gx-brand); text-decoration: none; }

/* ---------- FAQ accordion / context / history teaser ---------- */
.gx-context { font-size: .9rem; color: var(--gx-mut); }
.gx-context b { color: var(--gx-ink); }
.gx-faq { border-bottom: 1px dashed var(--gx-border); }
.gx-faq:last-child { border-bottom: 0; }
.gx-faq summary { font-weight: 700; font-size: .9rem; cursor: pointer; padding: 11px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.gx-faq summary::after { content: "+"; color: var(--gx-gold); font-weight: 800; font-size: 1.1rem; }
.gx-faq[open] summary::after { content: "–"; }
.gx-faq p { color: var(--gx-mut); font-size: .88rem; margin: 0 0 12px; }
.gx-minitable { width: 100%; border-collapse: collapse; font-size: .84rem; }
.gx-minitable td { padding: 6px 2px; border-top: 1px dashed var(--gx-border); font-weight: 600; }
.gx-minitable td:last-child { text-align: end; }

/* ---------- footer ---------- */
.gx-footer { border-top: 1px solid var(--gx-border); background: var(--gx-surface); margin-top: 26px; padding: 16px 0 28px; color: var(--gx-mut); font-size: .8rem; }
.gx-footer p { max-width: 900px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
    .gx-nav { display: none; }
    .gx-hero-side { flex-basis: 100%; min-width: 0; }
    .gx-chart { height: 190px; }
}
