:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #17202a;
  --muted: #5b6573;
  --border: #dde1e7;
  --accent: #1f4e79;
  --accent-text: #ffffff;
  --banner-bg: #fff4d6;
  --banner-text: #6b4e00;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;

  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-list-event-hover-bg-color: var(--surface-2);
  --fc-today-bg-color: rgba(31, 78, 121, .07);
  --fc-button-bg-color: var(--surface);
  --fc-button-border-color: var(--border);
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: var(--surface-2);
  --fc-button-hover-border-color: var(--border);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b;
    --surface: #181d25;
    --surface-2: #222833;
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --border: #2d3440;
    --accent: #7fb2e5;
    --accent-text: #0d1520;
    --banner-bg: #3a2f10;
    --banner-text: #f3d98b;
    --shadow: none;
    --fc-today-bg-color: rgba(127, 178, 229, .10);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

.mock-banner {
  background: var(--banner-bg);
  color: var(--banner-text);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
}

.site-header { padding: 28px 0 20px; }
.eyebrow { margin: 0 0 4px; font-size: 13px; color: var(--muted); letter-spacing: .02em; }
h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.2; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-areas: "picker cal" "sub cal";
  grid-template-rows: auto 1fr;
  gap: 16px;
  align-items: start;
  padding-bottom: 32px;
}
.picker { grid-area: picker; }
.subscribe { grid-area: sub; }
.calendar-panel { grid-area: cal; min-height: 640px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.step {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  font-size: 12px; font-weight: 700;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.quick { display: flex; gap: 10px; }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 13px; text-decoration: underline;
}

.calendar-list { list-style: none; margin: 0; padding: 0; }
.calendar-list li + li { border-top: 1px solid var(--border); }
.cal-option {
  display: grid;
  grid-template-columns: auto 12px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 2px;
  cursor: pointer;
}
.cal-option input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.swatch { width: 12px; height: 12px; border-radius: 3px; }
.cal-name { font-weight: 600; font-size: 14px; }
.cal-desc { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.cal-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

.sub-summary { margin: 8px 0 12px; color: var(--muted); font-size: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
.link-row { display: flex; gap: 6px; margin-bottom: 12px; }
.link-row input {
  flex: 1; min-width: 0;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  padding: 7px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-solid:hover { background: var(--accent); filter: brightness(1.08); }
.btn-quiet { border-style: dashed; }
.add-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

.local-note {
  margin: 12px 0 0; padding: 8px 10px; border-radius: 6px;
  background: var(--banner-bg); color: var(--banner-text); font-size: 13px;
}
.help { margin-top: 12px; font-size: 13px; color: var(--muted); }
.help summary { cursor: pointer; color: var(--text); font-weight: 600; }
.help ul { padding-left: 18px; margin: 8px 0 0; }
.help li { margin-bottom: 4px; }

.subscribe.is-empty #sub-body { display: none; }

.empty-note { color: var(--muted); text-align: center; margin: 12px 0 0; }

/* FullCalendar tweaks */
.fc { font-size: 14px; }
.fc .fc-toolbar-title { font-size: 18px; }
.fc .fc-button { font-size: 13px; padding: 4px 10px; box-shadow: none !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--accent-text); }
.fc .fc-event { cursor: pointer; }
.fc .fc-daygrid-event { white-space: normal; padding: 2px 4px; }
.fc .fc-daygrid-event .fc-event-main-frame { display: block; }
.fc .fc-daygrid-event .fc-event-time { display: block; overflow: visible; font-weight: 400; opacity: .9; font-size: 12px; }
.fc .fc-daygrid-event .fc-event-title { font-weight: 600; font-size: 12.5px; line-height: 1.3; }
.fc .fc-daygrid-day-number { font-size: 13px; }
.fc .fc-list-event-title a { color: var(--text); }

.site-footer { color: var(--muted); font-size: 13px; padding: 0 0 32px; }

/* Event dialog */
.event-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.event-dialog::backdrop { background: rgba(10, 14, 20, .45); }
.event-dialog form { position: absolute; top: 8px; right: 8px; margin: 0; }
.dlg-close { border: 0; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.dlg-type { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.event-dialog h3 { margin: 4px 32px 12px 0; font-size: 19px; line-height: 1.3; }
.dlg-facts { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; margin: 0 0 12px; font-size: 14px; }
.dlg-facts dt { color: var(--muted); }
.dlg-facts dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dlg-desc { margin: 0 0 12px; font-size: 14px; }
.dlg-more { margin: 0; font-size: 13px; color: var(--muted); font-style: italic; }

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "picker" "sub" "cal";
    grid-template-rows: auto;
  }
  .calendar-panel { min-height: 0; }
  h1 { font-size: 24px; }
}

@media (max-width: 600px) {
  .fc .fc-toolbar { flex-direction: column; gap: 8px; }
  .fc .fc-toolbar-title { font-size: 16px; }
}
