/* ══ RESET & BASE ══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #f1f5f9;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-2: #475569;
  --text-3: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-w: 240px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(99,102,241,.15);
}
html { font-size: 15px; }
body { font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; border: none; }
a { text-decoration: none; cursor: pointer; color: inherit; }

/* ══ AUTH ══════════════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6366f1 100%);
  position: relative; overflow: hidden;
}
.auth-bg { position: absolute; inset: 0; overflow: hidden; }
.auth-blob {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.07); filter: blur(40px);
}
.blob1 { width: 400px; height: 400px; top: -100px; left: -100px; }
.blob2 { width: 300px; height: 300px; bottom: -80px; right: -80px; animation: float 6s ease-in-out infinite; }
.blob3 { width: 200px; height: 200px; top: 50%; left: 50%; transform: translate(-50%,-50%); animation: float 8s ease-in-out infinite reverse; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-20px)} }
.auth-card {
  background: white; border-radius: 24px; padding: 40px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,.2); position: relative; z-index: 1;
  margin: 20px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon {
  width: 64px; height: 64px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; font-size: 28px; color: white; box-shadow: 0 8px 24px rgba(99,102,241,.35);
}
.auth-logo h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.auth-logo p { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-tab {
  flex: 1; padding: 10px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--text-3); background: transparent; transition: all .2s;
}
.auth-tab.active { background: white; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 14px; transition: border .2s; background: var(--bg); color: var(--text);
}
.field input:focus { border-color: var(--primary); background: white; }
.auth-err { color: var(--danger); font-size: 12px; margin-bottom: 12px; min-height: 16px; }
.btn-auth {
  width: 100%; padding: 13px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border-radius: 11px; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 16px rgba(99,102,241,.35); transition: all .2s; margin-top: 4px;
}
.btn-auth:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,.45); }
.btn-auth:active { transform: translateY(0); }

/* ══ LAYOUT ════════════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100; transition: transform .3s;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; flex-shrink: 0;
}
.sidebar-logo span { font-size: 16px; font-weight: 700; color: var(--text); }
.nav-user {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.nav-list { list-style: none; padding: 10px 10px; flex: 1; overflow-y: auto; }
.nav-list li { margin-bottom: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text-2); transition: all .2s; width: 100%;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(99,102,241,.06)); color: var(--primary); font-weight: 600; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-bottom { padding: 14px 12px; border-top: 1px solid var(--border); }
.btn-logout {
  width: 100%; padding: 9px 14px; background: none; border-radius: 9px;
  color: var(--text-3); font-size: 13px; font-weight: 500; text-align: left;
  display: flex; align-items: center; gap: 8px; transition: all .2s;
}
.btn-logout:hover { background: #fee2e2; color: var(--danger); }
.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  align-items: center; justify-content: space-between; padding: 0 16px; z-index: 99;
}
.burger {
  width: 36px; height: 36px; background: var(--bg); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text-2);
}
.mobile-title { font-size: 16px; font-weight: 700; color: var(--text); }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99;
}
.main-content {
  margin-left: var(--sidebar-w); min-height: 100vh; padding: 28px;
}
.page { display: none; }
.page.active { display: block; }

/* ══ CARDS & COMMON ════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.page-title i { color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0;
}
.stat-icon.purple { background: rgba(99,102,241,.12); color: var(--primary); }
.stat-icon.green  { background: rgba(34,197,94,.12); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,.12); color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,.12); color: var(--danger); }
.stat-icon.blue   { background: rgba(59,130,246,.12); color: #3b82f6; }
.stat-val { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; transition: all .2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.btn-secondary { background: var(--surface2); color: var(--text-2); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #dcfce7; color: #16a34a; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-purple { background: rgba(99,102,241,.12); color: var(--primary); }
.badge-green  { background: rgba(34,197,94,.12); color: #16a34a; }
.badge-orange { background: rgba(245,158,11,.12); color: #d97706; }
.badge-red    { background: rgba(239,68,68,.12); color: var(--danger); }
.badge-gray   { background: var(--surface2); color: var(--text-3); }

/* ══ MODAL ══════════════════════════════════════════════════════════════════════ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; backdrop-filter: blur(2px); }
.modal-box {
  display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: white; border-radius: 18px; padding: 28px; z-index: 201; width: 90%; max-width: 480px;
  box-shadow: 0 24px 80px rgba(0,0,0,.2); max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open, .modal-box.open { display: block; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.modal-title i { color: var(--primary); }
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.modal-field input, .modal-field textarea, .modal-field select {
  width: 100%; padding: 10px 12px; border: 2px solid var(--border); border-radius: 9px;
  font-size: 14px; transition: border .2s; background: var(--bg); color: var(--text);
}
.modal-field input:focus, .modal-field textarea:focus, .modal-field select:focus { border-color: var(--primary); background: white; }
.modal-field textarea { resize: vertical; min-height: 80px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ══ TOAST ══════════════════════════════════════════════════════════════════════ */
#toastContainer { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast {
  padding: 12px 18px; border-radius: 11px; font-size: 14px; font-weight: 600; color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,.2); animation: slideIn .3s ease;
}
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }

/* ══ DASHBOARD ══════════════════════════════════════════════════════════════════ */
.dash-welcome { margin-bottom: 24px; }
.dash-welcome h2 { font-size: 26px; font-weight: 700; color: var(--text); }
.dash-welcome p { color: var(--text-3); font-size: 14px; margin-top: 4px; }
.dash-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.quick-card {
  background: var(--surface); border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow); border: 1px solid var(--border); cursor: pointer;
  transition: all .2s; text-align: center;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.quick-card .q-icon { font-size: 28px; margin-bottom: 8px; }
.quick-card .q-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.quick-card .q-count { font-size: 20px; font-weight: 700; color: var(--text); margin-top: 2px; }
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }

/* ══ CALENDAR ══════════════════════════════════════════════════════════════════ */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-month-title { font-size: 20px; font-weight: 700; color: var(--text); }
.cal-btn { width: 34px; height: 34px; background: var(--surface2); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-2); transition: all .2s; }
.cal-btn:hover { background: var(--primary); color: white; }
.cal-grid-header { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 6px 0; text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-cell {
  min-height: 90px; border-radius: 10px; padding: 6px; cursor: pointer;
  border: 2px solid transparent; transition: all .15s; background: var(--surface);
  position: relative;
}
.cal-cell:hover { border-color: var(--primary); background: rgba(99,102,241,.04); }
.cal-cell.today { border-color: var(--primary); background: rgba(99,102,241,.07); }
.cal-cell.selected { border-color: var(--primary); background: rgba(99,102,241,.12); }
.cal-cell.other-month .cal-day { color: var(--text-3); }
.cal-cell.other-month { opacity: .5; }
.cal-day { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.cal-cell.today .cal-day { color: var(--primary); }
.cal-event {
  font-size: 10px; padding: 1px 5px; border-radius: 4px; margin-bottom: 1px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: white; font-weight: 500;
}
.cal-more { font-size: 10px; color: var(--text-3); }
.cal-detail { margin-top: 16px; }
.cal-detail-header { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.cal-event-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 8px; background: white;
}
.cal-event-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.ics-area { width: 100%; border: 2px dashed var(--border); border-radius: 10px; padding: 12px; font-size: 12px; font-family: monospace; height: 100px; resize: vertical; background: var(--bg); }
.ics-area:focus { border-color: var(--primary); background: white; }
.cal-sidebar { width: 280px; flex-shrink: 0; }
.cal-layout { display: flex; gap: 20px; }
.cal-main { flex: 1; min-width: 0; }

/* ══ TODOS ══════════════════════════════════════════════════════════════════════ */
.todo-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-btn { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface2); transition: all .2s; }
.filter-btn.active { background: var(--primary); color: white; }
.todo-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  background: white; border-radius: 12px; border: 1px solid var(--border);
  margin-bottom: 8px; transition: all .2s;
}
.todo-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(99,102,241,.1); }
.todo-item.completed { opacity: .6; }
.todo-check {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  flex-shrink: 0; margin-top: 2px; transition: all .2s;
}
.todo-check.done { background: var(--success); border-color: var(--success); color: white; }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 14px; font-weight: 600; color: var(--text); }
.todo-item.completed .todo-title { text-decoration: line-through; }
.todo-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.todo-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-3); background: transparent; transition: all .2s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ══ BUDGET ══════════════════════════════════════════════════════════════════════ */
.budget-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 20px; }
.budget-card { border-radius: 14px; padding: 18px; text-align: center; }
.budget-card.inc { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.budget-card.exp { background: linear-gradient(135deg, #fee2e2, #fecaca); }
.budget-card.bal { background: linear-gradient(135deg, rgba(99,102,241,.1), rgba(99,102,241,.06)); }
.budget-amount { font-size: 20px; font-weight: 700; }
.budget-card.inc .budget-amount { color: #16a34a; }
.budget-card.exp .budget-amount { color: var(--danger); }
.budget-card.bal .budget-amount { color: var(--primary); }
.budget-label { font-size: 12px; color: var(--text-2); margin-top: 4px; font-weight: 600; }
.tx-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 11px; border: 1px solid var(--border); background: white; margin-bottom: 8px;
  transition: all .2s;
}
.tx-item:hover { border-color: var(--primary); }
.tx-dot { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.tx-dot.inc { background: rgba(34,197,94,.12); }
.tx-dot.exp { background: rgba(239,68,68,.12); }
.tx-info { flex: 1; min-width: 0; }
.tx-cat { font-size: 13px; font-weight: 600; color: var(--text); }
.tx-desc { font-size: 11px; color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-right { text-align: right; flex-shrink: 0; }
.tx-amount { font-size: 15px; font-weight: 700; }
.tx-amount.inc { color: #16a34a; }
.tx-amount.exp { color: var(--danger); }
.tx-date { font-size: 11px; color: var(--text-3); }

/* ══ MEMO ══════════════════════════════════════════════════════════════════════ */
.memo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.memo-card {
  border-radius: 14px; padding: 16px; border: 1px solid var(--border); cursor: pointer;
  transition: all .2s; position: relative; min-height: 120px;
}
.memo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.memo-card.pinned::after { content: '📌'; position: absolute; top: 10px; right: 12px; font-size: 16px; }
.memo-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.memo-content { font-size: 12px; color: var(--text-2); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.memo-date { font-size: 10px; color: var(--text-3); margin-top: 10px; }

/* ══ SHOPPING ══════════════════════════════════════════════════════════════════ */
.shop-layout { display: flex; gap: 20px; }
.shop-lists { width: 220px; flex-shrink: 0; }
.shop-items { flex: 1; min-width: 0; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; transition: all .2s; margin-bottom: 4px;
  font-size: 14px; font-weight: 500; color: var(--text-2);
}
.list-item:hover { background: var(--surface2); color: var(--text); }
.list-item.selected { background: rgba(99,102,241,.1); color: var(--primary); font-weight: 700; }
.shop-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--border); background: white; margin-bottom: 6px; transition: all .2s;
}
.shop-item.checked { opacity: .55; }
.shop-cb {
  width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: all .2s;
}
.shop-cb.done { background: var(--success); border-color: var(--success); color: white; }
.shop-name { flex: 1; font-size: 13px; font-weight: 500; }
.shop-item.checked .shop-name { text-decoration: line-through; }
.shop-total { padding: 12px 16px; background: rgba(99,102,241,.07); border-radius: 10px; margin-top: 12px; display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; }

/* ══ WEATHER ══════════════════════════════════════════════════════════════════ */
.weather-main {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
  border-radius: 20px; padding: 28px; color: white; margin-bottom: 20px; position: relative; overflow: hidden;
}
.weather-main::before {
  content: ''; position: absolute; top: -50%; right: -10%; width: 300px; height: 300px;
  background: rgba(255,255,255,.08); border-radius: 50%;
}
.weather-city { font-size: 14px; opacity: .8; margin-bottom: 4px; }
.weather-temp { font-size: 64px; font-weight: 300; line-height: 1; }
.weather-desc { font-size: 16px; opacity: .9; margin-top: 4px; }
.weather-sub { display: flex; gap: 20px; margin-top: 16px; font-size: 13px; opacity: .85; }
.weather-sub span { display: flex; align-items: center; gap: 4px; }
.forecast-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.forecast-scroll::-webkit-scrollbar { height: 4px; }
.forecast-scroll::-webkit-scrollbar-track { background: var(--bg); }
.forecast-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.forecast-card {
  flex-shrink: 0; background: white; border-radius: 12px; padding: 14px 16px; text-align: center;
  border: 1px solid var(--border); min-width: 90px;
}
.forecast-day { font-size: 12px; font-weight: 700; color: var(--text-3); margin-bottom: 6px; }
.forecast-emoji { font-size: 24px; margin-bottom: 6px; }
.forecast-temp { font-size: 13px; font-weight: 700; color: var(--text); }
.forecast-minmax { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.city-search { display: flex; gap: 8px; margin-bottom: 16px; }
.city-search input {
  flex: 1; padding: 10px 14px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 14px; background: white;
}
.city-search input:focus { border-color: var(--primary); }
.city-results { display: flex; flex-direction: column; gap: 6px; }
.city-result-item {
  padding: 8px 12px; background: white; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: all .2s;
}
.city-result-item:hover { border-color: var(--primary); background: rgba(99,102,241,.05); }

/* ══ CONVERTER ══════════════════════════════════════════════════════════════════ */
.conv-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.conv-tab { padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface2); transition: all .2s; }
.conv-tab.active { background: var(--primary); color: white; }
.conv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.conv-item label { display: block; font-size: 11px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.conv-item input {
  width: 100%; padding: 10px 12px; border: 2px solid var(--border); border-radius: 9px;
  font-size: 15px; font-weight: 600; background: var(--bg); color: var(--text);
}
.conv-item input:focus { border-color: var(--primary); background: white; }

/* ══ ANALYTICS ══════════════════════════════════════════════════════════════════ */
.chart-container { position: relative; height: 220px; }

/* ══ SCROLLBAR ══════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ══ RESPONSIVE ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.15); }
  .mobile-header { display: flex; }
  .main-content { margin-left: 0; padding: 72px 14px 14px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .dash-row { grid-template-columns: 1fr; }
  .budget-summary { grid-template-columns: 1fr; }
  .cal-cell { min-height: 56px; }
  .cal-layout { flex-direction: column; }
  .cal-sidebar { width: 100%; }
  .shop-layout { flex-direction: column; }
  .shop-lists { width: 100%; }
  .weather-temp { font-size: 48px; }
  .modal-box { padding: 20px; }
  .toast { font-size: 13px; padding: 10px 14px; }
  #toastContainer { right: 12px; bottom: 12px; left: 12px; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .conv-grid { grid-template-columns: 1fr 1fr; }
  .cal-event { display: none; }
  .cal-cell { min-height: 40px; }
}

/* ══ STOCKS ══════════════════════════════════════════════════════════════════════ */
/* ══ STOCKS ════════════════════════════════════════════════════════════════ */
.stock-search-wrap {
  position: relative; margin-bottom: 20px;
}
.stock-search-box {
  position: relative; display: flex; align-items: center;
}
.stock-search-input {
  width: 100%; padding: 14px 44px 14px 44px; border: 2px solid var(--border); border-radius: 14px;
  font-size: 15px; background: white; color: var(--text); transition: border .2s; box-sizing: border-box;
  -webkit-appearance: none;
}
.stock-search-input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.12); outline: none;
}
.stock-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: white;
  border: 1.5px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.14);
  z-index: 100; max-height: 380px; overflow-y: auto;
}
.stock-dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s;
}
.stock-dropdown-item:first-child { border-radius: 14px 14px 0 0; }
.stock-dropdown-item:last-child { border-bottom: none; border-radius: 0 0 14px 14px; }
.stock-dropdown-item:hover { background: rgba(99,102,241,.06); }
.stock-dd-symbol {
  font-size: 12px; font-weight: 700; color: var(--primary); min-width: 80px;
  background: rgba(99,102,241,.1); padding: 3px 8px; border-radius: 6px; text-align: center;
  white-space: nowrap;
}
.stock-dd-name { font-size: 13px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-dd-exch { font-size: 11px; color: var(--text-3); flex-shrink: 0; }

/* 주식 카드 */
.stock-card {
  background: white; border-radius: 14px; padding: 15px 16px;
  border: 1.5px solid var(--border); transition: all .2s; position: relative; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.stock-card:hover { border-color: var(--primary); box-shadow: 0 4px 20px rgba(99,102,241,.12); transform: translateY(-1px); }
.stock-card:active { transform: translateY(0); }
.stock-card-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.stock-card-logo {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; letter-spacing: -.5px;
}
.stock-card-logo.up   { background: rgba(239,68,68,.1);  color: #ef4444; }
.stock-card-logo.down { background: rgba(59,130,246,.1); color: #3b82f6; }
.stock-card-logo.flat { background: rgba(99,102,241,.1); color: var(--primary); }
.stock-card-info { min-width: 0; flex: 1; }
.stock-card-symbol { font-size: 14px; font-weight: 700; color: var(--text); }
.stock-card-name {
  font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 2px;
}
.stock-card-exch { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.stock-card-right { text-align: right; flex-shrink: 0; }
.stock-price { font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; }
.stock-change { font-size: 12px; font-weight: 600; margin-top: 2px; white-space: nowrap; }
.stock-change.up   { color: #ef4444; }
.stock-change.down { color: #3b82f6; }
.stock-change.flat { color: var(--text-3); }

/* 즐겨찾기 별 버튼 */
.star-btn {
  width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; background: none; border: none; cursor: pointer;
  transition: all .2s; flex-shrink: 0; color: #d1d5db; line-height: 1; padding: 0;
}
.star-btn:hover { background: #fef9c3; color: #f59e0b; transform: scale(1.15); }
.star-btn.starred { color: #f59e0b; }
.star-btn.starred:hover { background: #fee2e2; color: #ef4444; }

/* 즐겨찾기 버튼 (상세 패널) */
.btn-fav-on {
  background: #fef9c3; color: #92400e; border: 1.5px solid #fde68a;
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.btn-fav-on:hover { background: #fee2e2; color: #ef4444; border-color: #fca5a5; }
.btn-fav-off {
  background: var(--primary); color: white; border: 1.5px solid var(--primary);
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.btn-fav-off:hover { opacity: .9; }

/* 주식 상세 패널 */
.stock-detail-card {
  background: white; border-radius: 16px; border: 1.5px solid var(--border);
  overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.stock-detail-header {
  padding: 20px 22px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99,102,241,.05), rgba(99,102,241,.01));
}
.stock-detail-price {
  font-size: 38px; font-weight: 200; line-height: 1; letter-spacing: -1px;
}
.stock-detail-price.up   { color: #ef4444; }
.stock-detail-price.down { color: #3b82f6; }
.stock-detail-price.flat { color: var(--text); }
.stock-detail-change { font-size: 15px; font-weight: 600; margin-top: 5px; }
.stock-detail-change.up   { color: #ef4444; }
.stock-detail-change.down { color: #3b82f6; }
.stock-detail-change.flat { color: var(--text-3); }
.stock-detail-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 480px) {
  .stock-detail-stats { grid-template-columns: repeat(2, 1fr); }
}
.stock-stat-item {
  padding: 14px 18px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.stock-stat-item:nth-child(3n) { border-right: none; }
.stock-stat-item:nth-last-child(-n+3) { border-bottom: none; }
@media (max-width: 480px) {
  .stock-stat-item:nth-child(3n) { border-right: 1px solid var(--border); }
  .stock-stat-item:nth-child(2n) { border-right: none; }
  .stock-stat-item:nth-last-child(-n+3) { border-bottom: 1px solid var(--border); }
  .stock-stat-item:nth-last-child(-n+2) { border-bottom: none; }
}
.stock-stat-label { font-size: 11px; color: var(--text-3); margin-bottom: 5px; letter-spacing: .2px; }
.stock-stat-value { font-size: 14px; font-weight: 700; color: var(--text); }

.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.stock-loading { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; padding: 8px 0; }

/* empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

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

/* ══ COINS ═════════════════════════════════════════════════════════════════ */
.coin-logo {
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 900; flex-shrink: 0;
  letter-spacing: -.5px; font-family: 'Courier New', monospace;
}
.coin-logo.up   { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #ef4444; }
.coin-logo.down { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #3b82f6; }
.coin-logo.flat { background: linear-gradient(135deg, #fef9c3, #fef08a); color: #d97706; }
.coin-card .stock-card-symbol { font-size: 14px; font-weight: 700; }
.coin-badge {
  display: inline-block; font-size: 9px; font-weight: 700; color: #d97706;
  background: #fef9c3; padding: 1px 5px; border-radius: 3px; margin-top: 3px;
  letter-spacing: .3px;
}

/* color picker row */
.color-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.color-dot {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all .15s;
}
.color-dot.selected { border-color: var(--text); transform: scale(1.15); }

/* tag type toggle */
.type-toggle { display: flex; border-radius: 10px; overflow: hidden; border: 2px solid var(--border); }
.type-btn { flex: 1; padding: 9px; font-size: 13px; font-weight: 600; transition: all .2s; text-align: center; }
.type-btn.inc.active { background: #dcfce7; color: #16a34a; }
.type-btn.exp.active { background: #fee2e2; color: var(--danger); }

/* ══ TRANSLATOR ══════════════════════════════════════════════════════════════ */
.trans-wrap { padding: 0 4px; }
.trans-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.trans-lang-sel { flex: 1; padding: 10px 8px; border: 2px solid var(--border); border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text); background: var(--card); cursor: pointer; }
.trans-swap-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; transition: transform .2s; }
.trans-swap-btn:hover { transform: rotate(180deg); }
.trans-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media(max-width:600px) { .trans-body { grid-template-columns: 1fr; } }
.trans-input-wrap, .trans-output-wrap { background: var(--card); border: 2px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; min-height: 160px; }
.trans-textarea { flex: 1; border: none; outline: none; resize: none; font-size: 16px; color: var(--text); background: transparent; line-height: 1.6; }
.trans-output { flex: 1; font-size: 16px; line-height: 1.6; min-height: 80px; }
.trans-input-footer, .trans-output-footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.trans-tts-btn, .trans-clear-btn, .trans-copy-btn { width: 32px; height: 32px; border-radius: 8px; border: none; cursor: pointer; background: var(--bg); color: var(--sub); font-size: 13px; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.trans-tts-btn:hover, .trans-copy-btn:hover { background: var(--primary); color: white; }

/* ══ DICTIONARY ══════════════════════════════════════════════════════════════ */
.dict-wrap { padding: 0 4px; }
.dict-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.dict-tab { flex: 1; padding: 9px; border: 2px solid var(--border); border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--card); color: var(--sub); transition: all .15s; text-align: center; }
.dict-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.dict-search-row { display: flex; gap: 8px; margin-bottom: 16px; }
.dict-input { flex: 1; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; font-size: 16px; outline: none; background: var(--card); color: var(--text); }
.dict-input:focus { border-color: var(--primary); }
.dict-result { margin-bottom: 20px; }
.dict-entry { background: var(--card); border-radius: 16px; padding: 18px; border: 2px solid var(--border); }
.dict-word { font-size: 28px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.dict-phonetic { font-size: 14px; color: var(--sub); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.dict-play-btn { background: var(--primary); color: white; border: none; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.dict-pos { display: inline-block; background: var(--primary); color: white; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 20px; margin: 10px 0 8px; text-transform: uppercase; }
.dict-def { display: flex; gap: 10px; margin-bottom: 8px; align-items: flex-start; }
.dict-def-num { width: 22px; height: 22px; background: #f1f5f9; border-radius: 50%; font-size: 12px; font-weight: 700; color: var(--sub); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.dict-def-text { font-size: 15px; color: var(--text); line-height: 1.5; }
.dict-example { font-size: 13px; color: var(--sub); font-style: italic; margin-top: 4px; padding-left: 4px; border-left: 2px solid var(--primary); }
.dict-vocab-wrap { background: var(--card); border-radius: 16px; padding: 16px; border: 2px solid var(--border); }
.dict-vocab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 700; font-size: 14px; color: var(--text); }
.dict-lang-mini { padding: 4px 8px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 12px; background: var(--bg); color: var(--text); cursor: pointer; }
.vocab-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.vocab-item:last-child { border-bottom: none; }
.vocab-word { font-weight: 700; font-size: 15px; color: var(--primary); cursor: pointer; min-width: 80px; }
.vocab-meaning { flex: 1; font-size: 13px; color: var(--sub); }
.vocab-del { background: none; border: none; color: #cbd5e1; cursor: pointer; font-size: 13px; padding: 4px; }
.vocab-del:hover { color: var(--danger); }

/* ══ STUDY ═══════════════════════════════════════════════════════════════════ */
.study-wrap { padding: 0 4px; }
.study-section-title { font-size: 13px; font-weight: 700; color: var(--sub); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.study-cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
@media(max-width:400px) { .study-cat-grid { grid-template-columns: repeat(2,1fr); } }
.study-cat-card { background: var(--card); border-radius: 14px; padding: 16px 10px; text-align: center; cursor: pointer; border: 2px solid var(--border); transition: all .15s; position: relative; }
.study-cat-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.study-cat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin: 0 auto 8px; }
.study-cat-name { font-size: 13px; font-weight: 600; color: var(--text); }
.study-cat-add { border-style: dashed; }
.study-del-btn { position: absolute; top: 6px; right: 6px; background: none; border: none; color: #cbd5e1; cursor: pointer; font-size: 12px; padding: 2px 4px; }
.study-del-btn:hover { color: var(--danger); }
.study-sub-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 16px; }
.study-sub-card { background: var(--card); border-radius: 12px; padding: 18px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; border: 2px solid var(--border); transition: all .15s; font-size: 15px; font-weight: 600; color: var(--text); }
.study-sub-card:hover { border-color: var(--primary); background: #eef2ff; }
.study-sub-card i { font-size: 20px; color: var(--primary); }
.study-topic-list { display: flex; flex-direction: column; gap: 8px; }
.study-topic-card { background: var(--card); border-radius: 14px; padding: 16px; display: flex; align-items: center; gap: 14px; cursor: pointer; border: 2px solid var(--border); transition: all .15s; }
.study-topic-card:hover { border-color: var(--primary); }
.study-topic-icon { width: 44px; height: 44px; background: #eef2ff; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--primary); flex-shrink: 0; }
.study-topic-info { flex: 1; }
.study-topic-name { font-size: 16px; font-weight: 700; color: var(--text); }
.study-topic-meta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.phrase-progress { height: 4px; background: var(--border); border-radius: 4px; margin-bottom: 6px; overflow: hidden; }
.phrase-progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.phrase-counter { text-align: center; font-size: 12px; color: var(--sub); margin-bottom: 16px; }
.phrase-card { background: var(--card); border-radius: 20px; padding: 28px 20px; border: 2px solid var(--border); text-align: center; margin-bottom: 16px; }
.phrase-en { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.5; margin-bottom: 14px; }
.phrase-word { cursor: pointer; display: inline; padding: 2px 3px; border-radius: 4px; transition: background .15s; }
.phrase-word:hover { background: #eef2ff; color: var(--primary); }
.phrase-tts-btn { background: var(--primary); color: white; border: none; border-radius: 10px; padding: 8px 18px; cursor: pointer; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.phrase-ko { font-size: 16px; color: var(--sub); margin-top: 8px; }
.phrase-nav { display: flex; gap: 10px; }
.phrase-nav-btn { flex: 1; padding: 12px; }
.word-popup { background: #1e293b; color: white; border-radius: 12px; padding: 14px 16px; margin-top: 14px; text-align: left; }
.word-popup-word { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.word-popup-meaning { font-size: 13px; color: #94a3b8; margin-bottom: 4px; }
.word-popup-ex { font-size: 12px; color: #64748b; font-style: italic; margin-top: 4px; }
.study-note-card { background: var(--card); border-radius: 12px; padding: 14px 16px; border: 2px solid var(--border); margin-bottom: 8px; position: relative; }
.study-note-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.study-note-content { font-size: 13px; color: var(--sub); line-height: 1.5; }
.back-btn { background: none; border: none; color: var(--sub); cursor: pointer; font-size: 18px; padding: 0 8px 0 0; }
/* ─── 언어 카드 ─── */
.study-lang-list { display: flex; flex-direction: column; gap: 10px; }
.study-lang-card { background: var(--card); border-radius: 16px; padding: 16px 18px; display: flex; align-items: center; gap: 16px; cursor: pointer; border: 2px solid var(--border); transition: all .15s; }
.study-lang-card:hover { border-color: var(--primary); transform: translateX(4px); }
.study-lang-flag { font-size: 36px; flex-shrink: 0; }
.study-lang-info { flex: 1; }
.study-lang-name { font-size: 18px; font-weight: 700; color: var(--text); }
.study-lang-desc { font-size: 12px; color: var(--sub); margin-top: 2px; }
