:root {
  --ink: #39393a;
  --ink-soft: #757575;
  --paper: #f2f2f2;
  --card: #ffffff;
  --line: #e6e6e6;
  --pine: #407589;
  --pine-deep: #2d515f;
  --mint: #83b7b5;
  --gold: #407589;
  --clay: #8a332c;
  --open: #2d515f;
  --shadow: 0 10px 28px rgba(47, 80, 95, 0.08);
  --serif: "Montserrat", "Segoe UI", sans-serif;
  --sans: "Raleway", "Segoe UI", sans-serif;
  --focus: #2d515f;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(30, 92, 69, 0.08), transparent 50%),
    var(--paper);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
}

h1, h2, h3, .mark, .kicker {
  font-family: var(--serif);
  font-weight: 650;
  letter-spacing: -0.02em;
}

h1, h2, h3, p { margin-top: 0; }

.wrap {
  width: min(980px, calc(100% - 2rem));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: #fff;
  color: var(--ink);
  padding: 0.6rem 0.9rem;
  z-index: 5;
  border-radius: 8px;
}

.skip:focus { top: 1rem; }

.site-header {
  background: #ffffff;
  color: var(--ink);
  padding: 1.1rem 0 1.2rem;
  border-top: 6px solid var(--pine);
  border-bottom: 4px solid var(--mint);
}

.header-inner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.logo-link { flex: 0 0 auto; line-height: 0; }

.logo {
  width: min(220px, 46vw);
  height: auto;
  display: block;
}

.org {
  margin: 0 0 0.2rem;
  font-family: var(--serif);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pine);
}

h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.15;
  font-weight: 650;
}

.lede {
  margin: 0;
  max-width: 40rem;
  color: var(--ink-soft);
  font-family: var(--sans);
}

.home-link { margin: 0.45rem 0 0; }

.home-link a { color: var(--pine); font-weight: 600; text-decoration-thickness: 1px; }

#banner:empty { display: none; }

#apple-cal .banner,
#quick-cancel .banner {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

#apple-cal .btn { margin-top: 0.65rem; }

.banner {
  width: min(980px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
}

.banner.preview {
  background: #f6ecd4;
  color: #3f3114;
  border-color: #e2d0a4;
}

.banner.warn {
  background: #f8e6e3;
  color: #6d221c;
  border-color: #e4bdb8;
}

main { padding: 1.25rem 0 3rem; }

.type-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 0.9rem;
}

.type-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.12rem;
  min-height: 44px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--pine-deep);
  border-radius: 12px;
  background: var(--pine);
  color: #fff;
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
}

.type-filter-name { font-size: 0.92rem; }

.type-filter-count {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.75rem;
  color: #fff;
}

.type-filter.is-selected {
  background: var(--pine-deep);
  color: #fff;
  box-shadow: inset 0 -3px 0 #fff;
}

.type-filter:hover {
  background: var(--mint);
  color: #000;
  border-color: #5da09d;
}

.type-filter:hover .type-filter-count { color: #000; }

.type-filter.is-selected:hover {
  background: var(--pine-deep);
  color: #fff;
  border-color: var(--pine-deep);
}

.type-filter.is-selected:hover .type-filter-count { color: #fff; }

.event {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 0 0 0.9rem;
  overflow: visible;
}

.event-head {
  position: relative;
  padding: 0.75rem 0.95rem 0.65rem;
  border-bottom: 1px solid #8fbfbc;
  border-radius: 11px 11px 0 0;
  background: #a9d4d1;
  color: #1a333c;
}

.event-line {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.event-cal-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.event-line-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.12rem 0.35rem;
  min-width: 0;
}

.cal-icon {
  flex: 0 0 auto;
  margin-top: 0.12rem;
  color: #1a333c;
}

.cal-menu[hidden] { display: none; }

.cal-menu {
  position: absolute;
  z-index: 5;
  top: calc(100% - 0.4rem);
  left: 0.75rem;
  display: flex;
  flex-direction: column;
  min-width: min(16rem, calc(100% - 1.5rem));
  padding: 0.35rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(18, 40, 32, 0.16);
}

.cal-menu-label {
  margin: 0.15rem 0.7rem 0.25rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cal-menu a,
.cal-menu button.cal-file {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pine-deep);
  font: inherit;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.cal-menu a:hover,
.cal-menu button.cal-file:hover { background: #e7f3f2; }

.event-line .kicker { font-size: 0.92rem; }

.event-date { font-weight: 650; }

.event-where {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.08rem 0.28rem;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.25;
  color: #1a333c;
}

.event-head .kicker,
.event-head .event-date,
.event-head .sep { color: #1a333c; }

.event-clock { font-weight: 700; }
.venue-street { font-weight: 400; }

.venue-name {
  font-weight: 700;
  color: #1a333c;
}

.venue-street { overflow-wrap: anywhere; }

.sep { color: #8aa0a8; font-weight: 400; }

.kicker {
  margin: 0;
  color: var(--pine);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.95rem;
}

h2 { margin: 0; font-size: 1rem; line-height: 1.35; }

.task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13.5rem 5.6rem;
  align-items: center;
  column-gap: 0.85rem;
  padding: 0.32rem 0.75rem;
  border-top: 1px solid #eee6d8;
}

.task:first-child { border-top: 0; }

.task-main { min-width: 0; }

.task h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.32rem;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.2;
}

.role-when { font-weight: 700; font-size: 0.84rem; color: var(--pine); }

.task-desc {
  margin: 0.12rem 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.35;
}

.task-signup { display: contents; }

.meter {
  height: 6px;
  width: min(14rem, 100%);
  background: #e8e1d3;
  border-radius: 99px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--mint);
}

.who {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-self: stretch;
  gap: 0.15rem;
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
}

.who li, .pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  max-width: 100%;
  min-height: 1.35rem;
  padding: 0.02rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #e7f1f4;
  color: var(--pine-deep);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: left;
}

.who li .who-name {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 1.35rem;
  margin: 0;
  padding: 0.02rem 0.45rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}

.who li:has(.who-name) {
  padding: 0;
  cursor: pointer;
}

.who li .who-name:hover,
.who li .who-name:focus-visible {
  text-decoration: underline;
}

.who li.open-spot {
  background: transparent;
  color: #757575;
  font-style: italic;
  font-weight: 400;
  border-color: #bdbdbd;
  border-style: dashed;
}

.pill {
  background: #efeae0;
  color: #3f3a33;
  font-weight: 650;
}

.pill.open { background: #e7f1f4; color: var(--open); }
.pill.full { background: #eeeae2; color: #4e493f; }
.pill.closed { background: #eeeae2; color: #4e493f; }

.task-action {
  display: flex;
  align-items: center;
  justify-content: stretch;
  align-self: stretch;
  width: 5.6rem;
}

.task-action .claim,
.task-action .pill,
.task-action .full-label {
  width: 100%;
  justify-content: center;
}

.full-label {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0.1rem 0.75rem;
  border-radius: 999px;
  background: #f0f0f0;
  color: #757575;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.1;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.claim, .btn, .icon-close, summary {
  font: inherit;
}

.claim, .btn {
  min-height: 44px;
  border: 1px solid var(--pine-deep);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  background: var(--pine);
  color: #fff;
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 700;
}

.claim {
  min-height: 38px;
  padding: 0.1rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.1;
  white-space: nowrap;
}

.btn.ghost, .icon-close {
  background: transparent;
  color: var(--pine-deep);
  border: 1px solid var(--line);
}

.icon-close { min-height: 44px; border-radius: 999px; padding: 0.3rem 0.8rem; cursor: pointer; }

.claim:hover, .btn:hover { background: var(--mint); color: #000; border-color: #5da09d; }

.claim:disabled,
.claim.current-spot {
  background: #f0f0f0;
  color: #757575;
  border-color: #e0e0e0;
  cursor: default;
}

.claim:disabled:hover,
.claim.current-spot:hover {
  background: #f0f0f0;
  color: #757575;
  border-color: #e0e0e0;
}

#board.is-changing .task { grid-template-columns: minmax(0, 1fr) 12rem 10.5rem; }
#board.is-changing .task-action { width: 10.5rem; }
#board.is-changing .claim { white-space: normal; line-height: 1.15; min-height: 44px; }
.btn.danger { background: var(--clay); border-color: #6d221c; }
.btn.danger:hover { background: #6d221c; color: #fff; border-color: #6d221c; }
.btn.ghost:hover, .icon-close:hover { background: #f2f2f2; }

.past-block {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 0.5rem;
}

.past-block summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--pine-deep);
  margin-bottom: 0.8rem;
}

.loading, .empty-events { color: var(--ink-soft); }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 1.25rem 0 2rem;
  font-size: 0.95rem;
}

.admin-links { margin-top: 0.45rem; }

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--pine);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.admin-add, .admin-remove {
  border: 1px solid var(--pine);
  border-radius: 999px;
  background: #fff;
  color: var(--pine-deep);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  min-height: 32px;
  padding: 0.15rem 0.6rem;
  cursor: pointer;
}

.admin-add { margin-top: 0.35rem; }

.admin-remove { margin-left: 0.35rem; }

.who li .admin-remove { flex: 0 0 auto; }

.check-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0 0.8rem;
  font-weight: 600;
}

#admin-add-warn { width: auto; margin: 0 0 0.8rem; }

.manage {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 6px solid var(--pine);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1.2rem;
  margin: 0 0 1rem;
}

.manage-actions, .manage-move {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin-top: 0.8rem;
}

.manage-move { flex-direction: column; align-items: stretch; }

select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfc5b2;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(36rem, calc(100% - 2rem));
  background: var(--pine-deep);
  color: #ffffff;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  z-index: 4;
}

dialog {
  border: 0;
  padding: 0;
  width: min(32rem, calc(100% - 1.5rem));
  border-radius: 18px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 24px 70px rgba(18, 40, 32, 0.28);
}

dialog::backdrop { background: rgba(18, 36, 30, 0.55); }

#signup-form, #cancel-form,
#admin-login-form, #admin-password-form, #admin-add-form, #admin-remove-form {
  padding: 1.15rem 1.2rem 1.2rem;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

#dialog-title, #cancel-title,
#admin-login-title, #admin-password-title, #admin-add-title, #admin-remove-title {
  font-size: 1.45rem;
  margin-bottom: 0.35rem;
}

#dialog-copy, #cancel-copy, #admin-add-copy, #admin-remove-copy {
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.dialog-x {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  min-height: 32px;
  margin-top: 0.1rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-x:hover { background: #f2f2f2; color: var(--ink); }

.admin-dialog {
  max-height: calc(100% - 1.5rem);
  overflow: auto;
}

.admin-dialog .dialog-actions { flex-wrap: wrap; }

@media (max-width: 420px) {
  .admin-dialog .dialog-actions .btn {
    flex: 1 1 auto;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    white-space: nowrap;
  }
}

.field { margin-bottom: 0.85rem; }

label { display: block; font-weight: 700; margin-bottom: 0.3rem; }

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfc5b2;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.hint { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.92rem; }

.form-error {
  background: #f8e6e3;
  color: #6d221c;
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  margin: 0 0 0.8rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

#content:focus { outline: none; }

@media (max-width: 740px) {
  .event-where { flex-basis: 100%; order: 3; }
  .event-where > .sep:first-child { display: none; }
  .task {
    grid-template-columns: minmax(0, 1fr) 5.6rem;
    grid-template-rows: auto auto;
  }
  #board.is-changing .task { grid-template-columns: minmax(0, 1fr) 8.4rem; }
  #board.is-changing .task-action { width: 8.4rem; }
  .task-main { grid-column: 1; grid-row: 1; }
  .who { grid-column: 1; grid-row: 2; width: 100%; }
  .task-action { grid-column: 2; grid-row: 1 / span 2; }
  .header-inner { align-items: flex-start; flex-wrap: wrap; }
  .logo { width: min(180px, 70vw); }
  .type-filters { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media print {
  .site-header { background: #fff; color: #000; border-bottom: 1px solid #000; }
  .lede, .org, .claim, .type-filters, .toast, .banner, dialog, .icon-close { display: none !important; }
  .event[hidden] { display: block !important; }
  .event { box-shadow: none; }
  .past-block > :not(summary) { display: block !important; }
}
