/* ═══════════════════════════════════════════════════════════════
   레이아웃 · 컴포넌트 — 모바일 우선.
   ═══════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ── 로그인 ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 22px calc(32px + var(--safe-bottom));
  max-width: 420px; margin: 0 auto;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo {
  font-family: var(--mono); font-size: 13px; letter-spacing: .18em;
  color: var(--accent); font-weight: 600;
}
.login-brand h1 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 4px; }
.login-brand p { color: var(--ink-3); font-size: 13.5px; margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.login-card { padding: 22px 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; height: 48px; padding: 0 14px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.checks { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }

.btn {
  width: 100%; height: 50px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink);
  font-size: 16px; font-weight: 650; letter-spacing: -.01em;
  transition: filter .12s, transform .06s;
}
.btn:active { transform: scale(.99); filter: brightness(.96); }
.btn[disabled] { opacity: .55; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }

/* ── 앱 셸 ──────────────────────────────────────────── */
.app { display: none; flex-direction: column; height: 100%; }
.app.show { display: flex; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.topbar .who { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.topbar .who b { color: var(--ink-2); font-weight: 600; }

.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; padding-bottom: calc(var(--tabbar-h) + 16px + var(--safe-bottom)); }

/* 하단 탭바 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; border: none; background: none; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600;
}
.tabbar button .ic { font-size: 20px; line-height: 1; }
.tabbar button.on { color: var(--accent); }

/* 통계 카드 (홈) */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .v { font-family: var(--mono); font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.sec-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 22px 4px 10px; letter-spacing: .01em; }
.muted { color: var(--ink-3); }
.center-msg { text-align: center; color: var(--ink-3); padding: 40px 20px; font-size: 14px; }
.spinner {
  width: 22px; height: 22px; border: 2.5px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
