/* Mulya — live prices. Light/dark via prefers-color-scheme. */
:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #f0f3f2;
  --text: #13201c;
  --muted: #5d6b66;
  --border: #e2e8e5;
  --brand: #0e7c66;
  --brand-ink: #ffffff;
  --gold: #c9a227;
  --up: #15803d;
  --up-bg: #e7f6ec;
  --down: #c62828;
  --down-bg: #fdecec;
  --flat-bg: #eef1f0;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 4px 16px rgba(16, 24, 20, .05);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
  --font-ne: "Noto Sans Devanagari", "Noto Sans Bengali", "Noto Naskh Arabic", "Mukta", var(--font);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --surface: #141d1a;
    --surface-2: #1b2622;
    --text: #e6eeeb;
    --muted: #93a39d;
    --border: #25322e;
    --brand: #34c3a0;
    --brand-ink: #062a22;
    --up: #4ade80;
    --up-bg: rgba(74, 222, 128, .12);
    --down: #f87171;
    --down-bg: rgba(248, 113, 113, .12);
    --flat-bg: #1f2a27;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); overflow-x: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .2rem 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 18px; padding-bottom: 40px; }
section { margin: 0 0 26px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.ne { font-family: var(--font-ne); color: var(--muted); font-weight: 400; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 14px; min-height: 62px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), #0b5d4d); color: #fff;
  display: grid; place-items: center; font-family: var(--font-ne); font-weight: 600; font-size: 17px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { color: var(--muted); font-family: var(--font-ne); font-size: .75rem; }
.region-toggle { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; max-width: 100%;
  min-width: 0; overflow-x: auto; scrollbar-width: none; }
.region-toggle::-webkit-scrollbar { display: none; }
.region-toggle a { padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: .88rem;
  white-space: nowrap; flex: none; }
@media (max-width: 1100px) { .region-toggle a:not(.active) .rt-name { display: none; } .region-toggle a { padding: 6px 9px; } }
.section-link { color: inherit; }
.pc-flag { font-size: .95em; }
.region-toggle a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.region-toggle a:hover { text-decoration: none; }
.search { flex: 1; min-width: 200px; }
.search input, .filter-input, .report-form input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font: inherit; }
.search input:focus, .filter-input:focus, .report-form input:focus { outline: 2px solid var(--brand); outline-offset: -1px; background: var(--surface); }
.links { display: flex; gap: 14px; font-weight: 500; font-size: .9rem; }
.links a { color: var(--muted); }

/* generic */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 12px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid.cats { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--flat-bg); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.up { background: var(--up-bg); color: var(--up); }
.chip.down { background: var(--down-bg); color: var(--down); }
.chip.lg { font-size: .9rem; padding: 4px 10px; }
.tag { display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .76rem; }
.tag.ev { background: #e0f2fe; color: #0369a1; }
@media (prefers-color-scheme: dark) { .tag.ev { background: rgba(56, 189, 248, .15); color: #7dd3fc; } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9e9e9e; margin-right: 6px; vertical-align: middle; }
.dot.ok, .dot.live { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.dot.partial { background: #f59e0b; }
.dot.failed { background: #ef4444; }
.btn { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.05); }

/* hero */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hero p { margin: 0; max-width: 680px; }
.hero > div { min-width: 0; }
.updated { font-size: .85rem; color: var(--muted); white-space: nowrap; }

/* price cards */
.price-card { position: relative; color: var(--text); overflow: hidden; display: flex; flex-direction: column; gap: 2px; transition: transform .12s ease, box-shadow .12s ease; }
.price-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.price-card:hover { text-decoration: none; transform: translateY(-1px); }
.pc-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pc-emoji { font-size: 1rem; }
.pc-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-price { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 4px; }
.pc-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .8rem; }

/* category cards */
.cat-card { display: flex; gap: 12px; align-items: center; color: var(--text); border-left: 4px solid var(--accent); }
.cat-card:hover { text-decoration: none; background: var(--surface-2); }
.cat-emoji { font-size: 1.8rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; flex: none; }
.cat-body { display: flex; flex-direction: column; min-width: 0; }

/* movers */
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-link { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.row-link:last-child { border-bottom: 0; }
.row-link:hover { text-decoration: none; color: var(--brand); }
.rl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-price { font-variant-numeric: tabular-nums; font-weight: 600; }

.sources-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.source-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .85rem; }
.source-pill .small { margin-left: 4px; }

/* page head */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.page-head { display: flex; gap: 16px; align-items: flex-start; }
.page-head p { margin: .2rem 0; }
.head-emoji { font-size: 2.2rem; width: 58px; height: 58px; flex: none; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }

/* toolbar + tables */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.toolbar .filter-input { max-width: 420px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .82rem; cursor: pointer; }
.chip-btn.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.table th.num, .table td.num { text-align: right; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: " ↕"; opacity: .35; }
.table th.asc::after { content: " ↑"; opacity: 1; }
.table th.desc::after { content: " ↓"; opacity: 1; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: 7px 8px; }
tr.no-price { opacity: .7; }
img.coin { width: 20px; height: 20px; border-radius: 50%; vertical-align: -4px; margin-right: 8px; }
img.coin.lg { width: 48px; height: 48px; margin: 0; }
details.subindices { margin-bottom: 16px; }
details.subindices summary { cursor: pointer; font-weight: 600; }

/* item page */
.item-head { border-top: 4px solid var(--accent); margin-bottom: 18px; }
.ih-main { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.ih-title { display: flex; gap: 14px; align-items: center; }
.ih-title h1 { margin: 0; }
.ih-price { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.ih-price .big { font-size: 2.3rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.chart-card { margin-bottom: 18px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.range-btns { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.range-btns button { border: 0; background: none; color: var(--muted); padding: 5px 10px; border-radius: 8px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.range-btns button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chart-box { position: relative; height: 300px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.two-col section { margin-bottom: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.note { background: var(--surface-2); }
.report-form { display: grid; gap: 10px; }
.report-form label { display: grid; gap: 4px; font-size: .85rem; font-weight: 500; }
.reports { list-style: none; padding: 0; margin: 0; }
.reports li { padding: 7px 0; border-bottom: 1px solid var(--border); }

/* sources page */
.sources-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.source-card header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.source-card .kv { margin: 10px 0; }

/* messages + prose + footer */
.messages { margin-bottom: 14px; display: grid; gap: 8px; }
.msg { padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.msg.success { border-color: var(--up); }
.msg.error { border-color: var(--down); }
.prose { max-width: 780px; }
.prose li { margin: 4px 0; }
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 22px 0; font-size: .88rem; }
.footer-inner { display: grid; gap: 8px; }

@media (max-width: 860px) {
  .two-col, .movers { grid-template-columns: 1fr; }
  .links { display: none; }
  .ih-price { text-align: left; align-items: flex-start; }
}
@media (max-width: 560px) {
  .hide-sm { display: none; }
  h1 { font-size: 1.4rem; }
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table th, .table td { padding: 9px 10px; }
  .search { order: 3; flex-basis: 100%; }
  .region-toggle { order: 4; flex-basis: 100%; }
  .region-toggle a .rt-name { display: inline !important; }
  body { overflow-x: hidden; }
  .ih-price .big { font-size: 1.9rem; }
  .chart-box { height: 240px; }
}
