* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #fff;
  color: #172a20;
  font:
    15px/1.45 Arial,
    Helvetica,
    sans-serif;
}
header {
  background: #eef6ed;
  border-bottom: 1px solid #b9cebb;
  padding: 14px 5vw;
}
header a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #174e32;
  font:
    bold 27px Georgia,
    serif;
  text-decoration: none;
}
header img {
  width: 34px;
}
main {
  max-width: 1020px;
  margin: 38px auto;
  padding: 0 20px;
}
#create {
  max-width: 700px;
  margin: auto;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  text-align: center;
  font:
    bold clamp(25px, 4vw, 34px)/1.2 Georgia,
    serif;
  overflow-wrap: anywhere;
}
h2 {
  font-size: 19px;
  margin: 0 0 14px;
}
.intro {
  text-align: center;
  margin: 8px 0 24px;
  color: #48604f;
}
form,
.boards > section {
  border: 1px solid #b9c9bc;
}
#newMeal > .fields,
#join {
  background: #f4f8f2;
  padding: 20px;
}
.fields,
.columns,
.boards,
.invite,
#signed,
.actions,
.legend {
  display: flex;
  gap: 16px;
}
.fields {
  align-items: end;
}
.fields label {
  flex: 1;
}
.fields input,
.timeFields select {
  display: block;
  width: 100%;
  margin-top: 4px;
}
input,
select,
button {
  font: inherit;
  color: inherit;
  border: 1px solid #8a9e8e;
  border-radius: 4px;
  background: #fff;
  padding: 6px 9px;
  max-width: 100%;
}
button,
select {
  cursor: pointer;
}
button:hover {
  border-color: #174e32;
}
label {
  font-size: 14px;
}
small,
.hint,
#selection,
#saveState {
  color: #526258;
  font-size: 13px;
}
.columns {
  gap: 0;
}
.columns > section {
  flex: 1;
  min-width: 0;
  padding: 22px;
}
.columns > section + section {
  border-left: 1px solid #ced9ce;
}
.hint {
  margin: 8px 0 12px;
}
.timeFields label {
  display: block;
  margin-bottom: 12px;
}
.actions {
  background: #f4f8f2;
  border-top: 1px solid #cdd9ce;
  justify-content: center;
  padding: 14px;
}
.primary {
  background: #165637;
  color: white;
  border-color: #165637;
  font-weight: bold;
  padding: 8px 20px;
}
#calendar,
#monthNav {
  max-width: 310px;
}
#monthNav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 6px;
}
#calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  touch-action: none;
  user-select: none;
}
#calendar button {
  border-radius: 1px;
  padding: 5px 0;
  background: #ffe2e2;
  color: #301e20;
  font-size: 14px;
}
#calendar button[aria-pressed="true"] {
  background: #a4d99a;
  color: #153e23;
}
#calendar span {
  font-size: 12px;
}
.invite,
#signed {
  justify-content: center;
  align-items: center;
  margin: 14px auto;
}
.invite input {
  width: 330px;
}
.displayZone {
  display: block;
  text-align: center;
  margin: 18px 0;
}
.boards > section {
  flex: 1;
  min-width: 0;
  padding: 16px;
}
.scroll {
  overflow: auto;
  max-height: 63vh;
}
.grid {
  display: grid;
  width: max-content;
  min-width: 100%;
  align-items: stretch;
  position: relative;
  user-select: none;
}
.grid b,
.grid em,
.grid .time {
  background: white;
  position: sticky;
  z-index: 1;
  text-align: center;
  font-style: normal;
  font-weight: normal;
  font-size: 11px;
}
.grid b {
  top: 0;
  padding: 4px;
  white-space: pre-line;
  border-bottom: 1px solid #617767;
  font-weight: bold;
}
.grid .time {
  left: 0;
  text-align: right;
  padding-right: 5px;
}
.slot,
.hole {
  height: 17px;
  border-radius: 0;
  border: 0;
  border-right: 1px solid #879a89;
  border-bottom: 1px dotted #b7c4b7;
  padding: 0;
}
.slot {
  background: #ffe2e2;
  touch-action: none;
}
.slot.hour,
.hole.hour {
  border-top: 1px solid #829284;
}
.slot.free,
.slot.previewOn {
  background: #83c77b;
}
.slot.previewOff {
  background: #ffe2e2;
}
.slot.group {
  touch-action: manipulation;
}
.slot:focus-visible,
.slot.inspect {
  outline: 2px solid #173b67;
  outline-offset: -2px;
}
.hole {
  background: #eee;
}
.legend {
  gap: 6px;
  align-items: center;
  font-size: 12px;
  margin: 12px 0;
}
.legend i {
  width: 90px;
  height: 12px;
  border: 1px solid #aab6a9;
  background: linear-gradient(90deg, #f6f7f3, #247140);
}
#details,
#message {
  overflow-wrap: anywhere;
}
#message {
  text-align: center;
  color: #8e2525;
  margin-top: 15px;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid #204f97;
  outline-offset: 2px;
}
@media (max-width: 700px) {
  main {
    margin: 22px auto;
    padding: 0 10px;
  }
  .boards {
    flex-direction: column;
  }
  .fields {
    flex-wrap: wrap;
  }
  .fields label {
    min-width: 140px;
  }
  .columns > section {
    padding: 14px;
  }
}
@media (max-width: 520px) {
  .columns {
    flex-direction: column;
  }
  .columns > section + section {
    border-left: 0;
    border-top: 1px solid #cdd9ce;
  }
  .invite {
    gap: 5px;
  }
  .invite input {
    min-width: 0;
    flex: 1;
  }
}
#calendar button.previewOn {
  background: #a4d99a;
}
#calendar button.previewOff {
  background: #ffe2e2;
}

/* Keep names as entered while displaying the poll in lowercase. */
body, button, select, input:not([type="password"]):not([readonly]) {
  text-transform: lowercase;
}

summary {
  cursor: pointer;
  color: #165637;
  font-weight: 600;
  padding: 6px 0;
}
summary small { font-weight: normal; }
#hours summary small { display: block; margin-left: 1.15em; }
.extras, .best {
  border-top: 1px solid #ced9ce;
  margin-top: 12px;
  padding-top: 5px;
}
.extras label { display: block; margin-top: 10px; }
.extras input, .extras textarea {
  width: 100%;
  display: block;
  margin-top: 4px;
}
textarea {
  resize: vertical;
  font: inherit;
  color: inherit;
  padding: 6px 9px;
  border: 1px solid #8a9e8e;
  border-radius: 4px;
}
#planDetails, #bestTime {
  background: #f4f8f2;
  padding: 10px 12px;
  border-left: 3px solid #73a178;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#planDetails { max-width: 620px; margin: 12px auto; }
#bestTime, .best label { margin: 8px 0; }
#calendar button[aria-pressed=true] { font-weight: bold; box-shadow: inset 0 -3px #24613b; }
.slot.free::after { content: "✓"; font-size: 10px; color: #174e32; }
#personal:focus { outline-offset: 2px; }
@media (max-width: 700px), (pointer: coarse) {
  .slot, .hole { height: 28px; }
  #calendar button { min-height: 36px; }
  .invite { flex-wrap: wrap; }
  .invite input { flex: 1 1 220px; min-width: 0; }
  .invite button { flex: 1 0 auto; }
  input, select, textarea { font-size: 16px; }
  .scroll { overscroll-behavior-x: contain; }
}
.gridHelp { display: block; margin-top: 8px; }
#calendar button:not([aria-pressed="true"]):not(.previewOn) { background: #f4f8f2; color: #172a20; }
#calendar button[aria-current="date"] { text-decoration: underline; text-underline-offset: 3px; }
#joinError { color: #8e2525; }

#planner, #notifyPanel {
  max-width: 760px;
  margin: 12px auto;
  border: 1px solid #b9c9bc;
  border-radius: 5px;
  padding: 10px 16px;
}
#planner > summary small { margin-left: .4em; }
#planBanner { text-align: center; color: #174e32; background: #eef6ed; padding: 10px; font-weight: bold; }
.planTools, .planPair, .planActions { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.planTools > details { flex: 1 1 220px; min-width: 0; }
.planPair label { flex: 1 1 100px; min-width: 0; }
.planForm { display: grid; gap: 10px; border: 0; padding: 12px 0; }
.planForm input:not([type=checkbox]), .planForm select, .planForm textarea {
  display: block; width: 100%; margin-top: 3px;
}
.planForm button { justify-self: start; }
.planForm .tick { display: flex; align-items: center; gap: 8px; }
.spotCard { border: 1px solid #b9c9bc; border-radius: 4px; padding: 12px; margin-top: 12px; }
#planner h3, #planner h4 { margin: 8px 0; }
#planner a { color: #165637; }
.seatRow { border-top: 1px solid #ced9ce; margin-top: 12px; padding-top: 5px; }
#planner { overflow-wrap: anywhere; }
.seatRow p, .commentList { font-size: 14px; }
.commentList { padding-left: 18px; white-space: pre-line; }
.commentList:empty { display: none; }
.textButton { background: transparent; color: #165637; text-decoration: underline; border: 0; padding: 0 4px; }
.mealDiscussion, #organizerBox, #planLog { margin-top: 14px; border-top: 1px solid #ced9ce; padding-top: 8px; }
#organizerBox > small { display: block; }
#plannerMsg { font-weight: bold; margin-top: 8px; }
@media(max-width:520px) {
  #planner > summary small { display:block; margin-left:1.15em; }
}
#notifyPanel button, #notifyPanel a { margin: 6px 4px 6px 0; }
#notifyPanel a { color: #165637; }
#notifyPanel input { max-width: 100%; }
#notifyPanel p { margin: 6px 0; }

#customOccasionField {
  display: block;
  text-align: center;
  margin: 12px auto;
}
#customOccasionField input { margin-left: .4em; }
#occasionWord { min-width: 0; overflow-wrap: anywhere; }


/* The calendar, editing controls and invite navigation have distinct surfaces. */
body { background: #f7f9f6; }
header { background: #fff; border-bottom-color: #d5dfd5; }
main { max-width: 1160px; margin: 28px auto; }
#create { max-width: 1040px; }
h1 { font-size: clamp(28px, 4.5vw, 44px); }
#occasionWord { font: inherit; line-height: inherit; border: 0; color: #155a39; background: #e0f0df; padding: 0 .14em; border-radius: 4px; }
.occasionRow { max-width: 860px; margin: 14px auto 8px; }
.choiceField { display: block; min-width: 0; font-size: 14px; }
.choiceBox { min-width: 0; max-width: 100%; }
.choiceRail, .quickRow, .toolBar, .viewBar { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.choiceRail { margin: 4px 0; }
.choiceRail button, .quickRow button, .toolBar button {
  color: #344b3b; border: 1px solid #cad7cb; background: white;
  padding: 5px 10px; border-radius: 14px; font-size: 13px; line-height: 1.35;
}
.choiceRail button[aria-checked=true], .quickRow button[aria-pressed=true], .toolBar button[aria-pressed=true] {
  background: #195835; color: white; border-color: #195835; font-weight: bold;
}
.choiceRail button:hover, .quickRow button:hover, .toolBar button:hover { border-color: #27643e; }
.choiceRail button[disabled] { opacity: 1; }
.occasionRow .choiceRail { justify-content: center; }
.choiceRail.longRail { flex-wrap: nowrap; overflow-x: auto; padding: 4px 2px; scrollbar-width: thin; }
.longRail button { flex: none; max-width: min(300px,90%); }
.railPaging { display: flex; justify-content: flex-end; gap: 4px; }
.railPaging button { padding: 0 9px; line-height: 24px; font-size: 19px; }
.railPaging button:disabled { opacity: .4; cursor: default; }
.choiceBox input[type=search] { width: 100%; margin: 4px 0; }
#newMeal { border: 1px solid #bdcdbf; border-radius: 10px; background: #fff; }
#newMeal > .fields { border-radius: 10px 10px 0 0; background: #edf4ea; }
#newMeal .columns { display: grid; grid-template-columns: 1.18fr 1fr .9fr; }
.columns > section { padding: 18px; }
.columns h2 { font-size: 19px; }
.columns > .extras { border-top: 0; margin: 0; }
.extras h2 small { font: normal 12px Arial,sans-serif; }
.timeFields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.timeFields label { margin: 0; }
.timeFields input[type=time] { display: block; width: 100%; margin-top: 4px; }
.timeFields .choiceField { grid-column: span 2; }
.actions { border-radius: 0 0 10px 10px; justify-content: flex-end; padding: 12px 18px; }
#join { margin: 16px auto; border-radius: 8px; background: #edf4ea; padding: 14px 18px; }
#join h2 { margin-bottom: 3px; }
.viewBar { border-bottom: 2px solid #aec4b1; margin: 20px 0 16px; gap: 2px; }
.viewBar button { padding: 10px 16px; border: 0; background: none; color: #36503f; border-radius: 6px 6px 0 0; font-weight: bold; }
.viewBar button[aria-pressed=true] { background: #195835; color: white; }
#planner { max-width: none; margin: 0; padding: 0; border: 0; }
.planGrid, .updatesGrid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 16px; align-items: start; }
.planGrid > div, .updatesGrid > section, .boards > section {
  min-width: 0; padding: 18px; background: #fff; border-radius: 9px; border: 1px solid #c8d7ca;
}
.planGrid .workbench { background: #f0f5ee; border-color: #c4d5c4; }
.toolBar { margin-bottom: 10px; }
#notifyPanel, #planLog { margin: 0; width: 100%; max-width: none; padding: 18px; }
.spotCard { border-left: 3px solid #4c8461; }
.seatRow { background: #f4f7f2; padding: 8px 10px; }
#availability .displayZone, .displayZone .choiceBox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#availability .displayZone { justify-content: flex-end; margin: 6px 0 12px; }
.displayZone .choiceBox input { width: 135px; }
.best { margin-top: 14px; }
.best h3, .tableCheck h4 { margin: 6px 0; }
.best .choiceField { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.planPair > .choiceField { flex: 1 1 120px; }
.tableCheck { background: #fff; border-radius: 6px; padding: 8px 12px; }
.tableCheck h4 small { font-weight: normal; }
@media(max-width:840px) {
  #newMeal .columns { grid-template-columns: 1fr 1fr; }
  #newMeal .extras { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; border-left: 0; border-top: 1px solid #cfdbd1; }
  .extras h2 { grid-column: 1/-1; margin-bottom: 0; }
  .extras label { margin-top: 4px; }
}
@media(max-width:650px) {
  main { padding: 0 10px; margin-top: 20px; }
  .planGrid, .updatesGrid { grid-template-columns: minmax(0,1fr); }
  .planGrid .workbench { grid-row: 1; }
  .viewBar button { flex: 1; padding: 10px 5px; }
  .planPair { gap: 8px; }
  .choiceRail button, .quickRow button, .toolBar button { min-height: 32px; }
}
@media(max-width:560px) {
  #newMeal .columns { grid-template-columns: 1fr; }
  #newMeal .columns > section { border-left: 0; padding: 14px; }
  #newMeal .columns > section + section { border-top: 1px solid #cfdbd1; }
  #calendar, #monthNav { max-width: none; }
  .actions .primary { width: 100%; }
  #availability .displayZone { justify-content: flex-start; }
}

.actions { justify-content: space-between; align-items: center; }
#pollSummary { font-size: 14px; color: #425b48; }
#boardSwitch { display: none; }
.seatBadge {
  display: inline-block; background: #ebece6; color: #41493b; border-radius: 4px;
  padding: 2px 7px; font-size: 12px; font-weight: bold;
}
.seatBadge.checked { background: #d4ebd6; color: #17462a; }
.seatBadge.soldOut { background: #fae1d8; color: #7b3320; }
#plannerIntro:empty { display:none; }
.toolBar button:disabled { opacity:.45; cursor:default; }
@media(max-width:700px) {
  #boardSwitch:not([hidden]) { display:flex; margin-bottom:8px; }
  .boards.hasGuest[data-board=mine] > section:last-child,
  .boards.hasGuest[data-board=group] > #personal { display:none; }
  .invite { flex-wrap:nowrap; }
  .invite input { flex:1; }
  .invite button { flex:none; }
}
@media(max-width:650px) {
  .planGrid.hasSpots .workbench { grid-row:auto; }
  .actions { position: sticky; bottom: 0; z-index: 2; background: #edf4ea; }
  .actions .primary { width:auto; flex-shrink:0; }
}

#backToOptions, #passwordToggle { display: none; }
.boardTitle { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#saveState { color: #165637; font-weight: bold; }
.datePager:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 5px 0; }
.datePager span { font-size: 13px; }
.datePager button { font-size: 19px; min-width: 42px; }
#slotInfo.inspecting {
  background: #eaf3e8; border-left: 3px solid #377347; padding: 8px 10px; margin: 8px 0;
}
#slotInfo button { margin-top: 4px; }
@media(max-width:700px) {
  body:has(#event:not([hidden])) header { padding-block: 7px; }
  body:has(#event:not([hidden])) header a { font-size: 21px; }
  body:has(#event:not([hidden])) header img { width: 26px; }
  #event .intro { margin: 4px 0 9px; }
  #event .invite { position: absolute; top: 4px; right: 12px; margin: 0; }
  #event .invite button { min-height: 36px; font-size: 13px; border: 0; background: transparent; color: #165637; text-decoration: underline; }
  #link:not(.manualCopy) { display:none; }
  #link.manualCopy { width: 48vw; flex: auto; }
  #join { margin: 10px auto; padding: 12px; }
  #join h2 { margin: 0 0 6px; font-size: 17px; }
  #join .fields { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; }
  #join .fields label { min-width: 0; }
  #join .fields input, #join .primary { min-height: 40px; }
  #join .primary { padding-inline: 12px; }
  #passwordField:not(.revealed) { display:none; }
  #passwordField.revealed { grid-column: 1; }
  #passwordToggle, #backToOptions {
    background: transparent; border: 0; padding: 5px 0; color: #245d3a; text-decoration: underline;
  }
  #passwordToggle { display:inline-block; font-size: 13px; }
  #signed { margin: 8px auto; }
  .viewBar { position: sticky; top: 0; z-index: 5; margin: 0 0 8px; background: #f7f9f6; }
  .viewBar button, #boardSwitch button { min-height: 40px; }
  #event :is(input,textarea,button,[tabindex="-1"]) { scroll-margin-block-start: 54px; }
  #availability .displayZone { margin: 4px 0; font-size: 12px; }
  #availability .displayZone .choiceBox { flex-wrap: wrap; }
  #boardSwitch { margin-block: 4px; }
  .boards > section { padding: 11px; }
  .boards h2 { font-size: 17px; margin-bottom: 4px; }
  .boards .hint { margin: 4px 0 6px; }
  .boards .scroll { max-height: 48vh; max-height: 48dvh; }
  .gridHelp { display:none; }
  #slotInfo.inspecting { position:sticky; top:42px; z-index:3; max-height:23vh; overflow:auto; }
}
@media(max-width:650px) {
  .planGrid .workbench, .planGrid.hasSpots .workbench { grid-row:1; padding:10px; }
  .planGrid:not(.editing) .workbench > :not(.toolBar):not(#plannerMsg) { display:none; }
  .planGrid:not(.editing) .toolBar { margin:0; }
  .planGrid.editing > :first-child { display:none; }
  .planGrid.editing .workbench > #backToOptions { display:inline-block; margin-bottom:6px; }
  .toolBar button { min-height: 36px; }
  #notifyPanel { grid-row: auto; }
  #optionsList .spotCard { margin-top: 6px; }
}
@media(max-width:700px) {
  .best { border: 0; padding: 0; margin: 6px 0 10px; }
  .best h3 { display: none; }
  .best.empty { display:none; }
  .best .choiceField { font-size:12px; }
  #bestTime { padding:6px 8px; font-size:13px; }
  #timeComment { padding:4px 9px; }
}

.touchHint, .timeCorner span { display:none; }
@media(pointer:coarse) {
  .touchHint, .timeCorner span { display:inline; }
  .grid .timeCorner { left:0; z-index:2; color:#43634b; }
  .grid .time { background: #f0f5ee; }
}

@media(max-width:700px) {
  #join .nameLabel {
    position:absolute; width:1px; height:1px; overflow:hidden;
    clip-path:inset(50%); white-space:nowrap;
  }
}
