:root {
  --bg: #0b0d12;
  --bg2: #12151d;
  --card: #171b26;
  --card2: #1d2230;
  --border: #2a3040;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #ffb300;
  --accent2: #ff8f00;
  --income: #4cd964;
  --expense: #ff5252;
  --danger: #ff5252;
}

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

body {
  background: radial-gradient(ellipse at 50% -20%, #1a2133 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Segoe UI', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  min-height: 100vh;
}

#app { max-width: 1060px; margin: 0 auto; padding: 24px 16px 60px; }

.hidden { display: none !important; }

/* ---------- 로그인 ---------- */
.login-box {
  max-width: 460px;
  margin: 8vh auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}

.logo { text-align: center; margin-bottom: 24px; }
.logo-badge {
  width: 64px; height: 64px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #111;
  letter-spacing: 1px;
  box-shadow: 0 6px 20px rgba(255,179,0,.35);
}
.logo-badge.small { width: 40px; height: 40px; font-size: 10px; margin: 0 14px 0 0; border-radius: 10px; }

.logo h1 { font-size: 22px; letter-spacing: .5px; }
.logo .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.login-form h2 { font-size: 16px; margin-bottom: 14px; color: var(--accent); }
.login-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.login-form input {
  width: 100%; margin-top: 6px; padding: 11px 14px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 15px; outline: none;
}
.login-form input:focus { border-color: var(--accent); }

.hint { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.6; text-align: center; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 10px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.auth-tab.active { background: var(--accent); color: #141414; border-color: var(--accent); }

.auth-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.auth-form input {
  width: 100%; margin-top: 6px; padding: 11px 14px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 15px; outline: none;
}
.auth-form input:focus { border-color: var(--accent); }

.auth-msg {
  margin-top: 14px; padding: 10px 14px; border-radius: 8px;
  background: rgba(255,82,82,.12); border: 1px solid rgba(255,82,82,.4);
  color: var(--expense); font-size: 13px; text-align: center;
}
.auth-msg.ok { background: rgba(76,217,100,.1); border-color: rgba(76,217,100,.4); color: var(--income); }

.profile-list { margin-bottom: 22px; }
.profile-list h3 { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.profile-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card2); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 10px; margin-bottom: 8px;
  cursor: pointer; transition: border-color .15s;
}
.profile-item:hover { border-color: var(--accent); }
.profile-item .p-nick { font-weight: 700; }
.profile-item .p-id { color: var(--muted); font-size: 13px; margin-left: 8px; }
.profile-item .p-del { color: var(--expense); font-size: 13px; padding: 2px 8px; border-radius: 6px; }
.profile-item .p-del:hover { background: rgba(255,82,82,.15); }

/* ---------- 버튼 ---------- */
.btn-primary {
  width: 100%; padding: 12px; margin-top: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: 8px; color: #141414;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

.btn-minus, .btn-plus {
  width: 38px; height: 38px; border-radius: 8px; border: none;
  font-size: 18px; font-weight: 700; cursor: pointer; transition: filter .12s;
}
.btn-minus { background: var(--expense); color: #fff; }
.btn-plus { background: var(--income); color: #fff; }
.btn-minus:hover, .btn-plus:hover { filter: brightness(1.15); }
.btn-minus:disabled, .btn-plus:disabled { opacity: .35; cursor: default; }

/* ---------- 헤더 ---------- */
header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.header-left { display: flex; align-items: center; }
.header-left h1 { font-size: 20px; }
.user-info { color: var(--muted); font-size: 13px; margin-top: 4px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.today-label {
  font-size: 13px; color: var(--accent); background: rgba(255,179,0,.1);
  border: 1px solid rgba(255,179,0,.3); padding: 6px 12px; border-radius: 8px;
}

.banner {
  background: rgba(255,179,0,.12); border: 1px solid rgba(255,179,0,.4);
  color: var(--accent); padding: 12px 16px; border-radius: 10px;
  margin-bottom: 18px; font-size: 14px;
}

/* ---------- 통계 ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 16px; position: relative; overflow: hidden;
}
.stat-card.accent { border-color: rgba(255,179,0,.45); background: linear-gradient(160deg, rgba(255,179,0,.10), var(--card)); }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.stat-card.income .stat-value { color: var(--income); }
.stat-card.expense .stat-value { color: var(--expense); }
.stat-note { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- 입력 ---------- */
.input-section h2 { font-size: 17px; margin-bottom: 14px; }
.input-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; margin-bottom: 30px;
}
.input-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px;
}
.input-card h3 { font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.tag {
  font-size: 11px; font-weight: 600; color: var(--accent);
  background: rgba(255,179,0,.1); border: 1px solid rgba(255,179,0,.3);
  padding: 2px 8px; border-radius: 6px;
}
.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1; padding: 11px 14px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 15px; outline: none; min-width: 0;
}
.input-row input:focus { border-color: var(--accent); }
.input-row .btn-primary { width: auto; margin: 0; padding: 11px 20px; flex-shrink: 0; }
.input-hint { font-size: 11px; color: var(--muted); margin-top: 10px; }

.amount-display {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 8px;
}
.amount-display #amountValue {
  font-size: 30px; font-weight: 800; color: var(--accent); letter-spacing: 1px;
  min-width: 60px;
}
.amount-unit { font-size: 14px; color: var(--muted); font-weight: 600; }
.amount-convert { font-size: 13px; color: var(--income); font-weight: 700; margin-bottom: 10px; }

.numpad {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.numpad-key, .numpad-submit {
  height: 52px; border: none; border-radius: 10px;
  font-size: 19px; font-weight: 700; cursor: pointer;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--border); transition: filter .12s, transform .05s;
}
.numpad-key:active, .numpad-submit:active { transform: scale(.96); }
.numpad-key:hover { filter: brightness(1.15); }
.numpad-key.del { color: var(--expense); }
.numpad-submit {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #141414; border: none; font-size: 16px;
}
.numpad-submit:hover { filter: brightness(1.1); }

.stepper-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.stepper-value {
  min-width: 44px; text-align: center; font-size: 22px; font-weight: 800;
}
.stepper-cost { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

.repair-row { display: flex; flex-direction: column; gap: 14px; }
.repair-item {
  background: var(--card2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.repair-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* ---------- 히스토리 ---------- */
.history-section { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.history-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.tab.active { background: var(--accent); color: #141414; font-weight: 700; border-color: var(--accent); }

.today-summary {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.today-summary div {
  background: var(--card2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; color: var(--muted);
}
.today-summary b { color: var(--text); font-size: 14px; }

.logs h4 { font-size: 13px; color: var(--muted); margin: 12px 0 8px; }
.logs ul { list-style: none; }
.logs li {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg2); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; font-size: 13px;
}
.logs li .amt { font-weight: 700; }
.logs li .income .amt { color: var(--income); }
.logs li .del { color: var(--expense); cursor: pointer; padding: 2px 8px; font-size: 12px; }
.logs li .del:hover { background: rgba(255,82,82,.15); border-radius: 6px; }
.log-empty { color: var(--muted); font-size: 12px; }

.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12px;
}
.history-table td { padding: 8px 10px; border-bottom: 1px solid rgba(42,48,64,.5); }
.history-table tr:last-child td { border-bottom: none; }
.history-table .inc { color: var(--income); font-weight: 700; }
.history-table .exp { color: var(--expense); font-weight: 700; }

@media (max-width: 640px) {
  .header-left h1 { font-size: 16px; }
  .stat-value { font-size: 21px; }
  .history-table { font-size: 12px; }
}
