:root {
  --bg: #f4efe4;
  --card: #fffdf8;
  --text: #1f2937;
  --muted: #5b6778;
  --brand: #0f3558;
  --brand-soft: #16476f;
  --accent: #d9b36a;
  --ok: #166534;
  --err: #991b1b;
  --line: rgba(126, 102, 59, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', 'Inter', sans-serif;
  background: radial-gradient(circle at 10% 10%, #fffdf8 0, #f4efe4 46%, #efe7d7 100%);
  color: var(--text);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.card {
  width: min(1040px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 50px rgba(16, 24, 40, 0.14);
  overflow: hidden;
}

.head {
  background: linear-gradient(130deg, var(--brand), var(--brand-soft));
  color: #fff;
  padding: 1.4rem 1.6rem;
}

.head h1 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.head p {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.9);
}

.content {
  padding: 1.2rem 1.4rem 1.5rem;
}

.top-info {
  margin-bottom: 0.9rem;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  color: var(--muted);
  font-size: 0.9rem;
}

.field input,
.field textarea {
  border: 1px solid #d6dde6;
  border-radius: 12px;
  padding: 0.72rem;
  font: inherit;
  background: #fff;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #1f2d3d;
}

.secondary {
  background: #e8edf3;
  color: #223043;
}

/* Anchor stilizzato come bottone (es. "Integra il booking sul tuo sito") */
.actions a.secondary,
.actions a.integrate-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, #2f97ff, #6fb9ff);
  color: #fff;
  border: 0;
  transition: .2s;
}
.actions a.integrate-cta:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -8px rgba(47,151,255,.55);
}

.box {
  margin-top: 0.95rem;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.ok {
  color: var(--ok);
}

.err {
  color: var(--err);
}

.muted {
  color: var(--muted);
}

.debug-wrap {
  margin-top: 0.8rem;
  border: 1px solid #d9e2ee;
  border-radius: 12px;
  background: #f9fbff;
  padding: 0.55rem 0.7rem;
}

.debug-wrap summary {
  font-weight: 700;
  cursor: pointer;
  color: #223043;
}

.debug-log {
  margin: 0.55rem 0 0;
  background: #0f172a;
  color: #d3e6ff;
  border-radius: 10px;
  padding: 0.7rem;
  min-height: 80px;
  max-height: 220px;
  overflow: auto;
  font-size: 0.74rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

.calendar-wrap {
  margin-top: 1.15rem;
  border: 1px solid #d9e2ee;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  padding: 0.95rem;
}

.calendar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.calendar-title {
  margin: 0;
  font-size: 1.05rem;
  color: #1d3348;
}

.calendar-controls {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.calendar-controls input[type="month"] {
  border: 1px solid #ccd6e2;
  border-radius: 10px;
  padding: 0.44rem 0.6rem;
  font: inherit;
}

.mini-btn {
  border-radius: 999px;
  border: 1px solid #d2dbe7;
  background: #f7fafd;
  color: #223043;
  padding: 0.42rem 0.75rem;
  font-weight: 700;
}

.calendar-status {
  color: #516073;
  font-size: 0.88rem;
  margin-bottom: 0.55rem;
}

.calendar-legend {
  margin-bottom: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  color: #42536a;
}

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

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

.legend-dot.available {
  background: #1f9d58;
}

.legend-dot.limited {
  background: #c97f14;
}

.legend-dot.full {
  background: #c63744;
}

.calendar-note {
  margin-left: auto;
  color: #5b6778;
  font-size: 0.74rem;
}

.fare-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.fare-weekday {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #485a70;
  padding: 0.2rem;
}

.fare-day {
  border: 1px solid #d9e2ee;
  border-radius: 12px;
  background: #fff;
  min-height: 102px;
  padding: 0.38rem;
  display: grid;
  align-content: start;
  gap: 0.3rem;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.fare-day:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #8eb0d4;
}

.fare-day:focus-visible {
  outline: 2px solid #0f3558;
  outline-offset: 1px;
}

.fare-day.is-empty {
  background: #f6f8fb;
  border-style: dashed;
  min-height: 102px;
}

.fare-day:disabled {
  cursor: not-allowed;
  opacity: 0.95;
}

.fare-day-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1f2937;
}

.fare-price {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f3558;
}

.fare-pill {
  width: fit-content;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.14rem 0.45rem;
  border: 1px solid transparent;
}

.fare-day.status-available .fare-pill {
  background: #e8f8ee;
  color: #166534;
  border-color: #bae7cb;
}

.fare-day.status-limited .fare-pill {
  background: #fff5e8;
  color: #8a5700;
  border-color: #f5d9ad;
}

.fare-day.status-full .fare-pill {
  background: #fceced;
  color: #9b1c28;
  border-color: #f2c8cc;
}

.fare-day.is-checkin,
.fare-day.is-checkout {
  border-color: #0f3558;
  box-shadow: inset 0 0 0 1px rgba(15, 53, 88, 0.25);
  background: #eff6ff;
}

.fare-day.in-range {
  background: #f5f9ff;
  border-color: #b4cbeb;
}

@media (max-width: 860px) {
  .card {
    width: min(900px, 100%);
  }

  .fare-day {
    min-height: 92px;
  }
}

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

  .calendar-note {
    margin-left: 0;
    width: 100%;
  }

  .fare-day {
    min-height: 82px;
    padding: 0.28rem;
  }

  .fare-price {
    font-size: 0.82rem;
  }
}
