/* URC Pulse — light, clean, thumb-first. No frameworks, no external fonts. */
:root {
  --bg: #f4f5f6;
  --card: #ffffff;
  --ink: #1c1e21;
  --ink2: #5b6168;
  --ink3: #9aa0a6;
  --line: #e4e6e9;
  --red: #a32d2d;      --red-bg: #fcebeb;   --red-line: #e24b4a;
  --green: #0f6e56;    --green-bg: #e1f5ee; --green-line: #1d9e75;
  --violet: #534ab7;   --violet-bg: #eeedfe;
  --blue: #185fa5;     --blue-bg: #e6f1fb;
  --radius: 14px;
  --nav-h: 58px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); overscroll-behavior-y: none;
}
#app { height: 100%; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; overflow-y: auto; }

/* ── login ── */
#login { display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { width: min(340px, 88vw); background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px 24px; text-align: center; }
.login-icon { width: 52px; height: 52px; margin-bottom: 10px; }
.login-box h1 { font-size: 22px; font-weight: 600; }
.login-sub { font-size: 13px; color: var(--ink2); margin: 4px 0 18px; }
.login-box input[type=text], .login-box input[type=password] {
  width: 100%; padding: 12px 14px; margin-bottom: 10px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.remember { display: flex; gap: 8px; align-items: center; font-size: 13px;
  color: var(--ink2); margin: 2px 0 14px; }
#login-btn { width: 100%; padding: 13px; font-size: 16px; font-weight: 600;
  color: #fff; background: var(--ink); border: 0; border-radius: 10px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; }

/* ── reel ── */
#reel { background: var(--bg); overflow: hidden; touch-action: pan-y; }
#reel-progress { position: absolute; top: calc(env(safe-area-inset-top) + 8px);
  left: 10px; right: 10px; display: flex; gap: 4px; z-index: 5; }
.seg { flex: 1; height: 3px; border-radius: 2px; background: #d6d9dd; overflow: hidden; }
.seg > i { display: block; height: 100%; width: 0; background: var(--ink2); }
.seg.done > i { width: 100%; }
.seg.red > i { background: var(--red-line); } .seg.green > i { background: var(--green-line); }
.seg.violet > i { background: var(--violet); }
.seg.active > i { transition: width linear; }
#reel-head { position: absolute; top: calc(env(safe-area-inset-top) + 18px);
  left: 14px; right: 14px; display: flex; justify-content: space-between; z-index: 5; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink2); }
.pill-green { color: var(--green); background: var(--green-bg); border-color: transparent; font-weight: 600; }
.pill-live { color: var(--green); }
.pill-live.stale { color: var(--ink3); }
#reel-card { position: absolute; inset: calc(env(safe-area-inset-top) + 52px) 14px
  calc(var(--nav-h) + 14px); display: flex; align-items: stretch; }
#reel-tap-prev { position: absolute; left: 0; top: 25%; bottom: 25%; width: 30%; z-index: 4; }
#reel-tap-next { position: absolute; right: 0; top: 25%; bottom: 25%; width: 55%; z-index: 4; }

.card { width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px; display: flex; flex-direction: column;
  overflow-y: auto; }
.card-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 12px;
  border-radius: 999px; margin-bottom: 10px; align-self: flex-start; }
.tag-red { color: var(--red); background: var(--red-bg); }
.tag-green { color: var(--green); background: var(--green-bg); }
.tag-violet { color: var(--violet); background: var(--violet-bg); }
.tag-blue { color: var(--blue); background: var(--blue-bg); }
.badge-new { font-size: 11px; font-weight: 700; color: #fff; background: var(--red-line);
  padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: 2px; }
.card h2 { font-size: 21px; font-weight: 650; line-height: 1.2; }
.card-sub { font-size: 13px; color: var(--ink2); margin: 3px 0 14px; }
.card-metric-label { font-size: 13px; color: var(--ink2); }
.card-metric { font-size: 34px; font-weight: 650; margin: 2px 0 10px; }
.card-metric small { font-size: 16px; font-weight: 400; color: var(--ink2); }
.metric-red { color: var(--red); } .metric-green { color: var(--green); }
.metric-violet { color: var(--violet); }
.card svg.spark { width: 100%; height: 52px; margin: 2px 0 8px; }
.card-story { font-size: 14.5px; line-height: 1.55; margin: 8px 0; }
.card-split { font-size: 12.5px; color: var(--ink2); margin-bottom: 10px; }
.card-claim { font-size: 12.5px; color: var(--blue); background: var(--blue-bg);
  padding: 5px 10px; border-radius: 8px; margin-bottom: 10px; align-self: flex-start; }
.card-cta { margin-top: auto; width: 100%; padding: 13px; font-size: 15px; font-weight: 600;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--ink);
  border-radius: 12px; }

/* ── shared page chrome (detail / feed / search) ── */
.page { padding: calc(env(safe-area-inset-top) + 12px) 14px calc(var(--nav-h) + 20px); }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-btn { font-size: 22px; line-height: 1; background: none; border: 0; color: var(--ink);
  padding: 6px 10px 6px 0; }
.page-head h2 { font-size: 19px; font-weight: 650; flex: 1; }
.section-label { font-size: 12px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink2); margin: 18px 0 8px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink2); font-size: 12px;
  padding: 4px 0; }
table.t th.num, table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td { padding: 6px 0; border-top: 1px solid var(--line); }
tr.hot td { color: var(--red); font-weight: 600; }
.stat-row { display: flex; gap: 8px; margin: 10px 0; }
.stat { flex: 1; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 14px; font-weight: 650; }
.stat span { font-size: 11px; color: var(--ink2); }
.stat b.warn { color: var(--red); }

/* commodity chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; font-size: 13px; padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* notes */
.note { background: var(--bg); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.note-meta { font-size: 11.5px; color: var(--ink3); margin-bottom: 2px; }
.note-body { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.note-input-row { display: flex; gap: 8px; margin-top: 10px; }
.note-input-row input { flex: 1; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.note-input-row button { padding: 11px 16px; font-size: 14px; font-weight: 600;
  background: var(--ink); color: #fff; border: 0; border-radius: 10px; }
.reason-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.reason-chips button { font-size: 12px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink2); }
.claim-btn { width: 100%; margin-top: 12px; padding: 12px; font-size: 14.5px; font-weight: 600;
  border-radius: 10px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); }
.claim-btn.mine { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
.claim-btn.held { border-color: var(--line); color: var(--ink2); }

/* feed / search rows */
.row { display: flex; gap: 10px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.row-ic { font-size: 16px; width: 26px; height: 26px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; flex: 0 0 auto; }
.ic-note { background: var(--blue-bg); color: var(--blue); }
.ic-claim { background: var(--violet-bg); color: var(--violet); }
.ic-save { background: var(--green-bg); color: var(--green); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 600; }
.row-sub { font-size: 12.5px; color: var(--ink2); overflow-wrap: break-word; }
.row-time { font-size: 11px; color: var(--ink3); flex: 0 0 auto; }
#search-input { width: 100%; padding: 12px 14px; font-size: 16px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); }

/* nav */
#nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--card);
  border-top: 1px solid var(--line); z-index: 20; }
.nav-btn { flex: 1; border: 0; background: none; font-size: 11.5px; color: var(--ink3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.nav-btn.active { color: var(--ink); font-weight: 600; }
.nav-ic { font-size: 17px; }

#toast { position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13.5px; padding: 10px 18px;
  border-radius: 999px; z-index: 40; max-width: 86vw; text-align: center; }

@media (min-width: 700px) {
  #reel-card { inset: calc(env(safe-area-inset-top) + 52px) auto calc(var(--nav-h) + 14px);
    left: 50%; transform: translateX(-50%); width: 420px; }
  .page { max-width: 560px; margin: 0 auto; }
}
