:root {
  --bg: #ecdfbd;
  --panel: #fffaf0;
  --panel-alt: #f3e6c4;
  --border: #c9a969;
  --border-soft: #ddc990;
  --text: #2e2318;
  --text-dim: #8a7350;
  --accent: #2f5233;
  --accent-light: #4a7a54;
  --accent-dark: #1c3520;
  --accent-2: #c98a2c;
  --accent-2-light: #e0aa4f;
  --accent-3: #8b3a3a;
  --danger: #8b3a3a;
  --danger-light: #ac5548;
  --header-bg-1: #142a1a;
  --header-bg-2: #234030;
  --header-text: #f3e9d2;
  --header-text-dim: #c3c7ad;
  --radius: 20px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'><path d='M20 280 C80 220,60 150,140 60' fill='none' stroke='%231c3520' stroke-width='4' stroke-opacity='0.16'/><g fill='%232f5233' fill-opacity='0.17'><ellipse cx='60' cy='210' rx='26' ry='14' transform='rotate(-35 60 210)'/><ellipse cx='85' cy='165' rx='24' ry='13' transform='rotate(-20 85 165)'/><ellipse cx='105' cy='120' rx='22' ry='12' transform='rotate(-10 105 120)'/><ellipse cx='128' cy='80' rx='20' ry='11' transform='rotate(2 128 80)'/></g><g fill='%23c98a2c' fill-opacity='0.28'><circle cx='140' cy='58' r='7'/><circle cx='120' cy='44' r='6'/><circle cx='156' cy='42' r='6'/><circle cx='136' cy='28' r='6'/></g><circle cx='96' cy='94' r='5' fill='%238b3a3a' fill-opacity='0.2'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'><path d='M280 20 C220 80,240 150,160 240' fill='none' stroke='%231c3520' stroke-width='4' stroke-opacity='0.14'/><g fill='%232f5233' fill-opacity='0.15'><ellipse cx='240' cy='90' rx='24' ry='13' transform='rotate(145 240 90)'/><ellipse cx='215' cy='135' rx='22' ry='12' transform='rotate(160 215 135)'/><ellipse cx='195' cy='180' rx='20' ry='11' transform='rotate(172 195 180)'/></g><g fill='%23c98a2c' fill-opacity='0.24'><circle cx='170' cy='225' r='6'/><circle cx='185' cy='240' r='6'/><circle cx='158' cy='242' r='6'/></g></svg>");
  background-position: top left, bottom -30px left -30px, top -30px right -30px;
  background-repeat: repeat, no-repeat, no-repeat;
  background-size: 180px 180px, 340px 340px, 340px 340px;
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ---------- top bar ---------- */

.top-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 28px 20px;
  background: linear-gradient(135deg, var(--header-bg-1), var(--header-bg-2) 60%, #2b4d36);
  box-shadow: 0 4px 16px rgba(20, 42, 26, 0.4);
  flex-shrink: 0;
  color: var(--header-text);
  z-index: 2;
}

/* Scalloped gold edge beneath the header -- a small signature detail */
.top-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 10px;
  background-image: radial-gradient(circle at 10px 0, transparent 10px, var(--accent-2) 10.5px);
  background-size: 20px 10px;
  background-repeat: repeat-x;
  filter: drop-shadow(0 3px 4px rgba(20, 42, 26, 0.25));
}

.clock-block { min-width: 170px; }
.clock-time {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1;
  color: var(--header-text);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.clock-date { font-size: 1rem; color: var(--header-text-dim); margin-top: 4px; }

.weather-block {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.1rem;
  color: var(--header-text);
}
.weather-loading { color: var(--header-text-dim); }
.weather-temp { font-family: var(--font-display); font-size: 2rem; font-weight: 600; }
.weather-location { color: var(--header-text-dim); font-size: 0.9rem; }
.weather-forecast { display: flex; gap: 14px; margin-left: 12px; }
.weather-forecast .day { text-align: center; font-size: 0.85rem; color: var(--header-text-dim); }
.weather-forecast .day .hi { color: var(--header-text); font-weight: 600; }

.family-filter {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.family-chip {
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: opacity 0.15s, transform 0.1s;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  background-color: var(--pill-color, var(--accent));
  background-image: linear-gradient(150deg, rgba(255,255,255,0.4), rgba(255,255,255,0) 60%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 3px 8px rgba(0,0,0,0.3);
}
.family-chip.active { opacity: 1; border-color: rgba(255,255,255,0.8); transform: translateY(-1px); }
.family-chip:active { transform: scale(0.96); }

.icon-btn {
  background: linear-gradient(160deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.28);
  color: var(--header-text);
  font-size: 1.4rem;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.icon-btn:active { transform: scale(0.94); }

/* ---------- main layout ---------- */

.main-area {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: 20px;
  padding: 24px 24px 24px;
}

.calendar-panel {
  flex: 3;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  box-shadow: 0 4px 10px rgba(46, 35, 24, 0.08), 0 20px 45px rgba(46, 35, 24, 0.16);
}
.calendar-panel::before {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 220px;
  height: 220px;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'><path d='M20 280 C80 220,60 150,140 60' fill='none' stroke='%231c3520' stroke-width='4' stroke-opacity='0.14'/><g fill='%232f5233' fill-opacity='0.13'><ellipse cx='60' cy='210' rx='26' ry='14' transform='rotate(-35 60 210)'/><ellipse cx='85' cy='165' rx='24' ry='13' transform='rotate(-20 85 165)'/><ellipse cx='105' cy='120' rx='22' ry='12' transform='rotate(-10 105 120)'/><ellipse cx='128' cy='80' rx='20' ry='11' transform='rotate(2 128 80)'/></g><g fill='%23c98a2c' fill-opacity='0.22'><circle cx='140' cy='58' r='7'/><circle cx='120' cy='44' r='6'/><circle cx='156' cy='42' r='6'/><circle cx='136' cy='28' r='6'/></g><circle cx='96' cy='94' r='5' fill='%238b3a3a' fill-opacity='0.16'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
}
.calendar-panel > * { position: relative; z-index: 1; }

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.month-label {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-style: italic;
  font-weight: 600;
  margin: 0;
  color: var(--accent-dark);
}
.month-label::before { content: "\1F33F  "; font-style: normal; }
.month-label::after { content: "  \1F33F"; font-style: normal; }

.nav-btn, .today-btn {
  background: linear-gradient(160deg, #fffef9, var(--panel-alt));
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(46, 35, 24, 0.15);
  transition: transform 0.1s, box-shadow 0.15s;
}
.today-btn { font-size: 1rem; font-weight: 600; }
.nav-btn:active, .today-btn:active { transform: scale(0.95); box-shadow: 0 1px 2px rgba(46, 35, 24, 0.15); }

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  box-shadow: inset 0 1px 3px rgba(46, 35, 24, 0.12);
}
.view-toggle button {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle button.active {
  background: linear-gradient(160deg, var(--accent-light), var(--accent));
  color: white;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 3px 8px rgba(47, 82, 51, 0.45);
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 0;
}

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

.day-cell {
  background: linear-gradient(160deg, #fffef9, var(--panel-alt));
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  overflow: hidden;
  min-height: 0;
  box-shadow: 0 1px 2px rgba(46, 35, 24, 0.08);
  transition: box-shadow 0.15s, transform 0.1s;
}
.day-cell:active { transform: scale(0.97); }
.day-cell.other-month { opacity: 0.4; box-shadow: none; }
.day-cell.today {
  background: linear-gradient(160deg, #fffef9, #fff0d6);
  border-color: var(--accent-2);
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(201, 138, 44, 0.25), 0 4px 10px rgba(201, 138, 44, 0.2);
}
.day-cell.today .day-number::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(201, 138, 44, 0.25);
}

.day-number { font-weight: 700; font-size: 1rem; color: var(--accent-dark); }

.event-pill {
  font-size: 0.78rem;
  padding: 3px 7px;
  border-radius: 6px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  background-color: var(--pill-color, var(--accent));
  background-image: linear-gradient(150deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 60%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 3px rgba(0,0,0,0.15);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.event-more { font-size: 0.75rem; color: var(--text-dim); }

/* ---------- week view ---------- */

.week-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  min-height: 0;
}

.week-day-col {
  background: linear-gradient(160deg, #fffef9, var(--panel-alt));
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  cursor: pointer;
  min-height: 0;
  box-shadow: 0 1px 2px rgba(46, 35, 24, 0.08);
}
.week-day-col.today {
  background: linear-gradient(160deg, #fffef9, #fff0d6);
  border-color: var(--accent-2);
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(201, 138, 44, 0.25), 0 4px 10px rgba(201, 138, 44, 0.2);
}

.week-day-header {
  text-align: center;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--border-soft);
}
.week-day-header .wd-name { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.week-day-header .wd-num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--accent-dark); }

.week-event-row {
  font-size: 0.82rem;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  background-color: var(--pill-color, var(--accent));
  background-image: linear-gradient(150deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 60%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 3px rgba(0,0,0,0.15);
  font-weight: 600;
}
.week-event-row .time { display: block; font-size: 0.7rem; font-weight: 500; opacity: 0.9; }

.week-no-events { color: var(--text-dim); font-size: 0.85rem; text-align: center; margin-top: 10px; }

/* ---------- to-do panel ---------- */

.todo-panel {
  flex: 1;
  max-width: 340px;
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  box-shadow: 0 4px 10px rgba(46, 35, 24, 0.08), 0 20px 45px rgba(46, 35, 24, 0.16);
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.todo-panel::before {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 170px;
  height: 170px;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'><path d='M280 20 C220 80,240 150,160 240' fill='none' stroke='%231c3520' stroke-width='4' stroke-opacity='0.13'/><g fill='%232f5233' fill-opacity='0.13'><ellipse cx='240' cy='90' rx='24' ry='13' transform='rotate(145 240 90)'/><ellipse cx='215' cy='135' rx='22' ry='12' transform='rotate(160 215 135)'/><ellipse cx='195' cy='180' rx='20' ry='11' transform='rotate(172 195 180)'/></g><g fill='%23c98a2c' fill-opacity='0.2'><circle cx='170' cy='225' r='6'/><circle cx='185' cy='240' r='6'/><circle cx='158' cy='242' r='6'/></g></svg>");
  background-repeat: no-repeat;
  background-size: contain;
}
.todo-panel > * { position: relative; z-index: 1; }

.todo-section {
  flex: 0 1 auto;
  min-height: 100px;
  display: flex;
  flex-direction: column;
}

.todo-panel h2 {
  margin: 0 0 6px 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 600;
  color: var(--accent-dark);
}
.todo-panel h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-top: 6px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, var(--accent-2), transparent);
  border-radius: 2px;
}

.todo-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.todo-form input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 1rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.todo-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 82, 51, 0.18);
}
.todo-form button {
  width: 48px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(160deg, var(--accent-light), var(--accent));
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 3px 8px rgba(47, 82, 51, 0.4);
  transition: transform 0.1s;
}
.todo-form button:active { transform: scale(0.93); }

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.todo-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 1.05rem;
}
.todo-list li.done { opacity: 0.45; text-decoration: line-through; }
.todo-list input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}
.todo-list .todo-text { flex: 1; word-break: break-word; }
.todo-list .todo-delete {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.3rem;
  cursor: pointer;
}

/* ---------- happenings section (shares the sidebar, to-do takes priority) ---------- */

.happenings-section {
  flex: 1 1 auto;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.happenings-section h3 {
  margin: 0 0 6px 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 600;
  color: var(--accent-dark);
  flex-shrink: 0;
}
.happenings-section h3::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-top: 6px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, var(--accent-2), transparent);
  border-radius: 2px;
}
.happenings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.happenings-list li {
  padding: 9px 4px 9px 10px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.85rem;
  border-left: 4px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.happenings-list li:active { transform: scale(0.98); background: var(--panel-alt); }
.happenings-list .h-row { display: flex; align-items: center; gap: 6px; }
.happenings-list .h-info { flex: 1; min-width: 0; }
.happenings-list .h-title { font-weight: 600; color: var(--text); }
.happenings-list .h-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.happenings-list .h-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.happenings-list .h-dismiss:active { background: var(--panel-alt); color: var(--danger); }

/* ---------- modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: overlayFadeIn 0.2s ease;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
  width: min(480px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 24px 60px rgba(20, 16, 10, 0.4);
  animation: modalPopIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -24px -24px 20px -24px;
  padding: 20px 24px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(135deg, var(--header-bg-1), var(--header-bg-2) 65%, #2b4d36);
  box-shadow: 0 3px 10px rgba(20, 42, 26, 0.3);
}
.modal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 600;
  color: var(--header-text);
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.modal-close {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--header-text);
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:active { transform: scale(0.92); }

#event-form label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
#event-form input[type="text"],
#event-form input[type="date"],
#event-form input[type="time"],
#event-form select,
#event-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: box-shadow 0.15s, border-color 0.15s;
}
#event-form input:focus,
#event-form select:focus,
#event-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 82, 51, 0.18);
}
.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin-top: 16px !important;
}
.checkbox-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.time-row { display: flex; gap: 12px; margin-top: 10px; }
.time-row.hidden { display: none; }
.time-row > div { flex: 1; }

.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 10px;
}
.primary-btn {
  background: linear-gradient(160deg, var(--accent-light), var(--accent) 70%);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  flex: 1;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 4px 14px rgba(47, 82, 51, 0.45);
  transition: transform 0.1s, box-shadow 0.15s;
}
.primary-btn::before { content: "\2713  "; }
.primary-btn:active { transform: translateY(1px) scale(0.98); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 6px rgba(47, 82, 51, 0.4); }

.danger-btn {
  background: linear-gradient(160deg, var(--danger-light), var(--danger) 70%);
  color: #fff;
  border: none;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 12px rgba(139, 58, 58, 0.4);
  transition: transform 0.1s;
}
.danger-btn::before { content: "\1F5D1  "; }
.danger-btn:active { transform: scale(0.96); }
.danger-btn.hidden { display: none; }

.link-btn {
  display: block;
  text-align: center;
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
  padding: 12px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  margin-top: 14px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.link-btn:active { background: var(--border-soft); transform: scale(0.98); }

.happening-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.happening-actions .link-btn { margin-top: 0; }

.qr-wrap { text-align: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.qr-wrap img { border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(46, 35, 24, 0.15); }
.qr-wrap .qr-caption { font-size: 0.85rem; color: var(--text-dim); margin-top: 8px; }

.day-event-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; max-height: 50vh; overflow-y: auto; }
.day-event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: transform 0.1s;
}
.day-event-row:active { transform: scale(0.98); }
.day-event-row .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
.day-event-row .info { flex: 1; }
.day-event-row .info .title { font-weight: 600; }
.day-event-row .info .time { font-size: 0.85rem; color: var(--text-dim); }
.no-events { color: var(--text-dim); padding: 12px; text-align: center; }

.happening-detail .h-detail-meta { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 12px; }
.happening-detail .h-detail-desc { font-size: 1rem; line-height: 1.5; }

.family-manage-list { list-style: none; padding: 0; margin: 0 0 14px 0; }
.family-manage-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.family-manage-list .swatch { width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.family-manage-list .fname { flex: 1; }
.family-manage-list .fdelete { background: none; border: none; color: var(--danger); font-size: 1.2rem; cursor: pointer; }

@media (max-width: 900px) {
  .main-area { flex-direction: column; }
  .todo-panel { max-width: none; max-height: 40vh; }
}

/* ---------- auth gate ---------- */
/* See static/css/auth-gate.css (loaded separately by every page) */

.account-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.account-email { font-size: 0.85rem; color: var(--text-dim); text-align: center; margin-bottom: 10px; }
