/* Keep the calendar and daily essentials inside one desktop viewport. */
body { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; }
header { flex: none; padding: 14px 24px; }
h1 { font-size: clamp(26px, 2.7vw, 42px); }
main { flex: 1; min-height: 0; width: 100%; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); gap: 12px; padding-bottom: 12px; }
.panel { padding: 14px; border-radius: 18px; }
.calendar-panel { display: flex; flex-direction: column; min-height: 0; }
.cal-head h2 { font-size: clamp(22px, 2vw, 30px); }
.days { flex: 1; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
.day { min-height: 0; text-align: left; padding: 6px; display: flex; flex-direction: column; }
.day.other { opacity: .6; }
.day .num { flex: none; }
.event { flex: none; white-space: nowrap; font-size: 12px; padding: 3px 4px; margin-top: 3px; }
.more-events { font-size: 11px; color: var(--soft); margin-top: 3px; }
#note { margin: 9px 0 0; }
.side { min-height: 0; grid-template-rows: auto minmax(100px, 1fr) auto; gap: 12px; }
.today-panel { order: 0; }
.photo-panel { order: 1; display: flex; flex-direction: column; min-height: 0; }
.preferences-panel { order: 2; }
.side h3 { font-size: 21px; margin-bottom: 8px; }
.photo { flex: 1; min-height: 0; height: 100px; }
.photo-panel small { font-size: 11px; margin-top: 5px; }
.photo-caption { font-size: 13px; }
.photo-caption button { padding: 5px 10px; }
.preferences-panel h3 { display: none; }
.widgets { gap: 7px; }
.widget { min-height: 0; padding: 9px; }
.widget strong { font-size: 11px; margin-bottom: 4px; }
.widget span { font-size: 14px; }
.widget p { margin: 4px 0 0; }
.dinner-card { width: 100%; text-align: left; }
.agenda { margin-bottom: 10px; }
.agenda-item { display: block; width: 100%; padding: 7px 9px; margin-bottom: 5px; text-align: left; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-empty { margin: 0 0 8px; font-size: 14px; color: var(--soft); }
.footer { flex: none; padding: 0 24px 10px; }
.hub-tools { font-size: 12px; opacity: 1; flex-wrap: wrap; justify-content: flex-end; }
dialog { max-height: 90dvh; overflow-y: auto; }
dialog input[type="checkbox"] { width: auto; }
dialog textarea { width: 100%; min-height: 90px; resize: vertical; font: inherit; padding: 10px; border: 1px solid #b2b7b4; border-radius: 9px; }
#dayView { width: min(92vw, 800px); padding: 28px; }
.day-heading { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.day-heading h2 { font: 500 clamp(25px, 3vw, 36px) Georgia, serif; margin-bottom: 18px; }
.eyebrow { font-size: 11px; letter-spacing: .15em; margin: 0 0 9px; color: #596c63; }
.day-toolbar { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.day-toolbar .primary { margin-left: auto; }
.day-events { display: grid; gap: 10px; }
.day-event { display: flex; gap: 15px; text-align: left; padding: 16px; width: 100%; background: white; border: 1px solid #ddd6c9; border-left: 4px solid #b9792b; }
.day-event.birthday { border-left-color: #b84f80; }
.event-time { min-width: 76px; font-size: 13px; color: #5c665e; }
.event-details strong, .event-details span { display: block; }
.event-details span { margin-top: 6px; font-size: 14px; color: #59665e; }
.day-details { border-top: 1px solid #ddd6c9; margin-top: 24px; padding-top: 20px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; }
.day-detail { text-align: left; align-self: start; padding: 16px; }
.day-detail strong, .day-detail span { display: block; margin-bottom: 8px; }
.day-details label { margin-top: 0; }
.local-note { color: #617068; font-size: 12px; margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #bf873e; outline-offset: 3px; }
body.hide-photos .side { grid-template-rows: auto auto; align-content: start; }
@media (min-width: 901px) and (max-height: 760px) {
  header { padding: 10px 20px; } header p { display: none; }
  .side h3 { font-size: 19px; } .widget { padding: 7px; }
  .photo-panel small { display: none; } .agenda-item { padding: 5px 8px; }
}

/* A warm, personal palette with seasonal and evening variations. */
body {
  --paper: #fffaf1; --ink: #49392c; --muted: #776653; --line: #d8cbb7;
  --accent: #8c4d30; --soft: #675640; --glass: #fffaf1;
  --tint: #f1e7d7; --holiday: #4f7053; --holiday-bg: #e4ecdd;
  color: var(--ink);
  background: radial-gradient(ellipse at top left, #fff9e7 0, transparent 55%),
    repeating-linear-gradient(94deg, #805b3410 0 1px, transparent 1px 7px), #e4d7c2;
}
body.autumn { --accent: #97472b; --tint: #f4e1cb; background: linear-gradient(125deg, #f5e5c9, #d9b990); }
body.winter { --accent: #446760; --tint: #e4eeea; --holiday-bg: #e0e9ed; background: linear-gradient(125deg, #edf2ee, #bdcdc7); }
body.spring { --accent: #6f7044; --tint: #eef0df; --holiday-bg: #e8edda; background: linear-gradient(125deg, #f7f1de, #c9d7b4); }
body.summer, body.coastal { --accent: #2d6b73; --tint: #e3efec; --holiday-bg: #dfece6; background: linear-gradient(125deg, #f9efd7, #b7d5d1); }
body.evening {
  --paper: #292b28; --ink: #f8ecd9; --muted: #d3c1aa; --line: #555044;
  --accent: #efbc7e; --soft: #dfcdb4; --glass: #292b28; --tint: #383a32;
  --holiday: #b6d2a6; --holiday-bg: #354337;
  background: radial-gradient(ellipse at bottom right, #6c4433, #191f1c 70%);
}
header { padding: 16px 26px; }
.family-brand { display: flex; align-items: center; gap: 16px; }
.family-seal { display: grid; place-items: center; width: 58px; height: 64px; flex: none; border: 1px solid var(--accent); border-radius: 28px 28px 10px 10px; font: 36px Georgia, serif; color: var(--accent); box-shadow: inset 0 0 0 5px #ffffff45; }
header .brand-kicker { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .19em; margin: 0 0 4px; }
h1 { color: var(--ink); text-shadow: none; letter-spacing: -.035em; line-height: 1.05; }
header .family-motto { font: italic 14px Georgia, serif; color: var(--muted); margin: 7px 0 0; }
.clock { color: var(--accent); font-variant-numeric: tabular-nums; }
.clock small { color: var(--muted); margin-top: 4px; }
.panel { border: 1px solid var(--line); box-shadow: 0 5px 18px #46362012; backdrop-filter: none; border-radius: 14px; }
.calendar-panel { border-top: 4px solid var(--accent); }
.cal-head h2, .side h3 { color: var(--ink); }
button, select { color: var(--ink); border-color: var(--line); background: var(--paper); }
button:hover { background: var(--tint); }
button.primary { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.weekdays div { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; }
.day { border-color: var(--line); border-radius: 8px; background: var(--paper); }
.day.other { opacity: .52; }
.day.today { border: 2px solid var(--accent); background: var(--tint); }
.day.today .num { color: var(--accent); }
.day:focus-visible { outline: 4px solid var(--accent); outline-offset: -4px; }
.num { font: 600 18px Georgia, serif; }
.event { background: var(--tint); color: var(--ink); }
.event.birthday { background: #f4dfe5; color: #6b3046; border-color: #ac607c; }
.event.holiday { background: var(--holiday-bg); color: var(--holiday); border-color: var(--holiday); }
.more-events { color: var(--muted); }
.agenda-empty { color: var(--muted); }
.agenda-item { border-left: 3px solid var(--holiday); background: var(--tint); }
.widget { background: var(--tint); border: 0; border-radius: 8px; }
.widget strong { color: var(--accent); letter-spacing: .06em; }
.photo { border: 6px solid var(--paper); box-shadow: 0 1px 8px #49392c22; border-radius: 4px; }
.photo-panel small, #note, .photo-caption { color: var(--muted); }
.footer { color: var(--muted); font-size: 12px; }
.dot { background: var(--accent); } .dot.b { background: #ac607c; } .holiday-dot { background: var(--holiday); }
.hub-tools button { color: var(--ink); font-size: 12px; }
.text-button { padding: 0; font-size: inherit; border: 0; background: transparent; text-decoration: underline; color: var(--accent); }
dialog { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
dialog::backdrop { background: #291f19b8; backdrop-filter: blur(4px); }
dialog button { color: var(--ink); background: var(--tint); border-color: var(--line); }
dialog button.primary { background: var(--accent); color: var(--paper); }
dialog input, dialog select, dialog textarea { background: var(--paper); color: var(--ink); border-color: var(--line); }
.eyebrow, .local-note, .event-details span, .event-time { color: var(--muted); }
.day-event { color: var(--ink); background: var(--paper); border-color: var(--line); border-left-color: var(--accent); }
.day-event.holiday { border-left-color: var(--holiday); background: var(--holiday-bg); }
.day-event.holiday .event-time { color: var(--holiday); }
.day-details { border-color: var(--line); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline-color: var(--accent); }

/* Opt-in TV sizing uses the browser viewport, including 1080p and 4K. */
@media (min-width: 901px) and (min-height: 581px) {
  body.tv-view { padding: 2vh 2vw; font-size: clamp(16px, 1.15vw, 36px); }
  .tv-view main { max-width: none; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); }
  .tv-view h1 { font-size: clamp(32px, 2.8vw, 96px); }
  .tv-view .family-motto { font-size: .85em; }
  .tv-view .brand-kicker { font-size: .6em; }
  .tv-view .family-seal { width: 2.4em; height: 2.7em; font-size: 1.5em; }
  .tv-view .clock { font-size: 1.6em; }
  .tv-view .clock small { font-size: .5em; }
  .tv-view .cal-head h2 { font-size: 1.65em; }
  .tv-view .side h3 { font-size: 1.25em; }
  .tv-view .num { font-size: 1.25em; }
  .tv-view .weekdays div { font-size: .7em; }
  .tv-view .event { font-size: .75em; }
  .tv-view .more-events { font-size: .65em; }
  .tv-view .widget span, .tv-view .agenda-item, .tv-view .agenda-empty { font-size: .85em; }
  .tv-view .widget strong { font-size: .65em; }
  .tv-view .widget p { font-size: .7em !important; }
  .tv-view .photo-caption { font-size: .8em; }
  .tv-view .photo-panel small, .tv-view #note { font-size: .65em; }
  .tv-view .footer, .tv-view .hub-tools, .tv-view .hub-tools button { font-size: .65em; }
  .tv-view .hub-tools button { font-size: 1em; }
  .tv-view .panel { padding: .7em; }
  .tv-view #dayView { width: min(90vw, 48em); padding: 1.5em; }
  .tv-view .day-heading h2 { font-size: 1.8em; }
  .tv-view .event-details span, .tv-view .event-time { font-size: .85em; }
  .tv-view .eyebrow, .tv-view .local-note { font-size: .7em; }
}
@media (max-width: 1100px) {
  .family-seal { display: none; }
  header .family-motto { font-size: 12px; }
}
@media (max-width: 520px) {
  header { padding: 14px 12px; gap: 10px; }
  header .brand-kicker { font-size: 8px; letter-spacing: .1em; }
  header .family-motto { display: none; }
  h1 { font-size: 25px; } .clock { font-size: 18px; }
  .preferences-panel .actions { flex-wrap: wrap; }
}
@media (max-width: 900px), (max-height: 580px) {
  body { height: auto; min-height: 100dvh; }
  main { flex: auto; grid-template-columns: 1fr; }
  .calendar-panel { min-height: 500px; }
  .side { grid-template-columns: 1fr; grid-template-rows: auto; }
  .photo { height: 220px; flex: auto; }
  .footer { flex-wrap: wrap; }
  .day { min-height: 60px; }
}
@media (max-width: 520px) {
  header { padding: 14px 12px; } h1 { font-size: 25px; } header p { font-size: 12px; }
  .clock { font-size: 17px; } .clock small { font-size: 11px; }
  .panel { padding: 10px; } .cal-head { gap: 10px; }
  .cal-head h2 { font-size: 25px; } .cal-head .actions { width: 100%; justify-content: space-between; }
  .day { padding: 4px; } .event { font-size: 10px; } .weekdays { margin-top: 8px; }
  .calendar-panel { min-height: 490px; } .day-details, .form-grid { grid-template-columns: 1fr; }
  #dayView { width: 100vw; height: 100dvh; max-height: 100dvh; max-width: 100vw; margin: 0; border-radius: 0; padding: 20px; }
  .hub-tools { justify-content: flex-start; } .footer { padding: 0 12px 16px; }
}

[hidden]{display:none!important}body[data-read-only="true"] #add,body[data-read-only="true"] #addDayEvent,body[data-read-only="true"] #saveNote,body[data-read-only="true"] #mealInput,body[data-read-only="true"] label[for="mealInput"]{display:none}body[data-read-only="true"] #dayDinner,body[data-read-only="true"] #editDinner{cursor:default}.hub-tools{flex-wrap:wrap;justify-content:flex-end}#note{line-height:1.3}#pairCode{text-transform:uppercase}



