:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d9dfeb;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --primary: #2f3f9f;
  --primary-dark: #22307e;
  --danger: #a22424;
  --danger-soft: #fff0f0;
  --success: #176b45;
  --success-soft: #eaf8f1;
  --warning: #8a5200;
  --warning-soft: #fff7e5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #8694f4;
  outline-offset: 2px;
}

.admin-header,
main,
footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 28px 20px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

h3 {
  margin-bottom: 6px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card,
.dashboard {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgb(29 41 82 / 8%);
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 36px;
  align-items: end;
  padding: clamp(24px, 5vw, 44px);
}

.login-card p:last-child,
.dashboard-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 750;
}

.login-row {
  display: flex;
  gap: 10px;
}

input {
  min-width: 0;
  flex: 1;
  border: 1px solid #aeb8cb;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
}

select,
textarea {
  width: 100%;
  border: 1px solid #aeb8cb;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

.button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 780;
  cursor: pointer;
}

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

.button-primary {
  color: #fff;
  background: var(--primary);
}

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

.button-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}

.button-danger {
  border-color: #e7b4b4;
  color: var(--danger);
  background: var(--danger-soft);
}

.dashboard {
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-navigation {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.panel-navigation a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--primary);
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 760;
  text-decoration: none;
}

.panel-navigation a:hover {
  border-color: #aeb8de;
  background: #f7f8ff;
}

.panel-section {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(20px, 4vw, 34px);
  background: var(--surface);
  box-shadow: 0 18px 45px rgb(29 41 82 / 8%);
  scroll-margin-top: 16px;
}

.section-heading,
.availability-heading,
.room-card-heading,
.period-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid #c8d1e7;
  border-radius: 12px;
  padding: 13px 15px;
  background: #f5f7ff;
}

.login-notice {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.notice[data-tone="error"] {
  border-color: #e7b4b4;
  color: var(--danger);
  background: var(--danger-soft);
}

.notice[data-tone="success"] {
  border-color: #a9dbc4;
  color: var(--success);
  background: var(--success-soft);
}

.reservation-list {
  display: grid;
  gap: 16px;
}

.reservation-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.reservation-top,
.reservation-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.status[data-ready="true"] {
  color: var(--success);
  background: var(--success-soft);
}

.status[data-refund-ready="true"] {
  color: var(--danger);
  background: var(--danger-soft);
}

.reservation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-block: 18px;
}

.detail {
  min-width: 0;
}

.detail-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.detail-value {
  overflow-wrap: anywhere;
  font-weight: 620;
}

.student-note {
  margin-block: 0 18px;
  border-left: 3px solid #b8c2e9;
  padding: 10px 12px;
  color: #39445c;
  background: #f7f8fc;
}

.reservation-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.action-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.deadline {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  border: 1px dashed #b8c2d6;
  border-radius: 14px;
  padding: 34px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.history-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.history-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: #fff;
  font-weight: 760;
  cursor: pointer;
}

.history-tabs button[aria-selected="true"] {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.history-tabs button:focus-visible {
  outline: 3px solid rgb(35 91 201 / 28%);
  outline-offset: 2px;
}

.history-tabs span {
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  margin-left: 4px;
  border-radius: 999px;
  padding: 1px 5px;
  color: inherit;
  background: rgb(255 255 255 / 18%);
  font-size: 0.74rem;
}

.history-card .reservation-grid {
  margin-bottom: 0;
}

.status[data-history-status="rejected"],
.status[data-history-status="payment_failures"] {
  color: var(--danger);
  background: var(--danger-soft);
}

.status[data-history-status="expired"] {
  color: var(--muted);
  background: #eef1f6;
}

.status[data-history-status="refunds"] {
  color: #075f50;
  background: #dcf5ed;
}

.refund-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.6fr) auto;
  align-items: end;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.refund-form label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.refund-form select,
.refund-form textarea {
  margin-top: 6px;
}

.refund-form textarea {
  min-height: 72px;
}

.refund-form .button {
  min-height: 44px;
}

.refund-state-copy {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
}

.history-reason {
  margin: 16px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: .88rem;
}

.compact-empty {
  padding: 24px;
}

.compact-empty h3 {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.availability-heading {
  margin-bottom: 16px;
}

.availability-heading p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

.month-controls {
  display: grid;
  grid-template-columns: auto minmax(152px, 1fr) auto;
  gap: 8px;
  min-width: 310px;
}

.month-controls input {
  width: 100%;
  padding-block: 9px;
}

.icon-button {
  width: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--primary);
  background: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
}

.today-button {
  grid-column: 1 / -1;
  padding-block: 8px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 18px;
  border-block: 1px solid var(--line);
  padding-block: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 680;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.calendar-legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.calendar-legend i[data-state="available"] {
  border: 1px solid #b8c6d7;
  background: #fff;
}

.calendar-legend i[data-state="blocked"] {
  background: #f6c9c9;
}

.calendar-legend i[data-state="reserved"] {
  background: #bed0ff;
}

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

.room-calendar-card {
  min-width: 0;
  border: 1px solid #cfd7e6;
  border-radius: 16px;
  padding: 18px;
  background: #fbfcff;
}

.room-card-heading {
  align-items: center;
  margin-bottom: 14px;
}

.room-card-heading h3 {
  margin-bottom: 0;
}

.room-price {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.minimum-stay-form {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid #cbd4ed;
  border-radius: 12px;
  padding: 13px;
  background: #f4f6ff;
}

.minimum-stay-copy h4 {
  margin: 0 0 3px;
  font-size: .92rem;
}

.minimum-stay-copy p {
  max-width: 330px;
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
}

.minimum-stay-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
}

.minimum-stay-controls label {
  margin: 0;
  color: var(--muted);
  font-size: .74rem;
}

.minimum-stay-controls input {
  display: block;
  width: 88px;
  margin-top: 4px;
  padding: 9px 10px;
}

.minimum-stay-controls .button {
  padding-block: 9px;
  white-space: nowrap;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.weekday {
  padding-block: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.calendar-spacer,
.calendar-day {
  aspect-ratio: 1;
}

.calendar-day {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid #d5dce9;
  border-radius: 7px;
  color: #3b465c;
  background: #fff;
  font-size: clamp(0.7rem, 1.5vw, 0.82rem);
  font-weight: 720;
}

.calendar-day[data-state="blocked"] {
  border-color: #e7aaaa;
  color: #7d2626;
  background: #fce3e3;
}

.calendar-day[data-state="reserved"] {
  border-color: #91aceb;
  color: #1f448e;
  background: #dce6ff;
}

.calendar-day[data-today="true"] {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.periods {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.periods h4,
.block-form h4 {
  margin: 0 0 10px;
  font-size: 0.93rem;
}

.period-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.period-row {
  align-items: center;
  border-radius: 10px;
  padding: 10px 11px;
  background: #f0f3f9;
  font-size: 0.8rem;
}

.period-row[data-kind="block"] {
  background: #fff0f0;
}

.period-row[data-kind="reservation"] {
  background: #edf2ff;
}

.period-copy {
  min-width: 0;
}

.period-copy strong,
.period-copy span {
  display: block;
}

.period-copy span {
  margin-top: 2px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.small-button {
  flex: 0 0 auto;
  padding: 7px 9px;
  font-size: 0.75rem;
}

.no-periods {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.block-form {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.block-fields label {
  margin: 0;
  font-size: 0.78rem;
}

.block-fields input,
.block-fields select,
.block-fields textarea {
  margin-top: 5px;
}

.block-fields .wide-field {
  grid-column: 1 / -1;
}

.indefinite-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 22px !important;
}

.indefinite-control input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
}

.block-submit {
  width: 100%;
  margin-top: 10px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

footer {
  padding-block: 20px 32px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

footer p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .login-card {
    grid-template-columns: 1fr;
  }

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

  .availability-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .month-controls {
    min-width: 0;
    max-width: 420px;
  }

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

@media (max-width: 560px) {
  .admin-header,
  main,
  footer {
    width: min(100% - 20px, 1180px);
  }

  .admin-header,
  .dashboard-heading,
  .section-heading,
  .reservation-top,
  .reservation-actions,
  .login-row {
    align-items: stretch;
    flex-direction: column;
  }

  .reservation-grid {
    grid-template-columns: 1fr;
  }

  .action-group {
    display: grid;
  }

  .section-summary {
    margin-top: 0;
  }

  .panel-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-navigation a {
    text-align: center;
  }

  .panel-section,
  .room-calendar-card {
    padding: 16px;
  }

  .block-fields {
    grid-template-columns: 1fr;
  }

  .minimum-stay-form,
  .minimum-stay-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .minimum-stay-controls input {
    width: 100%;
  }

  .block-fields .wide-field {
    grid-column: auto;
  }

  .indefinite-control {
    margin-top: 0 !important;
  }

  .button {
    width: 100%;
  }

  .refund-form {
    grid-template-columns: 1fr;
  }
}
