:root {
  --ink: #24302b;
  --paper: #f6f3ec;
  --moss: #3e5c4f;
  --clay: #b5583a;
  --line: #d9d2c1;
  --muted: #6f7a72;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Georgia', 'Iowan Old Style', serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

header {
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

header h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 0.25rem;
  letter-spacing: 0.02em;
}

header p {
  color: var(--muted);
  font-family: -apple-system, system-ui, sans-serif;
  margin: 0;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: -apple-system, system-ui, sans-serif;
  margin-bottom: 0.75rem;
}

.calendar-nav button {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font-size: 1rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.85rem;
}

.calendar-grid .dow {
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 4px;
}

.day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #f1efe6;
}

.day.blocked {
  background: #e8dcd6;
  color: var(--clay);
  text-decoration: line-through;
  opacity: 0.7;
}

.day.empty { background: transparent; }

.day.selectable {
  cursor: pointer;
  transition: background 0.12s ease;
}

.day.selectable:hover:not(.blocked) {
  background: #e3e9e4;
}

.day.in-range {
  background: #dce7e0;
}

.day.range-start,
.day.range-end {
  background: var(--moss);
  color: #fff;
  font-weight: bold;
}

.calendar-hint {
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.summary-box {
  font-family: -apple-system, system-ui, sans-serif;
  background: #f1efe6;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.summary-box .total {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--moss);
  margin-top: 0.25rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--clay);
  text-decoration: underline;
  cursor: pointer;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.8rem;
  padding: 0;
}

button.primary:disabled {
  background: #b7c2bb;
  cursor: not-allowed;
}

.day.src-directo { background: #e4ede7; }
.day.src-airbnb { background: #fde2e2; }
.day.src-booking { background: #dbeafe; }
.day.src-manual { background: #f1e6d0; }

.report-stats {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.dash-stats .stat.alert { background: #fde2e2; }
.dash-stats .stat.alert strong { color: #c0392b; }
.dash-stats .stat.warn { background: #f1e6d0; }
.dash-stats .stat.warn strong { color: #8a6d1f; }

.tab-bar {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  font-family: -apple-system, system-ui, sans-serif;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--moss);
  border-bottom-color: var(--moss);
  font-weight: bold;
}

.source-bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.8rem;
}

.source-bar-track {
  flex: 1;
  background: #f1efe6;
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
}

.source-bar-fill {
  height: 100%;
}

.stat {
  background: #f1efe6;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: -apple-system, system-ui, sans-serif;
  min-width: 140px;
}

.stat strong {
  display: block;
  font-size: 1.3rem;
  color: var(--moss);
}

.stat span {
  font-size: 0.78rem;
  color: var(--muted);
}

select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.95rem;
  background: #fff;
}

.tag.status-pendiente { background: #f1e6d0; color: #8a6d1f; }
.tag.status-checkin { background: #dbeafe; color: #1d4ed8; }
.tag.status-checkout { background: #e4ede7; color: var(--moss); }

.tag.confirmation-pendiente_confirmacion { background: #fde2e2; color: #c0392b; }
.tag.confirmation-confirmada { background: #e4ede7; color: var(--moss); }
.tag.confirmation-cancelada { background: #e5e5e5; color: #777; text-decoration: line-through; }

.day.is-today {
  box-shadow: inset 0 0 0 2px var(--moss);
  font-weight: bold;
}

.day.is-selected {
  box-shadow: inset 0 0 0 2px var(--clay);
}

.day-detail-box {
  font-family: -apple-system, system-ui, sans-serif;
  background: #f1efe6;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-top: 1rem;
}

.actions-cell {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.actions-cell button {
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.78rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.notes-cell {
  max-width: 140px;
  font-size: 0.82rem;
}

.legend {
  display: flex;
  gap: 1rem;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.free { background: #f1efe6; border: 1px solid var(--line); }
.dot.busy { background: #e8dcd6; }

form {
  font-family: -apple-system, system-ui, sans-serif;
  display: grid;
  gap: 0.9rem;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.3rem;
}

input, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

button.primary {
  background: var(--moss);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: -apple-system, system-ui, sans-serif;
}

button.primary:hover { opacity: 0.92; }

.msg {
  font-family: -apple-system, system-ui, sans-serif;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.msg.ok { background: #e4ede7; color: var(--moss); }
.msg.error { background: #f5e3dd; color: var(--clay); }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 100px;
  font-size: 0.72rem;
  background: #eee;
}

.tag.directo { background: #e4ede7; color: var(--moss); }
.tag.airbnb { background: #fde2e2; color: #c0392b; }
.tag.booking { background: #dbeafe; color: #1d4ed8; }
.tag.manual { background: #f1e6d0; color: #8a6d1f; }

.link-plain {
  color: var(--moss);
}

.small { font-size: 0.8rem; color: var(--muted); font-family: -apple-system, system-ui, sans-serif; }

.country-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.country-option {
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  font-family: -apple-system, system-ui, sans-serif;
  cursor: pointer;
}

.country-option:hover { background: #f1efe6; }
.country-option.muted { color: var(--muted); cursor: default; font-size: 0.8rem; }
.country-option.muted:hover { background: none; }

.tag.state-pendiente_confirmacion { background: #fde2e2; color: #c0392b; }
.tag.state-confirmada { background: #dbeafe; color: #1d4ed8; }
.tag.state-in_house { background: #e4ede7; color: var(--moss); }
.tag.state-checkout_hecho { background: #f1e6d0; color: #8a6d1f; }
.tag.state-cancelada { background: #e5e5e5; color: #777; text-decoration: line-through; }

.tag.pay-pendiente { background: #fde2e2; color: #c0392b; }
.tag.pay-parcial { background: #f1e6d0; color: #8a6d1f; }
.tag.pay-pagado { background: #e4ede7; color: var(--moss); }

.row-list {
  font-family: -apple-system, system-ui, sans-serif;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.booking-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.85rem;
}

.booking-row:hover { background: #faf9f5; }

.booking-row .chevron {
  transition: transform 0.15s ease;
  color: var(--muted);
  font-size: 0.8rem;
}

.booking-row.open .chevron {
  transform: rotate(90deg);
}

.booking-row .who {
  flex: 1;
  min-width: 0;
}

.booking-row .who strong {
  display: block;
  font-size: 0.95rem;
}

.booking-row .who span {
  color: var(--muted);
  font-size: 0.78rem;
}

.booking-detail {
  padding: 0.9rem 1rem 1.1rem 2.5rem;
  background: #faf9f5;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.booking-detail .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1.5rem;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.booking-detail .detail-grid span {
  color: var(--ink);
}

.booking-row:last-child,
.booking-detail:last-child { border-bottom: none; }
