:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --ink: #1c2430;
  --muted: #667085;
  --line: #d9ded6;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #a15c07;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 16px 44px rgba(28, 36, 48, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell,
.admin-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.booking-panel,
.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.booking-panel {
  padding: 24px;
}

.panel-header,
.admin-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.subsection-header {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.subsection-header h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

h2 {
  font-size: 1.05rem;
  margin-bottom: 14px;
}

.admin-link {
  color: var(--accent-dark);
  font-weight: 750;
  text-decoration: none;
}

.booking-form,
.form-section,
.admin-card {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.two-column {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
}

.store-grid,
.date-grid,
.slot-grid,
.checkbox-grid {
  display: grid;
  gap: 10px;
}

.store-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.date-grid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.slot-grid {
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
}

.choice-card,
.slot-button,
.date-button,
.option-pill {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.choice-card {
  padding: 16px;
}

.choice-card strong {
  display: block;
  margin-bottom: 6px;
}

.store-link {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.store-link:hover {
  color: var(--accent);
}

.slot-button,
.date-button {
  padding: 12px;
  text-align: center;
  font-weight: 800;
}

.choice-card.active,
.slot-button.active,
.date-button.active,
.option-pill.active {
  border-color: var(--accent);
  background: #e6fffb;
  outline: 2px solid rgba(15, 118, 110, 0.16);
}

.slot-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.checkbox-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.option-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.required-marker {
  color: var(--danger);
  font-weight: 900;
}

.helper-text {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.field.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.actions,
.verification-actions,
.option-editor {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.actions {
  justify-content: space-between;
}

.booking-actions {
  justify-content: center;
}

.booking-actions .message {
  flex-basis: 100%;
  text-align: center;
}

.booking-notice {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.acknowledgement {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}

.acknowledgement input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.primary-button,
.secondary-button,
.danger-button,
.tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.primary-button:disabled:hover {
  background: #9ca3af;
}

.secondary-button {
  background: #eef4f1;
  color: var(--accent-dark);
}

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

.message {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--ok);
}

.verification-panel {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.hidden {
  display: none !important;
}

.admin-header {
  margin-bottom: 20px;
}

.login-card {
  max-width: 460px;
}

.admin-card {
  padding: 20px;
  margin-bottom: 18px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.admin-toolbar {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.refresh-controls {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  min-height: 40px;
}

.tab {
  background: white;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.table-list {
  display: grid;
  gap: 10px;
}

.date-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.date-filter-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.date-filter-button.active {
  border-color: var(--accent);
  background: #e6fffb;
  color: var(--accent-dark);
}

.history-controls {
  align-items: end;
}

.history-table {
  display: grid;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.history-row {
  display: grid;
  grid-template-columns: 110px 80px 100px 190px 150px 130px 220px 220px 260px 190px 190px 190px;
  min-width: 2030px;
}

.history-row span {
  min-height: 42px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.history-row span:last-child {
  border-right: 0;
}

.history-row:last-child span {
  border-bottom: 0;
}

.history-head span {
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 78px repeat(5, minmax(170px, 1fr));
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.calendar-grid > *:nth-child(6n) {
  border-right: 0;
}

.calendar-grid > *:nth-last-child(-n + 6) {
  border-bottom: 0;
}

.calendar-time-header,
.calendar-day-header,
.calendar-time,
.calendar-cell {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-time-header,
.calendar-day-header {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 48px;
  padding: 12px 10px;
  background: white;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.calendar-time {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 78px;
  padding: 10px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.calendar-cell {
  min-height: 78px;
  padding: 6px;
  background: white;
}

.calendar-slot {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 64px;
  border: 1px solid #e7eaee;
  border-radius: 6px;
  padding: 8px;
  background: white;
  color: var(--muted);
  cursor: default;
  text-align: left;
}

.calendar-slot:disabled {
  opacity: 1;
}

.calendar-slot strong {
  color: var(--ink);
}

.calendar-slot.booked {
  border-color: #1f8ccf;
  background: #258fd2;
  color: white;
  cursor: pointer;
}

.calendar-slot.pending {
  border-color: #f59e0b;
  background: #f59e0b;
  color: white;
  cursor: pointer;
}

.calendar-slot.booked strong,
.calendar-slot.booked small,
.calendar-slot.pending strong,
.calendar-slot.pending small {
  color: white;
}

.calendar-slot.booked:hover {
  background: #1478b6;
}

.calendar-slot.pending:hover {
  background: #d97706;
}

.calendar-slot.blocked {
  background: #f2f4f7;
  color: var(--muted);
}

.row-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 28, 45, 0.42);
}

.confirm-modal {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-modal h2,
.confirm-modal p {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.booking-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 6px 0 0;
}

.booking-meta div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.booking-meta dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.booking-meta dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.status.pending {
  background: #fff7e6;
  color: var(--warn);
}

.status.cancelled {
  background: #fff1f0;
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.weekday-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weekday-picker input {
  width: auto;
}

.option-list {
  display: grid;
  gap: 10px;
}

.editable-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 760px) {
  .app-shell,
  .admin-shell {
    padding: 14px;
  }

  .booking-panel,
  .admin-card {
    padding: 16px;
  }

  .panel-header,
  .admin-header,
  .admin-toolbar,
  .section-header,
  .actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .refresh-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .store-grid,
  .two-column,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .editable-option {
    grid-template-columns: 1fr 1fr;
  }
}
