* {
  box-sizing: border-box;
}

:root {
  --ink: #172033;
  --muted: #697386;
  --line: #e6eaf0;
  --panel: #ffffff;
  --background: #f5f7fb;
  --brand: #1769e0;
  --brand-soft: #eaf2ff;
  --green: #17824b;
  --green-soft: #e8f7ef;
  --red: #b42318;
  --red-soft: #fff0ee;
  --gray-soft: #f0f2f5;
  --shadow: 0 14px 38px rgba(23, 32, 51, .08);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.booking-calendar {
  width: min(1180px, calc(100% - 32px));
  margin: 40px auto;
}

.calendar-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

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

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.1;
}

.intro {
  margin-bottom: 0;
  color: var(--muted);
}

.apartment-field {
  display: grid;
  gap: 8px;
  min-width: min(100%, 310px);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
}

select,
button {
  font: inherit;
}

select {
  min-height: 46px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.calendar-toolbar h2 {
  margin: 0;
  font-size: 1.25rem;
  text-align: center;
}

.secondary-button {
  width: fit-content;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: .2s ease;
}

.secondary-button:last-child {
  justify-self: end;
}

.secondary-button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.status {
  padding: 12px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: .9rem;
}

.status.success {
  color: var(--green);
}

.status.error {
  background: var(--red-soft);
  color: var(--red);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 18px 4px;
  color: var(--muted);
  font-size: .85rem;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.available { background: var(--green); }
.legend-dot.occupied { background: var(--red); }
.legend-dot.unknown { background: #9ba3b0; }

.calendar {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.weekdays {
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.weekdays span {
  padding: 13px 8px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

.day-cell {
  min-height: 126px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.day-cell:nth-child(7n) {
  border-right: 0;
}

.day-cell.available {
  background: linear-gradient(145deg, var(--green-soft), #fff 68%);
}

.day-cell.occupied {
  background: linear-gradient(145deg, var(--red-soft), #fff 68%);
}

.day-cell.unknown {
  background: linear-gradient(145deg, var(--gray-soft), #fff 68%);
}

.day-cell.empty {
  min-height: 126px;
  background: #fafbfc;
}

.day-number {
  margin-bottom: 18px;
  font-size: 1.1rem;
  font-weight: 800;
}

.availability-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.night-price {
  font-size: .95rem;
  font-weight: 800;
}

.night-price small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
}

.loading-state,
.empty-state {
  grid-column: 1 / -1;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .booking-calendar {
    width: min(100% - 20px, 1180px);
    margin: 20px auto;
  }

  .calendar-header {
    display: grid;
    align-items: stretch;
  }

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

  .calendar-toolbar h2 {
    grid-column: 1 / -1;
    grid-row: 1;
    order: -1;
  }

  .secondary-button:last-child {
    justify-self: end;
  }

  .weekdays span {
    padding: 10px 2px;
    font-size: .65rem;
  }

  .day-cell,
  .day-cell.empty {
    min-height: 104px;
    padding: 8px 6px;
  }

  .day-number {
    margin-bottom: 12px;
    font-size: .95rem;
  }

  .availability-label {
    font-size: .65rem;
    line-height: 1.15;
  }

  .night-price {
    font-size: .72rem;
  }

  .night-price small {
    font-size: .6rem;
  }
}
