:root {
  color-scheme: light;
  --page: #f7f8f4;
  --panel: #ffffff;
  --ink: #172226;
  --muted: #65747a;
  --line: #dbe2dd;
  --soft-line: #e9eee9;
  --oasis: #0b6a61;
  --oasis-deep: #075249;
  --oasis-soft: #e9f6f1;
  --slot: #edf8f3;
  --slot-border: #cde7dc;
  --selected: #0a7167;
  --selected-deep: #075349;
  --reserved: #ee4450;
  --reserved-deep: #cc3340;
  --gold: #cfa858;
  --shadow: 0 16px 50px rgba(27, 43, 39, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(247, 248, 244, 0.94)),
    radial-gradient(circle at 15% 10%, rgba(207, 168, 88, 0.16), transparent 26rem),
    var(--page);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus {
  border-color: rgba(11, 106, 97, 0.55);
  box-shadow: 0 0 0 3px rgba(11, 106, 97, 0.12);
  outline: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.icon-button:disabled,
.today-button:disabled {
  opacity: 0.46;
  box-shadow: none;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 112px;
  padding: 10px 36px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-width: 0;
  width: fit-content;
  text-decoration: none;
}

.brand img {
  display: block;
  width: clamp(138px, 15vw, 178px);
  height: auto;
  border-radius: 4px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 760;
  text-align: center;
  white-space: nowrap;
}

.member-chip {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px 10px 6px 6px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
}

.member-chip:hover,
.member-chip:focus-visible {
  background: var(--oasis-soft);
  outline: 0;
}

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #0d796f, #09564f);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(11, 106, 97, 0.22);
}

.member-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}

.member-copy strong {
  font-size: 0.96rem;
}

.member-copy span {
  color: var(--oasis);
  font-size: 0.85rem;
  font-weight: 650;
}

.chevron {
  color: var(--muted);
  font-size: 1.1rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  min-width: 0;
  max-width: 1500px;
  margin: 0 auto;
  padding: 32px 22px 28px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: center;
  max-width: 980px;
  margin: 32px auto;
  padding: 24px;
}

.login-panel h2 {
  margin: 0 0 8px;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label,
.admin-form label,
.history-filters label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.45fr);
  gap: 12px;
}

.form-error {
  min-height: 20px;
  color: var(--reserved);
  font-size: 0.9rem;
}

.summary-area {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(31, 45, 42, 0.05);
}

.summary-panel {
  display: grid;
  grid-template-columns: minmax(200px, 0.95fr) minmax(300px, 1.35fr) minmax(120px, 0.45fr) minmax(220px, 0.9fr);
  grid-template-areas:
    "heading selected total action"
    "date selected total note";
  align-items: center;
  gap: 14px 22px;
  padding: 22px;
}

.panel h2 {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 760;
}

.panel-heading {
  grid-area: heading;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-box {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--oasis-soft);
  color: var(--oasis);
  font-weight: 900;
}

.summary-date {
  grid-area: date;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin: 0;
  color: var(--ink);
  font-weight: 650;
}

.summary-date::before {
  content: "▣";
  color: var(--ink);
  font-size: 1rem;
}

.selected-block {
  grid-area: selected;
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 0 0 0 22px;
  border-left: 1px solid var(--line);
}

.selected-block span,
.selected-block small,
.fine-print,
.policy-panel p {
  color: var(--muted);
}

.selected-block strong {
  min-height: 32px;
  color: var(--oasis);
  font-size: 1.38rem;
  font-weight: 760;
  line-height: 1.25;
}

.summary-total {
  grid-area: total;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 86px;
  padding: 0 18px;
  border-left: 1px solid var(--line);
  font-weight: 700;
  gap: 12px;
}

.summary-total strong {
  white-space: nowrap;
}

.primary-action {
  grid-area: action;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--oasis), var(--oasis-deep));
  color: #fff;
  font-weight: 760;
  box-shadow: 0 10px 18px rgba(11, 106, 97, 0.22);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.primary-action:hover:not(:disabled),
.primary-action:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(11, 106, 97, 0.26);
  outline: 0;
}

.primary-action:disabled {
  opacity: 0.46;
  box-shadow: none;
}

.primary-action span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--oasis);
  font-weight: 900;
}

.fine-print {
  grid-area: note;
  margin: 0;
  padding-left: 30px;
  font-size: 0.86rem;
  position: relative;
}

.fine-print::before {
  content: "◇";
  position: absolute;
  left: 2px;
  top: -1px;
  color: var(--oasis);
  font-size: 1.25rem;
}

.legend-panel,
.policy-panel {
  padding: 22px 24px;
}

.legend {
  display: grid;
  gap: 18px;
  margin: 22px 0 0;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 15px;
}

.legend dd {
  margin: 0;
  color: var(--ink);
  font-weight: 560;
}

.swatch {
  width: 28px;
  height: 28px;
  margin: 0;
  border-radius: 5px;
  border: 1px solid var(--slot-border);
}

.swatch.available {
  background: var(--slot);
}

.swatch.selected {
  background: var(--selected);
  border-color: var(--selected-deep);
}

.swatch.reserved {
  background: var(--reserved);
  border-color: var(--reserved-deep);
}

.policy-panel {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 4px 14px;
}

.policy-icon {
  grid-row: span 4;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 7px;
  background: var(--oasis-soft);
  color: var(--oasis);
  font-size: 1.25rem;
  font-weight: 800;
}

.policy-panel p {
  margin: 0;
  font-size: 0.89rem;
}

.text-action {
  justify-self: start;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--oasis);
  font-weight: 720;
}

.calendar-shell {
  min-width: 0;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.icon-button,
.today-button,
.week-title {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(20, 34, 30, 0.04);
}

.icon-button {
  width: 44px;
  font-size: 1.7rem;
  line-height: 1;
}

.today-button {
  padding: 0 18px;
  font-weight: 650;
}

.week-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-width: 310px;
  padding: 0 20px;
  font-size: 1.12rem;
  font-weight: 700;
}

.week-title span:first-child {
  font-size: 1.05rem;
}

#next-week {
  justify-self: start;
}

.icon-button:hover,
.today-button:hover,
.week-title:hover,
.icon-button:focus-visible,
.today-button:focus-visible,
.week-title:focus-visible {
  border-color: #bfcac3;
  outline: 0;
}

.calendar-card {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.calendar-grid {
  --day-count: 7;
  --time-col: 100px;
  --day-min: 132px;
  display: grid;
  grid-template-columns: var(--time-col) repeat(var(--day-count), minmax(var(--day-min), 1fr));
  min-width: 1040px;
}

.corner-cell,
.day-header,
.time-label,
.slot-wrap {
  border-right: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
}

.corner-cell,
.day-header {
  min-height: 64px;
  background: rgba(255, 255, 255, 0.62);
}

.corner-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  border-right-color: var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.day-header {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 10px;
  text-align: center;
  font-weight: 730;
}

.day-header.today {
  background: linear-gradient(180deg, rgba(227, 247, 240, 0.9), rgba(245, 252, 249, 0.76));
  color: var(--oasis-deep);
}

.day-header span {
  color: var(--muted);
  font-size: 0.91rem;
  font-weight: 620;
}

.time-label {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 40px;
  padding: 0 16px 0 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 620;
  white-space: nowrap;
}

.slot-wrap {
  min-height: 40px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.24);
}

.slot {
  position: relative;
  width: 100%;
  height: 32px;
  border: 1px solid var(--slot-border);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), transparent),
    var(--slot);
  color: var(--oasis);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.slot:hover:not(:disabled),
.slot:focus-visible:not(:disabled) {
  z-index: 3;
  border-color: #8fc9b7;
  box-shadow: inset 0 0 0 1px rgba(11, 106, 97, 0.24), 0 8px 14px rgba(11, 106, 97, 0.1);
  outline: 0;
  transform: translateY(-1px);
}

.slot.selected {
  border-color: rgba(255, 255, 255, 0.55);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent),
    linear-gradient(180deg, #118174, #075d54);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.slot.selected::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 900;
}

.slot.reserved {
  border-color: #f66a72;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent),
    linear-gradient(180deg, #ff5b64, var(--reserved));
  color: #fff;
  box-shadow: none;
}

.slot.reserved::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 2px;
  transform: translate(-50%, -22%);
}

.slot.reserved::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 8px;
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  transform: translate(-50%, -86%);
}

.slot.reserved:disabled {
  opacity: 0.97;
}

.slot.range-start {
  border-bottom-left-radius: 3px;
  border-bottom-right-radius: 3px;
}

.slot.range-middle {
  border-radius: 3px;
}

.slot.range-end {
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
}

.slot.past {
  background: #f0f2ef;
  border-color: #dfe4df;
  color: #a6afaa;
}

.slot.past::after {
  content: "";
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 44px));
  padding: 14px 18px;
  border: 1px solid rgba(11, 106, 97, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  box-shadow: 0 18px 45px rgba(27, 43, 39, 0.16);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-top-link {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--oasis);
  font-weight: 750;
  text-decoration: none;
}

button.admin-top-link {
  cursor: pointer;
}

.admin-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-workspace {
  display: grid;
  gap: 22px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 32px 22px 38px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) minmax(420px, 1.25fr);
  gap: 22px;
}

.admin-panel {
  padding: 22px;
}

.admin-panel-heading,
.admin-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-panel h2,
.admin-calendar-header h2 {
  margin: 0;
  font-size: 1.12rem;
}

.eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--oasis);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.generated-code {
  min-height: 66px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px dashed rgba(11, 106, 97, 0.35);
  border-radius: var(--radius);
  background: var(--oasis-soft);
}

.generated-code:empty {
  display: none;
}

.generated-code span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.generated-code strong {
  color: var(--oasis-deep);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.data-table th,
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.code-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--oasis-soft);
  color: var(--oasis-deep);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.admin-calendar-controls {
  display: grid;
  grid-template-columns: 44px auto minmax(270px, auto) 44px;
  gap: 10px;
  align-items: center;
}

.admin-calendar-grid {
  --day-count: 7;
}

.admin-slot {
  display: grid;
  align-content: center;
  width: 100%;
  min-height: 32px;
  height: 100%;
  padding: 4px 8px;
  border: 1px solid var(--slot-border);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.7), transparent),
    var(--slot);
  overflow: hidden;
}

.admin-slot.booked {
  border-color: #f66a72;
  background: linear-gradient(180deg, #ff5b64, var(--reserved));
  color: #fff;
}

.admin-slot strong,
.admin-slot span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-slot strong {
  font-size: 0.78rem;
  line-height: 1.15;
}

.admin-slot span {
  font-size: 0.7rem;
  opacity: 0.86;
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(180px, 0.5fr) minmax(220px, 0.7fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 132px;
    padding: 10px 18px 12px;
  }

  .login-panel,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-calendar-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-calendar-controls {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-areas:
      "previous today next"
      "title title title";
  }

  #admin-previous {
    grid-area: previous;
  }

  #admin-today {
    grid-area: today;
  }

  #admin-date-title {
    grid-area: title;
    width: 100%;
    min-width: 0;
  }

  #admin-next {
    grid-area: next;
  }

  .history-filters {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 22px 14px;
  }

  .summary-panel {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr);
    grid-template-areas:
      "heading total"
      "date action"
      "selected selected"
      "note note";
  }

  .calendar-toolbar {
    grid-template-columns: 1fr;
  }

  .week-title {
    min-width: 0;
    width: 100%;
  }

  #next-week {
    justify-self: end;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: start;
    padding-inline: 14px;
  }

  .login-panel,
  .admin-workspace {
    margin-top: 22px;
    padding: 18px 14px;
  }

  .login-row {
    grid-template-columns: 1fr;
  }

  .admin-panel {
    padding: 18px;
  }

  .brand {
    max-width: 176px;
  }

  .brand img {
    width: 142px;
  }

  .member-chip {
    min-height: 44px;
    padding-right: 4px;
  }

  .member-copy,
  .chevron {
    display: none;
  }

  .avatar {
    width: 40px;
    height: 40px;
    font-size: 0.88rem;
  }

  .summary-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "date"
      "selected"
      "total"
      "action"
      "note";
    padding: 18px;
  }

  .selected-block {
    min-height: 0;
    padding: 0 0 18px;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-total {
    flex-direction: row;
    justify-content: space-between;
    min-height: 0;
    padding: 0;
    border-left: 0;
  }

  .toolbar-actions {
    display: contents;
  }

  .calendar-toolbar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-areas:
      "previous today next"
      "title title title";
    gap: 10px;
  }

  .toolbar-actions .icon-button {
    grid-area: previous;
  }

  .today-button {
    grid-area: today;
    width: 100%;
  }

  .week-title {
    grid-area: title;
  }

  #next-week {
    grid-area: next;
    justify-self: stretch;
  }

  .calendar-grid {
    --time-col: 74px;
    --day-min: 128px;
    min-width: 0;
  }

  .time-label {
    padding-right: 10px;
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
