/* ===== 디자인 토큰: "학급 통장" 컨셉 =====
   종이 통장 + 승인 도장 모티프. 거래 내역은 원장(元帳)처럼 줄글로,
   확정 동작에는 도장 스탬프 연출. */

:root {
  --paper: #f7f4ec;
  --paper-line: #e4ddc8;
  --card: #ffffff;
  --ink: #1b2a4a;
  --ink-soft: #4a5a7a;
  --deposit: #2f6f5e;
  --withdraw: #b23a2e;
  --gold: #c99a3b;
  --shadow: 0 1px 2px rgba(27, 42, 74, 0.06), 0 4px 14px rgba(27, 42, 74, 0.06);
  --radius: 14px;
  --font-display: "Noto Serif KR", serif;
  --font-body: "Pretendard", -apple-system, "Malgun Gothic", sans-serif;
  --font-num: "Roboto Mono", "Pretendard", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  background-image: linear-gradient(var(--paper-line) 1px, transparent 1px);
  background-size: 100% 34px;
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: #fff; }

.wrap { max-width: 480px; margin: 0 auto; padding: 24px 18px 80px; }
.wrap.wide { max-width: 900px; }

/* ---- 통장 표지 ---- */
.passbook-cover {
  background: var(--ink);
  color: #f7f4ec;
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.passbook-cover::after {
  content: "";
  position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px;
  border: 2px solid rgba(247,244,236,.15);
  border-radius: 50%;
}
.passbook-cover .class-name {
  font-family: var(--font-display);
  font-size: 13px; letter-spacing: .08em; opacity: .75; margin: 0 0 6px;
}
.passbook-cover h1 { font-family: var(--font-display); font-size: 26px; margin: 0 0 4px; font-weight: 700; }
.passbook-cover .job-badge {
  display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: rgba(247,244,236,.14); margin-bottom: 14px;
}
.passbook-cover .balance-label { font-size: 12px; opacity: .7; }
.passbook-cover .balance { font-family: var(--font-num); font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.passbook-cover .balance small { font-size: 16px; font-weight: 400; opacity: .8; }
.passbook-cover .sub-figures {
  display: flex; gap: 18px; margin-top: 12px;
  border-top: 1px solid rgba(247,244,236,.14); padding-top: 12px;
}
.passbook-cover .sub-figures div { font-size: 11px; opacity: .8; }
.passbook-cover .sub-figures strong { display: block; font-family: var(--font-num); font-size: 16px; opacity: 1; margin-top: 2px; }

/* ---- 카드 ---- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-top: 16px; }
.card h2 { font-family: var(--font-display); font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .eyebrow {
  font-size: 10px; font-family: var(--font-body); letter-spacing: .1em; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--paper-line); padding: 2px 8px; border-radius: 999px;
}

/* ---- 탭 ---- */
.tabs { display: flex; gap: 6px; margin-top: 18px; overflow-x: auto; padding-bottom: 4px; }
.tab-btn {
  flex: none; font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--paper-line);
  background: var(--card); color: var(--ink-soft); cursor: pointer; white-space: nowrap;
}
.tab-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- 원장 ---- */
.ledger-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px dashed var(--paper-line); font-size: 14px;
}
.ledger-row:last-child { border-bottom: none; }
.ledger-row .meta { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.ledger-row .amt { font-family: var(--font-num); font-weight: 700; white-space: nowrap; }
.amt.plus { color: var(--deposit); }
.amt.minus { color: var(--withdraw); }

/* ---- 항목 행 ---- */
.item-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--paper-line); border-radius: 10px; margin-bottom: 8px;
}
.item-row .name { font-weight: 700; font-size: 14px; }
.item-row .sub { font-size: 12px; color: var(--ink-soft); font-family: var(--font-num); margin-top: 2px; }
.item-row .desc-text { font-size: 12px; color: var(--ink-soft); margin-top: 4px; font-family: var(--font-body); }
.item-row .col { flex: 1; min-width: 0; }
.tick-up { color: var(--deposit); }
.tick-down { color: var(--withdraw); }

button.action {
  font-family: var(--font-body); font-weight: 700; font-size: 13px;
  padding: 8px 14px; border-radius: 8px; border: none;
  background: var(--ink); color: #fff; cursor: pointer; white-space: nowrap;
}
button.action.ghost { background: transparent; color: var(--ink); border: 1px solid var(--paper-line); }
button.action.buy { background: var(--deposit); }
button.action.sell { background: var(--withdraw); }
button.action.full { width: 100%; }
button.action:disabled { opacity: .4; cursor: not-allowed; }
button.action.small { font-size: 11px; padding: 5px 10px; }

input, select, textarea {
  font-family: var(--font-body); font-size: 14px; padding: 9px 10px;
  border: 1px solid var(--paper-line); border-radius: 8px; background: #fff; width: 100%;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
label { font-size: 12px; color: var(--ink-soft); display: block; margin: 10px 0 4px; }

/* ---- 도장 스탬프 ---- */
.stamp-toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%) scale(0.6) rotate(-8deg); opacity: 0;
  background: #fff; border: 3px solid var(--withdraw); color: var(--withdraw);
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  padding: 10px 22px; border-radius: 10px; box-shadow: var(--shadow);
  pointer-events: none; transition: transform .28s cubic-bezier(.2,1.4,.4,1), opacity .28s; z-index: 50;
}
.stamp-toast.show { opacity: 1; transform: translateX(-50%) scale(1) rotate(-8deg); }
.stamp-toast.deposit-color { border-color: var(--deposit); color: var(--deposit); }

/* ---- 상태 배지 ---- */
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 700;
  border: 1px solid var(--paper-line); color: var(--ink-soft); background: var(--paper);
}
.badge.done { background: var(--deposit); color: #fff; border-color: var(--deposit); }
.badge.pending { background: var(--gold); color: #fff; border-color: var(--gold); }
.badge.reject { background: var(--withdraw); color: #fff; border-color: var(--withdraw); }

.hint { font-size: 12px; color: var(--ink-soft); margin-top: 6px; line-height: 1.5; }
.error-text { font-size: 12px; color: var(--withdraw); margin-top: 6px; }
.empty { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 20px 0; }

.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 32px 26px; width: 100%; max-width: 360px; text-align: center;
}
.login-card h1 { font-family: var(--font-display); font-size: 22px; margin-bottom: 4px; }
.login-card .sub { font-size: 12px; color: var(--ink-soft); margin-bottom: 20px; }
.login-card button.action { width: 100%; margin-top: 14px; padding: 11px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr; } }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--paper-line); }
table.admin-table th { color: var(--ink-soft); font-weight: 600; font-size: 11px; letter-spacing: .04em; }

.proof-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--paper-line); }
.post { padding: 12px 0; border-bottom: 1px dashed var(--paper-line); }
.post:last-child { border-bottom: none; }
.post .author { font-weight: 700; font-size: 13px; }
.post .time { font-size: 11px; color: var(--ink-soft); }
.post .body { font-size: 14px; margin-top: 6px; line-height: 1.6; white-space: pre-wrap; }

.divider { height: 1px; background: var(--paper-line); margin: 16px 0; }
