/* public/css/app.css — Personal OS Design System */
:root {
  --bg: #0c0e14;
  --bg2: #131720;
  --bg3: #1a2030;
  --bg4: #212840;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #e2e8f0;
  --text2: #8892a4;
  --text3: #4a5568;
  --accent: #6366f1;
  --accent2: #818cf8;
  --accent-dim: rgba(99,102,241,0.15);
  --green: #10b981; --green-dim: rgba(16,185,129,0.12);
  --red: #ef4444; --red-dim: rgba(239,68,68,0.12);
  --amber: #f59e0b; --amber-dim: rgba(245,158,11,0.12);
  --blue: #3b82f6; --blue-dim: rgba(59,130,246,0.12);
  --purple: #8b5cf6; --purple-dim: rgba(139,92,246,0.12);
  --radius: 10px; --radius-sm: 6px; --radius-lg: 16px;
  --sidebar-w: 220px;
  --header-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; overflow-x: hidden; }
a { color: var(--accent2); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── SCROLLBAR ──────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── LAYOUT ──────────────────────── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: transform .25s ease;
}
.sidebar-logo {
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 16px; }
.logo-text { font-size: 15px; font-weight: 700; color: var(--text); }
.logo-sub { font-size: 10px; color: var(--text3); letter-spacing: .05em; margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text3); padding: 0 10px; margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text2); font-size: 13.5px; font-weight: 500; transition: all .15s; cursor: pointer;
  margin-bottom: 1px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent2); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--header-h); background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 12px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { flex: 1; padding: 24px; max-width: 1280px; width: 100%; }

/* ── BUTTONS ──────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; border: none; transition: all .15s; cursor: pointer;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #4f46e5; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--bg4); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-ghost { background: none; color: var(--text2); border: none; padding: 6px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--bg3); border-radius: var(--radius-sm); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: var(--bg3); border: 1px solid var(--border); color: var(--text2); font-size: 15px; }
.btn-icon:hover { color: var(--text); border-color: var(--border2); }

/* ── CARDS ──────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-body { padding: 20px 22px; }
.card-header { padding: 16px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14px; font-weight: 700; }
.card-sm { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); }

/* ── STAT CARDS ──────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text2); margin-top: 6px; }
.stat-up { color: var(--green); } .stat-down { color: var(--red); }

/* ── FORMS ──────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; letter-spacing: .03em; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px;
  transition: border-color .15s; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-select option { background: var(--bg3); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.trio { grid-template-columns: 1fr 1fr 1fr; }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }

/* ── TABLE ──────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text3); padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table .actions { display: flex; gap: 4px; }

/* ── BADGES ──────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-amber { background: var(--amber-dim); color: var(--amber); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-gray { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }

/* ── MODAL ──────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow); transform: translateY(8px); transition: transform .2s;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 14px 24px 20px; display: flex; gap: 8px; justify-content: flex-end; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: var(--bg3); }

/* ── TABS ──────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 18px; font-size: 13px; font-weight: 600; color: var(--text2); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s; background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

/* ── HABIT CARD ──────────────────── */
.habit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.habit-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.habit-card.good-habit { border-left: 3px solid var(--green); }
.habit-card.bad-habit { border-left: 3px solid var(--red); }
.habit-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.habit-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.habit-streak { font-size: 12px; color: var(--text2); }
.habit-streak strong { color: var(--amber); }
.habit-week { display: flex; gap: 4px; margin: 10px 0; }
.habit-day { width: 24px; height: 24px; border-radius: 4px; background: var(--bg3); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--text3); }
.habit-day.done-good { background: rgba(16,185,129,.25); border-color: var(--green); color: var(--green); }
.habit-day.done-bad { background: rgba(239,68,68,.25); border-color: var(--red); color: var(--red); }
.checkin-btn { width: 100%; padding: 8px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; border: 1px solid; }
.checkin-btn.good { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.checkin-btn.good.checked { background: var(--green); color: white; }
.checkin-btn.bad { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.checkin-btn.bad.checked { background: var(--red); color: white; }

/* ── CALENDAR ──────────────────── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-header-cell { background: var(--bg3); padding: 8px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); }
.cal-cell { background: var(--bg2); padding: 8px; min-height: 80px; cursor: pointer; transition: background .1s; position: relative; }
.cal-cell:hover { background: var(--bg3); }
.cal-cell.today { background: var(--accent-dim); }
.cal-cell.other-month { opacity: .4; }
.cal-date { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cal-amount { font-size: 11px; color: var(--green); font-weight: 600; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }

/* ── HEAT MAP ──────────────────── */
.heatmap-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--bg3); }
.heat-pos-1 { background: rgba(16,185,129,.2); }
.heat-pos-2 { background: rgba(16,185,129,.4); }
.heat-pos-3 { background: rgba(16,185,129,.6); }
.heat-pos-4 { background: rgba(16,185,129,.85); }
.heat-neg-1 { background: rgba(239,68,68,.2); }
.heat-neg-2 { background: rgba(239,68,68,.4); }
.heat-neg-3 { background: rgba(239,68,68,.6); }
.heat-neg-4 { background: rgba(239,68,68,.85); }

/* ── SCHEDULE ──────────────────── */
.schedule-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.schedule-item:last-child { border-bottom: none; }
.schedule-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.schedule-info { flex: 1; min-width: 0; }
.schedule-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-meta { font-size: 11.5px; color: var(--text2); margin-top: 2px; }
.schedule-amount { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; }

/* ── ALERTS / TOASTS ─────────────── */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius); background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); font-size: 13.5px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px;
  animation: slideIn .25s ease; max-width: 340px; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── EMPTY STATE ─────────────────── */
.empty { text-align: center; padding: 60px 24px; color: var(--text3); }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .6; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.empty-sub { font-size: 13px; margin-bottom: 20px; }

/* ── PROGRESS BAR ─────────────────── */
.progress { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s; }
.progress-bar.green { background: var(--green); }
.progress-bar.red { background: var(--red); }
.progress-bar.amber { background: var(--amber); }

/* ── SEARCH ──────────────────────── */
.search-wrap { position: relative; }
.search-wrap .form-input { padding-left: 36px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 15px; pointer-events: none; }

/* ── PAGINATION ──────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 20px; }
.page-btn { padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: var(--bg2); color: var(--text2); font-size: 12.5px; cursor: pointer; }
.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent2); }

/* ── SIDEBAR BADGE ──────────────── */
.nav-badge { margin-left: auto; background: var(--red); color: white; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

/* ── FAB ──────────────────────── */
.fab { position: fixed; bottom: 24px; right: 24px; width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: white; font-size: 24px; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,102,241,.5); z-index: 200; display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s; }
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(99,102,241,.6); }

/* ── COLOR CHIP ──────────────────── */
.color-chip { display: inline-flex; align-items: center; gap: 6px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── RESPONSIVE ──────────────────── */
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; padding: 4px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .sidebar-overlay.show { display: block; }
  .content { padding: 16px; }
  .form-row, .form-row.trio { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; }
}

/* ── UTILS ──────────────────────── */
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-6{margin-top:24px}
.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}
.gap-2{gap:8px}.gap-3{gap:12px}
.flex{display:flex}.flex-1{flex:1}.items-center{align-items:center}.justify-between{justify-content:space-between}
.text-sm{font-size:12px}.text-xs{font-size:11px}.text-muted{color:var(--text2)}.text-dim{color:var(--text3)}
.font-bold{font-weight:700}.font-semibold{font-weight:600}
.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.w-full{width:100%}.hidden{display:none!important}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.grid-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px}
@media(max-width:640px){.grid-2,.grid-3{grid-template-columns:1fr}}
.section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.section-title{font-size:16px;font-weight:700}
