/* 團媽端 PWA 佔位樣式(批2A)。全走 CSS variables;設計定案後只改此段 :root 變數 + 局部微調,不重寫結構。
   無品牌:中性灰階 + 一個中性藍主色。防呆底線照 UI_GUIDE §1(按鈕有底色、輸入白底有框、觸控 48px、金額 tabular、完成態)。 */
:root {
  --pri: #2563a8;          /* 中性藍主色(佔位) */
  --pri-d: #1e4e85;
  --pri-wash: #e8f0f9;
  --money: #14795a;        /* 金額/利潤綠 */
  --money-wash: #e3f3ec;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2530;
  --sub: #5c6773;
  --line: #d9dee4;
  --warn: #8a5a00; --warn-wash: #fbf0d8;
  --bad: #a32d2d; --bad-wash: #f7e6e6;
  --ok: #14795a; --ok-wash: #e3f3ec;
  --radius: 12px;
  --tap: 48px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.4;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden, [hidden] { display: none !important; }

/* ---- topbar ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--pri); color: #fff;
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
.topbar h1 { font-size: 17px; font-weight: 800; margin: 0; flex: 1; }
.topbar .back { background: rgba(255,255,255,.18); border: 0; color: #fff; font-size: 20px;
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }

/* ---- layout ---- */
.wrap { max-width: 560px; margin: 0 auto; padding: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,30,45,.05); }
.card h2 { font-size: 15px; font-weight: 800; margin: 0 0 10px; }
.muted { color: var(--sub); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---- forms(白底有框,48px)---- */
label { display: block; font-size: 13px; font-weight: 700; color: var(--sub); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 11px 12px; font-size: 16px;
  background: #fff; color: var(--ink); border: 2px solid var(--line); border-radius: 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--pri); }
textarea { min-height: 72px; resize: vertical; }

/* ---- buttons(一定有底色)---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); width: 100%; padding: 12px 16px; font-size: 16px; font-weight: 800;
  border: 0; border-radius: 12px; cursor: pointer; margin-top: 12px; }
.btn.pri { background: var(--pri); color: #fff; }
.btn.pri:active { background: var(--pri-d); }
.btn.money { background: var(--money); color: #fff; }
.btn.ghost { background: #fff; color: var(--pri); border: 2px solid var(--pri); }
.btn.bad { background: var(--bad); color: #fff; }
.btn.sm { width: auto; min-height: 40px; padding: 8px 14px; font-size: 14px; margin-top: 0; }
.btn:disabled { opacity: 1; background: #b9c0c8; color: #eef1f4; cursor: default; }
.btn-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-2 .btn { margin-top: 12px; }

/* ---- pills / states ---- */
.pill { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-wash); color: var(--ok); }
.pill.warn { background: var(--warn-wash); color: var(--warn); }
.pill.bad { background: var(--bad-wash); color: var(--bad); }
.pill.mut { background: #eef1f4; color: var(--sub); }
.done { background: var(--ok-wash); color: var(--ok); border-radius: 10px; padding: 10px 12px; font-weight: 800;
  display: flex; align-items: center; gap: 8px; margin-top: 10px; }

/* ---- KPI ---- */
.kpi-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.kpi .n { font-size: 21px; font-weight: 800; color: var(--pri-d); font-variant-numeric: tabular-nums; }
.kpi.money .n { color: var(--money); }
.kpi .l { font-size: 11.5px; color: var(--sub); font-weight: 700; margin-top: 2px; }

/* ---- caja card ---- */
.caja-card { cursor: pointer; }
.caja-card .earn { background: var(--money-wash); color: var(--money); font-weight: 800;
  border-radius: 8px; padding: 6px 10px; display: inline-block; font-size: 13px; }
.caja-card .precio { font-size: 22px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.thumb { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: #eef1f4; border: 1px solid var(--line); }
.item-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-row .c7 { font-weight: 800; font-size: 15px; }

/* ---- coverage bar ---- */
.bar { background: #eef1f4; border-radius: 999px; height: 14px; overflow: hidden; margin: 6px 0; }
.bar > span { display: block; height: 100%; background: var(--pri); }
.bar.money > span { background: var(--money); }

/* ---- bottom nav ---- */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4,1fr); padding-bottom: env(safe-area-inset-bottom); }
.nav button { background: none; border: 0; padding: 8px 4px 10px; font-size: 11px; font-weight: 700; color: var(--sub); cursor: pointer; }
.nav button.on { color: var(--pri); }
.nav button .i { display: block; font-size: 20px; line-height: 1.2; }

/* ---- misc ---- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 26px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li::after { content: ''; position: absolute; left: 11px; top: 15px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t { font-weight: 800; }
.timeline .when { font-size: 12px; color: var(--sub); }
.err-banner { background: var(--bad-wash); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-weight: 700; margin: 10px 0; }
.reintentar { text-align: center; padding: 30px 14px; }
.shot-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.shot-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.count-badge { background: var(--ok-wash); color: var(--ok); font-weight: 800; border-radius: 999px; padding: 2px 10px; font-size: 13px; }
canvas.preview { width: 100%; max-width: 320px; border: 1px solid var(--line); border-radius: 10px; display: block; margin: 10px auto; }
.center { text-align: center; }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
