/* ═══════════════════════════════════════════════════════ */
/* Crowny Finance — 지갑스타일 4상균형3진 회계 UI          */
/* ═══════════════════════════════════════════════════════ */

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1a1a24;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text2: #8888a0;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --t-color: #00d2d3;
  --o-color: #feca57;
  --a-color: #ff6b6b;
  --u-color: #576574;
  --green: #00b894;
  --red: #e17055;
  --radius: 16px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, 'Pretendard', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.page { display: none; padding: 20px; max-width: 480px; margin: 0 auto; padding-bottom: 40px; }
.page.active { display: block; }

/* ─── 헤더 ─── */

#app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--t-color), var(--accent));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
}
.brand { font-weight: 700; font-size: 16px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.health-battery {
  width: 60px; height: 26px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 6px;
  position: relative; overflow: hidden;
}
.battery-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.5s ease, background 0.5s ease;
  border-radius: 3px;
}
.battery-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px; font-weight: 700;
}
.grade-badge {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}

/* ─── 가입 ─── */

.signup-card { padding-top: 60px; text-align: center; }
.signup-card h1 {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, var(--t-color), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.subtitle { color: var(--text2); margin: 8px 0 40px; font-size: 15px; }

.signup-form {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
}

.signup-form input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.signup-form input:focus { border-color: var(--accent); }

.type-select { display: flex; gap: 8px; }
.type-btn {
  flex: 1;
  padding: 12px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.type-btn.active {
  border-color: var(--accent);
  color: var(--accent2);
  background: rgba(108, 92, 231, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  color: #fff;
  font-size: 16px; font-weight: 700;
  cursor: pointer; transition: transform 0.1s;
}
.btn-primary:active { transform: scale(0.97); }

.feature-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-top: 32px;
}
.feature {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px; text-align: center;
}
.feature-icon {
  width: 36px; height: 36px; margin: 0 auto 8px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
}
.feature:nth-child(1) .feature-icon { background: rgba(0,210,211,0.15); color: var(--t-color); }
.feature:nth-child(2) .feature-icon { background: rgba(254,202,87,0.15); color: var(--o-color); }
.feature:nth-child(3) .feature-icon { background: rgba(255,107,107,0.15); color: var(--a-color); }
.feature:nth-child(4) .feature-icon { background: rgba(87,101,116,0.15); color: var(--u-color); }
.feature-label { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.feature-desc { font-size: 11px; color: var(--text2); }

/* ─── 대시보드 ─── */

.wallet-card {
  background: linear-gradient(135deg, #1e1e30, #2a1e40);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid rgba(108,92,231,0.3);
}
.wallet-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.wallet-name { font-weight: 700; font-size: 16px; }
.wallet-id { color: var(--text2); font-size: 12px; font-family: monospace; }
.wallet-balance { text-align: center; margin-bottom: 20px; }
.balance-main { font-size: 36px; font-weight: 800; }
.balance-label { color: var(--text2); font-size: 12px; margin-top: 4px; }
.wallet-assets { display: flex; justify-content: space-around; }
.asset { text-align: center; }
.asset-label { font-size: 11px; color: var(--text2); display: block; }
.asset-value { font-size: 15px; font-weight: 700; }

/* ─── 입력 바 ─── */

.input-bar {
  display: flex; gap: 8px;
  margin-bottom: 16px;
}
.input-bar input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.input-bar input:focus { border-color: var(--accent); }
.btn-send {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.quick-actions { display: flex; gap: 8px; margin-bottom: 20px; }
.quick-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--text);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.quick-btn:hover { border-color: var(--accent); color: var(--accent2); }

/* ─── 건강 상세 ─── */

.health-detail, .recent-tx, .quadrant-summary {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.health-detail h3, .recent-tx h3, .quadrant-summary h3 {
  font-size: 14px; font-weight: 700; margin-bottom: 14px;
  color: var(--text2);
}
.health-bars { display: flex; flex-direction: column; gap: 12px; }
.health-item { display: flex; align-items: center; gap: 10px; }
.health-item span:first-child { width: 90px; font-size: 12px; color: var(--text2); }
.mini-bar {
  flex: 1; height: 8px;
  background: var(--surface2);
  border-radius: 4px; overflow: hidden;
}
.mini-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.mini-val { width: 32px; text-align: right; font-size: 12px; font-weight: 700; }

/* ─── 거래 목록 ─── */

.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx-empty { text-align: center; color: var(--text2); padding: 20px; font-size: 13px; }
.tx-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-left { display: flex; flex-direction: column; gap: 2px; }
.tx-desc { font-size: 14px; font-weight: 600; }
.tx-accounts { font-size: 11px; color: var(--text2); }
.tx-amount { font-size: 16px; font-weight: 800; }
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--red); }

/* ─── 4상 요약 ─── */

.quadrant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quad {
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.q-t { background: rgba(0,210,211,0.08); border: 1px solid rgba(0,210,211,0.2); }
.q-o { background: rgba(254,202,87,0.08); border: 1px solid rgba(254,202,87,0.2); }
.q-a { background: rgba(255,107,107,0.08); border: 1px solid rgba(255,107,107,0.2); }
.q-u { background: rgba(87,101,116,0.08); border: 1px solid rgba(87,101,116,0.2); }
.quad-label { font-size: 11px; color: var(--text2); margin-bottom: 6px; }
.quad-value { font-size: 18px; font-weight: 800; }
.q-t .quad-value { color: var(--t-color); }
.q-o .quad-value { color: var(--o-color); }
.q-a .quad-value { color: var(--a-color); }
.q-u .quad-value { color: var(--u-color); }

/* ─── 재무제표 ─── */

.page-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.btn-back {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.page-header h2 { font-size: 18px; font-weight: 700; }

.stmt-tabs {
  display: flex; gap: 4px;
  overflow-x: auto; margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.stmt-tab {
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text2);
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.stmt-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.stmt-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 300px;
}
.stmt-placeholder { text-align: center; color: var(--text2); padding: 40px; }

.stmt-row {
  display: flex; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.stmt-row:last-child { border-bottom: none; }
.stmt-row .label { color: var(--text2); }
.stmt-row .value { font-weight: 700; }
.stmt-row.total { font-weight: 800; font-size: 16px; border-top: 2px solid var(--border); margin-top: 8px; padding-top: 14px; }

.stmt-section { margin-bottom: 20px; }
.stmt-section-title {
  font-size: 13px; font-weight: 700; color: var(--accent2);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ─── 모달 ─── */

.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%; max-width: 400px;
  display: flex; flex-direction: column; gap: 14px;
}
.modal-content h3 { font-size: 18px; font-weight: 700; }
.modal-content input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.modal-actions { display: flex; gap: 8px; }
.btn-cancel {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
}

@media (min-width: 768px) {
  .page { max-width: 520px; }
}
