/* ============================================================
   HomePal — touch wall calendar
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --agenda-bg: #f5f8fd;
  --ink: #1e293b;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --line: #e6eaf2;
  --line-strong: #d7dded;
  --today: #eef4ff;
  --accent: #2563eb;
  --danger: #e11d48;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .10);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .22);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 100% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(1000px 600px at -10% 110%, #eafff4, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; cursor: pointer; }

.hidden { display: none !important; }

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: clamp(8px, 1vw, 14px);
}

/* Edge-to-edge: header gets a little breathing room, content runs to the edges. */
.topbar { padding: clamp(10px, 1.4vw, 18px) clamp(12px, 1.6vw, 22px) 0; }
.layout { padding: 0; }

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.topbar__left { justify-self: start; }
.topbar__center { justify-self: center; display: flex; align-items: center; gap: 14px; }
.topbar__right { justify-self: end; display: flex; align-items: center; gap: 10px; }

.monthnav { display: flex; align-items: center; gap: 10px; }

/* View switcher (Calendar / Lists) */
.viewswitch {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: 12px;
  flex: none;
}
.viewswitch button {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 9px;
  transition: background .12s ease, color .12s ease;
  white-space: nowrap;
}
.viewswitch button.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.app.view-lists .monthnav,
.app.view-lists #legend { display: none; }

.topbar__left { display: flex; align-items: center; gap: clamp(12px, 1.4vw, 22px); }

.clock {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1;
}
.clock__time {
  font-size: clamp(28px, 3.2vw, 44px);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.clock__meridiem {
  font-size: clamp(12px, 1.1vw, 16px);
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.clock__date {
  font-size: clamp(13px, 1.1vw, 16px);
  color: var(--ink-soft);
  font-weight: 600;
  margin-top: 2px;
}

.monthlabel {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 700;
  letter-spacing: -.02em;
  min-width: clamp(160px, 14vw, 240px);
  text-align: center;
}

.iconbtn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, background .15s ease, color .15s ease;
}
.iconbtn:hover { color: var(--ink); }
.iconbtn:active { transform: scale(.93); background: var(--surface-2); }

.pillbtn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, background .15s ease;
}
.pillbtn:active { transform: scale(.95); background: var(--surface-2); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  max-width: 40vw;
  justify-content: flex-end;
}
.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: background .12s ease, opacity .12s ease;
}
.legend__item:active { background: rgba(15, 23, 42, .05); }
.legend__item.is-off { opacity: .42; }
.legend__item.is-off .legend__dot { background: var(--ink-faint) !important; }
.legend__item.is-off .legend__name { text-decoration: line-through; }
.legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

/* ---------- Weather ---------- */
.weather {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 16px);
  padding-left: clamp(12px, 1.4vw, 22px);
  border-left: 1px solid var(--line);
}
.weather__now { display: flex; align-items: center; gap: 8px; }
.weather__icon { font-size: clamp(24px, 2.6vw, 34px); line-height: 1; }
.weather__temp {
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.weather__meta { line-height: 1.25; }
.weather__cond { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.weather__hilo { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.weather__days { display: flex; gap: clamp(6px, 0.8vw, 12px); }
.weather__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.weather__dicon { font-size: 16px; }
@media (max-width: 1180px) { .weather__days { display: none; } }
@media (max-width: 1000px) { .weather__meta { display: none; } }

/* ---------- Views (sliding viewport) ---------- */
.viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;            /* let JS own horizontal swipes, browser owns vertical scroll */
}
.views {
  display: flex;
  height: 100%;
  transition: transform .32s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
.view { flex: 0 0 100%; height: 100%; min-height: 0; }
.view--calendar { display: flex; flex-direction: column; }
.view--lists { display: flex; flex-direction: column; }
@media (prefers-reduced-motion: reduce) { .views { transition: none; } }

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr clamp(300px, 24vw, 380px);
  gap: 0;
}

/* ---------- Calendar ---------- */
.calendar {
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
}
.weekdays span {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.weekdays span.is-weekend { color: #b0b8c9; }

.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
}

.cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 7px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
  position: relative;
  transition: background .12s ease;
}
.cell:nth-child(7n) { border-right: none; }
.cell:active { background: var(--surface-2); }
.cell.is-outside { background: #fafbfd; }
.cell.is-outside .cell__num { color: var(--ink-faint); }
.cell.is-weekend:not(.is-outside) { background: #fcfdff; }

.cell__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.cell__num {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex: none;
}
.cell__wx {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  line-height: 1;
  padding-right: 2px;
}
.cell__wxicon { font-size: 15px; }
.cell__wxtemp { font-variant-numeric: tabular-nums; }
.cell.is-outside .cell__wx { opacity: .5; }
.cell.is-today .cell__num {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .4);
}

.cell__events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.chip {
  --c: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  background: color-mix(in srgb, var(--c) 14%, #fff);
  border-left: 3px solid var(--c);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip__time {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-weight: 700;
  flex: none;
}
.chip__title { overflow: hidden; text-overflow: ellipsis; }
.chip--allday {
  color: #fff;
  background: var(--c);
  border-left-color: transparent;
}
.chip--allday .chip__time { display: none; }
.chip--more {
  background: transparent;
  border-left: none;
  color: var(--ink-faint);
  font-weight: 700;
  padding-left: 8px;
}

/* ---------- Agenda ---------- */
.agenda {
  background: var(--agenda-bg);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agenda__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: background .12s ease;
}
.agenda__head:active { background: rgba(15, 23, 42, .04); }
.agenda__title { margin: 0; font-size: 18px; font-weight: 700; margin-right: auto; }
.iconbtn--sm { width: 38px; height: 38px; font-size: 17px; }

/* Date-range filter — only visible when the schedule is expanded. */
.agenda__ranges { display: none; gap: 4px; background: var(--bg); padding: 3px; border-radius: 10px; }
.agenda.is-expanded .agenda__ranges { display: flex; }
.agenda__ranges button {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  transition: background .12s ease, color .12s ease;
}
.agenda__ranges button.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.agenda__group { break-inside: avoid; }

/* ----- Expanded full-screen schedule ----- */
.agenda.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 30;
  border: none;
  background: var(--agenda-bg);
  box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
}
.agenda.is-expanded .agenda__head { padding: 20px clamp(20px, 3vw, 40px); }
.agenda.is-expanded .agenda__title { font-size: clamp(22px, 2.4vw, 30px); }
.agenda.is-expanded .agenda__list {
  padding: 12px clamp(20px, 3vw, 40px) 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0 clamp(20px, 2.5vw, 38px);
  align-content: start;
}
.agenda.is-expanded .agenda__day { font-size: 13px; padding-top: 18px; }

.aevent--detailed {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 0 2px 10px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.aevent--detailed .aevent__title { white-space: normal; font-size: 16px; }
.aevent--detailed .aevent__meta { white-space: normal; }
.aevent__desc {
  font-size: 13px;
  color: var(--ink-faint);
  margin-top: 6px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agenda__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px 14px;
  scrollbar-width: thin;
}
.agenda__day {
  padding: 14px 10px 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.agenda__day.is-today { color: var(--accent); }

.aevent {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  transition: background .12s ease;
}
.aevent:active { background: var(--surface-2); }
.aevent__rail {
  width: 4px;
  border-radius: 4px;
  flex: none;
  background: var(--accent);
}
.aevent__body { min-width: 0; }
.aevent__title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aevent__meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aevent__who {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 600;
}
.agenda__empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 15px;
}

/* ---------- To-do lists board ---------- */
.lists {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: clamp(12px, 1.4vw, 18px);
  align-content: start;
  padding: clamp(12px, 1.6vw, 22px);
  scrollbar-width: thin;
}

.listcard {
  --c: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 150px);
  overflow: hidden;
}
.listcard__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.listcard__dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.listcard__name {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listcard__count { font-size: 13px; font-weight: 700; color: var(--ink-faint); flex: none; }
.listcard__del { opacity: .55; }
.listcard__del:hover { opacity: 1; color: var(--danger); }

.listcard__items {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
}
.listcard__empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

.todo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px;
  border-radius: 10px;
  transition: background .1s ease;
}
.todo:active { background: var(--surface-2); }
.todo__check {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease, border-color .12s ease;
}
.todo.is-done .todo__check { background: var(--c); border-color: var(--c); }
.todo.is-done .todo__check::after { content: "✓"; color: #fff; font-size: 14px; font-weight: 800; line-height: 1; }
.todo__text {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: default;
  word-break: break-word;
}
.todo.is-done .todo__text { text-decoration: line-through; color: var(--ink-faint); }
.todo__del {
  flex: none;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 18px;
  border-radius: 8px;
  opacity: .45;
  transition: opacity .12s ease, color .12s ease;
}
.todo__del:hover { opacity: 1; color: var(--danger); }

.listcard__add { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.listcard__addinput {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
}
.listcard__addinput:focus {
  outline: none;
  border-color: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent);
}
.listcard__addbtn {
  flex: none;
  width: 42px;
  border: none;
  border-radius: 10px;
  background: var(--c);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.listcard__addbtn:active { filter: brightness(.95); }

/* New-list card */
.listcard--new { background: var(--surface-2); border-style: dashed; }
.listcard--new .listcard__head { color: var(--ink-soft); border-bottom-color: transparent; }
.listnew { display: flex; flex-direction: column; gap: 10px; padding: 4px 14px 16px; }
.listnew__name {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.listnew__row { display: flex; align-items: center; gap: 10px; }
.listnew__color {
  appearance: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: none;
  padding: 0;
  flex: none;
  cursor: pointer;
}
.listnew__color::-webkit-color-swatch-wrapper { padding: 0; }
.listnew__color::-webkit-color-swatch { border: none; border-radius: 10px; }
.listnew__row .ghostbtn { flex: 1; }

/* ---------- Empty state ---------- */
.emptystate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(244, 246, 251, .85);
  backdrop-filter: blur(4px);
  z-index: 40;
}
.emptystate__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  padding: 38px 34px;
  text-align: center;
}
.emptystate__logo { font-size: 46px; }
.emptystate__card h2 { margin: 10px 0 6px; font-size: 26px; }
.emptystate__card p { margin: 0 0 22px; color: var(--ink-soft); font-size: 16px; }

.bigbtn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 26px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
  transition: transform .08s ease, filter .15s ease;
}
.bigbtn:active { transform: scale(.96); filter: brightness(.97); }

.ghostbtn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  transition: transform .08s ease, background .15s ease;
}
.ghostbtn:active { transform: scale(.97); background: var(--surface-2); }

.hint {
  margin-top: 26px;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.hint summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 14px;
}
.hint ol { margin: 12px 0; padding-left: 20px; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.hint code { background: var(--bg); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.hint__note { font-size: 13px; color: var(--ink-faint); }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
}
.modal__panel {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop .18s ease;
}
.modal__panel--settings { max-width: 640px; }
.modal__panel--day { max-width: 460px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 { margin: 0; font-size: 20px; }
.modal__body { padding: 20px 22px; overflow-y: auto; }
.modal__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}
.modal__foot .spacer { flex: 1; }

/* ---------- Settings ---------- */
.settings__h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin: 6px 0 4px; }
.settings__sub { margin: 0 0 14px; font-size: 14px; color: var(--ink-soft); }
.settings__status { font-size: 13px; color: var(--ink-soft); }
.settings__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field select, .field input {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
}
.field select { background-image: none; }

/* ----- Weather location autocomplete ----- */
.weathersearch { position: relative; }
.weathersearch__input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
}
.weathersearch__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.weatherresults {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 6;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  max-height: 264px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.weatherresults.is-open { display: flex; }
.weatherresult {
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background .1s ease;
}
.weatherresult::before { content: "📍"; font-size: 15px; }
.weatherresult.is-active, .weatherresult:hover { background: var(--surface-2); }
.weatherresults__msg {
  padding: 12px;
  font-size: 13px;
  color: var(--ink-faint);
  font-weight: 600;
}
.weatherchosen {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, #fff);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.weatherchosen.is-set { display: flex; }
.weatherchosen__label { flex: 1; }
.weatherchosen__label::before { content: "📍 "; }
.weatherchosen__clear {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
}
.weatherchosen__clear:hover { color: var(--danger); }

.calrows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.calrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.calrow__color {
  appearance: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: none;
  padding: 0;
  flex: none;
  cursor: pointer;
}
.calrow__color::-webkit-color-swatch-wrapper { padding: 0; }
.calrow__color::-webkit-color-swatch { border: none; border-radius: 10px; }
.calrow__fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.calrow__name, .calrow__url {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.calrow__url { font-size: 12.5px; color: var(--ink-soft); }
.calrow__remove { width: 40px; height: 40px; flex: none; font-size: 20px; }

/* ---------- Day detail ---------- */
.daydetail { display: flex; flex-direction: column; gap: 10px; }
.dd-event {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.dd-event__rail { width: 5px; border-radius: 5px; flex: none; background: var(--accent); }
.dd-event__title { font-size: 16px; font-weight: 700; }
.dd-event__time { font-size: 14px; color: var(--ink-soft); margin-top: 3px; font-variant-numeric: tabular-nums; }
.dd-event__loc { font-size: 13px; color: var(--ink-faint); margin-top: 3px; }
.dd-event__who { font-size: 12px; color: var(--ink-faint); font-weight: 700; margin-top: 4px; }
.daydetail__empty { padding: 30px; text-align: center; color: var(--ink-faint); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  animation: pop .18s ease;
}
.toast--error { background: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 1.6fr 1fr; }
  .topbar { grid-template-columns: 1fr auto; }
  .topbar__left { display: none; }
  .legend { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
