*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f4f6f8;
  color: #1a1a1a;
  line-height: 1.5;
}

.flat-temp {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(27, 31, 36, 0.08);
  z-index: 10;
}

.flat-temp-icon {
  width: 1.125rem;
  height: 1.125rem;
  color: #22cf67;
  flex-shrink: 0;
}

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.title {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

.description {
  margin: 0 0 1.5rem;
  text-align: center;
  color: #57606a;
  font-size: 0.9375rem;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.days {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.75rem;
}

.day-card:nth-child(-n + 3) {
  grid-column: span 4;
}

.day-card:nth-child(n + 4) {
  grid-column: span 3;
}

@media (max-width: 768px) {
  .days {
    grid-template-columns: 1fr;
  }

  .day-card:nth-child(-n + 3),
  .day-card:nth-child(n + 4) {
    grid-column: span 1;
  }
}

.day-card {
  border: 1px solid #d0d7de;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.day-card:hover {
  border-color: #0969da;
  box-shadow: 0 2px 8px rgba(9, 105, 218, 0.12);
}

.day-card:focus-visible {
  outline: 2px solid #0969da;
  outline-offset: 2px;
}

.day-card.today {
  border-color: #0969da;
}

.day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  background: #f6f8fa;
  padding: 0.5rem 0.375rem;
  text-align: center;
  pointer-events: none;
}

.day-card.today .day-header {
  background: #f0f6ff;
}

.day-header .weekday {
  font-size: 0.75rem;
  color: #57606a;
}

.day-header .date {
  font-size: 0.9375rem;
  font-weight: 600;
}

.schedule {
  padding: 0.375rem 0.375rem 0.5rem;
  flex: 1;
  pointer-events: none;
}

.room-columns {
  display: grid;
  grid-template-columns: 1.25rem repeat(4, 1fr);
  gap: 0.25rem;
  align-items: stretch;
}

.time-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 1.375rem;
  padding-bottom: 0;
}

.time-axis span {
  font-size: 0.5625rem;
  color: #8b949e;
  line-height: 1;
}

.room-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.room-label {
  font-size: 0.5625rem;
  color: #57606a;
  line-height: 1.2;
  text-align: center;
  margin-bottom: 0.25rem;
  min-height: 1.125rem;
}

.timeline {
  position: relative;
  height: 7.5rem;
}

.timeline-track {
  position: absolute;
  inset: 0;
  background: #f0f2f5;
  border-radius: 4px;
  border: 1px solid #e1e4e8;
}

.booking-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 3px;
  padding: 0.125rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.booking-block.room-color-0 {
  background: #54aeff;
  color: #fff;
}

.booking-block.room-color-1 {
  background: #3fb950;
  color: #fff;
}

.booking-block.room-color-2 {
  background: #d29922;
  color: #fff;
}

.booking-block.room-color-3 {
  background: #bc8cff;
  color: #fff;
}

.booker {
  font-size: 0.5625rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.overlay.hidden {
  display: none;
}

.modal {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #57606a;
  padding: 0.25rem 0.5rem;
}

.close-btn:hover {
  color: #1a1a1a;
}

.modal h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.selected-day {
  margin: 0 0 1.25rem;
  color: #57606a;
  font-size: 0.9375rem;
}

.booking-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.booking-form input,
.booking-form select {
  display: block;
  width: 100%;
  margin-top: 0.375rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}

.booking-form input:focus,
.booking-form select:focus {
  outline: 2px solid #0969da;
  border-color: #0969da;
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.time-row label {
  margin-bottom: 0;
}

.booking-total {
  margin: 0 0 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: #f6f8fa;
  font-size: 0.9375rem;
}

.booking-total.hidden {
  display: none;
}

.booking-total strong {
  font-size: 1.125rem;
}

.total-breakdown {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: #57606a;
}

.error {
  margin: 0 0 1rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  background: #ffebe9;
  color: #cf222e;
  font-size: 0.875rem;
}

.error.hidden {
  display: none;
}

.save-btn {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: #0969da;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.save-btn:hover {
  background: #0550ae;
}

.save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
