/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #4F7EFF;
  --primary-dk: #3A62D4;
  --bg:         #F5F7FA;
  --surface:    #FFFFFF;
  --border:     #E8ECF2;
  --text:       #1A1A2E;
  --text-sub:   #7A8099;
  --danger:     #FF4F6A;
  --success:    #2ECC71;
  --warning:    #F5A623;
  --tag-bg:     #EEF2FF;
  --tag-text:   #4F7EFF;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 2px 12px rgba(0,0,0,0.07);
  --bottom-nav: 64px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ───────────────────────────────────────── */
#app {
  max-width: 430px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.header-date {
  font-size: 13px;
  color: var(--text-sub);
}

/* ── Quick Input Bar ─────────────────────────────────── */
.quick-input {
  background: var(--surface);
  padding: 8px 16px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.quick-input textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 10px 16px;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: border-color .2s;
  resize: none;
  font-family: inherit;
}
.quick-input textarea:focus { border-color: var(--primary); }
.quick-input textarea::placeholder { color: var(--text-sub); }
.quick-input-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn-voice, .btn-send {
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
}
.btn-voice { background: var(--bg); border: 1.5px solid var(--border); }
.btn-voice.recording { background: #FFEEF1; border-color: var(--danger); animation: pulse 1s infinite; }
.btn-send  { background: var(--primary); color: #fff; }
.btn-send:hover { background: var(--primary-dk); }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

/* ── Parsing Result Toast ────────────────────────────── */
.parse-toast {
  position: fixed;
  top: 80px; left: 50%; transform: translateX(-50%);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  z-index: 300;
  width: min(390px, 92vw);
  display: none;
}
.parse-toast.show { display: block; }
.parse-toast-type { font-size: 12px; color: var(--primary); font-weight: 700; margin-bottom: 4px; }
.parse-toast-title { font-size: 15px; font-weight: 600; }
.parse-toast-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-confirm { flex:1; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); padding: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-cancel  { flex:1; background: var(--bg); color: var(--text-sub); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px; font-size: 14px; cursor: pointer; }

/* ── Main Content ────────────────────────────────────── */
.main { flex: 1; overflow-y: auto; padding: 0 16px; padding-bottom: calc(var(--bottom-nav) + 16px); }
.main > :first-child { margin-top: 16px; }

/* ── Tab Bar ─────────────────────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: min(430px, 100vw);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  height: var(--bottom-nav);
  z-index: 100;
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; cursor: pointer;
  border: none; background: none;
  color: var(--text-sub); font-size: 10px; font-weight: 500;
  transition: color .15s;
}
.tab-item .tab-icon { font-size: 20px; line-height: 1; }
.tab-item.active { color: var(--primary); }

/* ── Section Header ──────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 17px; font-weight: 700; }
.btn-add {
  background: var(--primary); color: #fff;
  border: none; border-radius: 20px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer;
}

/* ── Card ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.card-title   { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-sub     { font-size: 13px; color: var(--text-sub); }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-sm {
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-sub);
}
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm.active-filter { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Tag / Badge ─────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--tag-bg); color: var(--tag-text);
  border-radius: 6px; padding: 2px 8px;
  font-size: 11px; font-weight: 600;
  margin-right: 4px;
}
.tag.green  { background: #ECFDF5; color: #059669; }
.tag.orange { background: #FFF7ED; color: #C2410C; }
.tag.red    { background: #FFF1F2; color: #BE123C; }
.tag.gray   { background: #F3F4F6; color: #6B7280; }

/* ── Status Badge ────────────────────────────────────── */
.status-badge {
  display: inline-block; border-radius: 20px;
  padding: 2px 10px; font-size: 11px; font-weight: 700;
}
.status-진행전  { background: #F3F4F6; color: #6B7280; }
.status-진행중  { background: #EEF2FF; color: #4F7EFF; }
.status-완료   { background: #ECFDF5; color: #059669; }
.status-포기   { background: #FFF1F2; color: #BE123C; }

/* ── Home Dashboard ──────────────────────────────────── */
.home-greeting { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.home-date     { font-size: 14px; color: var(--text-sub); margin-bottom: 20px; }
.summary-grid  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.summary-card  {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 16px;
  text-align: center; cursor: pointer;
}
.summary-card-icon  { font-size: 22px; margin-bottom: 4px; }
.summary-card-label { font-size: 11px; color: var(--text-sub); margin-bottom: 2px; }
.summary-card-count { font-size: 20px; font-weight: 800; color: var(--primary); }

/* ── Expense Chart Bar ───────────────────────────────── */
.expense-bar { margin-bottom: 10px; }
.expense-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.expense-bar-track { height: 8px; background: var(--border); border-radius: 4px; }
.expense-bar-fill  { height: 8px; background: var(--primary); border-radius: 4px; transition: width .4s; }

/* ── Postit ──────────────────────────────────────────── */
.postit {
  background: #FFFDE7; border: 1px solid #FDD835;
  border-radius: var(--radius-sm); padding: 12px;
  margin-bottom: 10px; font-size: 14px; line-height: 1.6;
  position: relative;
}
.postit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.btn-copy { background: none; border: none; font-size: 16px; cursor: pointer; }

/* ── Empty State ─────────────────────────────────────── */
.empty { text-align: center; padding: 48px 0; color: var(--text-sub); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ── Modal ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 200; display: none; align-items: flex-end;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 430px; margin: 0 auto;
  padding: 24px 20px 32px; max-height: 80vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; display: block; }
.form-control {
  width: 100%; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 14px; outline: none; background: var(--bg);
  color: var(--text); transition: border-color .2s;
}
.form-control:focus { border-color: var(--primary); }
input[type="datetime-local"].form-control,
input[type="date"].form-control,
input[type="time"].form-control,
input[type="month"].form-control { box-sizing: border-box; height: 38px; }
select.form-control { appearance: none; cursor: pointer; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-primary { flex:1; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn-ghost   { flex:1; background: none; color: var(--text-sub); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-size: 15px; cursor: pointer; }

/* ── Weather ────────────────────────────────────────── */
.weather-today {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.weather-today-main {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
}
.weather-today-icon { font-size: 48px; line-height: 1; }
.weather-today-temp { font-size: 36px; font-weight: 800; line-height: 1; }
.weather-today-desc { font-size: 14px; color: var(--text-sub); margin-top: 4px; }
.weather-today-detail {
  display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 8px;
}
.weather-today-detail.dust-row {
  grid-template-columns: 1fr 1fr; margin-top: 8px;
}
.weather-detail-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13px;
  white-space: nowrap; overflow: hidden;
}
.weather-detail-label { color: var(--text-sub); font-weight: 600; margin-right: 6px; }
.weather-forecast {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 12px 16px; box-shadow: var(--shadow);
}
.weather-forecast-row {
  display: flex; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.weather-forecast-row:last-child { border-bottom: none; }
.weather-forecast-day { width: 80px; font-weight: 600; }
.weather-forecast-icon { width: 32px; text-align: center; font-size: 18px; }
.weather-forecast-temp { flex: 1; text-align: center; }
.weather-forecast-pop { width: 50px; text-align: right; font-size: 12px; color: var(--primary); }

/* ── Calendar ───────────────────────────────────────── */
.cal-sticky {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  margin: 0 -16px; padding: 12px 16px 4px;
  transition: all .2s ease;
}
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.cal-header-title { font-size: 16px; font-weight: 700; }
.cal-nav {
  background: none; border: 1.5px solid var(--border); border-radius: 6px;
  width: 32px; height: 32px; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sub);
}
.cal-nav:hover { border-color: var(--primary); color: var(--primary); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  margin-bottom: 12px; transition: all .2s ease;
}
.cal-head {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-sub); padding: 4px 0;
}
.cal-cell {
  text-align: center; padding: 6px 2px 4px; border-radius: 8px;
  font-size: 13px; cursor: pointer; min-height: 40px;
  position: relative; transition: all .2s ease;
}
.cal-cell > * { pointer-events: none; }
.cal-cell:hover { background: var(--bg); }
.cal-cell.today { background: var(--primary); color: #fff; font-weight: 700; border-radius: 8px; }
.cal-cell.selected { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 8px; }
.cal-cell.empty { cursor: default; }
.cal-cell.empty:hover { background: none; }
.cal-dots {
  display: flex; gap: 2px; justify-content: center; margin-top: 1px;
  min-height: 8px; transition: all .2s ease;
}
.cal-dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.cal-dot.blue { background: var(--primary); }
.cal-dot.red { background: var(--danger); }
.cal-dot.today-dot { background: #fff; }

/* Weekend & Holiday colors */
.cal-head.sun { color: var(--danger); }
.cal-head.sat { color: var(--primary); }
.cal-cell.holiday { color: var(--danger); }
.cal-cell.saturday { color: var(--primary); }
.cal-cell.holiday.today, .cal-cell.saturday.today { color: #fff; }

/* Compact calendar (when scrolled) */
.cal-sticky.compact .cal-header { margin-bottom: 4px; }
.cal-sticky.compact .cal-header-title { font-size: 13px; }
.cal-sticky.compact .cal-nav { width: 26px; height: 26px; font-size: 12px; }
.cal-sticky.compact .cal-grid { gap: 1px; margin-bottom: 4px; }
.cal-sticky.compact .cal-head { font-size: 10px; padding: 2px 0; }
.cal-sticky.compact .cal-cell { padding: 3px 1px 2px; min-height: 24px; font-size: 11px; border-radius: 6px; }
.cal-sticky.compact .cal-dots { display: none; }

.date-label {
  font-size: 14px; font-weight: 700; color: var(--text-sub);
  padding: 8px 0 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.cal-browse-btn {
  background: none; border: 1.5px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; cursor: pointer;
  color: var(--text-sub); display: inline-flex; align-items: center; gap: 4px;
}
.cal-browse-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Loading ─────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
