:root {
  --bg: #f3efe6;
  --paper: #fffdf8;
  --ink: #1c1914;
  --muted: #6f675c;
  --line: #e6dfd2;
  --teal: #0f6e6b;
  --teal-dark: #0b5553;
  --teal-soft: #d7efee;
  --sand: #e8b86d;
  --coral: #c45c4a;
  --today: #1d4ed8;
  --shadow: 0 16px 40px rgba(40, 28, 12, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #f7e7c6 0%, transparent 50%),
    radial-gradient(900px 400px at 100% 0%, #cfe8e6 0%, transparent 45%),
    var(--bg);
  color: var(--ink);
}

button, input, textarea { font-family: inherit; }

.app {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
}

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(160deg, var(--teal) 0%, var(--teal-dark) 100%);
  box-shadow: 0 8px 18px rgba(15, 110, 107, 0.28);
}

.brand h1 { font-size: 18px; letter-spacing: -0.03em; }
.brand p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.stat-label { display: block; font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.stat strong { font-size: 18px; }

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.today { background: var(--today); }
.dot.selected { background: var(--teal); }
.dot.booked { background: var(--coral); }
.dot.range { background: #f3c9c2; box-shadow: inset 0 0 0 1px var(--coral); }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-head h2 { font-size: 14px; }

.booking-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  max-height: 280px;
}

.booking-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.booking-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.booking-card .who { font-weight: 700; font-size: 14px; }
.booking-card .when { font-size: 12px; color: var(--muted); margin: 4px 0; }
.booking-card .meta { font-size: 12px; color: var(--teal-dark); }

.empty-list {
  color: var(--muted);
  font-size: 13px;
  padding: 16px 8px;
}

.main { padding: 28px 32px 40px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav h2 { font-size: 26px; letter-spacing: -0.04em; min-width: 220px; text-align: center; }

.top-actions { display: flex; gap: 8px; }

.hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.calendar-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.weekdays span {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 0 14px;
}

.day {
  min-height: 92px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px;
  position: relative;
  cursor: pointer;
  transition: background .15s ease;
}
.day:hover:not(.empty):not(.past) { background: #f7f3ea; }
.day.empty { cursor: default; }
.day.past {
  color: #b9b1a6;
  cursor: not-allowed;
}
.day .num {
  font-size: 13px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.day.today .num {
  background: var(--today);
  color: white;
}
.day.in-range { background: #f8e4df; }
.day.start, .day.end, .day.selected {
  background: color-mix(in srgb, var(--teal) 12%, white);
}
.day.start .num, .day.end .num, .day.selected .num {
  background: var(--teal);
  color: white;
}
.day.booked-start, .day.booked-end, .day.booked-mid {
  background: #f7ddd8;
}
.day.booked-start .num, .day.booked-end .num {
  background: var(--coral);
  color: white;
}
.pills {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}
.pill {
  font-size: 10px;
  background: white;
  border: 1px solid #efc9c2;
  color: #8a3d32;
  border-radius: 999px;
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.icon-btn, .ghost-btn, .primary-btn, .danger-btn {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  font-weight: 600;
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1;
}
.icon-btn:hover { background: #f3eee4; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--ink);
}
.ghost-btn:hover { background: #f3eee4; }

.primary-btn {
  background: var(--teal);
  color: white;
  padding: 10px 16px;
}
.primary-btn:hover { background: var(--teal-dark); }

.danger-btn {
  background: #fde8e4;
  color: var(--coral);
  padding: 10px 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 20, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  width: min(560px, 100%);
  background: var(--paper);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: white;
}
input:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--teal) 35%, white);
  border-color: var(--teal);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nights { font-size: 13px; color: var(--teal-dark); font-weight: 600; }
.form-error { color: var(--coral); font-size: 13px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.spacer { flex: 1; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: var(--teal); color: white; border-color: var(--teal); }

.room-list {
  display: grid;
  gap: 8px;
}
.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.room-item.active { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.room-swatch {
  width: 12px;
  height: 28px;
  border-radius: 99px;
}
.room-item .name { font-size: 13px; font-weight: 700; }
.room-item .status { margin-left: auto; font-size: 11px; color: var(--muted); }
.room-item .status.busy { color: var(--coral); font-weight: 700; }
.room-item .status.free { color: var(--teal); font-weight: 700; }

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 8px;
}
.mini-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.wa-btn, a.wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #128c7e;
  color: white;
  text-decoration: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.wa-btn.secondary { background: #075e54; }
.wa-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help { font-size: 12px; color: var(--muted); font-weight: 500; }
.room-edit { display: grid; gap: 8px; }
.room-edit label { font-weight: 600; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .booking-list { max-height: 280px; }
  .month-nav h2 { min-width: unset; font-size: 20px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .day { min-height: 72px; }
}

@media (max-width: 640px) {
  .main, .sidebar { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .day { min-height: 58px; padding: 4px; }
}
