/* ==========================================================
   PettyTrack v1 — Recorder styles (mobile-first)
   ========================================================== */

:root {
  --bg: #0b1220;
  --bg-2: #111a2e;
  --card: #18233d;
  --border: #233152;
  --text: #e8edf6;
  --muted: #8aa0c2;
  --accent: #4f8cff;
  --accent-2: #6fb3ff;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 14px;
  --tap: 48px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
  line-height: 1.4;
}

a { color: var(--accent-2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red); margin: 8px 0 0; min-height: 1em; }
.hidden { display: none !important; }

/* ---------- boot ---------- */
.boot {
  height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
}
.boot-logo { font-size: 48px; }
.boot-text { color: var(--muted); letter-spacing: 1px; }

/* ---------- layout ---------- */
.app-shell {
  display: flex; flex-direction: column;
  min-height: 100vh;
  max-width: 720px; margin: 0 auto;
  padding-bottom: 72px; /* tabbar space */
}
.page { padding: 16px; }
.page-narrow { max-width: 460px; margin: 0 auto; padding: 24px 16px; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.topbar.sticky {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(11, 18, 32, 0.92);
}
.topbar-title { font-weight: 600; letter-spacing: 0.3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }

/* ---------- tabbar (bottom) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(11, 18, 32, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.tab {
  background: none; border: none; color: var(--muted);
  font-size: 15px; padding: 12px 4px; min-height: var(--tap);
  cursor: pointer;
}
.tab.active { color: var(--accent-2); }

/* ---------- card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px 0;
}
.card h3 { margin: 0 0 12px 0; font-size: 16px; }

/* ---------- form ---------- */
label { display: block; margin: 0 0 12px 0; color: var(--muted); font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
textarea { resize: vertical; }

/* ---------- buttons ---------- */
button {
  font-family: inherit; font-size: 16px;
  border-radius: 10px; cursor: pointer;
  min-height: var(--tap);
}
button.primary {
  display: block; width: 100%;
  background: var(--accent);
  color: #fff; border: none; font-weight: 600;
  padding: 14px; margin-top: 4px;
}
button.primary:active { background: var(--accent-2); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

button.link {
  background: none; border: none; color: var(--accent-2);
  padding: 8px 4px; min-height: 36px;
}

/* ---------- add-photo ---------- */
.add-photo {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 8px 0 4px;
}
.bigbtn {
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  background: var(--bg-2); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 24px 8px; min-height: 96px;
  color: var(--text);
}
#preview { width: 100%; border-radius: 10px; margin: 8px 0; }
.add-photo-info { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.ocr-banner {
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(79, 140, 255, 0.4);
  color: var(--accent-2);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 4px 0 8px;
}

/* ---------- balance ---------- */
.balance-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
}
.balance-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.balance-card.muted { background: var(--bg-2); }
.balance-label { color: var(--muted); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.balance-amount { font-size: 26px; font-weight: 700; margin-top: 6px; }
.balance-amount.small { font-size: 20px; }

/* ---------- recent list ---------- */
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
  gap: 10px;
}
.row .left { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row .left .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .left .sub { color: var(--muted); font-size: 12px; }
.row .right { text-align: right; white-space: nowrap; }
.row .right .amt { font-weight: 600; }
.row .right .cur { color: var(--muted); font-size: 12px; }
.row .badge {
  display: inline-block; padding: 2px 6px; border-radius: 6px;
  background: rgba(79, 140, 255, 0.15); color: var(--accent-2);
  font-size: 11px; margin-left: 6px;
}
.row .badge.cash { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }

/* ---------- filters ---------- */
.filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 12px;
}
.filters label { margin: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 10px; z-index: 30;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
