:root {
  --bg: #e6eaf1;
  --panel: #f7f9fc;
  --surface: #edf1f6;
  --field: #fbfcfe;
  --text: #1b2430;
  --muted: #55627a;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #d9e5fb;
  --border: #d3dae4;
  --border-strong: #bcc6d5;
  --danger: #b42318;
  --code-bg: #0f172a;
  --code-text: #dbe4f1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.07), 0 10px 28px -14px rgba(16, 24, 40, 0.18);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 24px 16px 48px;
}

.wrap { max-width: 1080px; margin: 0 auto; }

header { text-align: center; margin: 8px 0 24px; }
header h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.02em; }
header p { margin: 0 auto; max-width: 660px; color: var(--muted); }
/* Trust badge under the tagline: small surface pill with a padlock. */
header .trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px auto 0;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
header .trust-badge svg { flex: none; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
/* minmax(0, 1fr) (not bare 1fr) keeps the panels shrinkable so the preview
 * box cannot push the track past the viewport on narrow screens. */
@media (max-width: 920px) { main { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Sticky event panel on wide screens ----------
 * With the two panels side by side (above 920px) the event list keeps the
 * top of the viewport as the form scrolls, so events and the toolbar stay
 * reachable while editing. Long lists scroll inside the panel (max-height +
 * overflow) instead of being clipped; the nested .ics preview keeps its own
 * max-height/overflow and scrolls independently. */
@media (min-width: 921px) {
  main > .panel:nth-of-type(2) {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    scroll-padding-top: 274px; /* 260px toolbar + 14px margin. */
  }
  /* Keep the toolbar (calendar name, buttons, count) in view while a long
   * event list scrolls inside the pinned panel. The extra top padding plus
   * the matching negative margin extend its background across the panel's
   * own 20px padding, so scrolling content never peeks above it. */
  main > .panel:nth-of-type(2) > .toolbar {
    position: sticky;
    top: -20px;
    z-index: 1;
    margin-top: -20px;
    padding: 20px 0 12px;
    background: var(--panel);
    flex-wrap: nowrap;
  }
  /* Keep the buttons row single-line: at 921-940px with a classic scrollbar
   * gutter the row was 2px too narrow and used to wrap to two lines, growing
   * the toolbar to ~312px - past the 274px scroll-padding-top - so Shift+Tab
   * could focus a list button hidden behind the toolbar. The negative right
   * margin lets the row borrow the panel's right padding as headroom (the
   * row has no background, so this is invisible and buttons keep their
   * position); nowrap plus nowrap button labels keep the toolbar height
   * constant. Mobile (<=920px) still wraps freely. */
  main > .panel:nth-of-type(2) > .toolbar > .toolbar-buttons {
    flex-wrap: nowrap;
    margin-right: -20px;
  }
  main > .panel:nth-of-type(2) > .toolbar .btn { white-space: nowrap; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; }

/* Form section headers: light uppercase label with a hairline rule. */
.form-section {
  margin: 22px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
#event-form > .form-section:first-of-type { margin-top: 0; }

.field { margin-bottom: 14px; min-width: 0; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
/* The title is the one deliberately large field. */
#title { font-size: 17px; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: inherit;
  background: var(--field);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: 1; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Keyboard focus for controls that have no visible focus style of their own. */
.btn:focus-visible,
.chip:focus-visible,
summary:focus-visible,
.check input:focus-visible,
.day-check input:focus-visible,
.att-rsvp input:focus-visible,
.drop-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2355627a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
}

/* Strip the native date/time controls' intrinsic floor: min-width:0 alone
 * isn't enough on iOS Safari - appearance:none is what actually lets the
 * native control shrink to the track. display/width still come from the
 * .field input rule. */
input[type="date"],
input[type="time"] { min-width: 0; -webkit-appearance: none; appearance: none; }

textarea { resize: vertical; }
/* Zone filter sits directly above the select it narrows. */
#timezone-filter { margin-bottom: 8px; }
.field .hint { margin: 6px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }

/* Inline validation */
.field.invalid input,
.field.invalid select,
.field.invalid textarea { border-color: var(--danger); }
.field.invalid input:focus,
.field.invalid select:focus,
.field.invalid textarea:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.15);
}
.field-error {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--danger);
}

/* Import panel */
#import-box {
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  background: var(--surface);
}
#import-box > summary { padding: 10px 0; }
#import-box[open] > summary { margin-bottom: 12px; }
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  padding: 18px 12px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--field);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 14px;
}
.drop-zone strong { color: var(--text); font-size: 14px; }
.drop-zone.dragging { border-color: var(--accent); background: var(--accent-soft); }
#import-text { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
#import-status { margin: 0 0 14px; }
#import-status:empty { display: none; }

/* Import mode radios (styled like the other .check boxes) */
.import-mode { border: 0; margin: 0 0 12px; padding: 0; }
.import-mode legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 4px; }
.import-mode .check { margin: 0 0 4px; }

/* Advanced fields collapse behind a details styled like the import panel. */
#advanced-box {
  margin: 18px 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  background: var(--surface);
}
#advanced-box > summary { padding: 10px 0; }
#advanced-box[open] > summary { margin-bottom: 12px; }

/* Import warnings/notes */
#import-notes { margin: 0 0 14px; }
#import-notes .import-notes > summary { font-size: 13px; }
#import-notes ul {
  margin: 6px 0 0;
  padding-left: 20px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
#import-notes li { overflow-wrap: anywhere; }

/* minmax(0, 1fr) (not bare 1fr) keeps the tracks shrinkable: iOS Safari's
 * native date/time controls have a large intrinsic min-content width, so a
 * bare 1fr track (= minmax(auto, 1fr)) can't shrink below it and the inputs
 * overflow the row. Same fix as main/.reminder-row above. */
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.field-row.tri { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) {
  .field-row, .field-row.tri { grid-template-columns: minmax(0, 1fr); }
}
/* The recurrence row shows only two controls side-by-side (interval + ends;
 * BYDAY is span-all), so give it two tracks on wide screens — three would
 * shrink eagerly and clip the nested until date input. */
@media (min-width: 561px) {
  #recur-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin: 2px 0 14px;
  /* WCAG 2.5.8: a 24px-minimum tappable area around the 18px checkbox. */
  min-height: 24px;
  padding: 3px 0;
  cursor: pointer;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Chip groups: duration presets and the segmented repeat control. Pressed
 * state lives entirely in aria-pressed, so the visual state can never drift
 * from what assistive technology reports. */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Weekly day-of-week picker: an inline row of compact .check-style boxes. */
.field-row .field.span-all { grid-column: 1 / -1; }
/* Nested controls inside the Ends group sit under its select. */
.end-sub { margin: 8px 0 0; }
.day-picker-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.day-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.day-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  /* WCAG 2.5.8: a 24px-minimum tappable area around the 18px checkbox. */
  min-height: 24px;
  padding: 3px 0;
  cursor: pointer;
}
.day-check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Reminder rows */
#reminder-rows { display: grid; gap: 8px; margin-bottom: 10px; }
#reminder-rows:empty { margin-bottom: 0; }
.reminder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.reminder-row .field { margin-bottom: 0; }
.reminder-remove { justify-self: end; align-self: center; padding: 7px 10px; font-size: 13px; }
@media (max-width: 560px) {
  .reminder-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .reminder-remove { grid-column: 1 / -1; justify-self: end; }
}

/* Organizer + attendees */
.contact-group { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.contact-group legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 8px; }
#attendee-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
#attendee-list:empty { margin-bottom: 0; }
.attendee-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.attendee-row .field { margin-bottom: 0; }
.att-rsvp {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-height: 24px;
  padding: 3px 0;
  cursor: pointer;
}
.att-rsvp input { width: 18px; height: 18px; accent-color: var(--accent); }
.att-remove { justify-self: end; align-self: center; padding: 7px 10px; font-size: 13px; }

.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Small-screen sticky action bar ----------
 * On phones the form's Add/Update row is pinned to the bottom of the viewport
 * so the primary action is always reachable without scrolling back. Only
 * #event-form's row is pinned: #import-box has its own .form-actions, and
 * pinning that too would stack two fixed bars. The fixed bar is out of flow,
 * so body reserves room (padding-bottom) for it at the end of the document,
 * and the undo toast (also fixed) is raised clear of it. */
@media (max-width: 920px) {
  html { scroll-padding-bottom: 148px; }
  body { padding-bottom: 132px; }
  #event-form > .form-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--panel);
    border-top: 1px solid var(--border);
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px -12px rgba(16, 24, 40, 0.25);
    border-radius: 0;
    flex-wrap: wrap;
  }
  /* The status line wraps inside the bar (clamped to two lines so an
   * arbitrarily long message cannot grow the fixed bar past the reserved
   * space and the toast offset below). Screen readers still get the full
   * text from the role="status" region. */
  #event-form > .form-actions .status-msg {
    min-width: 0;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  /* Measured: a two-line status bar is ~116px tall, so 84px would tuck the
   * toast behind it. 124px clears the tallest bar with a small gap. */
  body .undo-toast { bottom: calc(124px + env(safe-area-inset-bottom)); }
}

.btn {
  font: inherit;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--border-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.copied { background: var(--accent); border-color: var(--accent); color: #fff; }
#copy-btn { min-width: 92px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Touch targets: coarse pointers (phones/tablets) get 44px-minimum tappable
 * controls (WCAG 2.5.5). Only the padding floor changes; the desktop density
 * behind a fine pointer is untouched. */
@media (pointer: coarse) {
  .field input,
  .field select,
  .field textarea { min-height: 44px; }
  .btn { min-height: 44px; padding-top: 11px; padding-bottom: 11px; }
}

.toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.toolbar h2 { margin: 0; }
.toolbar-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.calendar-name-field { width: min(100%, 28ch); margin-bottom: 0; }
.download-controls { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.filename-field { width: 14ch; margin-bottom: 0; }
.toolbar .field label { font-size: 12px; margin-bottom: 3px; }
.toolbar .field input { padding: 9px; }

/* Invite-style card summarizing the earliest event (renderEventCard in
 * app.js). A mini calendar page on the left, title + summary on the right;
 * purely informational. All colors resolve through vars, so it follows dark
 * mode automatically. */
.event-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin: 0 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.event-card-date {
  flex: none;
  display: flex;
  flex-direction: column;
  width: 56px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  text-align: center;
}
.event-card-month {
  display: block;
  padding: 3px 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.event-card-day {
  display: block;
  padding: 4px 0 6px;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.event-card-body { min-width: 0; }
.event-card-body strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.event-card-body small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

#event-list { list-style: none; margin: 0 0 14px; padding: 0; }
#event-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface);
}
/* The prepended calendar glyph sits left of the stacked title + summary, so
 * .event-info is a two-column grid; the glyph spans both text rows. (A plain
 * flex row would place the title and the summary side by side.) */
#event-list .event-info {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
}
/* Background data-URI SVG (CSP img-src data:), stroke in the light muted
 * tone — a background image cannot follow currentColor; the dark scheme
 * re-declares the image below, same pattern as the select chevron. */
.event-glyph {
  grid-row: 1 / span 2;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 8px 0 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Crect x='1.5' y='2.5' width='13' height='12' rx='2.5' fill='none' stroke='%2355627a' stroke-width='1.5'/%3E%3Cpath d='M1.5 6h13M5 1v3M11 1v3' fill='none' stroke='%2355627a' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
#event-list strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
#event-list small {
  color: var(--muted);
  font-size: 12.5px;
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
#event-list .btn { flex: none; padding: 6px 10px; font-size: 13px; }
#event-list .gcal-link {
  text-decoration: none;
  white-space: nowrap;
  color: var(--accent);
}
#event-list .gcal-link:hover { color: var(--accent-strong); border-color: var(--border-strong); }
#event-list .empty { display: block; color: var(--muted); font-size: 13px; padding: 8px 2px; }
#event-list .empty-msg { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--text); }
#event-list .empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* VTIMEZONE emission toggle (preview-side option) */
.vtimezone-toggle { margin: 4px 0 10px; font-size: 13px; font-weight: 500; align-items: flex-start; }
.vtimezone-toggle input { margin-top: 2px; }

details { margin-top: 6px; }
summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
summary:hover { color: var(--text); }
pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 10px 0 0;
  max-height: 340px;
  white-space: pre;
}
#preview.wrapped { white-space: pre-wrap; }

/* Preview controls live inside the summary, which is a wrapping flex row so
 * the buttons drop below the label and the summary grows in height instead
 * of overflowing on narrow screens (e.g. 320px with Wrap on). The buttons
 * swallow their clicks in app.js so the details does not toggle when they
 * are used. */
#preview-box summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
/* Flex suppresses the native disclosure marker, so draw a chevron as
 * generated content; as the last flex item it lands after the controls. */
#preview-box summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2355627a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: transform 0.15s;
}
#preview-box[open] > summary::after { transform: rotate(180deg); }
.preview-controls {
  margin-left: auto;
  display: flex;
  gap: 6px;
  font-size: 12.5px;
}
.preview-controls .btn { padding: 4px 8px; }

.status-msg { font-size: 13px; color: var(--muted); }
.status-msg.error { color: var(--danger); }

/* Undo toast */
.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: min(92vw, 520px);
  padding: 10px 12px 10px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
}
.undo-toast .btn { padding: 6px 12px; font-size: 13px; }

footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }
footer a { color: var(--accent); }

[hidden] { display: none !important; }

.panel.faq .faq-item { border-top: 1px solid var(--border); }
.panel.faq .faq-item:first-of-type { border-top: 0; }
.panel.faq summary { padding: 10px 0; }
.panel.faq .faq-item p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }

/* ---------- Dark mode (CSS-only, follows prefers-color-scheme) ----------
 * All text pairings below were checked against WCAG AA (≥ 4.5:1):
 * text/muted/accent/danger/code-text all clear AA on their backgrounds, and
 * the primary/copy buttons switch to dark text because white on #7da2ff
 * would fail AA for normal text. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --panel: #161c2b;
    --surface: #1c2333;
    --field: #131926;
    --text: #e3e9f4;
    --muted: #9aa8c0;
    --accent: #7da2ff;
    --accent-strong: #9db9ff;
    --accent-soft: #21335f;
    --border: #2a3347;
    --border-strong: #3a4661;
    --danger: #ff9285;
    --code-bg: #0a0f1a;
    --code-text: #cdd8ea;
    /* Native controls (date/time pickers, scrollbars) render dark. */
    color-scheme: dark;
  }

  /* The chevron is an inline SVG data URI, so its stroke cannot follow a
   * variable — re-declare the background in the dark muted tone. */
  .field select {
    background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239aa8c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  }

  #preview-box summary::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239aa8c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }

  /* Event-list calendar glyph in the dark muted tone. */
  .event-glyph {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Crect x='1.5' y='2.5' width='13' height='12' rx='2.5' fill='none' stroke='%239aa8c0' stroke-width='1.5'/%3E%3Cpath d='M1.5 6h13M5 1v3M11 1v3' fill='none' stroke='%239aa8c0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  }

  /* The light-mode ring alpha is nearly invisible on the dark fields. */
  .field input:focus,
  .field select:focus,
  .field textarea:focus {
    box-shadow: 0 0 0 3px rgba(125, 162, 255, 0.28);
  }

  /* White on #7da2ff fails AA — use the page background as the text color
   * (the pressed chip shares the accent background). */
  .btn.primary,
  .btn.copied,
  .chip[aria-pressed="true"] {
    color: #0f1420;
  }

  /* Browser-default link blue (#0000ee) is ~1.8:1 on the dark panel; the
   * accent keeps AA. footer a already resolves to the accent via the base
   * rule — kept here so both link sets stay accessible if that changes. */
  .faq a,
  footer a {
    color: var(--accent);
  }
}