:root {
  --bg: #f1f5f9; --card: #ffffff; --text: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --accent: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --card: #111a2e; --text: #e5edf9; --muted: #94a3b8; --line: #1f2b45; --accent: #60a5fa; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
  font-size: 16px; line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px; position: sticky; top: 0; background: var(--bg);
  border-bottom: 1px solid var(--line); z-index: 2;
}
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
main { max-width: 640px; margin: 0 auto; padding: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.badge { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--line); }
.badge.ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.badge.bad { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  flex: 1; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .5; }
input {
  width: 100%; min-height: 48px; padding: 10px 12px; margin: 8px 0; font-size: 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.link { background: none; border: 0; color: var(--accent); font-size: 14px; text-decoration: underline; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.err { color: var(--bad); }
.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; word-break: break-word; }
.events li:last-child { border-bottom: 0; }
.events .lvl { display: inline-block; min-width: 52px; font-size: 12px; font-weight: 700; }
.lvl.WARN { color: var(--warn); } .lvl.ERROR { color: var(--bad); } .lvl.INFO { color: var(--muted); }
.events time { display: block; color: var(--muted); font-size: 12px; }
[hidden] { display: none !important; }
#loginBtn { width: 100%; }
#coins .lvl, #sigs .lvl, #openTrades .lvl, #closedTrades .lvl, #newsList .lvl { min-width: 96px; }

.bar{height:14px;background:#1e293b;border-radius:7px;overflow:hidden;margin:4px 0 10px}
.barfill{height:100%;width:0;background:#22c55e;transition:width .4s}

/* ---- app-style layout: bottom tab bar + trade cards ---- */
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.page { animation: none; }
.sec { margin-top: 16px; }
.row.gap { margin-top: 8px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 4px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tile small { display: block; color: var(--muted); font-size: 12px; }
.tile span { font-size: 20px; font-weight: 700; word-break: break-word; }
.up { color: var(--ok); } .dn { color: var(--bad); }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.tcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tcard .sym { font-size: 16px; font-weight: 700; }
.tcard .pnl { text-align: right; font-size: 20px; font-weight: 700; line-height: 1.1; }
.tcard .pnl small { display: block; font-size: 12px; font-weight: 600; }
.tcard .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tcard .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; margin-top: 8px; font-size: 13px; }
.tcard .grid span { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.tag.lg { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.tag.sh { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  background: none; border: 0; color: var(--muted); min-height: 56px; padding: 6px 0 4px; font-size: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
}
.nav button.on { color: var(--accent); font-weight: 700; }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
