/* ===== CSS VARIABLES ===== */
:root {
  --bg: #F5F5F5;
  --card: #FFFFFF;
  --accent: #111111;
  --accent-light: #E0E0E0;
  --sidebar: #111111;
  --sidebar-hover: #2A2A2A;
  --sidebar-active: #444444;
  --text: #111111;
  --text-mid: #555555;
  --text-light: #999999;
  --border: #E0E0E0;
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-md: rgba(0, 0, 0, 0.10);
  --radius: 14px;
  --radius-sm: 8px;
  --priority-high: #111111;
  --priority-mid: #666666;
  --priority-low: #AAAAAA;
  --sidebar-w: 220px;
  --transition: 0.2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
}
a { color: inherit; text-decoration: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
img { max-width: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent-light); border-radius: 3px; }

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  position: relative;
  z-index: 10;
  transition: width var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}
.sidebar-logo p {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  user-select: none;
}
.nav-item .nav-icon { font-size: 1.05rem; min-width: 22px; text-align: center; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
}

/* ===== MAIN CONTENT ===== */
#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== PAGES ===== */
.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-header h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
}
.page-header .actions { display: flex; gap: 10px; align-items: center; }

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: 0 4px 20px var(--shadow-md); }
.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  margin-bottom: 10px;
}

/* ===== GRID LAYOUTS ===== */
.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: 14px; }

/* ===== BUTTONS ===== */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #333333; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.btn-ghost { background: transparent; color: var(--text-mid); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #F0F0F0; color: #333333; }
.btn-danger:hover { background: #333333; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon { padding: 7px; border-radius: 50%; }

/* ===== FORM ELEMENTS ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-mid); }
input[type="text"], input[type="number"], input[type="date"],
input[type="time"], select, textarea {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: #fff; }
textarea { resize: vertical; min-height: 80px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  width: min(520px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { font-size: 1.2rem; color: var(--text-light); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== DASHBOARD ===== */
.dash-hero {
  background: linear-gradient(135deg, #111111 0%, #333333 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 4px;
}
.dash-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.dash-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 80px;
  width: 240px; height: 240px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}
.dash-date { font-size: 0.82rem; opacity: 0.65; margin-bottom: 4px; }
.dash-time { font-size: 2.5rem; font-weight: 300; letter-spacing: 3px; margin-bottom: 8px; font-variant-numeric: tabular-nums; opacity: 0.95; }
.dash-greeting { font-size: 1.65rem; font-weight: 700; margin-bottom: 10px; }
.dash-weather {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  backdrop-filter: blur(4px);
  font-size: 0.88rem;
  max-width: 360px;
}
.dash-weather .temp { font-size: 1.3rem; font-weight: 700; }
.dash-weather .weather-desc { opacity: 0.85; }
.dash-weather .humidity { opacity: 0.65; font-size: 0.8rem; }

.dash-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.summary-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 2px 10px var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.summary-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow-md); border-color: var(--accent-light); }
.summary-card .sc-icon { font-size: 1.5rem; margin-bottom: 8px; }
.summary-card .sc-label { font-size: 0.75rem; color: var(--text-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.summary-card .sc-value { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-top: 3px; }
.summary-card .sc-sub { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }

/* ===== TODO ===== */
.todo-filters {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-date { display: flex; align-items: center; gap: 8px; }
.filter-date label { font-size: 0.82rem; color: var(--text-mid); font-weight: 600; }

.todo-section { margin-bottom: 24px; }
.todo-section-header {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-light);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.todo-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  margin-bottom: 8px;
  transition: all var(--transition);
}
.todo-item:hover { border-color: var(--accent-light); box-shadow: 0 2px 8px var(--shadow); }
.todo-item.done { opacity: 0.55; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--text-light); }
.todo-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0; margin-top: 1px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; color: #fff;
}
.todo-item.done .todo-check { background: var(--accent); border-color: var(--accent); }
.todo-item.done .todo-check::after { content: '✓'; }
.todo-priority {
  width: 4px; border-radius: 2px; align-self: stretch; flex-shrink: 0;
}
.priority-high { background: var(--priority-high); }
.priority-mid { background: var(--priority-mid); }
.priority-low { background: var(--priority-low); }
.priority-other { background: #BBBBBB; }
.todo-body { flex: 1; min-width: 0; }
.todo-text { font-size: 0.9rem; font-weight: 500; }
.todo-meta { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; align-items: center; }
.todo-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; background: var(--bg); color: var(--text-mid); font-weight: 600; }
.todo-actions { display: flex; gap: 4px; flex-shrink: 0; }
.todo-actions button { font-size: 0.78rem; padding: 4px 8px; border-radius: 6px; }
.todo-actions .edit-btn { color: var(--text-mid); background: var(--bg); }
.todo-actions .edit-btn:hover { background: var(--accent-light); color: var(--text); }
.todo-actions .del-btn { color: #333333; background: #EEEEEE; }
.todo-actions .del-btn:hover { background: #333333; color: #fff; }

.goals-section { margin-top: 10px; }
.goals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.goal-card {
  background: var(--card); border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); padding: 14px 16px;
}
.goal-type { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.goal-type.short { color: var(--text); }
.goal-type.long { color: var(--text-mid); }
.goal-item { display: flex; align-items: flex-start; gap: 8px; font-size: 0.84rem; color: var(--text-mid); margin-bottom: 5px; }
.goal-item::before { content: '·'; color: var(--text); flex-shrink: 0; margin-top: 1px; }

/* ===== DIET ===== */
.diet-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.meal-group { margin-bottom: 20px; }
.meal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.meal-title {
  font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-light);
  display: flex; align-items: center; gap: 6px;
}
.food-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 10px 14px; border: 1px solid var(--border);
  margin-bottom: 6px;
  transition: all var(--transition);
}
.food-item:hover { border-color: var(--accent-light); }
.food-name { flex: 1; font-size: 0.88rem; font-weight: 500; }
.food-macros { display: flex; gap: 8px; }
.macro-badge {
  font-size: 0.7rem; padding: 2px 7px; border-radius: 20px; font-weight: 600;
  background: var(--bg); color: var(--text-mid);
}
.macro-badge.cal { background: #EEEEEE; color: #222222; }
.macro-badge.prot { background: #E8E8E8; color: #333333; }
.macro-badge.carb { background: #F0F0F0; color: #444444; }
.macro-badge.fat { background: #EBEBEB; color: #555555; }

.nutrition-panel { display: flex; flex-direction: column; gap: 14px; }
.chart-wrap { position: relative; width: 160px; height: 160px; margin: 0 auto; }
.chart-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.chart-center .big { font-size: 1.3rem; font-weight: 700; }
.chart-center .sm { font-size: 0.7rem; color: var(--text-light); }
.macro-bars { display: flex; flex-direction: column; gap: 8px; }
.macro-bar-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.macro-bar-label { width: 50px; color: var(--text-mid); font-weight: 600; }
.macro-bar-track { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; }
.macro-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.macro-bar-val { width: 45px; text-align: right; color: var(--text-light); font-size: 0.75rem; }
.water-tracker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.water-glass {
  width: 28px; height: 28px; border: 2px solid var(--border); border-radius: 4px;
  cursor: pointer; transition: all var(--transition); font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.water-glass.filled { background: #888888; border-color: #555555; }

/* ===== EXERCISE ===== */
.exercise-list { display: flex; flex-direction: column; gap: 10px; }
.exercise-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 14px 16px; border: 1px solid var(--border);
  transition: all var(--transition);
}
.exercise-item:hover { border-color: var(--accent-light); box-shadow: 0 2px 8px var(--shadow); }
.exercise-icon { font-size: 1.5rem; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: var(--radius-sm); }
.exercise-body { flex: 1; }
.exercise-type { font-size: 0.92rem; font-weight: 600; }
.exercise-meta { font-size: 0.78rem; color: var(--text-light); margin-top: 3px; display: flex; gap: 8px; }
.exercise-cal { font-size: 1rem; font-weight: 700; color: var(--text); }

.exercise-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.summary-stat { background: var(--card); border-radius: var(--radius-sm); padding: 14px; text-align: center; border: 1px solid var(--border); }
.summary-stat .val { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.summary-stat .lbl { font-size: 0.75rem; color: var(--text-light); margin-top: 3px; }

/* ===== FINANCE ===== */
.finance-header-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px;
}
.fin-stat { background: var(--card); border-radius: var(--radius); padding: 16px 20px; border: 1px solid var(--border); }
.fin-stat .val { font-size: 1.3rem; font-weight: 700; }
.fin-stat .lbl { font-size: 0.75rem; color: var(--text-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.income-val { color: #333333; }
.expense-val { color: #111111; }
.balance-val { color: var(--text); }

.finance-list { display: flex; flex-direction: column; gap: 8px; }
.finance-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 12px 14px; border: 1px solid var(--border);
  transition: all var(--transition);
}
.finance-item:hover { border-color: var(--accent-light); }
.fin-cat-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.fin-info { flex: 1; }
.fin-cat { font-size: 0.88rem; font-weight: 600; }
.fin-note { font-size: 0.76rem; color: var(--text-light); margin-top: 2px; }
.fin-amount { font-size: 1rem; font-weight: 700; }
.fin-amount.income { color: #333333; }
.fin-amount.expense { color: #111111; }
.fin-time { font-size: 0.73rem; color: var(--text-light); }

/* ===== NOTES ===== */
.notes-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.notes-list { display: flex; flex-direction: column; gap: 8px; }
.note-card {
  background: var(--card); border-radius: var(--radius-sm);
  padding: 12px 14px; border: 1.5px solid var(--border);
  cursor: pointer; transition: all var(--transition);
}
.note-card:hover, .note-card.active { border-color: var(--accent); box-shadow: 0 2px 8px var(--shadow); }
.note-card.active { background: #F0F0F0; }
.note-card-title { font-size: 0.88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-card-preview { font-size: 0.76rem; color: var(--text-light); margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.note-card-meta { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.note-mood { font-size: 0.85rem; }
.note-tag-pill { font-size: 0.68rem; padding: 1px 7px; border-radius: 20px; background: var(--bg); color: var(--text-mid); }
.note-date-label { font-size: 0.7rem; color: var(--text-light); margin-left: auto; }

.note-editor {
  background: var(--card); border-radius: var(--radius);
  border: 1.5px solid var(--border); padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.note-editor-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-editor-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#note-content-editor {
  min-height: 320px; font-family: 'Menlo', 'Consolas', monospace; font-size: 0.88rem; line-height: 1.7;
}
.note-preview {
  min-height: 320px; padding: 12px; font-size: 0.9rem; line-height: 1.8;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
}
.note-preview h1, .note-preview h2, .note-preview h3 { margin-bottom: 10px; color: var(--text); }
.note-preview p { margin-bottom: 8px; color: var(--text-mid); }
.note-preview ul, .note-preview ol { padding-left: 20px; margin-bottom: 8px; }
.note-preview code { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-size: 0.85em; }
.note-preview blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-light); font-style: italic; }
.toggle-preview-btn { margin-left: auto; }

/* ===== STATS ===== */
.stats-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.period-btn {
  padding: 6px 14px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
  background: var(--card); color: var(--text-mid); border: 1.5px solid var(--border);
  cursor: pointer; transition: all var(--transition);
}
.period-btn.active, .period-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.stats-section { margin-bottom: 28px; }
.stats-section-title {
  font-size: 0.9rem; font-weight: 700; color: var(--text-mid);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.stats-section-title::before { content: ''; display: block; width: 4px; height: 16px; background: var(--accent); border-radius: 2px; }
.chart-container { position: relative; height: 240px; }

/* ===== SCHEDULE / CALENDAR ===== */
.schedule-layout { display: grid; grid-template-columns: 1fr 290px; gap: 20px; align-items: start; }

.cal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.cal-month-title { flex: 1; text-align: center; font-size: 1.1rem; font-weight: 700; }
.cal-nav-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border);
  font-size: 1.05rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
.cal-nav-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-weekday {
  text-align: center; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-light); padding: 3px 0 8px;
}
.cal-weekday.weekend { color: #CC2200; }

.cal-day {
  min-height: 78px; padding: 5px 6px; border-radius: 8px;
  background: var(--card); border: 1.5px solid transparent;
  cursor: pointer; transition: all var(--transition);
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
}
.cal-day:hover { border-color: var(--accent-light); box-shadow: 0 2px 8px var(--shadow); }
.cal-day.empty { background: transparent; cursor: default; pointer-events: none; border: none; }
.cal-day.today { border-color: var(--accent) !important; }
.cal-day.selected { background: #F0F0F0 !important; border-color: var(--accent) !important; }
.cal-day.weekend { background: #F8F8F8; }
.cal-day.holiday { background: #F2F2F2; }
.cal-day.weekend.holiday { background: #EEEEEE; }
.cal-day.today.weekend, .cal-day.today.holiday { border-color: var(--accent) !important; }

.cal-day-num {
  font-size: 0.8rem; font-weight: 700;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0;
  color: var(--text);
}
.cal-day.today .cal-day-num { background: var(--accent); color: #fff; }
.cal-day.weekend:not(.today) .cal-day-num { color: #CC2200; }
.cal-day.holiday:not(.today) .cal-day-num { color: #CC2200; }
.cal-day.weekend.holiday:not(.today) .cal-day-num { color: #CC2200; }

.cal-holiday-label {
  font-size: 0.59rem; color: #CC2200; line-height: 1.25;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cal-event-chip {
  font-size: 0.63rem; padding: 1px 5px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff; font-weight: 500; cursor: pointer;
  transition: opacity var(--transition);
}
.cal-event-chip:hover { opacity: 0.85; }
.cal-conflict-badge {
  font-size: 0.58rem; font-weight: 800;
  background: #333333; color: #fff;
  border-radius: 50%; width: 15px; height: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.day-panel {
  background: var(--card); border-radius: var(--radius);
  border: 1.5px solid var(--border); padding: 16px 18px;
  position: sticky; top: 20px;
}
.day-panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 14px; gap: 8px;
}
.day-panel-title { font-size: 0.95rem; font-weight: 700; }

.schedule-event-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  margin-bottom: 8px; transition: all var(--transition);
}
.schedule-event-item:hover { border-color: var(--accent-light); box-shadow: 0 2px 8px var(--shadow); }
.event-color-bar { width: 4px; border-radius: 2px; align-self: stretch; flex-shrink: 0; min-height: 36px; }
.event-info { flex: 1; min-width: 0; }
.event-title { font-size: 0.88rem; font-weight: 600; }
.event-time { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }
.event-note { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }

.conflict-warning {
  display: flex; gap: 8px; align-items: flex-start;
  background: #F5F5F5; border: 1px solid #DDDDDD;
  border-radius: 8px; padding: 9px 12px; margin-bottom: 12px;
  font-size: 0.8rem; color: #333333; line-height: 1.5;
}
.sch-color-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 900px) {
  .schedule-layout { grid-template-columns: 1fr; }
  .day-panel { position: static; }
  .cal-day { min-height: 60px; }
}
@media (max-width: 640px) {
  .cal-day { min-height: 48px; padding: 3px 4px; }
  .cal-event-chip { display: none; }
}

/* ===== DIET ESTIMATION ===== */
.estimate-result {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.estimate-result:hover { background: var(--bg); }
.estimate-result:last-child { border-bottom: none; }
.est-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.est-macros { font-size: 0.74rem; color: var(--text-light); margin-top: 2px; }

/* ===== NOTE IMAGES ===== */
.note-images { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.note-img-wrap { position: relative; }
.note-img-wrap img {
  max-width: 200px; max-height: 150px;
  border-radius: 8px; border: 1.5px solid var(--border);
  object-fit: cover; cursor: zoom-in;
  transition: transform var(--transition);
}
.note-img-wrap img:hover { transform: scale(1.03); }
.note-img-del {
  position: absolute; top: 5px; right: 5px;
  background: rgba(0,0,0,0.55); color: #fff;
  border: none; border-radius: 50%;
  width: 20px; height: 20px; cursor: pointer;
  font-size: 0.65rem; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.note-img-del:hover { background: #333333; }
.note-paste-hint {
  font-size: 0.76rem; color: var(--text-light);
  padding: 10px 14px; text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: 8px; margin-top: 6px;
}

/* ===== TOAST ===== */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 18px; border-radius: var(--radius-sm);
  background: var(--sidebar); color: #fff;
  font-size: 0.84rem; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}
.toast.success { background: #444444; }
.toast.error { background: #111111; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.6; }
.empty-state p { font-size: 0.88rem; }

/* ===== TAGS INPUT ===== */
.tags-input { display: flex; flex-wrap: wrap; gap: 6px; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
.tags-input input { background: none; border: none; outline: none; flex: 1; min-width: 80px; font-size: 0.85rem; padding: 2px 0; }
.tags-input .tag { display: flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; background: var(--accent-light); color: var(--text); font-size: 0.76rem; font-weight: 600; }
.tags-input .tag button { color: var(--text-mid); font-size: 0.8rem; line-height: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  :root { --sidebar-w: 54px; }
  .nav-item span { display: none; }
  .sidebar-logo p, .sidebar-logo h1 { display: none; }
  .sidebar-logo { padding: 16px 12px; }
  #main { padding: 20px 16px; }
  .diet-layout, .notes-layout { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .dash-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .finance-header-stats, .exercise-summary { grid-template-columns: 1fr; }
  .goals-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .dash-greeting { font-size: 1.3rem; }
}

/* ===== SCHEDULE — VIEW SWITCHER ===== */
.sch-view-btn {
  padding: 4px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
  color: var(--text-mid); background: transparent; border: none; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.sch-view-btn.active { background: var(--accent); color: #fff; }
.sch-view-btn:hover:not(.active) { background: var(--accent-light); }

/* ===== SCHEDULE — CATEGORY BUTTONS ===== */
.sch-cat-btn {
  padding: 4px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
  border: 1.5px solid var(--cat, var(--border)); color: var(--cat, var(--text-mid));
  background: transparent; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.sch-cat-btn.active { background: var(--cat, var(--accent)); color: #fff; }
.sch-cat-btn:hover:not(.active) { background: color-mix(in srgb, var(--cat, #111111) 15%, transparent); }

/* ===== SCHEDULE — REMINDER BUTTONS ===== */
.sch-reminder-btn {
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 500;
  border: 1.5px solid var(--border); color: var(--text-light);
  background: transparent; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sch-reminder-btn.active { background: var(--accent-light); color: var(--text); border-color: var(--accent); }

/* ===== WEEK VIEW ===== */
.week-header-cell { text-align: center; padding: 6px 2px; border-right: 1px solid var(--border); }
.week-slot { min-height: 40px; border-right: 1px solid var(--border); padding: 2px; }
.week-event-chip { border-radius: 4px; padding: 2px 5px; cursor: pointer; overflow: hidden; }
.week-event-chip:hover { opacity: 0.85; }
