:root {
  --bg: #eef4ef;            /* sage page background */
  --panel: #e4efe6;         /* tinted inner panels */
  --panel-line: #d0dfd3;
  --card: #ffffff;
  --ink: #1c2433;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #16a34a;        /* logo green — buttons, focus */
  --accent-bright: #4ade80; /* logo check green */
  --accent-warm: #ea580c;   /* logo orange — links, highlights */
  --accent-ink: #ffffff;
  --good: #16a34a;
  --bad: #dc2626;
  --notice-bg: #ecfdf5;
  --notice-line: #a7f3d0;
  --error-bg: #fef2f2;
  --error-line: #fecaca;
  --final-bg: #fefce8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 1rem 1rem 3rem; }

.site-head {
  padding: 0.75rem 0 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { display: inline-block; }
.brand .logo { height: 34px; width: auto; display: block; }
.help-link { color: var(--muted); font-size: 0.9rem; }

/* Help guides */
.role-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0 0.25rem; }
.role-nav a {
  padding: 0.35rem 0.9rem; border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.9rem;
}
.role-nav a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.help h2 { margin-top: 2rem; }
.help ul, .help ol { padding-left: 1.3rem; }
.help li { margin: 0.3rem 0; }
.help kbd {
  font: inherit; font-size: 0.85rem; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.05rem 0.4rem;
}

.card {
  background: var(--card);
  border: 1px solid #d8e2da;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.06);
}
.card.narrow { max-width: 460px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.card > h2:first-child { margin-top: 0; }

h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.card > h1 {
  padding-bottom: 0.45rem;
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, var(--accent-warm), var(--accent), var(--accent-bright)) 1;
}
h2 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }

a { color: var(--accent-warm); }
a:hover { color: var(--accent); }

.muted { color: var(--muted); }
.desc { white-space: pre-line; }
.footnote { text-align: center; color: var(--muted); margin-top: 1.25rem; }

label { display: block; font-weight: 600; font-size: 0.9rem; margin: 1rem 0 0.25rem; }

input[type="text"], input[type="password"], input[type="url"], input[type="date"],
input[type="time"], input[type="number"], input[type="email"], input:not([type]),
textarea, select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.code-input { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; }

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  margin-top: 1rem;
}
button:hover { filter: brightness(1.08); }
button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.notice, .error {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  margin: 0.75rem 0;
}
.notice { background: var(--notice-bg); border: 1px solid var(--notice-line); }
.error { background: var(--error-bg); border: 1px solid var(--error-line); color: var(--bad); }

/* Inline how-it-works guidance (the Help pages hold the full guides) */
.guide-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.75rem 1rem 0.85rem; margin: 1rem 0; font-size: 0.9rem;
}
.guide-box h3 { margin: 0 0 0.35rem; font-size: 0.9rem; color: var(--accent); }
.guide-box ol, .guide-box ul { margin: 0; padding-left: 1.25rem; }
.guide-box li { margin: 0.25rem 0; }
.guide-box p { margin: 0.25rem 0 0; }

/* min-width: 0 — fieldsets otherwise refuse to shrink below their content
   width and overflow small screens */
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 1.25rem 0 0; padding: 0.75rem 1rem 1rem; min-width: 0; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.4rem; }

/* Create page slot rows: From [date][time]  To [date][time]  × */
.slot-row {
  display: flex; gap: 0.6rem; align-items: center;
  margin-top: 0.5rem; padding: 0.5rem 0.6rem;
  border: 1px solid var(--panel-line); border-radius: 8px; background: var(--bg);
}
/* The From/To groups live in their own wrapper so both always get the same
   width — dates align under dates, times under times — while the star and
   remove controls sit in a rail on the right, centered across both lines. */
.slot-times { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.slot-controls { display: flex; align-items: center; gap: 0.4rem; }
.slot-part { display: flex; align-items: center; gap: 0.4rem; flex: 1; min-width: 22.5rem; }
.part-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); width: 2.4rem; }
/* min-widths above the natural (untruncated) widths Chromium gives these
   controls at 16px — "07/30/2026" and "10:00 AM" must never clip */
.slot-part input[type="date"], .slot-part input[type="time"] {
  padding-left: 0.45rem; padding-right: 0.45rem;
}
.slot-part input[type="date"] { flex: 1.3; min-width: 10.5rem; }
.slot-part input[type="time"] { flex: 1; min-width: 8.75rem; }
.slot-row .remove {
  margin: 0; padding: 0.2rem 0.6rem; background: transparent;
  color: var(--muted); border: 1px solid var(--line); font-size: 1rem;
}
.slot-row .remove:hover { color: var(--bad); border-color: var(--bad); }

/* Time zone bar */
.tz-bar {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 1.25rem 0 0.5rem; flex-wrap: wrap;
}
.tz-bar label { margin: 0; }
.tz-bar select { width: auto; max-width: 100%; }

/* Participant slot choices */
.slot-option {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 400; margin: 0.4rem 0; padding: 0.5rem 0.6rem;
  border: 1px solid var(--line); border-radius: 8px;
}
.slot-option input { width: auto; }
.slot-when { flex: 1; }

/* Yes / Maybe / No answer pills (polls). One-on-one keeps the checkbox. */
.avail-pick { display: inline-flex; gap: 0.3rem; margin-left: auto; }
.avail-pick label {
  display: inline-flex; align-items: center; gap: 0.3rem; margin: 0;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.65rem;
  font-size: 0.85rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.avail-pick input { width: auto; margin: 0; }
.avail-pick label.avail-yes:has(input:checked) { background: #dcfce7; border-color: var(--good); color: #15803d; }
.avail-pick label.avail-maybe:has(input:checked) { background: #ffedd5; border-color: var(--accent-warm); color: #9a3412; }
.avail-pick label.avail-no:has(input:checked) { background: var(--bg); border-color: var(--muted); }
.pill-maybe { background: #ffedd5; color: #9a3412; }
.mark-maybe { color: #9a3412; font-weight: 700; }

/* Icon-only buttons (e.g. the save icons in the admin organizer table) */
.icon-btn { padding: 0.3rem 0.45rem; line-height: 1; }
.icon-btn svg { display: block; }

/* Sortable column headers */
th a.th-sort { color: inherit; text-decoration: none; }
th a.th-sort:hover { text-decoration: underline; }
.slot-option.slot-taken { opacity: 0.55; background: var(--bg); }
.slot-option:has(input:disabled:not([data-taken])) { opacity: 0.55; }
.check-row {
  display: flex; align-items: flex-start; gap: 0.5rem;
  font-weight: 400; margin-top: 0.9rem;
}
.check-row input { width: auto; margin-top: 0.25rem; }

.pill {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  padding: 0.1rem 0.55rem; border-radius: 999px;
  background: var(--line); color: var(--muted);
  vertical-align: middle;
}
.pill-open { background: #dcfce7; color: var(--good); }
.pill-closed { background: #fee2e2; color: var(--bad); }
.pill-final { background: #fef08a; color: #854d0e; }
.pill-pop { background: #dcfce7; color: #15803d; }
.pill-preferred { background: #ffedd5; color: #9a3412; }

/* Preferred slots */
.slot-option.slot-preferred { border-color: var(--accent-warm); background: #fff7ed; }
/* Answered state wins over the preferred tint (rules below override above). */
.slot-option:has(input[type="checkbox"]:checked),
.slot-option:has(input[value="yes"]:checked) { border-color: var(--good); background: #f0fdf4; }
.slot-option:has(input[value="maybe"]:checked) { border-color: var(--accent-warm); background: #fff7ed; }
.slot-row.row-preferred { border-color: var(--accent-warm); background: #fff7ed; }
.slot-row.row-error { border-color: var(--bad); background: var(--error-bg); }
.pref-check {
  display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer;
  color: var(--accent-warm); font-weight: 600; margin: 0; padding: 0 0.3rem;
}
.pref-check input { width: auto; }

/* Event type icons */
.type-icon { vertical-align: -3px; }
.btn-link .type-icon { margin-right: 0.15rem; }
.type-cell { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.type-cell .type-icon { color: var(--accent); }

/* Transposed responses grid: participants as rows, slots as columns */
.grid-transposed th.slot-col {
  font-weight: 500; font-size: 0.78rem; white-space: nowrap; text-align: center;
}
.grid-transposed th.col-preferred { background: #ffedd5; }
.grid-transposed .star { color: var(--accent-warm); margin-left: 0.2rem; }
.grid-transposed .pick-row td { background: var(--final-bg); }
.grid-transposed .totals-row td { background: var(--panel); }
.grid-transposed td.final-col { background: var(--final-bg); }

/* Responses table */
.table-scroll { overflow-x: auto; margin-top: 0.5rem; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; font-size: 0.9rem; }
th { background: var(--panel); }

/* Tinted inner panels (share box, close controls, add forms, …) */
.close-box {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  padding: 0.9rem 1.1rem 1.1rem;
  margin-top: 1.1rem;
}
.close-box h3 { margin-top: 0; }
.close-box input, .close-box textarea, .close-box select { background: #fff; }
th.rot { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.mark { text-align: center; color: var(--good); font-weight: 700; }
td.mark.mark-maybe { color: #9a3412; }
.grid-transposed .totals-maybe td { background: #fff7ed; }
tr.final-row td { background: var(--final-bg); }

/* Share box */
.share-grid { display: grid; gap: 0.5rem; }
.copy-row { display: flex; gap: 0.5rem; }
.copy-row input { flex: 1; font-size: 0.85rem; color: var(--muted); }
.copy-row .copy { margin: 0; padding: 0.45rem 0.9rem; white-space: nowrap; }

/* Final result */
.final { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--final-bg); }
.final h2 { margin-top: 0; }
.final-time { font-size: 1.15rem; }
.meeting-link { word-break: break-all; }

/* Dashboards (organizer + site admin) */
.head-links { float: right; font-size: 0.85rem; font-weight: 400; }
.head-links a { color: var(--muted); }
.code-inline {
  font-weight: 700; letter-spacing: 0.12em; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.1rem 0.45rem;
}
button.mini { margin: 0; padding: 0.25rem 0.6rem; font-size: 0.8rem; }
input.date-mini { width: auto; padding: 0.25rem 0.4rem; font-size: 0.85rem; }
input.num-mini { width: 3.6rem; padding: 0.25rem 0.4rem; font-size: 0.85rem; }
form.inline { align-items: center; white-space: nowrap; }
/* Organizer table: name with the email beneath it, wrapping long addresses */
td.org-cell { min-width: 11rem; }
.org-email { font-size: 0.85rem; overflow-wrap: anywhere; }
.hint { font-size: 0.85rem; margin: 0.35rem 0 0; }
.expiry-note { margin-top: -0.25rem; }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
form.inline { display: inline-flex; gap: 0.35rem; }
td.actions { white-space: nowrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-3 label { margin-top: 0.25rem; }
.btn-link {
  display: inline-block; margin-top: 0.5rem; padding: 0.55rem 1rem;
  background: var(--accent); color: var(--accent-ink); border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.btn-link:hover { filter: brightness(1.08); }
.create-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.5rem 1.25rem;
  margin: 0.5rem 0 1rem;
}
.create-choices .btn-link { display: block; text-align: center; margin-top: 0; }
.create-choices .hint { margin: 0.4rem 0 0; }
.whoami { margin-top: -0.25rem; }

@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  /* wrap inside the part instead of shrinking inputs below their readable width */
  .slot-part { min-width: 100%; flex-wrap: wrap; }
  .slot-option { flex-wrap: wrap; }
  .avail-pick { margin-left: 0; width: 100%; }
}

/* Edit page: current slots with delete buttons */
.slot-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.slot-list li {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.4rem 0.6rem; margin-top: 0.35rem;
  background: var(--card); border: 1px solid var(--panel-line); border-radius: 8px;
}
.slot-list li > span:first-child { flex: 1; min-width: 12rem; }
.slot-list .star { color: var(--accent-warm); }
.slot-list form.inline { margin-left: auto; gap: 0.3rem; }
.star-btn {
  margin: 0; padding: 0.15rem 0.5rem; font-size: 1rem; line-height: 1.2;
  background: transparent; color: var(--accent-warm); border: 1px solid var(--line);
}
.star-btn.on { background: #ffedd5; border-color: var(--accent-warm); }
.star-btn:hover { border-color: var(--accent-warm); }
.slot-list .icon-btn { margin: 0; }
.close-box h4 { margin: 0.75rem 0 0.25rem; font-size: 0.95rem; }

/* Organizer dashboard: the login email beside the name */
.head-email { font-size: 0.95rem; font-weight: 400; }

/* Organizer login: forgot-code disclosure */
details.forgot { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
details.forgot summary { cursor: pointer; font-weight: 600; color: var(--accent-warm); }
details.forgot summary:hover { color: var(--accent); }
