:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-soft: #f7f3ec;
  --text: #3d3a36;
  --muted: #948d84;
  --border: #ede7dc;

  --primary: #a8c9e8;
  --primary-dark: #7fa8d4;
  --mint: #b7e0c9;
  --pink: #f5cfe0;
  --peach: #fbdcae;
  --lavender: #d7c6ef;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 18px rgba(150, 130, 100, 0.08);
  --shadow-sm: 0 2px 8px rgba(150, 130, 100, 0.06);
}

* { box-sizing: border-box; }

/* ---------- Inline SVG icon-ууд ---------- */
svg.icon {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.2em;
}
svg.icon-lg { width: 1.45em; height: 1.45em; }
svg.icon-xl { width: 2.1em; height: 2.1em; }
svg.icon-title { width: 1em; height: 1em; color: var(--primary-dark); vertical-align: -0.08em; }
svg.icon-inline { vertical-align: -0.22em; opacity: 0.8; }
.empty-state svg.icon { opacity: 0.55; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

/* ---------- Top nav ---------- */
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topnav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--surface-soft); color: var(--text); }
.nav-links a.active { background: var(--primary); color: #fff; }

.logout-form { display: flex; align-items: center; gap: 12px; }
.user-chip { color: var(--muted); font-size: 0.9rem; }

/* ---------- Нүүр хуудас: модулийн panel card ---------- */
.home-hero { margin: 44px 0 28px; }
.home-hero h1 { font-size: 1.9rem; margin: 0 0 6px; }
.home-hero p { color: var(--muted); margin: 0; font-size: 1rem; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}
.module-card {
  --accent: var(--primary);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 26px 24px 22px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.module-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--accent);
}
.module-card:not(.disabled):hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.module-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.module-name { font-size: 1.15rem; font-weight: 700; }
.module-desc { font-size: 0.86rem; color: var(--muted); line-height: 1.5; flex: 1; }
.module-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.module-stats span {
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 0.76rem;
  color: var(--muted);
}
.module-go { margin-top: 12px; font-size: 0.86rem; font-weight: 600; color: var(--primary-dark); }
.module-card.disabled { opacity: 0.62; }
.module-card.disabled .module-icon { filter: grayscale(0.35); }
.module-soon {
  margin-top: 12px;
  align-self: flex-start;
  background: var(--surface-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 600;
}

/* Модуль доторх дээд цэс */
.module-back {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.module-back:hover { background: var(--surface-soft); color: var(--text); }
.module-chip {
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 5px 13px;
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--text); }
.btn-danger { background: #fbe2e2; color: #b5524a; }
.btn-danger:hover { background: #f7cfcf; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

/* ---------- Login ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eaf3fb 0%, #fbf8f3 45%, #fdf1f6 100%);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  text-align: center;
}
.auth-card h1 { font-size: 1.6rem; margin: 0 0 4px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 28px; font-size: 0.95rem; }
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}
.error-msg {
  background: #fbe2e2;
  color: #b5524a;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

/* ---------- Page header ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head p { color: var(--muted); margin: 4px 0 0; font-size: 0.92rem; }

/* ---------- Stat pills ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-pill .num { font-size: 1.6rem; font-weight: 700; }
.stat-pill .label { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* ---------- Todos ---------- */
.todo-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.todo-item.done { opacity: 0.55; }
.todo-item.done .todo-text { text-decoration: line-through; }
.todo-checkbox {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--surface-soft);
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
}
.todo-checkbox:checked { background: var(--mint); border-color: var(--mint); }
.todo-checkbox:checked::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 700; }
.todo-text { flex: 1; font-size: 0.94rem; }
.todo-due {
  font-size: 0.76rem;
  color: var(--muted);
  background: var(--surface-soft);
  padding: 2px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}
.todo-due.overdue { background: #fbe2e2; color: #b5524a; }
.todo-add-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.todo-add-form .field { margin-bottom: 0; flex: 1; min-width: 180px; }
.todo-add-form .field.date-field { flex: 0 0 160px; min-width: 140px; }

/* ---------- Note rows (title-only list) ---------- */
.note-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 18px;
  box-shadow: var(--shadow-sm);
}
.note-row-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-row-title:hover { color: var(--primary-dark); text-decoration: underline; }
.note-row-date { color: var(--muted); font-size: 0.78rem; flex-shrink: 0; }

/* ---------- Note attachments (авсаархан хэлбэр) ---------- */
.attach-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 14px;
  overflow: hidden;
}
.attach-panel > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}
.attach-panel > summary::-webkit-details-marker { display: none; }
.attach-panel > summary::after { content: "▾"; margin-left: auto; font-size: 0.75rem; }
.attach-panel[open] > summary::after { content: "▴"; }
.attach-panel > summary:hover { color: var(--text); background: var(--surface-soft); }
.attach-count {
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.76rem;
  color: var(--muted);
}
.attach-body { padding: 4px 18px 16px; border-top: 1px solid var(--border); }
.attach-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; }
.attach-upload input[type="file"] { font-size: 0.82rem; max-width: 320px; }

.attach-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.attach-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 6px 3px 4px;
  max-width: 230px;
}
.attach-chip > a { display: flex; align-items: center; gap: 7px; min-width: 0; }
.attach-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.attach-icon { width: 26px; text-align: center; font-size: 0.9rem; }
.attach-name {
  font-size: 0.78rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-chip:hover .attach-name { color: var(--primary-dark); }
.attach-remove {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 4px;
  line-height: 1;
}
.attach-remove:hover { color: #b5524a; }

/* ---------- Panel launcher (course detail) ---------- */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0 8px;
}
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
  text-decoration: none;
}
.panel-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.panel-card:active { transform: translateY(-1px); }
.panel-card .icon { font-size: 1.8rem; }
.panel-card .title { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.panel-card .count { color: var(--muted); font-size: 0.85rem; }

/* ---------- Course grid ---------- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-top: 6px solid var(--course-color, var(--primary));
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.course-card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.course-card p.desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 14px;
  min-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.course-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .icon { font-size: 2.4rem; margin-bottom: 12px; }

/* ---------- Course detail / notes ---------- */
.course-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.color-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--course-color, var(--primary));
  flex-shrink: 0;
}
.notes-list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.note-card h4 { margin: 0 0 8px; font-size: 1.02rem; }
.note-card .note-body {
  white-space: pre-wrap;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 10px;
}
.note-meta { color: var(--muted); font-size: 0.78rem; display: flex; justify-content: space-between; align-items: center; }
.note-actions { display: flex; gap: 8px; }

.color-swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
}
.swatch.selected { border-color: var(--text); }
.swatch input { display: none; }

.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- Timer ---------- */
.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 20px 0; }
.timer-modes {
  display: flex;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  padding: 5px;
  gap: 4px;
}
.timer-modes button {
  border: none;
  background: transparent;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.timer-modes button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.timer-circle {
  width: 280px; height: 280px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.timer-circle svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.timer-display { font-size: 3.2rem; font-weight: 700; z-index: 1; font-variant-numeric: tabular-nums; }
.timer-sub { color: var(--muted); font-size: 0.85rem; margin-top: 6px; z-index: 1; }
.timer-inner-text { display: flex; flex-direction: column; align-items: center; }

.timer-controls { display: flex; gap: 12px; }
.timer-controls .btn { min-width: 110px; }

.timer-settings {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: center;
}
.timer-settings .field { margin-bottom: 0; min-width: 160px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-soft);
  color: var(--muted);
}
.badge-pomodoro { background: #fde2b0aa; color: #8a5a12; }
.badge-deepwork { background: #d7c4f0aa; color: #5c3d8f; }

/* ---------- Stats ---------- */
.stats-section { margin-top: 32px; }
.stats-section h2 { font-size: 1.1rem; margin-bottom: 14px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 10px 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar {
  width: 100%;
  max-width: 26px;
  border-radius: 6px 6px 0 0;
  background: var(--primary);
  transition: height 0.3s;
}
.bar-label { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

.course-bars { display: flex; flex-direction: column; gap: 12px; }
.course-bar-row { display: flex; align-items: center; gap: 12px; }
.course-bar-row .name { width: 140px; font-size: 0.88rem; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-bar-track { flex: 1; background: var(--surface-soft); border-radius: 999px; height: 14px; overflow: hidden; }
.course-bar-fill { height: 100%; border-radius: 999px; }
.course-bar-row .val { width: 70px; text-align: right; font-size: 0.82rem; color: var(--muted); flex-shrink: 0; }

.type-split { display: flex; gap: 16px; }
.type-card { flex: 1; border-radius: var(--radius-md); padding: 18px; text-align: center; }
.type-card.pomodoro { background: #fdf1dd; }
.type-card.deepwork { background: #f1e8fa; }
.type-card .num { font-size: 1.5rem; font-weight: 700; }
.type-card .label { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

.streak-banner {
  background: linear-gradient(120deg, var(--mint), var(--primary));
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.streak-banner .flame { font-size: 2rem; }
.streak-banner .num { font-size: 1.5rem; font-weight: 700; }
.streak-banner .label { font-size: 0.85rem; opacity: 0.9; }

.course-bar-play {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.course-bar-play:hover { background: var(--primary); transform: scale(1.08); }
.course-bar-play.placeholder { background: none; }

/* ---------- Хогийн сав ---------- */
.trash-list { display: flex; flex-direction: column; gap: 12px; }
.trash-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  flex-wrap: wrap;
}
.trash-info { flex: 1; min-width: 160px; }
.trash-name { font-weight: 600; font-size: 0.96rem; }
.trash-meta { font-size: 0.76rem; color: var(--muted); margin-top: 3px; }
.trash-countdown {
  font-size: 0.76rem;
  background: var(--surface-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}
.trash-countdown.urgent { background: #fbe2e2; color: #b5524a; font-weight: 600; }
.trash-actions { display: flex; gap: 8px; }

/* ---------- Сүүлийн сешнүүд ---------- */
.session-list { display: flex; flex-direction: column; }
.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--border);
}
.session-row:last-child { border-bottom: none; }
.session-type { font-size: 1rem; }
.session-course { flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; }
.session-course > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.session-time { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.session-minutes { font-weight: 600; width: 62px; text-align: right; font-variant-numeric: tabular-nums; }
.session-flag { font-size: 0.72rem; border-radius: 999px; padding: 2px 9px; width: 84px; text-align: center; }
.session-flag.done { background: #e6f5ec; color: #3f8f62; }
.session-flag.partial { background: var(--surface-soft); color: var(--muted); }

.today-chip { font-weight: 500; }
.today-chip strong { font-size: 1.05rem; }

/* ---------- Navbar дээрх бяцхан timer ---------- */
.mini-timer {
  --mini-color: var(--primary);
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px 4px 4px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.mini-timer[hidden] { display: none; }
.mini-timer-main { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 2px; }
.mini-timer-face {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--mini-color);
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  animation: mini-pulse 2.4s ease-in-out infinite;
}
.mini-timer.paused .mini-timer-face { animation: none; opacity: 0.65; }
.mini-timer-text { display: flex; flex-direction: column; line-height: 1.1; }
.mini-timer-time { font-size: 0.92rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-timer-label { font-size: 0.62rem; color: var(--muted); }
.mini-timer-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  line-height: 1;
  font-family: inherit;
}
.mini-timer-btn:hover { background: var(--surface); color: var(--text); }
.mini-timer-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--border);
}
.mini-timer-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.5s linear;
}

@keyframes mini-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.09); }
}

/* ---------- Timer дуусахад гарах мэдэгдэл ---------- */
.timer-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  font-size: 0.9rem;
  max-width: 320px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
}
.timer-toast.show { opacity: 1; transform: translateY(0); }
.timer-toast-face { font-size: 1.2rem; }

/* ---------- Утсан дээрх доод цэс (mobile app маягийн) ---------- */
.bottom-nav { display: none; }

@media (max-width: 760px) {
  /* Дээд цэсийг доод мөр рүү шилжүүлж, толгой хэсгийг авсаархан болгоно */
  .topnav-inner { padding: 10px 16px; gap: 10px; }
  .nav-links,
  .module-back,
  .module-chip,
  .user-chip { display: none; }
  .brand { font-size: 1rem; flex: 1; }
  .logout-form .btn { padding: 7px 13px; font-size: 0.85rem; }
  .page { padding: 0 16px 92px; }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(150, 130, 100, 0.10);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 600;
    transition: color 0.15s, background 0.15s;
  }
  .bottom-nav-item:active { background: var(--surface-soft); }
  .bottom-nav-icon {
    font-size: 1.15rem;
    line-height: 1;
    width: 34px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    transition: background 0.15s;
  }
  .bottom-nav-item.active { color: var(--primary-dark); }
  .bottom-nav-item.active .bottom-nav-icon { background: var(--surface-soft); }
  .bottom-nav-label { white-space: nowrap; }

  /* Мэдэгдэл доод цэсийг бүтээхгүй байх */
  .timer-toast { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); max-width: none; }
}

@media (max-width: 640px) {
  .course-bar-row .name { width: 90px; }
  .mini-timer-label { display: none; }
  .mini-timer { padding: 3px 4px 3px 3px; }
  .mini-timer-face { width: 26px; height: 26px; font-size: 0.85rem; }
  .page-head { margin: 22px 0 16px; }
  .page-head h1 { font-size: 1.28rem; }
  .home-hero { margin: 28px 0 20px; }
  .home-hero h1 { font-size: 1.5rem; }
  .module-grid { grid-template-columns: 1fr; gap: 14px; }
  .module-card { padding: 20px 18px 18px; }
  .card { padding: 18px; }
  .stat-row { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
  .type-split { flex-direction: column; }
  .session-flag { display: none; }
  .rte-toolbar { position: static; }
  .timer-modes { flex-wrap: wrap; justify-content: center; max-width: 100%; }
  .timer-modes button { padding: 8px 13px; font-size: 0.82rem; white-space: nowrap; }
  .timer-circle { width: 230px; height: 230px; }
  .timer-circle svg { width: 230px; height: 230px; }
  .timer-display { font-size: 2.6rem; }
  .timer-controls { flex-wrap: wrap; justify-content: center; }
  .timer-controls .btn { min-width: 92px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* ---------- Rendered markdown (note view) ---------- */
.note-rendered { font-size: 1rem; line-height: 1.7; color: var(--text); }
.note-rendered h1, .note-rendered h2, .note-rendered h3 {
  margin: 1.2em 0 0.5em;
  line-height: 1.3;
}
.note-rendered h1:first-child, .note-rendered h2:first-child, .note-rendered h3:first-child { margin-top: 0; }
.note-rendered h1 { font-size: 1.5rem; }
.note-rendered h2 { font-size: 1.25rem; }
.note-rendered h3 { font-size: 1.08rem; }
.note-rendered p { margin: 0 0 1em; }
.note-rendered ul, .note-rendered ol { margin: 0 0 1em; padding-left: 1.4em; }
.note-rendered li { margin-bottom: 0.3em; }
.note-rendered blockquote {
  margin: 0 0 1em;
  padding: 4px 16px;
  border-left: 3px solid var(--primary);
  background: var(--surface-soft);
  color: var(--muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.note-rendered code {
  background: var(--surface-soft);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88em;
}
.note-rendered pre {
  background: var(--surface-soft);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0 0 1em;
}
.note-rendered pre code { background: none; padding: 0; }
.note-rendered img { max-width: 100%; border-radius: var(--radius-sm); margin: 0.4em 0; }
.note-rendered a { color: var(--primary-dark); text-decoration: underline; }
.note-rendered hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.note-rendered table { border-collapse: collapse; width: 100%; margin: 0 0 1em; }
.note-rendered th, .note-rendered td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.note-rendered input[type="checkbox"] { margin-right: 6px; }
.empty-note { color: var(--muted); font-style: italic; }
.print-only-img { display: none; }

/* ---------- Rich text editor (OneNote маягийн) ---------- */
.note-title-input {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  border: none !important;
  border-bottom: 2px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 6px 2px !important;
  background: transparent !important;
}
.note-title-input:focus { border-bottom-color: var(--primary) !important; outline: none; }

.rte { position: relative; }
.rte-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  margin-bottom: 10px;
}
.rte-toolbar select {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0 4px;
  cursor: pointer;
}
.rte-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.rte-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.86rem;
  font-family: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.rte-btn:hover { background: var(--surface); border-color: var(--border); }
.rte-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.rte-btn-wide { padding: 0 10px; font-size: 0.82rem; }
.rte-color {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.86rem;
}
.rte-color:hover { background: var(--surface); }
.rte-color input[type="color"] {
  width: 22px;
  height: 20px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

/* Чөлөөт байрлалтай хуудас — дарсан газраа бичнэ */
.nb-canvas { position: relative; }
/* Өргөн нь бичсэн текстээсээ хамаарч томорно; гараар чирвэл тогтмол өргөн болно */
.nb-box {
  position: absolute;
  padding: 8px 10px;
  width: max-content;
  min-width: 90px;
  max-width: 560px;
  line-height: 1.7;
  overflow-wrap: break-word;
}
.nb-media { padding: 5px; }
.nb-media img, .nb-media video { display: block; width: 100%; height: auto; }
.nb-box > *:first-child { margin-top: 0; }
.nb-box > *:last-child { margin-bottom: 0; }

.nb-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }

.rte-canvas {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 26px 26px;
  cursor: text;
  overflow: auto;
  resize: both;
  min-width: 320px;
  min-height: 240px;
}

.rte-sizebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.rte-size-group { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.rte-size-group select {
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0 4px;
  cursor: pointer;
}
.rte-size-readout {
  font-variant-numeric: tabular-nums;
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 3px 10px;
}
.rte-canvas.drag-over { border-color: var(--primary); }
.rte-canvas .nb-box {
  border: 1px dashed transparent;
  border-radius: 6px;
  outline: none;
  resize: horizontal;
  overflow: hidden;
  cursor: move;
}
/* Блокийн хүрээ = зөөх, дотор нь = бичих */
.rte-canvas .nb-box > * { cursor: text; }
.rte-canvas .nb-box img,
.rte-canvas .nb-box video { cursor: move; }
.rte-canvas .nb-box:hover { border-color: var(--border); }
.rte-canvas .nb-box.nb-active { border-color: var(--primary); background: var(--surface); }
.rte-canvas img, .nb-box img { max-width: 100%; height: auto; border-radius: var(--radius-sm); cursor: pointer; }
.rte-canvas img.rte-img-selected { outline: 2px solid var(--primary); outline-offset: 2px; }
.rte-canvas video, .nb-box video { max-width: 100%; border-radius: var(--radius-sm); }

.nb-controls {
  position: absolute;
  display: none;
  gap: 4px;
  z-index: 7;
}
.nb-controls.visible { display: flex; }
.nb-controls button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  width: 24px;
  height: 22px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.nb-grip { cursor: move !important; touch-action: none; }
.nb-controls button:hover { color: var(--text); border-color: var(--primary); }

.rte-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: nwse-resize;
  z-index: 6;
  touch-action: none;
}
.rte-status { margin: 8px 0 0; font-size: 0.82rem; color: var(--muted); }
.rte-hint { font-size: 0.8rem; color: var(--muted); align-self: center; }

/* Засварлагч болон уншиж буй хуудсанд ижил харагдана */
.nb-box h1, .note-rendered h1 { font-size: 1.5rem; }
.nb-box h2, .note-rendered h2 { font-size: 1.25rem; }
.nb-box h3, .note-rendered h3 { font-size: 1.08rem; }
.nb-box blockquote, .note-rendered blockquote {
  margin: 0 0 1em;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--primary);
  color: var(--muted);
}
.nb-box pre, .note-rendered pre {
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 0.88rem;
}
.nb-box ul, .nb-box ol { padding-left: 1.4em; margin: 0 0 1em; }
.nb-box p { margin: 0 0 0.7em; }
.nb-box mark, .note-rendered mark { background: #ffe9a8; padding: 0 2px; }

font[size="1"] { font-size: 11px; }
font[size="2"] { font-size: 13px; }
font[size="3"] { font-size: 15px; }
font[size="4"] { font-size: 18px; }
font[size="5"] { font-size: 24px; }
font[size="6"] { font-size: 32px; }
font[size="7"] { font-size: 44px; }

/* ---------- Print ---------- */
@media print {
  .topnav, .no-print { display: none !important; }
  body { background: #fff; }
  .page { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  .nb-scroll { overflow: visible; }
  .print-only-img { display: block; width: 100%; height: auto; object-fit: contain; break-inside: avoid; margin-bottom: 12px; }
}

/* ── Хаяг / нэвтрэлт ─────────────────────────────────────────── */
.auth-alt {
  margin: 20px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.auth-alt a { color: var(--accent-strong, #4a7fb5); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

.field-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.notice-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e8f6ec;
  color: #2f6b43;
  border: 1px solid #bfe3cb;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  margin: 0 0 16px;
}

.stack-form .field { margin-bottom: 14px; }

a.user-chip { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
a.user-chip:hover { filter: brightness(0.95); }

p.muted { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }

/* ══ Эдийн засаг модуль ═══════════════════════════════════════════ */

/* Сар сонгогч */
.month-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.month-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}
.month-arrow:hover { background: var(--surface-soft); color: var(--text); }
.month-arrow.disabled { opacity: 0.35; pointer-events: none; }
.month-label { font-weight: 700; font-size: 1.05rem; }
.month-today {
  font-size: 0.82rem;
  color: var(--primary-dark);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

/* Хурдан бүртгэлийн форм */
.quick-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.quick-add .field { margin-bottom: 0; flex: 1; min-width: 130px; }
.quick-add .field.date-field { flex: 0 0 150px; }
.quick-add .field.kind-field { flex: 0 0 auto; }
.kind-toggle { display: flex; gap: 6px; }
.kind-toggle label {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--surface);
  white-space: nowrap;
}
.kind-toggle input { accent-color: var(--primary-dark); margin: 0; }
.kind-toggle label:has(input:checked) { background: var(--surface-soft); border-color: var(--primary); font-weight: 600; }

.stat-pill.expense .num { color: #c0736c; }
.stat-pill.income .num { color: #4f9268; }

/* Хамгийн их зарлагатай ангилал */
.top-spend {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--cat) 45%, #fff), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.top-spend-icon {
  width: 62px; height: 62px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  flex-shrink: 0;
}
.top-spend-body { flex: 1; min-width: 0; }
.top-spend-label { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.top-spend-name { font-size: 1.5rem; font-weight: 700; margin: 2px 0 4px; }
.top-spend-sub { color: var(--muted); font-size: 0.9rem; }
.top-spend-share { font-size: 2.6rem; font-weight: 700; opacity: 0.55; }
.top-spend-share span { font-size: 1.2rem; }

/* Төсвийн анхааруулга */
.budget-alerts { display: grid; gap: 8px; margin-bottom: 20px; }
.budget-alert {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 0.9rem;
}
.budget-alert.over { background: #fbe6e4; color: #a8544c; }
.budget-alert.near { background: #fdf1dd; color: #97723a; }
.budget-alert-num { margin-left: auto; font-weight: 600; white-space: nowrap; }

/* Ангиллын зарлагын багана */
.spend-bars { display: grid; gap: 16px; }
.spend-row { display: flex; align-items: flex-start; gap: 12px; }
.spend-icon {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.spend-main { flex: 1; min-width: 0; }
.spend-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.spend-name { font-weight: 600; }
.spend-amount { font-weight: 700; white-space: nowrap; }
.spend-track {
  height: 9px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 5px;
}
.spend-fill { height: 100%; border-radius: 999px; transition: width 0.3s; }
.spend-meta {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--muted);
}
.spend-budget.over { color: #c0736c; font-weight: 600; }
.budget-inline { display: flex; gap: 4px; align-items: center; }
.budget-inline input {
  width: 110px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.78rem;
  font-family: inherit;
  background: transparent;
  color: var(--text);
}
.budget-inline input:focus { border-style: solid; border-color: var(--primary); outline: none; }
.budget-inline button {
  border: none; background: none; cursor: pointer;
  color: var(--muted); padding: 2px 4px; display: flex;
}
.budget-inline button:hover { color: #4f9268; }
.spend-total-note { margin: 16px 0 0; font-size: 0.85rem; color: var(--muted); }

/* Гүйлгээний жагсаалт */
.tx-list { display: grid; gap: 2px; }
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }
.tx-row.editing { background: var(--surface-soft); border-radius: var(--radius-sm); }
.tx-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.tx-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-cat {
  font-size: 0.8rem; color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.tx-date { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.tx-amount { font-weight: 700; white-space: nowrap; }
.tx-amount.expense { color: #c0736c; }
.tx-amount.income { color: #4f9268; }
.tx-actions { display: flex; gap: 2px; }
.tx-btn {
  border: none; background: none; cursor: pointer;
  color: var(--muted); padding: 5px; border-radius: 8px;
  display: inline-flex; text-decoration: none;
}
.tx-btn:hover { background: var(--surface-soft); color: var(--text); }
.tx-btn.danger:hover { background: #fbe2e2; color: #b5524a; }

/* Шүүлтүүр */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label { color: var(--muted); font-size: 0.88rem; display: inline-flex; align-items: center; gap: 6px; }
.filter-bar select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.filter-totals { margin-left: auto; display: flex; gap: 12px; }

/* Чиг хандлагын багана */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
}
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.trend-bar { width: 42%; max-width: 26px; border-radius: 6px 6px 0 0; }
.trend-bar.expense { background: #eab5ae; }
.trend-bar.income { background: #b3ddc3; }
.trend-col.active .trend-bar.expense { background: #d98b84; }
.trend-col.active .trend-bar.income { background: #85c6a3; }
.trend-label {
  margin-top: 8px; font-size: 0.78rem; color: var(--muted);
  text-decoration: none;
}
.trend-col.active .trend-label { color: var(--text); font-weight: 700; }
.trend-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 0.82rem; color: var(--muted); }
.trend-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.trend-legend .dot.expense { background: #eab5ae; }
.trend-legend .dot.income { background: #b3ddc3; }

/* Ангиллын тохиргоо */
.cat-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.cat-form-actions { display: flex; gap: 10px; margin-top: 6px; }
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.color-opt span {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c); cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s;
}
.color-opt input:checked + span { border-color: var(--text); transform: scale(1.12); }

.cat-list { display: grid; gap: 4px; }
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--border);
}
.cat-row:last-child { border-bottom: none; }
.cat-row.archived { opacity: 0.5; }
.cat-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.cat-main { flex: 1; min-width: 0; }
.cat-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cat-tag {
  font-size: 0.7rem; background: var(--surface-soft);
  border-radius: 999px; padding: 2px 8px; color: var(--muted); font-weight: 500;
}
.cat-meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.cat-track { height: 6px; background: var(--surface-soft); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 999px; }
.cat-actions { display: flex; gap: 2px; flex-shrink: 0; }

@media (max-width: 760px) {
  .top-spend { gap: 14px; padding: 18px; }
  .top-spend-icon { width: 50px; height: 50px; }
  .top-spend-name { font-size: 1.25rem; }
  .top-spend-share { font-size: 1.8rem; }
  .tx-cat { display: none; }
  .quick-add .field.date-field { flex: 1 1 130px; }
  .filter-totals { margin-left: 0; width: 100%; }
}

/* ══ Төлөвлөгөө модуль ════════════════════════════════════════════ */

.page-wide { max-width: 1240px; }

.week-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.week-progress { flex: 1; min-width: 220px; }
.week-progress-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.88rem; color: var(--muted); margin-bottom: 5px;
}
.week-progress-head svg.icon { vertical-align: -0.2em; }
.week-progress-pct { font-weight: 700; color: var(--text); }
.week-progress-track { height: 8px; background: var(--surface-soft); border-radius: 999px; overflow: hidden; }
.week-progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.3s; }
.today-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px; font-size: 0.9rem;
  color: var(--muted); white-space: nowrap;
}
.today-pill strong { color: var(--text); }

.overdue-card { border-left: 4px solid #e0a19a; }

/* Даалгаврын мөр (жагсаалт хэлбэр) */
.task-list { display: grid; gap: 2px; }
.task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px 9px 10px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.task-row:last-child { border-bottom: none; }
.task-row.prio-1 { border-left-color: #f8c99b; }
.task-row.prio-2 { border-left-color: #f2b8b5; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-date { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.task-date.late { color: #b5665e; font-weight: 600; }
.task-actions { display: flex; gap: 2px; }
.task-check {
  border: none; background: none; cursor: pointer; padding: 3px;
  color: var(--muted); display: flex; border-radius: 50%;
}
.task-check:hover { color: #4f9268; }
.task-goal {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; border-radius: 999px; padding: 2px 9px;
  color: #4a453f; white-space: nowrap; max-width: 140px;
  overflow: hidden; text-overflow: ellipsis;
}

/* Даалгаврын форм */
.task-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.task-form-grid .field.grow { grid-column: span 2; min-width: 200px; }

/* 7 хоногийн самбар */
.week-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.day-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex; flex-direction: column;
  min-height: 190px;
}
.day-col.weekend { background: var(--surface-soft); }
.day-col.past { opacity: 0.82; }
.day-col.today { border-color: var(--primary-dark); box-shadow: 0 0 0 2px rgba(127, 168, 212, 0.22); opacity: 1; }
.day-head {
  display: flex; align-items: baseline; gap: 6px;
  padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.day-name { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.day-num { font-size: 1.05rem; font-weight: 700; }
.day-col.today .day-num { color: var(--primary-dark); }
.day-count { margin-left: auto; font-size: 0.72rem; color: var(--muted); }
.day-tasks { flex: 1; display: grid; gap: 6px; align-content: start; }
.day-task {
  background: var(--surface-soft);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 8px;
}
.day-col.weekend .day-task { background: var(--surface); }
.day-task.prio-1 { border-left-color: #f8c99b; }
.day-task.prio-2 { border-left-color: #f2b8b5; }
.day-task.done { opacity: 0.6; }
.day-task.done .day-task-title { text-decoration: line-through; }
.day-task-main { display: flex; align-items: flex-start; gap: 5px; }
.day-task-title { font-size: 0.85rem; line-height: 1.35; word-break: break-word; }
.day-task .task-goal { margin: 5px 0 0 22px; font-size: 0.68rem; max-width: 100%; }
.day-task-actions { display: flex; gap: 0; margin-top: 3px; padding-left: 18px; }
.day-task-actions .tx-btn { padding: 3px; }
.day-task-actions svg.icon { width: 0.95em; height: 0.95em; }
.day-add { display: flex; gap: 4px; margin-top: 8px; }
.day-add input {
  flex: 1; min-width: 0;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 6px 8px; font-size: 0.8rem; font-family: inherit;
  background: transparent; color: var(--text);
}
.day-add input:focus { border-style: solid; border-color: var(--primary); outline: none; background: var(--surface); }
.day-add button {
  border: none; background: none; cursor: pointer; color: var(--muted);
  padding: 4px; display: flex; border-radius: 6px;
}
.day-add button:hover { background: var(--surface-soft); color: var(--text); }

.backlog-add { display: flex; gap: 8px; margin: 12px 0; align-items: center; flex-wrap: wrap; }
.backlog-add input[type="text"] {
  flex: 1; min-width: 180px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-family: inherit; font-size: 0.9rem;
  background: var(--surface); color: var(--text);
}
.backlog-add input[type="text"]:focus { border-color: var(--primary); outline: none; }

/* Сарын календарь */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.cal-weekday {
  text-align: center; font-size: 0.75rem; font-weight: 700;
  color: var(--muted); padding-bottom: 4px;
}
.cal-cell {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex; flex-direction: column; gap: 3px;
  text-decoration: none; color: var(--text);
  background: var(--surface);
  min-height: 58px;
}
.cal-cell:hover { background: var(--surface-soft); }
.cal-cell.out { opacity: 0.35; }
.cal-cell.today { border-color: var(--primary-dark); box-shadow: 0 0 0 2px rgba(127, 168, 212, 0.2); }
.cal-cell.all-done { background: #eef7f0; }
.cal-day { font-size: 0.85rem; font-weight: 600; }
.cal-count {
  font-size: 0.68rem; color: var(--muted);
  border-radius: 999px; padding: 1px 6px; align-self: flex-start;
  background: var(--surface-soft);
}
.cal-count.prio-1 { background: #fdf0dc; color: #96712f; }
.cal-count.prio-2 { background: #fbe6e4; color: #a8544c; }
.cal-bar { margin-top: auto; height: 4px; background: var(--surface-soft); border-radius: 999px; overflow: hidden; }
.cal-bar span { display: block; height: 100%; background: var(--primary-dark); border-radius: 999px; }

/* Зорилго */
.goal-count {
  margin-left: auto; font-size: 0.8rem; color: var(--muted); font-weight: 500;
}
.goal-list { display: grid; gap: 14px; }
.goal-row { display: flex; align-items: center; gap: 12px; }
.goal-row.done { opacity: 0.6; }
.goal-icon {
  width: 36px; height: 36px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #4a453f; flex-shrink: 0;
}
.goal-main { flex: 1; min-width: 0; }
.goal-title { font-weight: 600; margin-bottom: 5px; }
.goal-track {
  position: relative;
  height: 8px; background: var(--surface-soft);
  border-radius: 999px; overflow: hidden;
}
.goal-track.big { height: 22px; margin: 14px 0 12px; overflow: visible; }
.goal-track.big .goal-fill { border-radius: 999px; }
.goal-fill { height: 100%; border-radius: 999px; transition: width 0.3s; }
.goal-track-pct {
  position: absolute; right: 10px; top: 0; line-height: 22px;
  font-size: 0.78rem; font-weight: 700; color: var(--muted);
}
.goal-meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.goal-pct { font-weight: 700; color: var(--muted); }

.goal-card { border-top: 4px solid var(--goal); }
.goal-card.done { opacity: 0.7; }
.goal-card.done .goal-card-title h2 { text-decoration: line-through; }
.goal-card-head { display: flex; align-items: flex-start; gap: 12px; }
.goal-card-title { flex: 1; min-width: 0; }
.goal-card-title h2 { font-size: 1.1rem; margin: 0; }
.goal-card-title p { margin: 4px 0 0; }
.goal-card-actions { display: flex; gap: 2px; }
.goal-progress-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.goal-progress-set { display: flex; align-items: center; gap: 6px; }
.goal-progress-set input {
  width: 74px; text-align: right;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 9px; font-family: inherit; background: var(--surface); color: var(--text);
}
.goal-progress-set input:focus { border-color: var(--primary); outline: none; }
.goal-progress-of { color: var(--muted); font-size: 0.9rem; }
.goal-auto-note { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.goal-tasks { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 6px; }

@media (max-width: 1000px) {
  .week-board {
    grid-template-columns: repeat(7, minmax(158px, 1fr));
    overflow-x: auto;
    padding-bottom: 8px;
  }
}
@media (max-width: 760px) {
  .task-form-grid .field.grow { grid-column: span 1; }
  .cal-cell { min-height: 46px; padding: 4px; }
  .cal-count { font-size: 0.6rem; padding: 1px 4px; }
  .today-pill { width: 100%; justify-content: center; }
}

/* ── Төлөвлөгөөний архив ─────────────────────────────────────────── */
.backlog-done {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.backlog-done summary {
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  padding: 4px 0;
}
.backlog-done summary::-webkit-details-marker { display: none; }
.backlog-done summary:hover { color: var(--text); }

.archive-total {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.88rem; color: var(--muted);
}
.archive-chart .bar-col {
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding-top: 4px;
}
.archive-chart .bar-col:hover { background: var(--surface-soft); }
.archive-chart .bar-col.active .bar { background: var(--primary-dark); }
.archive-chart .bar-value {
  font-size: 0.7rem; color: var(--muted); display: block;
  height: 14px; text-align: center;
}

.archive-group { margin-bottom: 18px; }
.archive-group:last-child { margin-bottom: 0; }
.archive-day {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 700; color: var(--muted);
  padding: 6px 0 4px;
}
.archive-day-count {
  margin-left: auto; font-weight: 500; font-size: 0.78rem;
  background: var(--surface-soft); border-radius: 999px; padding: 2px 9px;
}
.archived-goal .goal-pct { color: #4f9268; }

/* ── Хуудаслалт ──────────────────────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.pager-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
  white-space: nowrap;
}
.pager-btn:hover { background: var(--surface-soft); color: var(--text); }
.pager-btn.disabled { opacity: 0.35; pointer-events: none; }
.pager-nums { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-num {
  min-width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0 7px;
}
.pager-num:hover { background: var(--surface-soft); color: var(--text); }
.pager-num.active { background: var(--primary); color: #fff; font-weight: 700; }
.pager-gap { color: var(--muted); padding: 0 2px; }
.pager-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 10px 0 0;
}

@media (max-width: 560px) {
  .pager-btn span, .pager-btn { font-size: 0.8rem; padding: 6px 10px; }
  .pager-num { min-width: 26px; height: 26px; }
}

/* ── «Бидний зорилго» ────────────────────────────────────────────── */
.pair-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  border-left: 4px solid var(--mint);
}
.pair-entry:hover { background: var(--surface-soft); }
.pair-entry-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--mint);
  display: flex; align-items: center; justify-content: center;
  color: #3f5f4d; flex-shrink: 0;
}
.pair-entry-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pair-entry-text .muted { font-size: 0.83rem; }
.pair-entry-go { color: var(--muted); }

.pair-invite { text-align: center; }
.pair-invite-icon { color: var(--primary-dark); margin-bottom: 8px; }
.pair-invite h2 { margin: 0 0 6px; font-size: 1.15rem; }
.pair-invite .backlog-add { margin-top: 18px; justify-content: center; }

.pair-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); flex-shrink: 0;
}
.pair-avatar.big {
  width: 52px; height: 52px; border-radius: 18px;
  background: var(--mint); color: #3f5f4d;
}
.pair-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
}
.pair-names { font-size: 1.15rem; font-weight: 700; }

.motto-card .motto {
  margin: 0 0 14px;
  padding: 14px 18px;
  background: var(--surface-soft);
  border-left: 4px solid var(--mint);
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-style: italic;
}

.pair-goal-form, .pair-date-form {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
.pair-goal-form .field, .pair-date-form .field { margin: 0; flex: 0 1 130px; }
.pair-goal-form .field.grow, .pair-date-form .field.grow { flex: 1 1 200px; }
.pair-goal-form input, .pair-date-form input[type="text"], .pair-date-form input[type="date"] {
  width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-family: inherit; font-size: 0.9rem;
  background: var(--surface); color: var(--text);
}
.pair-goal-form input:focus, .pair-date-form input:focus { border-color: var(--primary); outline: none; }
.pair-yearly {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--muted); white-space: nowrap;
}
.pair-yearly input { accent-color: var(--primary-dark); }

.pair-goals .goal-row { align-items: flex-start; }

.date-countdown {
  font-size: 0.8rem; color: var(--muted);
  border-radius: 999px; padding: 3px 10px;
  background: var(--surface-soft); white-space: nowrap;
}
.date-countdown.soon { background: #fdf1dd; color: #97723a; font-weight: 600; }
.date-countdown.now { background: #f6d9e6; color: #a3527a; font-weight: 700; }
.task-row.date-today { background: #fdf5f8; border-radius: var(--radius-sm); }

.pair-unlink-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--muted);
  padding: 12px 16px;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  margin: 0;
}

.goal-month-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.goal-month-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; text-decoration: none; background: var(--surface);
}
.goal-month-chip:hover { background: var(--surface-soft); color: var(--text); }
.goal-month-chip span { font-weight: 700; }
.goal-meta .cat-tag { margin-right: 6px; }
.pair-goal-form input[type="month"] {
  width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-family: inherit; font-size: 0.9rem;
  background: var(--surface); color: var(--text);
}

/* ══ Хувийн хөгжил модуль ═════════════════════════════════════════ */

/* Зуршлын тор */
.habit-scroll { overflow-x: auto; }
.habit-grid { border-collapse: collapse; width: 100%; }
.habit-grid th, .habit-grid td { text-align: center; padding: 4px 2px; }
.habit-grid th {
  font-size: 0.7rem; font-weight: 600; color: var(--muted);
  padding-bottom: 8px;
}
.habit-grid th .habit-wd { display: block; }
.habit-grid th .habit-dn { display: block; font-size: 0.82rem; color: var(--text); }
.habit-grid th.today .habit-dn, .habit-grid th.today .habit-wd { color: var(--primary-dark); font-weight: 700; }
.habit-grid td.today { background: rgba(168, 201, 232, 0.12); }
.habit-grid tbody tr { border-top: 1px solid var(--border); }
.habit-name-col {
  text-align: left !important;
  min-width: 200px;
  padding-right: 12px !important;
}
.habit-name-col { white-space: nowrap; }
.habit-icon {
  width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #40483f; vertical-align: middle; margin-right: 8px;
}
.habit-name { font-size: 0.9rem; font-weight: 600; vertical-align: middle; }
.habit-actions { display: inline-flex; gap: 0; margin-left: 8px; vertical-align: middle; opacity: 0.5; }
.habit-actions:hover, tr:hover .habit-actions { opacity: 1; }
.habit-actions .tx-btn { padding: 3px; }
.habit-actions svg.icon { width: 0.95em; height: 0.95em; }
.habit-cell {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: block; margin: 0 auto;
  transition: transform 0.12s;
}
.habit-cell:hover { transform: scale(1.15); border-color: var(--primary); }
.habit-cell.done { background: var(--c); border-color: transparent; }
.habit-streak-col { width: 46px; }
.habit-streak {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 24px; padding: 0 7px;
  border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--surface-soft); color: var(--muted);
}
.habit-streak.on { background: #fdeadf; color: #b5673f; }

/* Тэмдэглэлийн форм */
.entry-form-top { display: flex; gap: 14px; flex-wrap: wrap; }
.entry-form-top .field { flex: 0 1 170px; margin-bottom: 14px; }
.entry-form-top .field.grow { flex: 1 1 240px; }
.entry-form textarea {
  width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; font-family: inherit; font-size: 0.95rem;
  background: var(--surface); color: var(--text); resize: vertical;
}
.entry-form textarea:focus { border-color: var(--primary); outline: none; }
.file-input {
  width: 100%;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: inherit; font-size: 0.85rem;
  background: var(--surface-soft); color: var(--muted); cursor: pointer;
}
.file-input:hover { border-color: var(--primary); }

/* Сэтгэл санаа */
.mood-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.mood-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.mood-opt span {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font-size: 0.85rem; cursor: pointer;
  background: var(--surface); color: var(--muted);
}
.mood-opt input:checked + span {
  border-color: var(--m); background: color-mix(in srgb, var(--m) 22%, #fff);
  color: var(--text); font-weight: 600;
}
.mood-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #4a453f; flex-shrink: 0;
}
.mood-dot.big { width: 44px; height: 44px; }

/* Тэмдэглэлийн карт */
.entry-card { display: block; text-decoration: none; color: var(--text); }
.entry-card:hover { background: var(--surface-soft); }
.entry-card-head { display: flex; align-items: center; gap: 12px; }
.entry-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.entry-card-title .muted { font-size: 0.8rem; }
.entry-photo-count {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; color: var(--muted);
  background: var(--surface-soft); border-radius: 999px; padding: 3px 10px;
}
.entry-excerpt {
  margin: 10px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55;
  white-space: pre-wrap;
}
.entry-thumbs { display: flex; gap: 6px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.entry-thumbs img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.entry-thumb-more {
  width: 72px; height: 72px; border-radius: var(--radius-sm);
  background: var(--surface-soft); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
}

.entry-view-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.entry-view-actions { margin-left: auto; display: flex; gap: 8px; }
.entry-body { white-space: pre-wrap; line-height: 1.7; margin: 0; }

/* Зургийн тор */
.photo-add { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.photo-add .file-input { flex: 1; min-width: 200px; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.photo-item { margin: 0; }
.photo-item img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  display: block; background: var(--surface-soft);
}
.photo-item img:hover { filter: brightness(0.96); }
.photo-item figcaption {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; font-size: 0.75rem; color: var(--muted);
}
.photo-name {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); text-decoration: none;
}
a.photo-name:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 760px) {
  .habit-name-col { min-width: 150px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ── Зуршлын сануулга ────────────────────────────────────────────── */
.remind-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.remind-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.remind-toggle span {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--border); border-radius: 999px;
  padding: 7px 15px; font-size: 0.87rem; cursor: pointer;
  background: var(--surface); color: var(--muted);
}
.remind-toggle input:checked + span {
  border-color: var(--primary); background: var(--surface-soft);
  color: var(--text); font-weight: 600;
}
.remind-row input[type="time"] {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 11px; font-family: inherit; font-size: 0.9rem;
  background: var(--surface); color: var(--text);
}
.remind-row input[type="time"]:disabled { opacity: 0.4; }
.remind-row .field-hint { margin: 0; }

.habit-remind {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; color: var(--muted);
  background: var(--surface-soft); border-radius: 999px;
  padding: 2px 8px; margin-left: 8px; vertical-align: middle;
}
.habit-remind svg.icon { width: 0.9em; height: 0.9em; }

.remind-status {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border-left: 4px solid var(--primary);
}
.remind-status.ok { border-left-color: var(--mint); }
.remind-status-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
}
.remind-status-text { flex: 1; min-width: 200px; font-size: 0.9rem; color: var(--muted); }
.habit-reminder-toast { cursor: pointer; max-width: 320px; line-height: 1.45; }

/* ── Мэдэгдлийн тохиргоо ─────────────────────────────────────────── */
.push-status {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-left: 4px solid var(--border);
}
.push-status.ok { border-left-color: var(--mint); }
.push-status.warn { border-left-color: #eab5ae; }
.push-status-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--surface-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.push-status.ok .push-status-icon { background: var(--mint); color: #3f5f4d; }
.push-status-body { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 3px; }
.push-status-body .muted { font-size: 0.85rem; }
.push-status-actions { display: flex; gap: 8px; }

.notify-list { display: grid; gap: 4px; }
.notify-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notify-row:last-child { border-bottom: none; }
.notify-row input { margin-top: 3px; accent-color: var(--primary-dark); width: 17px; height: 17px; }
.notify-main { display: flex; flex-direction: column; gap: 2px; }
.notify-label { font-weight: 600; font-size: 0.94rem; }
.notify-hint { font-size: 0.82rem; color: var(--muted); }

.install-steps { margin: 0; padding-left: 20px; font-size: 0.9rem; line-height: 1.8; color: var(--muted); }
.install-steps strong { color: var(--text); }

/* 24 цагийн хэлбэрийн цаг сонгогч (хөтчийн AM/PM-ээс хамаарахгүй) */
.time-select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.time-select select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  font-family: inherit;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  color: var(--text);
  text-align: center;
}
.time-select select:focus { border-color: var(--primary); outline: none; }
.time-sep { font-weight: 700; color: var(--muted); }
.time-note { font-size: 0.75rem; color: var(--muted); margin-left: 6px; }
.time-select.off { opacity: 0.4; }
