/* =====================================================================
   모바일 웹앱 공통 셸 — 사용자(내 바우처) / 병원용 결제 접수 공통
   tokens.css → base.css → app.css 순서로 로드
   ===================================================================== */

.app {
  width: 100%; max-width: var(--app-max); margin: 0 auto;
  min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--paper);
}
@media (min-width: 520px) {
  body.app-user, body.app-hosp { background: var(--bg); }
  .app { min-height: 100dvh; box-shadow: var(--shadow); }
}

/* ---------- 상단 바 ---------- */
.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--sp-5) 4px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint);
}
.top-bar .brand { display: inline-flex; align-items: center; gap: 5px; }

.app-bar { padding: 10px var(--sp-5) var(--sp-4); display: flex; flex-direction: column; gap: 2px; }
.app-bar .greet { font-size: 12.5px; color: var(--ink-faint); }
.app-bar .title { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--accent); }

/* ---------- 언어 선택 ---------- */
.lang-bar { display: flex; justify-content: flex-end; padding: 2px var(--sp-4) 0; position: relative; z-index: 5; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-alt); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-pill); padding: 5px 11px 5px 9px;
  font-family: var(--font-body); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.lang-btn svg { width: 13px; height: 13px; color: var(--accent); }
.lang-btn .caret { font-size: 9px; color: var(--ink-faint); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-menu {
  position: absolute; top: 32px; right: var(--sp-4);
  background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: var(--radius-box); box-shadow: var(--shadow);
  padding: 5px; min-width: 148px; max-height: 60vh; overflow-y: auto; display: none;
}
.lang-menu.is-on { display: block; }
.lang-menu button {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: none; padding: 8px 10px; border-radius: 8px;
  font-family: var(--font-body); font-size: 12.5px; color: var(--ink); cursor: pointer; text-align: left;
}
.lang-menu button:hover { background: var(--bg-alt); }
.lang-menu button.is-on { color: var(--accent); font-weight: 700; background: var(--accent-soft); }

/* ---------- 화면 전환 상태 ---------- */
.state { display: none; }
.state.is-on { display: flex; flex-direction: column; flex: 1; animation: rise .25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.screen-body { flex: 1; padding: 2px var(--sp-5) 18px; overflow-y: auto; }

/* ---------- 로그인 ---------- */
.login-stage {
  padding: var(--sp-4) 22px var(--sp-6); flex: 1;
  display: flex; flex-direction: column; justify-content: center;
}
.login-badge {
  width: 54px; height: 54px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin: 0 auto var(--sp-4);
}
.login-badge svg { width: 25px; height: 25px; }
.login-head { text-align: center; margin-bottom: var(--sp-5); }
.login-head b { display: block; font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.login-head small { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; line-height: 1.5; }
.login-note { font-size: 11px; color: var(--ink-faint); text-align: center; margin-top: 13px; line-height: 1.5; }

/* ---------- 하단 탭 ---------- */
.bottom-tabs {
  display: flex; border-top: 1px solid var(--line);
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px); background: var(--paper);
  position: sticky; bottom: 0;
}
.btab {
  flex: 1; background: none; border: none; cursor: pointer;
  font-family: var(--font-display); display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--ink-faint); padding: 6px 4px; border-radius: var(--radius-btn);
}
.btab .ic { width: 18px; height: 18px; display: block; }
.btab.is-on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.btab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tabpanel { display: none; }
.tabpanel.is-on { display: block; animation: rise .25s ease both; }

/* ---------- 상단 탭(병원용) ---------- */
.top-tabs { display: none; padding: 0 18px; gap: 4px; border-bottom: 1px solid var(--line); }
.top-tabs.is-on { display: flex; }
.ttab {
  flex: 1; background: none; border: none; cursor: pointer; padding: 9px 4px 10px; margin-bottom: -1px;
  font-family: var(--font-display); font-size: 12.5px; font-weight: 600; color: var(--ink-faint);
  border-bottom: 2px solid transparent;
}
.ttab.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.ttab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.tabwrap { display: none; }
.tabwrap.is-on { display: flex; flex-direction: column; flex: 1; }

/* ---------- 리스트 행 ---------- */
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 2px; border-bottom: 1px solid var(--line); gap: 10px;
}
.list-item:last-child { border-bottom: none; }
.list-item .place { font-size: 13.5px; font-weight: 600; }
.list-item .date  { font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.list-item .amt   { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; color: var(--danger); white-space: nowrap; }
.list-item .amt.plus { color: var(--ok); }
