/* ==========================================================
   PettyTrack v1 — Viewer 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); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red); }
.hidden { display: none !important; }

.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; }

.app-shell {
  max-width: 720px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column;
}
.page { padding: 16px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.topbar.sticky { position: sticky; top: 0; z-index: 10;
  background: rgba(11, 18, 32, 0.92); backdrop-filter: blur(8px); }
.topbar-title { font-weight: 600; letter-spacing: 0.3px; }

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

.summary {
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.15), rgba(111, 179, 255, 0.05));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.summary .num { font-size: 30px; font-weight: 700; margin: 4px 0; }
.summary .lbl { color: var(--muted); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.summary .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }

label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  font-size: 16px; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 10px; outline: none;
}
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: 12px;
}
button.link { background: none; border: none; color: var(--accent-2); }

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

.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); }

/* Thumbnail + photo popup */
.row.has-thumb { gap: 12px; }
.row.has-thumb .thumb {
  width: 56px; height: 56px;
  object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
  cursor: zoom-in;
}
.photo-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.photo-overlay .photo-full {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.photo-overlay .photo-close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px;
  background: rgba(0, 0, 0, 0.4);
  color: white; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  font-size: 24px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.balance-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; margin-bottom: 8px;
}
.balance-card .name { font-size: 13px; color: var(--muted); }
.balance-card .nums { display: flex; gap: 14px; margin-top: 4px; }
.balance-card .num { font-weight: 600; }
