:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1b1b18;
  --muted: #5c5852;
  --line: #d9d2c5;
  --accent: #1f4d3a;
  --accent-soft: #e3ede7;
  --danger: #8b1e1e;
  --danger-bg: #f8d7d3;
  --warn: #8a5a00;
  --warn-bg: #f7e3b8;
  --ok: #1f4d3a;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

.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;
}

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

.site-header,
main,
.banner {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1.1rem;
}

.site-header {
  padding-bottom: 0.25rem;
}

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

.header-row h1 {
  margin: 0 0 0.45rem;
  font-size: 1.6rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.badge {
  display: inline-block;
  margin: 0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.82rem;
}

.badge.ok {
  background: #d9eadf;
  color: var(--ok);
}

.badge.live {
  background: var(--danger-bg);
  color: var(--danger);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.1rem;
  margin-bottom: 0.9rem;
  box-shadow: 0 1px 2px rgba(27, 27, 24, 0.04);
}

.card.attention {
  border-color: var(--warn);
}

/* Collapsed secondary sections */
details.section {
  padding: 0;
  margin-top: 0;
}

details.section > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
}

details.section > summary::-webkit-details-marker {
  display: none;
}

details.section > summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex: none;
  margin-left: 0.75rem;
}

details.section[open] > summary::after {
  transform: rotate(-135deg);
}

details.section > summary h2 {
  display: inline;
  margin: 0;
  font-size: 1.05rem;
}

details.section > :not(summary) {
  margin-left: 1.1rem;
  margin-right: 1.1rem;
}

details.archive {
  margin: 0.75rem 0 0;
  border-top: 1px dashed var(--line);
  padding-top: 0.65rem;
}

details.archive > summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.archive > summary::-webkit-details-marker {
  display: none;
}

details.archive > summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-left: 0.5rem;
}

details.archive[open] > summary::after {
  transform: rotate(-135deg);
}

details.archive .list {
  margin-top: 0.65rem;
}

/* Tucked-away form extras (times, PIN) */
details.tuck {
  margin: 0 0 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 0.7rem;
  padding: 0.55rem 0.75rem;
  background: #fbf9f3;
}

details.tuck > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

details.tuck > summary::-webkit-details-marker {
  display: none;
}

details.tuck > summary::after {
  content: "change";
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: underline;
  margin-left: auto;
}

details.tuck[open] > summary::after {
  content: "done";
}

details.tuck.locked > summary {
  display: none;
}

details.tuck > :not(summary) {
  margin-top: 0.7rem;
}

details.tuck.locked > :not(summary) {
  margin-top: 0;
}

details.tuck label {
  margin-bottom: 0.25rem;
}

.edit-context {
  margin: 0 0 1rem;
  padding: 0.8rem;
  border: 1px solid #d7ad55;
  border-radius: 0.7rem;
  background: var(--warn-bg);
  color: #5f3e00;
  font-weight: 700;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

input,
select,
textarea {
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: white;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.pin-input {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.16em;
  font-weight: 700;
}

#regenerate-pin {
  width: auto;
  padding: 0 0.9rem;
  white-space: nowrap;
  margin: 0;
}

.pin-box {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.8rem;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 0.7rem;
  background: #111;
  color: #f4f1ea;
  border-radius: 0.7rem;
}

.occupancy-pin {
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  text-align: left;
  padding: 0.45rem 0.65rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  width: 100%;
  border: 0;
  border-radius: 0.7rem;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 650;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 0.6rem;
}

button.compact,
.btn.compact {
  width: auto;
  min-width: 6.5rem;
  padding: 0 0.9rem;
  margin: 0;
}

button.secondary {
  background: #ece7dc;
  color: var(--ink);
}

.btn.secondary {
  background: #ece7dc;
  color: var(--ink);
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

button.danger {
  background: var(--danger);
}

button.danger-text {
  color: var(--danger);
}

.consent-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.65rem;
  font-weight: 500;
}

.consent-row input,
.preference-list input {
  min-height: auto;
  margin-top: 0.25rem;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.actions button {
  margin: 0;
}

.fine-print,
.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

form .fine-print {
  font-weight: 400;
}

.error {
  color: var(--danger);
  font-weight: 650;
}

/* Chip-style pickers (code type, days, locks) */
.kind-picker {
  border: 0;
  padding: 0;
  margin: 0 0 0.5rem;
}

.option-set {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0.7rem 0.8rem 0.85rem;
  margin: 0 0 0.9rem;
}

.option-set legend {
  padding: 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.option-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.option-picks label {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  margin: 0;
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.option-picks input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.option-picks label:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.option-picks label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#lock-choices {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.8rem;
}

#lock-choices .lock-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  border-radius: 0.75rem;
  padding: 0.75rem;
  white-space: normal;
}

#lock-choices .lock-choice input {
  position: static;
  width: 1.2rem;
  height: 1.2rem;
  opacity: 1;
  margin: 0.15rem 0.65rem 0 0;
}

#lock-choices .lock-choice span {
  display: grid;
  gap: 0.2rem;
}

#lock-choices .lock-choice small {
  color: var(--muted);
}

#lock-choices .lock-choice ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

#lock-choices .lock-choice.unsupported {
  background: #f4efed;
  color: var(--muted);
}

#lock-choices .lock-choice:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}

.preference-list label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
  font-weight: 500;
}

.preference-list label:last-child {
  margin-bottom: 0;
}

.account-controls {
  border-top: 1px solid var(--line);
  margin-top: 1.2rem;
  padding-top: 1rem;
}

.account-controls h3 {
  margin: 0 0 0.35rem;
}

.stacked-actions {
  display: grid;
  gap: 0.55rem;
}

.stacked-actions > * {
  margin: 0;
}

.site-footer {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.4rem 1.1rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
}

#tz-use-location {
  margin: 0 0 0.85rem;
}

.banner-danger {
  background: var(--danger);
  color: white;
  border-radius: 0.9rem;
  margin: 0 auto 1rem;
}

.banner-danger p {
  margin: 0.35rem 0 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list:empty {
  display: none;
}

.slot-compare {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}

.slot-compare li {
  margin: 0.15rem 0;
}

.item {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0.75rem;
}

.item p {
  margin: 0.35rem 0;
}

.item .actions {
  margin: 0.6rem 0 0;
}

.item.warn {
  border-color: var(--warn);
  background: var(--warn-bg);
}

.item.pending {
  border-color: #58728d;
  background: #f1f5f8;
}

.pending-note {
  color: #3f556b;
}

button.secondary.delete-action {
  color: var(--danger);
}

.item.danger {
  border-color: var(--danger);
  background: #fdecea;
}

.item.inline-editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.item.inline-editing #booking-form {
  border-top: 1px solid var(--line);
  margin-top: 0.9rem;
  padding-top: 1rem;
}

.item.save-success {
  border-color: #2f7d4a;
  background: #edf8f0;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.save-feedback {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #23633a;
  font-weight: 750;
  margin: 0.75rem 0 0;
}

.message-box {
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.45;
  padding: 0.75rem 2.4rem 0.75rem 0.75rem;
  background: #111;
  color: #f4f1ea;
  border-radius: 0.7rem;
  overflow-x: auto;
  margin: 0;
}

.message-wrap {
  position: relative;
  margin: 0.5rem 0 0.6rem;
}

button.icon-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  margin: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #f4f1ea;
  border-radius: 0.45rem;
}

button.icon-btn:hover,
button.icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

button.icon-btn.copied {
  color: #9ee0b5;
}

.status {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

#form-error {
  margin: 0.5rem 0 0;
}


/* Compact scheduling form */
#access-kind .option-picks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.3rem;
}

#access-kind .option-picks label {
  min-width: 0;
  justify-content: center;
  padding: 0.42rem 0.15rem;
  font-size: clamp(0.7rem, 3vw, 0.82rem);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
}

.schedule-moments {
  display: grid;
  gap: 0.8rem;
  margin: 0;
}

#email-fields .consent-row,
#rotate-fields .consent-row {
  margin-bottom: 0.5rem;
}

.moment-block {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.moment-block legend {
  margin: 0 0 0.35rem;
  padding: 0;
  font-weight: 600;
}

.moment-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.4rem;
  gap: 0.5rem;
  min-width: 0;
}

.input-shell {
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: white;
}

.input-shell:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.moment-controls .input-shell input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding-inline: 0.55rem;
  border: 0;
  border-radius: 0;
  outline: 0;
  font-size: 0.95rem;
  -webkit-appearance: none;
  appearance: none;
}

.pin-row {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  min-width: 0;
}

.pin-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

#regenerate-pin {
  max-width: 8rem;
}

.header-row .eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

@media (max-width: 520px) {
  .row,
  .actions {
    grid-template-columns: 1fr;
  }

  .moment-controls {
    grid-template-columns: minmax(0, 1fr) 6.15rem;
    gap: 0.4rem;
  }

  .moment-controls .input-shell input {
    padding-inline: 0.45rem;
    font-size: 0.9rem;
  }

  #regenerate-pin {
    padding-inline: 0.7rem;
  }
}


.deleted-schedules {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.deleted-schedules > summary {
  font-weight: 700;
}

.deleted-schedules[open] > summary {
  margin-bottom: 0.75rem;
}

.item.recently-deleted {
  border-color: #2f7d4a;
  background: #edf8f0;
  animation: deleted-fade var(--deleted-fade-ms, 4500ms) ease-in forwards;
}

@keyframes deleted-fade {
  0%,
  65% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(0.985);
  }
}

@media (prefers-reduced-motion: reduce) {
  .item.recently-deleted {
    animation-name: deleted-fade-reduced;
  }

  @keyframes deleted-fade-reduced {
    from {
      opacity: 1;
    }

    to {
      opacity: 0;
    }
  }
}
