:root {
  --bg: #f3f0eb;
  --surface: #fbfaf7;
  --surface-strong: #ffffff;
  --text: #252423;
  --muted: #7a7670;
  --line: #dfdbd4;
  --line-strong: #ccc6bd;
  --accent: #343331;
  --accent-soft: #ece7df;
  --danger: #9b3e35;
  --shadow: 0 18px 50px rgba(52, 49, 45, 0.08);
  --radius: 20px;
}
:root { --season-ink: #46564c; --season-tint: #edf0ec; --reminder-ink: #86422e; --reminder-tint: #fff0dd; }
:root[data-season="halloween"] {
  color-scheme: dark;
  --bg: #1e1d21;
  --surface: #29272c;
  --surface-strong: #302d33;
  --text: #ede7df;
  --muted: #b4aaa5;
  --line: #454047;
  --line-strong: #625762;
  --accent: #bc916e;
  --accent-soft: #3b333e;
  --danger: #df9990;
  --shadow: 0 8px 24px rgba(0,0,0,.12);
  --season-ink: #aa8eac;
  --season-tint: #302a35;
  --reminder-ink: #dfb58b;
  --reminder-tint: #39302c;
}
:root[data-season="newyear"] { --bg: #eef1ef; --surface: #fafbf9; --line: #d8e0db; --accent: #314b40; --accent-soft: #e2ebe5; --season-ink: #9a514e; --season-tint: #e7efea; --reminder-ink: #8b383b; --reminder-tint: #fbebeb; }
:root[data-season="winter"] { --season-ink: #637985; --season-tint: #e9eff2; --accent-soft: #e8edf0; }
:root[data-season="spring"] { --season-ink: #6b8069; --season-tint: #eaf0e6; --accent-soft: #e8ede5; }
:root[data-season="summer"] { --season-ink: #5f827d; --season-tint: #e7f0ed; --accent-soft: #e8efeb; }
:root[data-season="autumn"] { --season-ink: #8d7060; --season-tint: #f0eae4; }
html[data-season] .topbar { background: var(--season-tint); border-top: 2px solid var(--season-ink); }
html[data-season] .brand-mark { box-shadow: inset 0 -3px 0 var(--season-ink); }
html[data-season] .topbar .eyebrow { color: var(--season-ink); }
.reminder-alert { border: 1px solid var(--reminder-ink); border-radius: 8px; min-height: 36px; padding: 7px 10px; background: var(--reminder-tint); color: var(--reminder-ink); font-size: 12px; font-weight: 650; white-space: normal; }
.reminder-alert[hidden] { display: none; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }

* {
  box-sizing: border-box;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.photo-section { margin-top: 16px; }
.photo-label { display: inline-flex; align-items: center; cursor: pointer; }
.photo-label input { width: 160px; margin-left: 12px; }
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill,96px); gap: 10px; margin-top: 12px; }
.photo-cell { position: relative; width: 96px; height: 96px; }
.photo-thumbnail { display: block; width: 96px; height: 96px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: zoom-in; }
.photo-thumbnail img { display: block; width: 100%; height: 100%; object-fit: contain; }
.photo-remove { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; color: var(--text); background: var(--surface); }
.photo-viewer { width: fit-content; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 44px 12px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); overflow: auto; }
.photo-viewer::backdrop { background: rgba(0,0,0,.8); }
.photo-viewer img { display: block; width: auto; height: auto; max-width: min(1100px,calc(100vw - 52px)); max-height: calc(100dvh - 94px); object-fit: contain; }
.photo-viewer-close { position: absolute; right: 8px; top: 6px; }
.photo-viewer-status { min-width: 200px; text-align: center; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent 42%),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), transparent 42%),
    var(--bg);
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(251, 250, 247, 0.88);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 10px;
  font-size: 44px;
}

.auth-card p {
  color: var(--muted);
}

.auth-brand {
  box-shadow: none;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.68);
  backdrop-filter: blur(18px);
}

.brand,
.profile-card,
.panel,
.metric-card {
  border: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.82);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.profile-card span,
.panel-kicker,
.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--accent-soft);
}

.profile-card {
  margin-top: auto;
  display: grid;
  gap: 9px;
  padding: 14px;
  border-radius: 18px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 132px;
  margin-bottom: 24px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(251, 250, 247, 0.74);
  box-shadow: var(--shadow);
}

.topbar-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.header-art {
  position: absolute;
  inset: -38px 28px auto auto;
  width: min(34vw, 360px);
  height: 220px;
  opacity: 0.42;
  pointer-events: none;
}

.header-art::after {
  position: absolute;
  inset: 54% 8% 12% 8%;
  content: "";
  border-radius: 50%;
  background: rgba(50, 47, 43, 0.18);
  filter: blur(18px);
}

.header-art img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: grayscale(0.18) saturate(0.8) contrast(0.94);
}

.topbar-actions,
.focus-row,
.button-cluster,
.editor-actions,
.modal-actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button,
.small-button,
.icon-button,
.quick-ai button {
  min-height: 40px;
  border-radius: 13px;
  border: 1px solid var(--line);
  padding: 0 14px;
}

.primary-button {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.ghost-button,
.small-button,
.icon-button,
.quick-ai button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.54);
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 21px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.today-grid {
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr) minmax(300px, 1fr);
}

.today-extra-grid {
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  margin-top: 18px;
}
.reminder-module, .daily-tools { display: grid; align-content: start; gap: 12px; min-width: 0; }
.reminder-module { width: 100%; max-width: 280px; }
.reminder-calendar, .reminder-agenda { padding: 12px; border-radius: 14px; }
.reminder-calendar .panel-head { margin-bottom: 8px; gap: 8px; }
.reminder-calendar h2, .reminder-agenda h2 { font-size: 14px; }
.reminder-agenda .panel-head { margin-bottom: 6px; }
.reminder-agenda.has-reminders { border: 2px solid var(--reminder-ink); background: var(--reminder-tint); box-shadow: 0 4px 16px rgba(100,60,40,.07); }
.reminder-agenda.has-reminders h2 { color: var(--reminder-ink); }
.reminder-agenda.has-reminders #reminderCount { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 6px; background: var(--reminder-ink); color: white; font-size: 12px; font-weight: 700; }
.reminder-agenda.has-reminders .reminder-note strong { color: var(--reminder-ink); font-size: 15px; }
.reminder-field { display: grid; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.reminder-field input { min-height: 42px; width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
.reminder-calendar .panel-head { flex-wrap: wrap; }
.reminder-calendar .button-cluster { gap: 3px; }
.reminder-calendar .icon-button { width: 24px; min-height: 26px; font-size: 18px; border: 0; background: transparent; }
.reminder-weekdays, .reminder-calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 2px; }
.reminder-weekdays { margin-bottom: 5px; text-align: center; font-size: 10px; color: var(--muted); }
.reminder-day, .reminder-empty-day { min-width: 0; height: 27px; }
.reminder-day { position: relative; min-height: 27px; padding: 0 0 3px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font-size: 11px; }
.reminder-day:hover { background: var(--accent-soft); }
.reminder-day.has-reminders { background: #dce8e0; color: #294c3b; font-weight: 650; }
.reminder-day.selected { border-color: #647d6c; box-shadow: inset 0 0 0 1px #647d6c; }
.reminder-day[aria-current="date"] { text-decoration: underline; text-underline-offset: 3px; }
.reminder-dot { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #527b62; bottom: 3px; left: calc(50% - 1.5px); }
.reminder-today { margin-top: 6px; min-height: 25px; padding: 0; border: 0; background: transparent; font-size: 11px; }
.reminder-agenda-list { display: grid; gap: 6px; }
.reminder-note { display: grid; gap: 4px; width: 100%; min-width: 0; padding: 10px 0; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); }
.reminder-note strong { font-size: 14px; overflow-wrap: anywhere; }
.reminder-note span { font-size: 12px; color: var(--muted); }
.reminder-note:hover strong { text-decoration: underline; }
.reminder-note:last-child { border-bottom: 0; }

.panel,
.metric-card {
  border-radius: var(--radius);
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-kicker {
  display: block;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.panel-note {
  color: var(--muted);
  font-size: 12px;
}

.focus-panel {
  min-height: 310px;
}

.focus-task {
  min-height: 124px;
  display: flex;
  align-items: center;
  padding: 18px 0;
  font-size: 30px;
  font-weight: 740;
  line-height: 1.08;
}

.task-list,
.habit-list,
.note-list,
.template-list,
.metric-settings-list,
.folder-list,
.close-day-bars {
  display: grid;
  gap: 10px;
}

.task-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.task-item,
.habit-item,
.note-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
}

.task-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.note-format-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; }
.note-format-toolbar button { min-width: 30px; height: 30px; padding: 4px; border: 0; border-radius: 4px; color: var(--text); background: transparent; }
.note-format-toolbar button:hover { background: var(--accent-soft); }
.note-format-toolbar select { width: 64px; padding: 4px; min-height: 30px; }
#noteModal { max-height: calc(100dvh - 24px); overflow-y: auto; }
#noteModal #noteBodyInput { min-height: 160px; }
.note-rich-text { min-height: 280px; padding: 14px; border: 1px solid var(--line); border-radius: 0 0 8px 8px; outline: none; }
.note-rich-text:focus { border-color: var(--accent); }
.note-rich-text, .note-reader { font-size: 16px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.note-reader { min-height: 240px; padding: 16px 0; }
.note-rich-text p, .note-reader p { margin: 0 0 10px; }
.note-rich-text ul, .note-rich-text ol, .note-reader ul, .note-reader ol { padding-left: 26px; white-space: normal; }
.editor-panel #editorTitle { overflow-wrap: anywhere; min-width: 0; }

.task-item { grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; }
.task-priority { width: 96px; min-width: 0; padding: 6px; font-size: 11px; color: var(--muted); }
.day-report { padding-left: 24px; margin: 0; }
.day-report li { padding: 8px 0; overflow-wrap: anywhere; line-height: 1.6; }
.progress-totals { margin: 16px 0; }
.progress-total { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.progress-total span { overflow-wrap: anywhere; min-width: 0; }
[hidden] { display: none !important; }

.task-action {
  width: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
}

.task-action:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.task-item.done,
.habit-item.done {
  color: var(--muted);
  background: rgba(236, 231, 223, 0.64);
}

.check {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
}

.done .check {
  background: var(--accent);
}

.pill {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 12px;
}

.template-item,
.metric-setting-item,
.folder-item,
.progress-line {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.46);
}

.template-item {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
}

.template-item strong,
.metric-setting-item strong,
.folder-item strong {
  display: block;
}

.template-item span,
.metric-setting-item span,
.folder-item span,
.progress-line span {
  color: var(--muted);
  font-size: 12px;
}

.progress-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.metric-card {
  display: grid;
  gap: 7px;
  padding: 18px;
}

.metric-card strong {
  font-size: 42px;
  line-height: 1;
}

select,
.search,
.chat-form input,
.auth-form input,
.api-box input,
.metric-editor input,
.folder-editor input,
.note-meta-editor input,
.note-meta-editor select,
.modal input,
.modal textarea,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.66);
  outline: none;
}

select,
.search,
.chat-form input,
.auth-form input,
.api-box input,
.metric-editor input,
.folder-editor input,
.note-meta-editor input,
.note-meta-editor select,
.modal input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 310px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.month-box {
  min-height: 88px;
  display: grid;
  align-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
}

.month-box strong {
  font-size: 13px;
}

.bar {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--accent-soft);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-cell {
  cursor: pointer;
  aspect-ratio: 1 / 0.82;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
  font-size: 12px;
}

.day-cell strong,
.day-cell span {
  display: block;
}

.day-cell strong {
  color: var(--text);
  font-size: 13px;
}

.day-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.day-cell.hot-1 {
  background: #eee9e1;
}

.day-cell.hot-2 {
  background: #d9d2c8;
}

.day-cell.hot-3 {
  color: #fff;
  background: #5d5a55;
}
#progressView .metrics-row { gap: 10px; margin-bottom: 12px; max-width: 660px; }
#progressView .metric-card { padding: 12px 14px; gap: 5px; border-radius: 14px; }
#progressView .metric-card strong { font-size: 28px; }
#progressView > .panel { padding: 14px; margin-bottom: 12px; }
#progressView .panel-head { margin-bottom: 10px; }
#progressView h2 { font-size: 15px; }
#progressView .year-grid { grid-template-columns: repeat(12,minmax(0,1fr)); gap: 5px; }
#progressView .month-box { min-height: 62px; padding: 7px; border-radius: 8px; gap: 6px; }
#progressView .month-box strong { font-size: 11px; }
#progressView .month-box .pill { padding: 2px 0; background: transparent; font-size: 11px; }
#progressView .month-grid { grid-template-columns: repeat(7,minmax(0,1fr)); gap: 5px; max-width: 440px; }
#progressView .day-cell { height: 44px; min-height: 44px; aspect-ratio: auto; padding: 4px; border-radius: 7px; }
#progressView .day-cell strong { font-size: 13px; line-height: 15px; }
#progressView .day-cell span { font-size: 10px; line-height: 12px; margin-top: 0; }
#progressView .metric-settings-list { gap: 6px; }
#progressView .metric-setting-item { padding: 8px 10px; gap: 5px; border-radius: 8px; }
@media (max-width: 720px) {
  #progressView .year-grid { grid-template-columns: repeat(6,minmax(0,1fr)); }
  #progressView .metrics-row { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #progressView .metric-card { min-width: 0; padding: 10px; }
  #progressView .metric-card span, #progressView .metric-card small { overflow-wrap: anywhere; font-size: 10px; }
  #progressView .metric-card strong { font-size: 24px; }
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
  gap: 18px;
}

.metric-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.note-list {
  margin-top: 12px;
}
.note-category-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.note-category-toolbar > input, .note-category-toolbar > select { flex: 1 1 120px; min-width: 0; width: auto; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }

.important-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(236, 231, 223, 0.82);
}

.important-box strong {
  display: block;
  margin-top: 3px;
  font-size: 28px;
  line-height: 1;
}

.folder-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.folder-item {
  position: relative;
  min-height: 66px;
  text-align: left;
}

.folder-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.folder-editor,
.note-meta-editor {
  display: grid;
  gap: 10px;
}

.folder-editor {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.folder-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.folder-mini-button {
  width: 30px;
  min-height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.note-meta-editor {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.note-item {
  grid-template-columns: minmax(0, 1fr) auto;
  text-align: left;
}

.note-item strong,
.note-item span {
  display: block;
}

.note-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-panel {
  min-height: 500px;
}
.editor-actions { flex-wrap: wrap; }
.danger-button { color: var(--danger); }
.memo-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.vault-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.vault-grid article {
  display: grid;
  gap: 10px;
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.46);
}

.vault-grid span {
  color: var(--muted);
  font-size: 12px;
}

.vault-grid.locked {
  filter: blur(3px);
  user-select: none;
}

.chat-panel {
  min-height: 560px;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 410px;
  max-height: 54vh;
  overflow: auto;
  padding-right: 4px;
}

.message {
  width: fit-content;
  max-width: min(620px, 88%);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  line-height: 1.42;
}

.message.user {
  justify-self: end;
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { position: relative; margin-right: 24px; }
.message-edit { position: absolute; left: calc(100% + 5px); bottom: 3px; display: grid; place-items: center; margin: 0; padding: 0; width: 20px; height: 24px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font-size: 12px; opacity: 0; transition: opacity 120ms ease; }
.message.user:hover .message-edit, .message.user:focus-within .message-edit { opacity: .55; }
.message-edit:hover, .message-edit:focus-visible { opacity: 1 !important; }
.message-edit:focus-visible { outline: 1px solid var(--line-strong); outline-offset: 1px; }
@media (hover: none) { .message-edit { opacity: .45; } }
.chat-panel .panel-head { flex-wrap: wrap; }
.chat-panel .button-cluster { flex-wrap: wrap; }

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.quick-ai {
  display: grid;
  gap: 10px;
}

.quick-head {
  margin-top: 22px;
}

.api-box {
  display: grid;
  gap: 12px;
}

.api-box label {
  display: grid;
  gap: 6px;
}

.api-box label span,
.api-box p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.api-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-ai button {
  width: 100%;
  text-align: left;
}

.modal {
  max-width: 480px;
  width: calc(100% - 32px);
  border: 0;
  border-radius: 22px;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(27, 26, 25, 0.24);
  backdrop-filter: blur(3px);
}

.modal-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal textarea {
  min-height: 160px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
}

.check-line input {
  width: 18px;
  height: 18px;
}

.day-modal-card {
  max-height: min(720px, calc(100vh - 32px));
  overflow: auto;
}

.day-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.day-summary article,
.day-log article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
}

.day-summary span,
.day-log span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.day-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.day-log {
  display: grid;
  gap: 8px;
}

.day-log article {
  display: grid;
  gap: 4px;
}

.review-score {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.review-score strong {
  font-size: 46px;
  line-height: 1;
}

.review-score span {
  color: var(--muted);
}

.modal-actions {
  justify-content: flex-end;
}

.focus-mode .panel:not(.focus-panel),
.focus-mode .sidebar,
.focus-mode .topbar .topbar-copy,
.focus-mode .topbar .primary-button {
  opacity: 0.32;
}

/* Halloween uses the same restrained palette on every surface. */
html[data-season="halloween"] body,
html[data-season="halloween"] .auth-screen { background: var(--bg); }
html[data-season="halloween"] .sidebar { background: #242226; backdrop-filter: none; }
html[data-season="halloween"] .brand,
html[data-season="halloween"] .profile-card,
html[data-season="halloween"] .panel,
html[data-season="halloween"] .metric-card,
html[data-season="halloween"] .auth-card { background: var(--surface); }
html[data-season="halloween"] .topbar { background: var(--season-tint); border-top: 1px solid var(--line); }
html[data-season="halloween"] .topbar .eyebrow { color: var(--muted); }
html[data-season="halloween"] .brand-mark { background: #514357; color: var(--text); box-shadow: none; }
html[data-season="halloween"] .nav-item.active { background: #443747; border-color: #66536a; color: #f0d8c0; }
html[data-season="halloween"] .primary-button { background: var(--accent); border-color: var(--accent); color: #201c1a; }
html[data-season="halloween"] .ghost-button,
html[data-season="halloween"] .small-button,
html[data-season="halloween"] .icon-button,
html[data-season="halloween"] .task-action,
html[data-season="halloween"] .folder-mini-button,
html[data-season="halloween"] .quick-ai button { background: var(--surface-strong); }
html[data-season="halloween"] .task-item,
html[data-season="halloween"] .habit-item,
html[data-season="halloween"] .note-item,
html[data-season="halloween"] .template-item,
html[data-season="halloween"] .metric-setting-item,
html[data-season="halloween"] .folder-item,
html[data-season="halloween"] .progress-line,
html[data-season="halloween"] .vault-grid article,
html[data-season="halloween"] .day-summary article,
html[data-season="halloween"] .day-log article,
html[data-season="halloween"] .review-score { background: #302d33; }
html[data-season="halloween"] .task-item.done,
html[data-season="halloween"] .habit-item.done { background: #28262b; }
html[data-season="halloween"] input:not([type="checkbox"]),
html[data-season="halloween"] select,
html[data-season="halloween"] textarea { background: #242226; color: var(--text); border-color: var(--line); }
html[data-season="halloween"] input::placeholder,
html[data-season="halloween"] textarea::placeholder { color: #a0969e; }
html[data-season="halloween"] .folder-item.active { background: #443747; border-color: #78617c; }
html[data-season="halloween"] .important-box { background: #3b323f; border-color: #6b5570; }
html[data-season="halloween"] .month-box,
html[data-season="halloween"] .day-cell { background: #302d33; }
html[data-season="halloween"] .day-cell.hot-1 { background: #423645; }
html[data-season="halloween"] .day-cell.hot-2 { background: #66516a; }
html[data-season="halloween"] .day-cell.hot-3 { background: #ac8463; }
html[data-season="halloween"] .day-cell.hot-3 strong,
html[data-season="halloween"] .day-cell.hot-3 span { color: #1e1a18; }
html[data-season="halloween"] .bar { background: #443b46; }
html[data-season="halloween"] .bar span { background: #ad8f76; }
html[data-season="halloween"] .message { background: #343038; }
html[data-season="halloween"] .message.user { background: #514155; border-color: #67526c; color: #f1e9ee; }
html[data-season="halloween"] .reminder-day.has-reminders { background: #574333; color: #f0c99f; }
html[data-season="halloween"] .reminder-day.selected { border-color: #a58ba8; box-shadow: inset 0 0 0 1px #a58ba8; }
html[data-season="halloween"] .reminder-dot { background: #e0b38b; }
html[data-season="halloween"] .reminder-agenda.has-reminders { background: var(--reminder-tint); border: 1px solid #6a5646; box-shadow: inset 3px 0 0 #ac8765; }
html[data-season="halloween"] .reminder-alert { background: #3c312c; border-color: #675243; }
html[data-season="halloween"] .reminder-agenda.has-reminders #reminderCount { background: #b58a66; color: #211c18; }
html[data-season="halloween"] .reminder-calendar .icon-button,
html[data-season="halloween"] .reminder-today { background: transparent; }
html[data-season="halloween"] .header-art { right: 6px; width: 220px; opacity: .38; }
html[data-season="halloween"] .header-art img { mix-blend-mode: soft-light; filter: grayscale(.15) saturate(.65); }
html[data-season="halloween"] .header-art::after { display: none; }
html[data-season="halloween"] .modal::backdrop { background: rgba(10,8,12,.65); }
html[data-season="halloween"] :focus-visible { outline: 2px solid #b39ab8; outline-offset: 2px; }
.halloween-stilllife { display: none; }
html[data-season="halloween"] .halloween-stilllife { display: block; position: absolute; z-index: 1; right: 215px; bottom: -5px; width: 205px; height: 118px; object-fit: contain; opacity: .78; pointer-events: none; filter: saturate(.65); }
html[data-season="halloween"] .topbar::after { content: ''; position: absolute; top: 0; right: 0; width: 82px; height: 82px; background: url('./assets/halloween-web.svg') right top / contain no-repeat; opacity: .28; pointer-events: none; }
html[data-season="halloween"] .focus-panel { position: relative; }
html[data-season="halloween"] .focus-panel::after { content: ''; position: absolute; right: 1px; bottom: 1px; width: 64px; height: 64px; background: url('./assets/halloween-web.svg') center / contain no-repeat; transform: rotate(90deg); opacity: .17; pointer-events: none; }
@media (max-width: 720px) {
  html[data-season="halloween"] .halloween-stilllife { right: 10px; top: 0; bottom: auto; width: 120px; height: 90px; opacity: .65; }
  html[data-season="halloween"] .header-art { right: 90px; top: 0; width: 115px; height: 90px; opacity: .2; }
  html[data-season="halloween"] .topbar::after { width: 48px; height: 48px; opacity: .2; }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow: auto;
  }

  .nav {
    display: flex;
    min-width: max-content;
  }

  .profile-card {
    min-width: 210px;
  }

  .today-grid,
  .today-extra-grid,
  .split,
  .ai-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .topbar {
    min-height: 158px;
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
    border-radius: 22px;
  }

  .header-art {
    inset: 10px -22px auto auto;
    width: 220px;
    height: 148px;
    opacity: 0.34;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .metrics-row,
  .vault-grid,
  .year-grid {
    grid-template-columns: 1fr;
  }

  .month-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .day-summary {
    grid-template-columns: 1fr;
  }

  .task-tools,
  .task-item,
  .template-item,
  .metric-editor,
  .folder-list,
  .note-meta-editor {
    grid-template-columns: 1fr;
  }

  .task-item {
    justify-items: start;
    grid-template-columns: 24px minmax(0, 1fr) auto auto;
    gap: 8px;
  }
  .task-item .task-title { grid-column: 2 / -1; }
  .task-item .pill { grid-column: 2; max-width: 100%; overflow-wrap: anywhere; }
  .task-item .task-priority { grid-column: 2; width: 100%; }
  .task-item .edit-task { grid-column: 3; }
  .task-item .delete-task { grid-column: 4; }
}
