/* ============ THEMES ============
   Every colour in the app comes from these variables. A theme is just a
   different set of values, so switching theme = changing data-theme on <html>.
*/
:root,
:root[data-theme="pastel"] {
  --bg: #FAF6F0;        /* cream background */
  --surface: #FFFFFF;   /* cards */
  --primary: #A8BFA3;   /* sage green */
  --primary-strong: #7E9C79;
  --accent: #C9B8E0;    /* soft lilac */
  --text: #4A4650;      /* warm dark gray */
  --muted: #8C8794;
  --border: #EBE3D8;
  --on-primary: #2F3B2D;
}

:root[data-theme="burgundy"] {
  --bg: #2A0F16;
  --surface: #3A1822;
  --primary: #A8324A;
  --primary-strong: #C24560;
  --accent: #E3B5A4;
  --text: #F5E9E6;
  --muted: #C9A9A6;
  --border: #55272F;
  --on-primary: #FFF4F1;
}

:root[data-theme="brown"] {
  --bg: #2B211C;
  --surface: #3A2D26;
  --primary: #A67B5B;
  --primary-strong: #BF9170;
  --accent: #D9B99B;
  --text: #F2E8DF;
  --muted: #BFA996;
  --border: #50403A;
  --on-primary: #1F1612;
}

:root[data-theme="beige"] {
  --bg: #EFE6D8;
  --surface: #F8F2E8;
  --primary: #B8956A;
  --primary-strong: #9C7A50;
  --accent: #8B6B4A;
  --text: #4A3F35;
  --muted: #8A7B6B;
  --border: #DDD0BC;
  --on-primary: #FFFFFF;
}

/* ============ BASE ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

h1, h2, h3 { font-weight: 600; }
.muted { color: var(--muted); font-size: 0.92rem; }

/* ============ LAYOUT ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.brand-name { font-size: 1.3rem; font-weight: 600; letter-spacing: 0.5px; }

.nav { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: block;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s;
}
.nav-link:hover { background: var(--border); }
.nav-link.active { background: var(--primary); color: var(--on-primary); }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 8px; }
.theme-switcher { display: flex; gap: 8px; }
.theme-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  opacity: 0.8;
}
.theme-dot:hover, .theme-dot.selected { opacity: 1; border-color: var(--text); }
.theme-dot[data-theme-pick="pastel"]   { background: linear-gradient(135deg, #A8BFA3 50%, #C9B8E0 50%); }
.theme-dot[data-theme-pick="burgundy"] { background: #A8324A; }
.theme-dot[data-theme-pick="brown"]    { background: #A67B5B; }
.theme-dot[data-theme-pick="beige"]    { background: #D9C4A3; }

.tiny-link { font-size: 0.75rem; color: var(--muted); text-decoration: none; }
.tiny-link:hover { text-decoration: underline; }

.main { flex: 1; padding: 32px 40px; max-width: 1100px; }
.topbar { margin-bottom: 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar h2 { font-size: 1.7rem; }

.view { display: none; }
.view.active { display: block; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}
.card h3 { margin-bottom: 10px; font-size: 1.05rem; }

.ring-placeholder {
  width: 90px; height: 90px; border-radius: 50%;
  border: 8px solid var(--border);
  border-top-color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 8px 0 12px;
  font-weight: 600;
}

.btn {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.btn:hover { background: var(--primary-strong); transform: translateY(-1px); }

/* ============ BIRTHDAY OPENING ============ */
.birthday {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, var(--accent), transparent 55%),
              radial-gradient(circle at 75% 80%, var(--primary), transparent 55%),
              var(--bg);
  transition: opacity 0.8s;
}
.birthday.hidden { display: none; }
.birthday.fading { opacity: 0; pointer-events: none; }

.birthday-card { text-align: center; padding: 32px; max-width: 520px; }
.b-line { opacity: 0; transform: translateY(14px); animation: rise 1s forwards; }
.b-1 { font-size: 1.9rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text); animation-delay: 0.4s; margin: 0; }
.b-2 { font-size: 3.6rem; margin: 2px 0 20px; animation-delay: 1.2s; }
.b-3 { font-size: 1.1rem; line-height: 1.6; white-space: pre-line; animation-delay: 2.2s; }
.b-4 { margin-top: 14px; color: var(--muted); font-style: italic; animation-delay: 3.2s; }
.b-5 { margin-top: 30px; animation-delay: 4.2s; }

@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ============ TABLET / SMALL SCREENS ============ */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; height: auto;
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-right: none; border-top: 1px solid var(--border);
    z-index: 50;
  }
  .brand, .sidebar-footer { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-link { padding: 12px 10px; font-size: 0.9rem; }
  .main { padding: 20px 16px 90px; }
}

/* ============ LISTS, FORMS, TASKS, EVENTS ============ */
.hidden { display: none !important; }

.item-list { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}
.item:last-child { border-bottom: none; }
.item-title { flex: 1; word-break: break-word; }
.item.done .item-title { text-decoration: line-through; color: var(--muted); }
.time { color: var(--muted); font-size: 0.85rem; min-width: 92px; }
.badge {
  font-size: 0.75rem; color: var(--on-primary); background: var(--accent);
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
:root[data-theme="beige"] .badge { color: #FFFFFF; }

.check { width: 18px; height: 18px; accent-color: var(--primary-strong); cursor: pointer; }

.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-form input[type="text"] { flex: 1 1 160px; }
input[type="text"], input[type="date"], input[type="time"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.92rem;
}
input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.small-label { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }

.btn.small { padding: 8px 18px; font-size: 0.9rem; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--border); transform: none; }

.icon-btn {
  background: none; border: none; color: var(--muted);
  font-size: 1.3rem; line-height: 1; padding: 4px 10px; border-radius: 10px; cursor: pointer;
}
.icon-btn:hover { background: var(--border); color: var(--text); }
.icon-btn.danger:hover { color: #C0392B; }

.overdue { margin-bottom: 20px; border-color: var(--accent); }
.overdue .muted { margin-bottom: 8px; }

/* ============ CALENDAR ============ */
#view-calendar.active { display: flex; flex-direction: column; gap: 20px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h3 { margin: 0; text-transform: capitalize; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekdays { margin-bottom: 6px; text-align: center; font-size: 0.8rem; color: var(--muted); }
.cal-cell {
  position: relative;
  aspect-ratio: 1.3;
  min-height: 44px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.cal-cell.empty { background: none; border: none; cursor: default; }
.cal-cell:not(.empty):hover { border-color: var(--primary); }
.cal-cell.today { border-color: var(--primary-strong); font-weight: 700; }
.cal-cell.selected { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.cal-cell .dot {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.cal-cell.selected .dot { background: var(--on-primary); }
.cal-day h3 { margin-bottom: 10px; text-transform: capitalize; }

/* ============ ANATOMY LINE-ART DETAILS ============ */
/* The spine is a mask: its lines take the colour of the theme's accent. */
.sidebar-art {
  flex: 1;
  min-height: 120px;
  margin: 0 auto;
  width: 150px;
  background-color: var(--accent);
  opacity: 0.9;
  -webkit-mask: url("/static/spine.svg") no-repeat center / contain;
  mask: url("/static/spine.svg") no-repeat center / contain;
  pointer-events: none;
}
.sidebar-footer { margin-top: 0; }

/* Heartbeat line: draws itself once when the page opens */
.pulse { fill: none; stroke: var(--primary-strong); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pulse path { stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 2.4s ease-out 0.3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.topbar-pulse { width: 170px; height: 34px; opacity: 0.75; flex-shrink: 0; }

.b-pulse { width: 200px; height: 40px; margin: -6px auto 14px; display: block; animation-delay: 1.8s; }
.birthday .b-pulse path { animation-delay: 2s; }

@media (max-width: 900px) {
  .sidebar-art { display: none; }
  .topbar-pulse { width: 110px; }
}

#today-events-empty, #tasks-empty, #cal-day-empty { margin-bottom: 12px; }

/* ============ CALENDAR WITH EVENTS ============ */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h3 { margin: 0; }

.cal-grid { gap: 6px; }
.cal-cell {
  display: flex; flex-direction: column; gap: 4px;
  aspect-ratio: auto;
  min-height: 108px;
  padding: 6px;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
}
.cal-cell.empty { min-height: 0; }
.cal-cell .dot { display: none; }
.cal-num { font-size: 0.85rem; font-weight: 600; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; }
.cal-cell.today { font-weight: 400; border-color: var(--border); }
.cal-cell.today .cal-num { background: var(--primary-strong); color: var(--on-primary); }
.cal-cell.selected { background: var(--bg); color: var(--text); border-color: var(--primary-strong); box-shadow: 0 0 0 2px var(--primary); }

.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chip {
  display: block; width: 100%;
  background: color-mix(in srgb, var(--tag) 32%, var(--surface));
  border: none; border-left: 3px solid var(--tag);
  color: var(--text);
  font: inherit; font-size: 0.72rem; line-height: 1.35;
  padding: 2px 6px; border-radius: 6px;
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.chip:hover { background: color-mix(in srgb, var(--tag) 50%, var(--surface)); }
.more { font-size: 0.7rem; color: var(--muted); padding-left: 4px; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--tag); display: inline-block; }

/* Event rows (Today and the selected day) */
.event-row { border-left: 4px solid var(--tag); padding-left: 12px; cursor: pointer; border-radius: 4px; align-items: flex-start; }
.event-row:hover { background: color-mix(in srgb, var(--tag) 12%, transparent); }
.event-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.event-details { font-size: 0.8rem; color: var(--muted); word-break: break-word; }
.tag-badge {
  font-size: 0.72rem; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--tag) 32%, var(--surface)); color: var(--text);
}

.color-input { width: 30px; height: 30px; padding: 0; border: none; background: none; cursor: pointer; }
.tag-help { margin-bottom: 8px; }
#tag-color { width: 38px; height: 38px; padding: 0; border: none; background: none; cursor: pointer; }

/* ============ EVENT DIALOG ============ */
.dialog {
  border: none; border-radius: 22px; padding: 26px;
  width: min(540px, 94vw); max-height: 92vh; overflow-y: auto;
  background: var(--surface); color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  margin: auto;
}
.dialog::backdrop { background: rgba(30, 20, 30, 0.5); }
.dialog h3 { margin-bottom: 16px; font-size: 1.2rem; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; color: var(--muted); margin-bottom: 12px; }
.field.grow { flex: 1; min-width: 130px; }
.field input, .field select, .field textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; font: inherit; font-size: 0.95rem;
}
.field textarea { resize: vertical; }
.field input[type="color"] { padding: 2px; height: 40px; width: 56px; cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; color: var(--text); font-size: 0.95rem; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--primary-strong); }

.form-error { color: #C0392B; font-size: 0.88rem; margin-bottom: 10px; }
:root[data-theme="burgundy"] .form-error, :root[data-theme="brown"] .form-error { color: #FF9A8A; }

.dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.delete-actions, .main-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-text { color: #C0392B; }
:root[data-theme="burgundy"] .danger-text, :root[data-theme="brown"] .danger-text { color: #FF9A8A; }

@media (max-width: 900px) {
  .cal-cell { min-height: 64px; padding: 4px; }
  /* On small screens events become small coloured dots instead of text chips */
  .cal-chips { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .chip { width: 8px; height: 8px; padding: 0; font-size: 0; border: none; border-radius: 50%; background: var(--tag); }
  .more { display: none; }
}

/* small polish */
#ev-series-note { margin: -4px 0 14px; }
.event-row .time { min-width: 78px; padding-top: 2px; white-space: nowrap; }
.event-row .tag-badge { margin-top: 2px; }

/* event rows: stacked layout so titles never break mid-word */
.event-row { flex-direction: column; align-items: stretch; gap: 2px; padding-top: 8px; padding-bottom: 8px; }
.event-top { display: flex; align-items: center; gap: 8px; }
.event-top .tag-badge { margin-left: auto; margin-top: 0; }
.event-row .time { min-width: 0; padding-top: 0; }
.event-row .item-title { font-weight: 500; }

/* ============ DAILY SCHEDULE ============ */
.schedule-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.schedule-side { display: flex; flex-direction: column; gap: 20px; }

.sched-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sched-head h3 { margin: 0; text-transform: capitalize; flex: 1; text-align: center; }
.sched-nav { display: flex; align-items: center; gap: 4px; }

.allday-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 8px 10px; margin-bottom: 12px;
  background: var(--bg); border-radius: 12px;
}
.allday-strip .chip { width: auto; max-width: 220px; font-size: 0.8rem; padding: 4px 10px; }
.allday-label { font-size: 0.75rem; color: var(--muted); margin-right: 6px; }

.timeline { position: relative; margin-left: 54px; cursor: copy; }
.hour-row { position: absolute; left: 0; right: 0; height: 60px; border-top: 1px solid var(--border); pointer-events: none; }
.hour-row::after { content: ""; position: absolute; left: 0; right: 0; top: 30px; border-top: 1px dashed var(--border); opacity: 0.6; }
.hour-label { position: absolute; left: -54px; top: -9px; width: 44px; text-align: right; font-size: 0.75rem; color: var(--muted); background: var(--surface); }

.t-block {
  position: absolute;
  display: flex; flex-direction: column; gap: 1px;
  overflow: hidden;
  padding: 4px 8px;
  border: none; border-left: 4px solid var(--tag);
  border-radius: 10px;
  background: color-mix(in srgb, var(--tag) 34%, var(--surface));
  color: var(--text);
  font: inherit; font-size: 0.8rem; text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.t-block:hover { background: color-mix(in srgb, var(--tag) 52%, var(--surface)); z-index: 2; }
.t-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-time { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.now-line { position: absolute; left: -6px; right: 0; height: 2px; background: var(--primary-strong); pointer-events: none; z-index: 3; }
.now-line::before { content: ""; position: absolute; left: -2px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary-strong); }

.sched-hint { margin-top: 12px; font-size: 0.8rem; }

@media (max-width: 1000px) {
  .schedule-layout { grid-template-columns: 1fr; }
}

/* short events (under 45 min): title and time share one line */
.t-block.short { flex-direction: row; align-items: center; gap: 8px; padding: 2px 8px; }
.t-block.short .t-time { flex-shrink: 0; }

/* all-day events stay readable text chips on small screens (the calendar grid uses dots) */
@media (max-width: 900px) {
  .allday-strip .chip {
    width: auto; height: auto; max-width: 100%;
    padding: 4px 10px; font-size: 0.8rem;
    border-radius: 6px;
    background: color-mix(in srgb, var(--tag) 32%, var(--surface));
  }
}

/* ============ FOCUS RING AND TIMER ============ */
.ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.ring-svg { width: 100%; height: 100%; display: block; }
.ring-track { stroke: var(--border); }
.ring-lap1 { stroke: var(--primary-strong); }
.ring-lap2 { stroke: var(--accent); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring-main { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ring-sub { font-size: 0.72rem; color: var(--muted); }

.focus-body { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.focus-info { min-width: 0; }
.focus-amount { font-weight: 600; margin-bottom: 4px; }
.focus-card .btn { width: 100%; }
.focus-sessions { margin: 12px 0 0; }
.focus-sessions .item { font-size: 0.9rem; padding: 6px 4px; }

.week-bars { display: flex; justify-content: space-between; gap: 6px; margin-top: 14px; }
.week-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-bar { width: 100%; max-width: 26px; height: 44px; background: var(--border); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.week-bar i { display: block; width: 100%; background: var(--primary); border-radius: 6px; }
.week-col.met .week-bar i { background: var(--primary-strong); }
.week-col.is-today .week-day { color: var(--text); font-weight: 700; }
.week-day { font-size: 0.7rem; color: var(--muted); }

/* full-screen focus mode */
.focus-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 25% 15%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 55%),
              radial-gradient(circle at 80% 85%, color-mix(in srgb, var(--primary) 45%, transparent), transparent 55%),
              var(--bg);
}
.focus-panel { position: relative; width: min(440px, 92vw); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 24px; }
.focus-close { position: absolute; top: -8px; right: 0; font-size: 1.8rem; }
.ring-big { width: 280px; height: 280px; }
.ring-big .ring-main { font-size: 3rem; }
.ring-big .ring-sub { font-size: 0.85rem; margin-top: 4px; }
#fo-status { font-size: 1rem; letter-spacing: 0.5px; }
#fo-setup { display: flex; flex-direction: column; gap: 12px; width: 100%; }
#fo-setup input { text-align: center; }
#fo-running { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.fo-label { font-size: 1.05rem; min-height: 1.4em; }
.fo-buttons { display: flex; gap: 12px; }
.fo-buttons .btn { min-width: 120px; }

/* the ring breathes gently while a session is running */
@media (prefers-reduced-motion: no-preference) {
  .focus-overlay .ring-big { animation: breathe 7s ease-in-out infinite; }
  @keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
}

.dialog-small { width: min(380px, 94vw); }
input[type="number"] {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; font: inherit; font-size: 0.95rem;
}
#fo-setup input[type="text"] {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font: inherit;
}

/* six tabs fit in the small-screen bottom bar */
@media (max-width: 900px) {
  .nav-link { padding: 12px 6px; font-size: 0.78rem; white-space: nowrap; }
  .ring-big { width: 240px; height: 240px; }
}

/* ============ EXAMS AND STUDY PLANNER ============ */
.exam-row { align-items: flex-start; gap: 12px; padding: 10px 4px; cursor: pointer; border-radius: 10px; }
.exam-row:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.countdown {
  flex-shrink: 0; width: 62px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--bg); border: 1px solid var(--border);
}
.countdown.urgent { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.count-num { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.count-num.small { font-size: 0.95rem; }
.count-unit { font-size: 0.7rem; opacity: 0.8; }
.exam-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-btn { align-self: flex-start; margin-top: 6px; }

.plan-summary { font-weight: 600; margin: 14px 0 6px; }
.plan-list { max-height: 240px; overflow-y: auto; margin-bottom: 10px; }
.plan-list .time { min-width: 100px; text-align: right; }
.plan-note { max-width: 240px; font-size: 0.8rem; }
#plan-preview-btn { margin-top: 4px; }

/* ============ CHAT ============ */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; max-width: 760px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 4px 14px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.cleo { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble.user { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; }
.bubble.thinking { color: var(--muted); font-style: italic; }
.bubble.error { border-color: #d9788b; color: #b0405a; }
.proposal {
  align-self: flex-start; width: min(420px, 90%); padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 16px;
}
.proposal-kind { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.proposal-rows { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; }
.proposal-rows dt { color: var(--muted); font-size: 0.85rem; }
.proposal-rows dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.proposal-actions { display: flex; align-items: center; gap: 8px; }
.proposal-status { font-size: 0.85rem; color: var(--muted); }
.proposal-status.ok { color: var(--primary-strong); font-weight: 600; }
.proposal-status.bad { color: #b0405a; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--border); }
.chat-form textarea {
  flex: 1; resize: none; padding: 11px 14px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; max-height: 120px;
}
.chat-form textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (max-width: 900px) { .chat-wrap { height: calc(100vh - 190px); } .bubble { max-width: 90%; } }

/* ============ STUDY ============ */
.study-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.study-head h2 { margin: 0; }
.subject-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.swatch.big { width: 16px; height: 16px; border-radius: 5px; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.subject-card {
  text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 18px; cursor: pointer;
  background: var(--surface); color: var(--text); font: inherit;
  border: 1px solid var(--border); border-left: 6px solid var(--tag); border-radius: 16px;
}
.subject-card:hover { background: color-mix(in srgb, var(--tag) 12%, var(--surface)); }
.subject-name { font-size: 1.1rem; font-weight: 600; }
.subject-meta { font-size: 0.85rem; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: none; font: inherit; color: var(--muted); cursor: pointer;
  padding: 10px 14px; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary-strong); }
.study-body { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.study-body .card { margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-pick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch-pick.picked { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.dropzone { border: 2px dashed var(--border); border-radius: 14px; padding: 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dropzone.over { border-color: var(--primary-strong); background: color-mix(in srgb, var(--primary) 15%, transparent); }
.dropzone p { margin: 0; }
.notes-card { display: flex; flex-direction: column; gap: 10px; }
.notes-card input, .notes-card textarea, .generate-card select, .generate-card input {
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.notes-card h3 { margin: 0; }
.notes-card .btn { align-self: flex-start; }
.material-meta { margin-left: auto; padding-right: 10px; font-size: 0.85rem; }
.gen-row { display: flex; gap: 12px; flex-wrap: wrap; }
.gen-row .field { margin-bottom: 8px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card-row { align-items: flex-start; gap: 8px; }
.card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.study-chat { height: calc(100vh - 290px); min-height: 360px; max-width: none; }
.study-foot { display: flex; justify-content: flex-end; }
.bubble-group { align-self: flex-start; max-width: 80%; display: flex; flex-direction: column; gap: 6px; }
.bubble-group .bubble { max-width: none; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.source-chip { font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--muted); }
.review { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.review-top { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.flash {
  width: 100%; min-height: 240px; padding: 28px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px;
  background: var(--surface); color: var(--text); font: inherit; border: 1px solid var(--border); border-radius: 22px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}
.flash.back { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
.flash-side { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.flash-text { font-size: 1.25rem; line-height: 1.45; text-align: center; }
.review-hint { margin: 0; font-size: 0.85rem; }
.review-buttons { display: flex; gap: 12px; }
.review-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.big-score { font-size: 2.4rem; font-weight: 700; margin: 0; }
.quiz-question { margin: 14px 0; font-size: 1.15rem; line-height: 1.4; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  text-align: left; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; cursor: pointer;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary-strong); }
.quiz-option.right { background: color-mix(in srgb, #7FB7A4 35%, var(--surface)); border-color: #7FB7A4; opacity: 1; }
.quiz-option.wrong { background: color-mix(in srgb, #D9788B 30%, var(--surface)); border-color: #D9788B; opacity: 1; }
.quiz-option:disabled { opacity: 0.75; cursor: default; }
.quiz-feedback { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); line-height: 1.45; }
.quiz-card .btn { margin-top: 12px; align-self: flex-start; }
@media (max-width: 900px) { .study-chat { height: calc(100vh - 340px); } .bubble-group { max-width: 92%; } }

/* ============ CLOCK ============ */
.clock { flex-shrink: 0; }
.clock-time { font-size: 2.8rem; font-weight: 600; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
@media (max-width: 900px) { .topbar-pulse { display: none; } .clock-time { font-size: 2.1rem; } }

/* ============ TABLET (Lenovo P11 and similar) ============ */
.settings-btn { display: none; }
@media (max-width: 900px) {
  .topbar { gap: 12px; }
  .settings-btn { display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; width: 44px; height: 44px; }
  .clock { margin-left: auto; }
}
.theme-row { display: flex; gap: 14px; margin: 6px 0 18px; }
.theme-row .theme-dot { width: 34px; height: 34px; }
.settings-links { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* fingers are bigger than a mouse pointer */
@media (pointer: coarse) {
  .nav-link { padding: 14px 12px; }
  .btn.small { padding: 11px 20px; }
  .icon-btn { min-width: 42px; min-height: 42px; }
  .check, .check-row input { width: 24px; height: 24px; }
  .tab { padding: 14px 16px; }
  .quiz-option { padding: 16px 18px; }
  .item { padding-top: 10px; padding-bottom: 10px; }
  .cal-cell { min-height: 72px; }
}

/* ============ VOICE ============ */
.voice-btn { padding: 0; width: 46px; height: 46px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.voice-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.voice-btn.on { background: color-mix(in srgb, var(--primary) 30%, transparent); border-color: var(--primary-strong); }
.voice-btn.listening { background: #D9788B; color: #fff; border-color: #D9788B; animation: listen-pulse 1.1s ease-in-out infinite; }
@keyframes listen-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 120, 139, 0.55); } 50% { box-shadow: 0 0 0 10px rgba(217, 120, 139, 0); } }

.voice-settings { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; align-items: flex-start; }
.voice-settings .field { width: 100%; }
.voice-settings select { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; width: 100%; }
.voice-settings input[type=range] { width: 100%; accent-color: var(--primary-strong); }
#settings-dialog { max-height: 90vh; overflow-y: auto; }

.settings-side { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.settings-side .gear { font-size: 1.2rem; }
.settings-side:hover { background: var(--border); }

/* ---- focus: add time, subjects, floating chip */
.focus-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.focus-buttons .btn { flex: 1; }
.focus-subjects { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.small-head { margin: 0 0 2px; font-size: 0.85rem; }
.subj-row { display: grid; grid-template-columns: minmax(70px, 1fr) 2fr auto; align-items: center; gap: 10px; font-size: 0.88rem; }
.subj-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-bar { height: 8px; border-radius: 6px; background: var(--border); overflow: hidden; }
.subj-bar i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.subj-time { color: var(--muted, #888); font-variant-numeric: tabular-nums; }
.subject-week { font-size: 0.82rem; color: var(--muted); }
.subject-title .subject-week { align-self: center; margin-left: 4px; }
.focus-chip {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  background: var(--primary); color: var(--on-primary); border: 0; border-radius: 999px;
  padding: 10px 18px; font: inherit; font-weight: 600; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 18px rgba(0,0,0,0.22); cursor: pointer; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.focus-chip.hidden { display: none; }
#fo-subject { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
@media (max-width: 900px) { .focus-chip { bottom: 84px; } }

/* ---- self-care card */
.care-label { margin: 14px 0 6px; font-size: 0.85rem; color: var(--muted); }
.care-card .care-label:first-of-type { margin-top: 4px; }
.drops { display: flex; flex-wrap: nowrap; gap: 0; justify-content: space-between; }
.drop { background: none; border: 0; padding: 2px; cursor: pointer; width: 34px; height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.drop svg { width: 26px; height: 30px; fill: none; stroke: var(--primary-strong, var(--primary)); stroke-width: 1.6; stroke-linejoin: round; transition: transform .12s, fill .2s; }
.drop:hover svg { transform: translateY(-2px); }
.drop.full svg { fill: var(--primary); }
.drop-extra { align-self: center; font-size: 0.85rem; color: var(--muted); }
.care-line { margin: 6px 0 0; font-size: 0.92rem; }
.moods { display: flex; gap: 6px; }
.mood { font-size: 1.4rem; width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; background: var(--surface); cursor: pointer; filter: grayscale(0.6); opacity: .8; }
.mood:hover { opacity: 1; }
.mood.picked { border-color: var(--primary-strong, var(--primary)); filter: none; opacity: 1; }
.care-habits { list-style: none; margin: 0 0 8px; padding: 0; }
.care-habit { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
.care-habit label { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; }
.care-habit input { width: 20px; height: 20px; accent-color: var(--primary-strong, var(--primary)); flex-shrink: 0; }
.care-habit.done span { text-decoration: line-through; color: var(--muted); }
.care-remove { opacity: 0; font-size: 1.2rem; }
.care-habit:hover .care-remove, .care-habit:focus-within .care-remove { opacity: .7; }
@media (pointer: coarse) { .care-remove { opacity: .45; } .care-habit { padding: 10px 2px; } }

.drops.many { flex-wrap: wrap; justify-content: flex-start; }

/* ---- self-care extras */
.check-line { display: flex; gap: 10px; align-items: center; font-size: 0.92rem; }
.care-more { margin: 12px 0 0; border-top: 1px solid var(--border); padding-top: 8px; }
.care-more summary { cursor: pointer; font-size: 0.88rem; color: var(--muted); list-style: none; padding: 4px 0; }
.care-more summary::before { content: "▸ "; }
.care-more[open] summary::before { content: "▾ "; }
.sleep-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.9rem; }
.sleep-row input[type=time] { padding: 6px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.coffee-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.coffee-row .icon-btn { border: 1px solid var(--border); border-radius: 50%; width: 36px; height: 36px; }
.care-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.streak { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.mini-card { padding: 16px; }
.mini-card h3 { margin-bottom: 8px; }
.mini-focus { display: flex; align-items: center; gap: 14px; }
.ring-mini { width: 76px; height: 76px; }
.ring-mini .ring-main { font-size: 0.95rem; }
.drops.mini .drop { width: 28px; height: 34px; }
.drops.mini .drop svg { width: 20px; height: 24px; }
.care-habits.compact .care-habit { padding: 4px 2px; font-size: 0.85rem; }
.care-habits.compact input { width: 17px; height: 17px; }

.care-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 60; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px 12px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: min(560px, 92vw); }
.care-toast.hidden { display: none; }
.toast-actions { display: flex; gap: 6px; }
@media (max-width: 900px) { .care-toast { bottom: 90px; } }

.breath-dialog { text-align: center; }
.breath-stage { height: 190px; display: flex; align-items: center; justify-content: center; }
.breath-circle { width: 150px; height: 150px; border-radius: 50%; background: var(--primary); opacity: .55; transform: scale(.55); }
.breath-circle.go { animation: breathe-guide 10s ease-in-out forwards; }
@keyframes breathe-guide { 0% { transform: scale(.55); } 40% { transform: scale(1); } 100% { transform: scale(.55); } }
.breath-word { font-size: 1.3rem; font-weight: 600; margin: 4px 0 2px; }

.week-dialog { width: min(620px, 94vw); }
.week-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-bottom: 10px; }
.week-table th, .week-table td { text-align: center; padding: 4px 2px; }
.week-table th:first-child { text-align: left; color: var(--muted); font-weight: 500; }
.week-table th.today { color: var(--primary-strong); }
.week-table td.small { font-size: 0.8rem; color: var(--muted); }
.week-table td.face { font-size: 1.3rem; }
.wk-bar { height: 60px; width: 18px; margin: 0 auto; background: var(--border); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.wk-bar i { display: block; width: 100%; background: var(--primary); border-radius: 6px; }
.week-notes { margin: 0; padding-left: 18px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
.focus-buttons .btn { white-space: nowrap; padding-left: 12px; padding-right: 12px; }

/* ---- roadmap */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.goal-card { border-top: 5px solid var(--goal); display: flex; flex-direction: column; gap: 10px; }
.goal-card.achieved { opacity: .8; }
.goal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.goal-head h3 { margin: 0; }
.goal-date { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.goal-date.late, .step-due.late { color: var(--danger, #c0504d); }
.goal-note { margin: 0; font-size: 0.9rem; }
.goal-progress { display: flex; align-items: center; gap: 10px; }
.goal-bar { flex: 1; height: 10px; border-radius: 8px; background: var(--border); overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: var(--goal); border-radius: 8px; transition: width .3s; }
.goal-pct { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.goal-steps { list-style: none; margin: 0; padding: 0; }
.goal-step { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
.goal-step label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.goal-step input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--goal); flex-shrink: 0; }
.goal-step.done span { text-decoration: line-through; color: var(--muted); }
.step-due { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.goal-step:hover .care-remove, .goal-step:focus-within .care-remove { opacity: .7; }
.goal-step-form { display: flex; gap: 6px; flex-wrap: wrap; }
.goal-step-form input[type=text] { flex: 1 1 140px; min-width: 0; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.goal-step-form input[type=date] { padding: 6px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; max-width: 140px; }
.goal-actions { display: flex; justify-content: flex-end; }
.goal-done summary { cursor: pointer; color: var(--muted); margin: 6px 0 12px; }

/* ---- roadmap folders, smaller goals, tags */
.goal-folder { display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer; font: inherit; color: var(--text); border-left: 6px solid var(--goal); }
.goal-folder:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.08); }
.folder-title { font-size: 1.15rem; font-weight: 600; }
.folder-meta { font-size: 0.85rem; margin: 0; }
.goal-summary { border-left: 6px solid var(--goal); display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.steps-heading { margin: 4px 0 10px; }
.step-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.step-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.step-card.complete { opacity: .75; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-head > input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary-strong); flex-shrink: 0; }
.step-title { flex: 1; text-align: left; background: none; border: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; display: flex; gap: 8px; padding: 4px 0; }
.step-title .struck { text-decoration: line-through; color: var(--muted); }
.chev { color: var(--muted); width: 12px; }
.step-count { font-size: 0.82rem; color: var(--muted); min-width: 28px; text-align: right; }
.goal-bar.thin { height: 6px; }
.goal-items { list-style: none; margin: 4px 0 0; padding: 0; }
.goal-item { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 0.92rem; flex-wrap: wrap; }
.goal-item label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.goal-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary-strong); }
.goal-item.done span { color: var(--muted); }
.goal-item label span { }
.goal-item.done label span { text-decoration: line-through; }
.goal-item-title { flex: 1; }
.goal-item:hover .care-remove, .goal-item:focus-within .care-remove { opacity: .7; }
.small-note { font-size: 0.85rem; margin: 2px 0; }
.add-step { margin-top: 4px; }
.goal-tag { font-size: 0.7rem; color: var(--muted); border: 1px solid var(--border); border-left: 3px solid var(--goal, var(--border)); border-radius: 8px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; align-self: center; }
/* the goal tag sits under the task title */
.item-title .goal-tag { display: block; width: fit-content; margin: 3px 0 0; max-width: 100%; }

/* ---- morning check-in */
.checkin-dialog { width: min(520px, 94vw); }
.ci-rule { height: 1px; background: var(--border); margin: 16px 0 10px; }
.ci-line { margin-bottom: 10px; }
.ci-line strong { font-size: 0.82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ci-line p { margin: 2px 0 0; }
.checkin-dialog .chips { flex-direction: row; } .checkin-dialog .chip { width: auto; flex: 0 0 auto; }

/* ---- evening check-in and journal */
.journal-fields { display: flex; flex-direction: column; gap: 6px; }
.journal-fields textarea { width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
#journal-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; margin: 10px 0; }
.journal-entry { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.journal-entry:hover { border-color: var(--primary); }
.journal-entry strong { font-size: 0.85rem; color: var(--muted); }
.je-line { font-size: 0.92rem; }
.je-line em { color: var(--muted); font-style: normal; }
#evening-dialog, #journal-edit-dialog { max-height: 92vh; overflow-y: auto; }

/* ---- Day overview panels keep a fixed height and scroll inside when they have more to show */
#view-today .grid { align-items: start; }
#view-today .grid > .card { max-height: 470px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--primary) transparent; }
#overdue-box { max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--primary) transparent; }
.schedule-side .mini-card { max-height: 320px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--primary) transparent; }
#view-today .grid > .card::-webkit-scrollbar, #overdue-box::-webkit-scrollbar, .schedule-side .mini-card::-webkit-scrollbar { width: 7px; }
#view-today .grid > .card::-webkit-scrollbar-thumb, #overdue-box::-webkit-scrollbar-thumb, .schedule-side .mini-card::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 6px; }

.birthday .confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
