:root {
  --bg: #0b0f1a;
  --card: #151b2e;
  --card-2: #1b2238;
  --txt: #e8ecf6;
  --muted: #8b93ad;
  --indigo: #6366f1;
  --emerald: #10b981;
  --line: #252c44;
  --danger: #ef4444;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #1a2138 0%, var(--bg) 60%);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", system-ui, sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 8px) 16px calc(var(--safe-bottom) + 24px);
}

/* HERO */
.hero {
  padding: 18px 4px 8px;
  text-align: center;
}
.hero-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.month-label { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.ghost-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--txt);
  width: 38px; height: 38px; border-radius: 12px; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.ghost-btn:active { background: var(--card-2); }
.hero-sub { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.hero-amount {
  font-size: 46px; font-weight: 800; letter-spacing: -1.5px;
  background: linear-gradient(100deg, #a5b4fc, #6ee7b7);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1.1; margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.hero-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* CARDS */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
}

/* WEEK */
.week-row { display: flex; justify-content: space-between; align-items: flex-start; }
.week-title { color: var(--muted); font-size: 13px; }
.week-hours { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.week-status {
  font-size: 12.5px; color: var(--indigo); background: rgba(99,102,241,.12);
  padding: 5px 10px; border-radius: 999px; font-weight: 600;
}
.week-status.ok { color: var(--emerald); background: rgba(16,185,129,.14); }
.progress { margin-top: 12px; height: 8px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--indigo), var(--emerald));
  border-radius: 999px; transition: width .35s ease;
}

/* QUICK */
.quick-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.quick-row { display: flex; gap: 8px; }
.inp {
  background: var(--card-2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 12px; padding: 12px; font-size: 16px; width: 100%;
  font-variant-numeric: tabular-nums;
}
.inp:focus { outline: none; border-color: var(--indigo); }
#quickDate { flex: 1.4; }
#quickHours { flex: 1; text-align: center; }
.primary-btn {
  background: linear-gradient(100deg, var(--indigo), #4f46e5);
  color: #fff; border: none; border-radius: 12px; padding: 0 18px;
  font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.primary-btn:active { filter: brightness(.92); }
.quick-presets { display: flex; gap: 8px; margin-top: 10px; }
.preset {
  flex: 1; background: var(--card-2); border: 1px solid var(--line); color: var(--txt);
  padding: 9px 0; border-radius: 10px; font-size: 14px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.preset:active { background: var(--indigo); border-color: var(--indigo); }

/* CALENDAR */
.cal-card { padding: 14px 12px; }
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11px; color: var(--muted); text-align: center; margin-bottom: 8px;
}
.cal-weekdays .sat { color: #7aa2ff; }
.cal-weekdays .sun { color: #ff8a8a; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1;
  background: transparent; border: 1px solid transparent; border-radius: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 0; cursor: pointer; color: var(--txt);
  font-family: inherit;
}
.cal-cell.blank { cursor: default; }
.cal-num { font-size: 13.5px; font-variant-numeric: tabular-nums; line-height: 1; }
.cal-cell.sat .cal-num { color: #7aa2ff; }
.cal-cell.sun .cal-num { color: #ff8a8a; }
.cal-h {
  font-size: 9.5px; font-weight: 700; color: var(--emerald);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.cal-cell.has { background: rgba(16,185,129,.12); }
.cal-cell.week-ok { border-color: rgba(16,185,129,.45); }
.cal-cell.today .cal-num {
  background: var(--indigo); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
}
.cal-cell.selected { background: rgba(99,102,241,.22); border-color: var(--indigo); }
.cal-cell:active { background: rgba(99,102,241,.3); }

.cal-legend {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  margin-top: 12px; font-size: 11px; color: var(--muted);
}
.cal-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.cal-legend .dot.has { background: rgba(16,185,129,.5); }
.cal-legend .dot.week-ok { background: transparent; border: 1.5px solid rgba(16,185,129,.7); }
.cal-legend .dot.today { background: var(--indigo); border-radius: 50%; }

/* LIST */
.list-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.muted { color: var(--muted); }
.day-list { list-style: none; margin: 0; padding: 0; }
.day-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.day-item:last-child { border-bottom: none; }
.day-info { display: flex; flex-direction: column; gap: 2px; }
.day-date { font-size: 15px; font-weight: 600; }
.day-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-right { display: flex; align-items: center; gap: 12px; }
.day-pay { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.del-btn {
  background: none; border: none; color: var(--muted); font-size: 20px;
  cursor: pointer; padding: 4px 8px; line-height: 1;
}
.del-btn:active { color: var(--danger); }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 8px; }
.empty.hidden, .hidden { display: none; }

/* SETTINGS */
.settings-toggle {
  width: 100%; background: none; border: none; color: var(--muted);
  font-size: 14px; padding: 4px; cursor: pointer; text-align: left;
}
.settings-body { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.set-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.set-row .inp.small { width: 130px; flex: none; text-align: right; }
.switch-row span { flex: 1; }
.switch { width: 22px; height: 22px; accent-color: var(--indigo); }
.set-actions { display: flex; gap: 8px; }
.ghost-line {
  flex: 1; background: var(--card-2); border: 1px solid var(--line); color: var(--txt);
  padding: 11px 0; border-radius: 10px; font-size: 13.5px; cursor: pointer;
}
.set-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 2px 0 0; }

.foot { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 22px; opacity: .7; }

/* TOAST */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px);
  transform: translateX(-50%); background: #fff; color: #111;
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,.35); z-index: 50;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; } }
