:root {
  --ink: #0b1232;
  --navy: #074b7a;
  --card-top: #e1f1fb;
  --green: #008b28;
  --green-dark: #006d22;
  --border: #c9d5e2;
  --muted: #617182;
  --danger: #b42318;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: #edf5fa;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: #edf5fa; }
.icon, .message-icon { display: inline-flex; flex: none; }
.icon svg, .message-icon svg { width: 1em; height: 1em; }

/* Banner. The photo comes from each trip's `banner` in lib/trips.js. */
.hero {
  min-height: 250px;
  background:
    linear-gradient(180deg, rgba(2, 28, 45, .45), rgba(2, 28, 45, .15) 60%, rgba(2, 28, 45, .35)),
    var(--banner, none) center 55% / cover,
    linear-gradient(115deg, #04495b, #ffb76a);
  display: flex;
  align-items: center;
}
.hero-inner { max-width: 1080px; margin: auto; width: 100%; padding: 30px 20px 62px; color: #fff; text-align: center; text-shadow: 0 2px 10px rgba(10, 25, 40, .8); }
h1 { font-size: clamp(30px, 5vw, 54px); line-height: 1.12; margin: 0 0 12px; font-weight: 800; }
.subtitle { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: clamp(20px, 3.4vw, 34px); font-weight: 750; }
.wa-badge { display: inline-grid; place-items: center; background: #25d366; color: #fff; border-radius: 50%; height: 48px; width: 48px; font-size: 30px; flex: none; text-shadow: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }

.panel { position: relative; max-width: 1050px; margin: -35px auto 45px; background: #fff; border-radius: 24px; padding: 28px; box-shadow: 0 8px 30px #153c5726; }
.selector { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 20px; margin: 5px 15px 28px; }
.selector label { font-weight: 800; font-size: 27px; }
select, input, textarea { font: inherit; color: #10172d; }
select {
  font-size: 25px; padding: 15px 56px 15px 20px; border: 2px solid var(--border); border-radius: 14px; width: 100%;
  appearance: none; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310172d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 18px center / 24px;
}

/* Day picker (custom so the open list is full width and long names wrap) */
.day-picker { position: relative; min-width: 0; }
.day-button {
  display: block; width: 100%; text-align: left; cursor: pointer;
  font: inherit; font-size: 25px; color: #10172d; padding: 15px 56px 15px 20px;
  border: 2px solid var(--border); border-radius: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310172d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 18px center / 24px;
}
.day-button[aria-expanded="true"] { border-color: var(--navy); }
.day-list {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px #153c5733;
  max-height: 65vh; overflow-y: auto;
}
.day-option { padding: 12px 14px; border-radius: 10px; font-size: 18px; line-height: 1.3; cursor: pointer; }
.day-option:hover, .day-option:focus { background: #eef6fb; outline: none; }
.day-option[aria-selected="true"] { background: var(--card-top); font-weight: 700; }

.message-card { display: block; border-radius: 20px; overflow: hidden; box-shadow: 0 4px 12px #16406122; margin: 0 0 22px; border: 1px solid #e4edf5; background: #fff; }
.card-top { background: var(--card-top); display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.number { background: var(--navy); color: #fff; border-radius: 10px; min-width: 54px; height: 54px; padding: 0 8px; display: grid; place-items: center; font-size: 30px; font-weight: 750; flex: none; }
.message-icon { font-size: 34px; color: #073c58; }
.card-top h2 { font-size: clamp(20px, 3vw, 29px); margin: 0; flex: 1; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.edit-button { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; color: #08374c; font: inherit; font-size: 22px; cursor: pointer; padding: 10px; flex: none; }
.edit-button .icon { font-size: 24px; }
.card-body { padding: 20px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: clamp(17px, 2.4vw, 23px); line-height: 1.45; margin-bottom: 22px; }
.message-text a { color: #0b57d0; }
/* Group Leader card header: "#01 – Heading" and Edit on the first row, the doc's
   description underneath across the full width. */
.card-top.leader-top { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; row-gap: 2px; padding: 12px 16px 12px 20px; }
.leader-top h2 { font-size: clamp(19px, 2.6vw, 25px); line-height: 1.25; }
.leader-top .edit-button { padding: 4px 6px; }
.card-note { grid-column: 1 / -1; margin: 0; font-size: 14px; line-height: 1.35; color: #4f6475; white-space: pre-line; }
.message-editor { display: block; width: 100%; min-height: 60vh; overflow: hidden; resize: vertical; font-size: 18px; line-height: 1.45; padding: 14px; border: 2px solid #9bb9cf; border-radius: 12px; margin-bottom: 12px; }
[hidden] { display: none !important; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.editor-actions button { border: 1px solid #a9c5d7; border-radius: 9px; padding: 10px 14px; background: #fff; font: inherit; cursor: pointer; }
.copy-button { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; background: var(--green); color: #fff; border: 0; border-radius: 14px; padding: 16px; font: inherit; font-size: clamp(19px, 3vw, 27px); font-weight: 750; cursor: pointer; min-height: 66px; }
.copy-button .icon { font-size: 1.45em; }
.copy-button:active { background: var(--green-dark); }
.copy-status { font-size: 15px; color: #246447; margin: 9px 0 0; }
.copy-status:empty { display: none; }
.empty { color: var(--muted); font-size: 18px; text-align: center; padding: 20px 0; }
.footnote { text-align: center; color: var(--muted); font-size: 13px; margin: 24px 0 0; }

/* Admin */
.admin-bar { background: #082d47; color: #fff; padding: 22px 20px 58px; }
.admin-bar-inner { max-width: 1050px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-bar h1 { font-size: clamp(26px, 4vw, 36px); margin: 0; }
.who { margin: 4px 0 0; opacity: .8; font-size: 15px; }
.view-link { color: #fff; font-weight: 700; background: rgba(255, 255, 255, .14); padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.admin-note { color: var(--muted); font-size: 15px; margin: -10px 15px 20px; }
.page-status { margin: 0 15px 18px; padding: 12px 14px; border-radius: 10px; background: #e7f6ec; color: #1d5b33; font-weight: 600; }
.page-status.error { background: #fdecea; color: var(--danger); }
.page-status:empty { display: none; }
.tools { display: flex; gap: 6px; flex: none; }
.tool-button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #a9c5d7; background: #fff; color: #08374c; border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 16px; cursor: pointer; min-height: 42px; }
.tool-button .icon { font-size: 18px; }
.tool-button:disabled { opacity: .35; cursor: default; }
.tool-label:empty { display: none; }
.message-card.editing { border: 2px solid var(--navy); }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input { width: 100%; font-size: 18px; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; }
.field select { font-size: 18px; padding: 12px 48px 12px 14px; border-radius: 12px; background-size: 20px; background-position: right 14px center; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.save-button { background: var(--green) !important; color: #fff; border-color: var(--green) !important; font-weight: 700; }
.add-button { display: block; width: 100%; border: 2px dashed #9bb9cf; background: #f5fafd; color: var(--navy); border-radius: 14px; padding: 16px; font: inherit; font-size: 20px; font-weight: 700; cursor: pointer; }
body.busy { cursor: progress; }
body.busy button { pointer-events: none; }

/* Simple pages (home, 404) */
.simple { max-width: 640px; margin: 60px auto; padding: 0 20px; text-align: center; }

@media (max-width: 650px) {
  .hero { min-height: 220px; }
  .hero-inner { padding: 24px 16px 56px; }
  .subtitle { gap: 9px; }
  .wa-badge { height: 38px; width: 38px; font-size: 24px; }
  .panel { margin: -28px 10px 30px; padding: 17px 12px; border-radius: 20px; }
  .selector { grid-template-columns: 1fr; gap: 8px; margin: 4px 5px 22px; }
  .selector label { font-size: 21px; }
  select, .day-button { font-size: 19px; padding: 13px 48px 13px 14px; background-position: right 14px center; }
  .day-option { font-size: 17px; padding: 11px 12px; }
  .card-top { gap: 9px; padding: 11px; }
  .number { min-width: 40px; height: 42px; font-size: 23px; }
  .message-icon { font-size: 26px; }
  .card-top h2 { font-size: 19px; }
  .edit-button { font-size: 17px; padding: 7px; gap: 6px; }
  .edit-button .icon { font-size: 19px; }
  .card-body { padding: 15px; }
  .message-text { font-size: 17px; }
  .copy-button { font-size: 20px; padding: 14px; }
  .admin-bar { padding: 18px 16px 50px; }
  .admin-note { margin: -8px 5px 16px; }
  .page-status { margin: 0 5px 14px; }
  .admin .card-top { flex-wrap: wrap; }
  .admin .tools { width: 100%; justify-content: flex-end; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}
