:root {
  color-scheme: light;
  --background: #f5f1e8;
  --surface: #fffdf8;
  --text: #18211c;
  --muted: #526057;
  --accent: #b52b3a;
  --border: #d8d1c2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

.container {
  width: min(100% - 2rem, 64rem);
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding-block: 1rem;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}

.eyebrow,
.status {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-name {
  font-weight: 650;
}

.hero {
  max-width: 48rem;
  padding-block: clamp(3rem, 9vw, 7rem) 2rem;
}

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

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.25rem, 8vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  padding-block: 2.5rem 1rem;
}

.page-heading h1 {
  font-size: clamp(2rem, 6vw, 3.75rem);
}

.state,
.message {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 0.4rem 0.8rem;
  white-space: nowrap;
}

.messages {
  padding-top: 1rem;
}

.panel,
.warning-panel,
.success-panel,
.login-panel {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  padding: clamp(1rem, 3vw, 1.75rem);
}

.login-panel {
  max-width: 32rem;
  margin-block: clamp(2rem, 8vw, 6rem);
}

.login-panel form {
  display: grid;
  gap: 1rem;
}

.plan {
  border-left: 0.4rem solid #386b8c;
}

.warning-panel {
  border-left: 0.4rem solid #b47500;
  background: #fff7df;
}

.success-panel {
  border-left: 0.4rem solid #34734a;
  background: #eaf7ee;
}

.facts,
.field-grid,
.repeat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 1rem;
}

.visitor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 3rem);
}

.visitor-column {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.facts div {
  min-width: 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.facts dd {
  margin: 0;
  font-weight: 650;
}

.timeline {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.5rem;
}

.timeline li {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.75rem;
}

.event-list {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.event-list a {
  display: grid;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: inherit;
  padding: 0.8rem 1rem;
  text-decoration: none;
}

.event-list span {
  color: var(--muted);
}

.document-list {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.document-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.document-list div,
.document-list span {
  display: grid;
}

.document-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.booking-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.booking-ranges a,
.source-card {
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.6rem;
}

.booking-ranges a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.booking-period-form,
.booking-summary,
.booking-timestamps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: end;
}

.booking-period-form p,
.booking-date-field {
  margin: 0;
}

.booking-date-field,
.booking-date-inputs,
.sync-busy,
.sync-busy span:last-child {
  display: flex;
}

.booking-date-field,
.sync-busy span:last-child {
  flex-direction: column;
}

.booking-date-inputs {
  position: relative;
  align-items: stretch;
}

.booking-date-text {
  width: 9.5rem;
  padding-right: 2.5rem;
}

.booking-date-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.calendar-picker-button {
  position: absolute;
  right: 0.2rem;
  top: 0.2rem;
  bottom: 0.2rem;
  width: 2.2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.sync-busy {
  align-items: center;
  gap: 0.65rem;
}

.sync-busy[hidden] {
  display: none;
}

.sync-busy small {
  color: var(--muted);
}

.sync-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 0.2rem solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sync-spin 0.8s linear infinite;
}

@keyframes sync-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sync-spinner {
    animation-duration: 1.8s;
  }
}

.booking-event header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.booking-event h2 {
  margin-bottom: 0;
}

.booking-date,
.booking-timestamps {
  color: var(--muted);
}

.booking-summary {
  margin: 1rem 0;
}

.booking-summary div {
  min-width: 10rem;
}

.booking-summary dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.booking-summary dd {
  margin: 0.2rem 0 0;
}

.quality {
  align-self: start;
  white-space: nowrap;
}

.source-card {
  margin-top: 0.75rem;
}

.booking-documents {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.document-actions,
.document-actions form,
.document-upload form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.document-actions form {
  margin: 0;
}

.document-upload {
  margin-top: 1rem;
}

.repeat-row {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
}

@media (min-width: 64rem) {
  .shift-row {
    grid-template-columns: minmax(12rem, 1.5fr) minmax(9rem, 1fr) repeat(2, minmax(5.5rem, 0.55fr)) auto auto;
    align-items: end;
  }

  [data-formset="expense"] .repeat-row {
    grid-template-columns: minmax(11rem, 0.8fr) minmax(8rem, 0.5fr) minmax(16rem, 1.5fr) auto;
    align-items: end;
  }
}

.repeat-row .field > select + select,
.repeat-row .field > input + select {
  margin-top: 0.4rem;
}

.hidden-delete {
  display: none;
}

.remove-form {
  align-self: end;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
}

.marked-for-removal {
  border-style: dashed;
  opacity: 0.65;
}

.remove-note {
  align-self: center;
  color: var(--accent);
  font-weight: 650;
}

.detail-fields {
  display: grid;
  gap: 1.5rem;
  max-width: 42rem;
}

.field label,
.field-grid label,
form p label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 650;
}

input,
select,
textarea,
button {
  max-width: 100%;
  font: inherit;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  border: 1px solid #aaa397;
  border-radius: 0.4rem;
  background: white;
  padding: 0.55rem 0.65rem;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 0.4rem;
  background: var(--text);
  color: white;
  cursor: pointer;
  padding: 0.65rem 1rem;
  font-weight: 700;
}

button.secondary {
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.check {
  display: block;
  margin-block: 0.75rem;
}

.help,
.helptext,
.duration {
  color: var(--muted);
  font-size: 0.9rem;
}

.errorlist,
.form-errors {
  color: #8b1724;
  font-weight: 650;
}

.feedback {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.intro {
  color: var(--muted);
  font-size: clamp(1.05rem, 3vw, 1.35rem);
}

.notice {
  max-width: 48rem;
  margin-bottom: 4rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  padding: clamp(1.25rem, 4vw, 2rem);
}

.notice p:last-child,
.notice ul:last-child {
  margin-bottom: 0;
}

@media (max-width: 30rem) {
  .container {
    width: min(100% - 1.25rem, 64rem);
  }

  .page-heading {
    display: block;
  }

  .state {
    display: inline-block;
  }
}

@media (max-width: 42rem) {
  .visitor-grid {
    grid-template-columns: 1fr;
  }
}
