/* GoldPriceHQ app (web/app.html): a phone-first, dark, one-accent interface. */
:root {
  --bg: #16130f; --bar: #1d1a16; --card: #26221d; --card2: #2f2a24; --ink: #f4efe6; --muted: #a59d90; --line: #3a342c;
  --gold: #e8b45a; --on-gold: #1c1407; --up: #4fcf8e; --down: #f07a6e;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f6f3ee; --bar: #fffdf9; --card: #ffffff; --card2: #f1ece4; --ink: #1d1a16; --muted: #6b6358; --line: #e4ddd2;
    --gold: #a8741c; --on-gold: #fff; --up: #1d7a4b; --down: #c0392b; }
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", system-ui, sans-serif; line-height: 1.6; min-height: 100vh; padding-bottom: calc(76px + var(--safe-b)); }
button, input, select { font: inherit; color: inherit; }
.num, .big, .price, .amt { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bar); padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line); }
.bar h1 { margin: 0; font-size: 1.3rem; }
.bar-side { color: var(--muted); font-size: .85rem; }
main { max-width: 560px; margin: 0 auto; padding: 14px 16px 24px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.fine { color: var(--muted); font-size: .82rem; margin: 14px 2px 0; }

/* prices */
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--up); flex: none; }
.dot.stale { background: var(--down); }
.toggles { display: flex; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; min-height: 48px; }
.chip-ico { width: 26px; height: 26px; border-radius: 50%; background: var(--card2); color: var(--muted); display: grid; place-items: center; font-size: .85rem; }
.chip select { background: transparent; border: 0; font-size: 16px; font-weight: 700; min-height: 40px; max-width: 150px; }
.chip select option { color: #000; }
.rows { list-style: none; margin: 4px 0 0; padding: 0; }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 16px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row .name { color: var(--muted); font-size: .95rem; }
.row .price { font-size: 1.75rem; font-weight: 700; display: block; margin: 2px 0; text-align: start; }
.row .price small { font-size: .95rem; font-weight: 400; color: var(--muted); margin-inline-start: 4px; }
.row .chg { font-size: .9rem; direction: ltr; unicode-bidi: isolate; display: block; text-align: start; }
.up { color: var(--up); } .down { color: var(--down); }
.spark { width: 120px; height: 46px; }
.spark path { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.skel { display: inline-block; height: 1em; width: 6em; border-radius: 6px; background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.install-card { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--gold); border-radius: 14px; padding: 10px 12px; margin: 10px 0; font-size: .9rem; }
.install-card span { flex: 1; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px 20px; border-radius: 14px; border: 0;
  background: var(--gold); color: var(--on-gold); font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.link { background: none; border: 0; color: var(--muted); min-width: 40px; min-height: 40px; cursor: pointer; font-size: 1rem; }

/* calculator */
.result { position: relative; text-align: center; padding: 30px 0 18px; }
.big { background: none; border: 0; color: var(--gold); font-size: 2.6rem; font-weight: 800; cursor: pointer; padding: 4px 12px; border-radius: 12px; }
.big:focus-visible { outline: 2px solid var(--gold); }
.sub { font-size: 1.15rem; }
.menu { position: absolute; z-index: 4; inset-inline: 10%; top: 86px; background: var(--card2); border: 1px solid var(--line); border-radius: 16px; padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.menu button { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 12px 14px; min-height: 48px; border-radius: 10px; cursor: pointer; font-size: 1rem; }
.menu button:hover, .menu button:focus-visible { background: var(--card); }
.weight { display: grid; justify-items: center; gap: 6px; margin: 10px 0 18px; }
.weight input { width: 60%; max-width: 260px; text-align: center; font-size: 1.5rem; font-weight: 700; background: var(--card); border: 1px solid var(--line); border-radius: 16px; min-height: 64px; }
.premium { background: var(--card); border-radius: 16px; padding: 14px 16px; }
.prem-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.prem-head span { flex: 1; }
input[type=range] { width: 100%; accent-color: var(--gold); min-height: 40px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.grid2 > * { min-width: 0; }
.field { display: grid; gap: 6px; text-align: center; }
.box { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-height: 54px; padding: 8px 12px; font-size: 16px; font-weight: 700; text-align: center; }
select.box option { color: #000; }
.shop-in { margin-top: 16px; }

/* my gold */
.summary { background: var(--card); border-radius: 18px; padding: 18px; display: grid; gap: 10px; }
.summary .total { font-size: 2rem; font-weight: 800; text-align: center; }
.summary .pl { text-align: center; font-size: 1rem; }
.kv { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; font-size: .95rem; }
.kv span:first-child { color: var(--muted); }
.breaks { margin: 16px 0 6px; display: grid; gap: 8px; }
.brk { display: grid; grid-template-columns: 70px 1fr 64px; align-items: center; gap: 10px; font-size: .88rem; }
.brk .track { height: 10px; background: var(--card2); border-radius: 6px; overflow: hidden; }
.brk .fill { height: 100%; background: var(--gold); border-radius: 6px; }
.items { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.item { background: var(--card); border-radius: 16px; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; cursor: pointer; border: 1px solid transparent; }
.item:hover, .item:focus-visible { border-color: var(--line); }
.item b { font-size: 1.05rem; }
.item .val { font-size: 1.25rem; font-weight: 800; text-align: end; }
.item .meta { color: var(--muted); font-size: .85rem; }
.item .pl { text-align: end; font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty b { color: var(--ink); font-size: 1.1rem; display: block; margin: 8px 0; }
.empty-ico { font-size: 2.6rem; color: var(--gold); }
.backup { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.fab { position: fixed; z-index: 6; inset-inline-start: max(18px, calc(50% - 262px)); bottom: calc(92px + var(--safe-b)); width: 62px; height: 62px; border-radius: 50%;
  border: 0; background: var(--gold); color: var(--on-gold); font-size: 2rem; cursor: pointer; box-shadow: 0 8px 22px rgba(0,0,0,.35); }

/* dialog */
dialog { width: min(520px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 20px; background: var(--bar); color: var(--ink); padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.55); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; font-size: 1.2rem; }
#item-form > .field { margin-top: 14px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 54px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--gold); color: var(--on-gold); font-size: 1.4rem; cursor: pointer; }
.stepper output { font-size: 1.3rem; font-weight: 700; min-width: 2ch; text-align: center; }
.dlg-actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 20px; }
.dlg-actions .btn:last-child { flex: 1; }

/* news and more */
.news { list-style: none; margin: 0; padding: 0; }
.news a { display: block; padding: 14px 2px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.news b { display: block; font-weight: 600; line-height: 1.55; }
.news .src { color: var(--gold); font-size: .88rem; }
.news .when { color: var(--muted); font-size: .85rem; margin-inline-start: 8px; }
.menu-list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 16px; overflow: hidden; }
.ml { display: flex; align-items: center; width: 100%; min-height: 56px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-decoration: none; text-align: start; cursor: pointer; font-size: 1rem; }
.menu-list li:last-child .ml { border-bottom: 0; }

/* bottom tabs */
.tabs { position: fixed; z-index: 7; inset-inline: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bar); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 10px; min-height: 60px; color: var(--muted); text-decoration: none; font-size: .78rem; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--gold); font-weight: 700; }
.toast { position: fixed; z-index: 9; inset-inline: 16px; bottom: calc(86px + var(--safe-b)); margin: 0 auto; max-width: 420px; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; text-align: center; }

/* alerts and tools */
.bell { padding: 4px 12px; color: var(--gold); text-decoration: none; }
.bell svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.panel { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 16px; }
.h2 { font-size: 1.05rem; margin: 18px 2px 10px; }
.panel .h2 { margin-top: 0; }
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg2 button { min-height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); font-weight: 700; cursor: pointer; }
.seg2 button[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn.wide { width: 100%; margin-top: 12px; }
.big-s { font-size: 2rem; font-weight: 800; color: var(--gold); text-align: center; margin: 12px 0 4px; }
.alert-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; background: var(--card); border-radius: 16px; padding: 12px 14px; }
.alert-item .meta { color: var(--muted); font-size: .85rem; }
.alert-item.done { opacity: .6; }

/* bars and coins list */
.bars { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 16px; overflow: hidden; }
.bar-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 56px; }
.bar-row:last-child { border-bottom: 0; }
.bar-row .meta { color: var(--muted); font-size: .82rem; grid-column: 1; }
.bar-row .amt { grid-row: 1 / span 2; grid-column: 2; font-weight: 800; font-size: 1.1rem; }
.bar-row .amt small { font-weight: 400; color: var(--muted); font-size: .85rem; margin-inline-start: 4px; }
