:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --ink: #211d18;
  --muted: #857e70;
  --accent: #b8863a;
  --accent-soft: #f3e6cd;
  --danger: #c1484a;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(33, 29, 24, 0.08);
  --shadow-sm: 0 2px 8px rgba(33, 29, 24, 0.06);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle at 20% 0%, #fffaf0 0%, var(--bg) 55%);
  margin: 0;
  color: var(--ink);
  min-height: 100vh;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 18px 56px;
}

header.top {
  text-align: center;
  margin-bottom: 24px;
}

header.top .icon { font-size: 2rem; }
header.top .logo { display: block; margin: 0 auto 6px; width: min(260px, 72%); height: auto; }

h1 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 8px 0 4px;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 16px;
  animation: rise 0.35s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
}

label {
  display: block;
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
label:first-child { margin-top: 0; }

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  margin-top: 6px;
  border: 1.5px solid #e6e1d6;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: #fdfcfa;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button {
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary {
  width: 100%;
  padding: 14px;
  margin-top: 20px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 18px rgba(33,29,24,0.18); }

.btn-secondary {
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid #e6e1d6 !important;
}

.btn-danger {
  padding: 6px 12px;
  font-size: 0.78rem;
  background: var(--danger);
  color: #fff;
}

/* Selezione servizio come pillole */
.service-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.service-pill {
  position: relative;
}
.service-pill input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.service-pill label {
  display: block;
  margin: 0;
  padding: 12px 16px;
  border: 1.5px solid #e6e1d6;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  background: #fdfcfa;
  transition: all 0.15s ease;
  user-select: none;
}
.service-pill input:checked + label {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #6b4a17;
}
.service-pill .duration { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.service-pill input:checked + label .duration { color: #8a662c; }

/* Slot orari */
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.slot {
  padding: 10px 6px;
  border: 1.5px solid #e6e1d6;
  border-radius: var(--radius-sm);
  background: #fdfcfa;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}
.slot.selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.slot.occupied { background: #f1efe9; color: #b3ada0; text-decoration: line-through; border-color: #f1efe9; }
.slots-empty { color: var(--muted); font-size: 0.9rem; }

/* Toggle switch per checkbox */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  gap: 12px;
}
.toggle-row span { font-size: 0.9rem; font-weight: 500; }
.switch { position: relative; width: 46px; height: 27px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0;
  background: #e0dbcd;
  border-radius: 999px;
  transition: background 0.2s ease;
}
.switch .track::before {
  content: '';
  position: absolute;
  width: 21px; height: 21px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(19px); }

/* Reveal animato del campo telefono */
.reveal {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.32s ease, opacity 0.24s ease;
}
.reveal.open { max-height: 130px; opacity: 1; }
.hint { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }

.hidden { display: none !important; }
.error { color: var(--danger); font-size: 0.85rem; margin-top: 10px; }

/* Conferma */
.confirmation { text-align: center; }
.confirmation .check {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #8a662c;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.confirmation p { color: var(--muted); margin: 4px 0 18px; }
.confirmation a.btn-primary { display: block; text-decoration: none; text-align: center; box-sizing: border-box; }

/* Liste admin */
ul { list-style: none; padding: 0; margin: 0; }
li {
  padding: 10px 0;
  border-bottom: 1px solid #efece3;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 0.88rem;
}
li:last-child { border-bottom: none; }

.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

@media (max-width: 380px) {
  .container { padding: 20px 12px 44px; }
  .card { padding: 16px; }
}
