:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #5b6577;
  --line: #e3e7ee;
  --brand: #2f6df0;
  --brand-ink: #fff;
  --early: #fde9c8;
  --late: #d6e4ff;
  --playoff: #f3d9ff;
  --danger: #c2342c;
  --ok: #1f9d57;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand); }
.container { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.site-header nav a { text-decoration: none; font-size: 14px; }
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; margin: 0 0 18px;
}
h1 { font-size: 28px; margin: 8px 0 4px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.lead { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.hero { padding: 14px 0 6px; }
.hero h1 { font-size: 32px; line-height: 1.15; margin: 0 0 10px; }
.hero-sub { color: var(--muted); font-size: 17px; max-width: 60ch; margin: 0 0 8px; }

.seo { margin-top: 28px; border-top: 1px solid var(--line); }
.seo > summary { cursor: pointer; list-style: none; font-weight: 700; font-size: 16px; padding: 16px 0; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.seo > summary::-webkit-details-marker { display: none; }
.seo > summary::before { content: "›"; font-size: 20px; line-height: 1; color: var(--muted); transition: transform .15s ease; }
.seo[open] > summary::before { transform: rotate(90deg); }
.seo-body { padding-bottom: 8px; }
.seo h2 { font-size: 20px; margin: 22px 0 10px; }
.seo .steps, .seo .bullets { padding-left: 20px; margin: 0; }
.seo .steps li, .seo .bullets li { margin: 8px 0; }
.seo .faq { margin: 0; }
.seo .faq dt { font-weight: 700; margin: 14px 0 2px; }
.seo .faq dd { margin: 0 0 6px; color: var(--muted); }
.seo code { background: var(--line); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

/* breathing room between the Generate button and the generated schedule */
#preview:not(:empty) { display: block; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }

label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink); min-width: 0;
}
/* Keep native date/time pickers (reliable on iOS/Safari) but make sure they stay
   inside their grid cell instead of overflowing onto neighbors. */
input[type="date"], input[type="time"] { box-sizing: border-box; max-width: 100%; min-width: 0; }
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.row > * { min-width: 0; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline label { margin: 0; font-weight: 500; }
.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.checks label { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; margin: 0; }
.checks input { width: auto; }

button {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 9px 14px; border-radius: 8px;
}
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.danger { color: var(--danger); border-color: #eccac7; }
button.small { padding: 5px 9px; font-size: 13px; }
button:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--line); }
.tag.early { background: var(--early); }
.tag.late { background: var(--late); }
.tag.playoff { background: var(--playoff); }
tr.playoff td { background: #faf3ff; }

.banner { border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px; }
.banner.warn { background: #fff6e6; border: 1px solid #ffe0a3; }
.banner.info { background: #eef3ff; border: 1px solid #cfe0ff; }
.banner.ok { background: #e9f8ef; border: 1px solid #b7e6c9; }
.banner.err { background: #fdeceb; border: 1px solid #f3c4c0; color: #7a201b; }

.linkbox { display: flex; gap: 8px; margin: 6px 0; }
.linkbox input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat { background: #f3f5f9; border-radius: 8px; padding: 8px 10px; }
.stat b { display: block; font-size: 18px; }
.week-head { margin: 18px 0 6px; font-weight: 700; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.spinner { color: var(--muted); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 4px 0 14px; }
.segmented button { border: none; border-radius: 0; background: #fff; color: var(--ink); padding: 8px 16px; border-right: 1px solid var(--line); font-weight: 600; }
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--brand); color: var(--brand-ink); }
.slot-panel { padding: 4px 0 4px; }

table.mini { width: auto; border: 1px solid var(--line); border-radius: 8px; }
table.mini th, table.mini td { padding: 4px 12px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.cal { border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-width: 560px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-summary { font-weight: 600; font-size: 14px; }
.cal-months { display: flex; gap: 18px; flex-wrap: wrap; }
.cal-month { flex: 1; min-width: 210px; }
.cal-title { font-weight: 600; font-size: 13px; text-align: center; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0; }
.cal-day { text-align: center; padding: 7px 0; border-radius: 6px; cursor: pointer; font-size: 13px; user-select: none; }
.cal-day:hover:not(.empty) { background: var(--line); }
.cal-day.empty { cursor: default; }
.cal-day.in-range { background: #e6eefc; }
.cal-day.start, .cal-day.end { background: var(--brand); color: var(--brand-ink); }
.cal-day.today { outline: 1px solid var(--brand); }

.pairs { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.pair-row { display: flex; gap: 8px; align-items: center; }
.pair-row input[type="time"] { width: 140px; flex: 0 0 auto; }
.pair-row input:not([type="time"]) { flex: 1; min-width: 120px; }
.pair-row button { flex: 0 0 auto; }

.matrix-wrap { overflow-x: auto; padding-bottom: 4px; }
table.matrix { border-collapse: collapse; }
table.matrix th, table.matrix td { width: 26px; height: 26px; min-width: 26px; text-align: center; font-size: 11px; padding: 0; }
table.matrix th { color: var(--muted); font-weight: 600; background: transparent; }
table.matrix td.cell { color: #2b2f3a; border: 2px solid #fff; border-radius: 4px; }
table.matrix td.empty { background: transparent; border: none; }
.matrix-legend { display: flex; gap: 16px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 5px; }
.mtip { position: fixed; z-index: 50; display: none; background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

.cal-list { margin: 6px 0 2px; }
.cal-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cal-row:last-child { border-bottom: none; }
.cal-name { font-weight: 600; font-size: 14px; }
.cal-acts { display: flex; gap: 8px; flex-shrink: 0; }
