:root {
  --bg: #14120f;
  --bg-panel: #1c1a15;
  --bg-card: #221f19;
  --bg-card-hover: #2a261f;
  --line: #35312a;
  --brass: #c9a35f;
  --brass-dim: #8a7245;
  --cream: #f3ede0;
  --muted: #8f887a;
  --success: #7ea27f;
  --radius: 14px;
  --font-display: "Fraunces", serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

/* ---------- Reset & Base ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 15% 0%, rgba(201, 163, 95, 0.07), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(201, 163, 95, 0.05), transparent 45%);
  color: var(--cream);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- App Layout ---------- */
.app-shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 48px; 
  align-items: start;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

/* ---------- Header ---------- */
.brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 60px; 
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.6px;
}

/* ---------- Progress Steps ---------- */
.progress {
  display: flex;
  align-items: center;
  margin-bottom: 60px;
  user-select: none;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.progress-step .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.progress-step .label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.progress-step.active {
  color: var(--cream);
}

.progress-step.active .num {
  background: var(--brass);
  border-color: var(--brass);
  color: #201b12;
  font-weight: 700;
}

.progress-step.done .num {
  background: transparent;
  border-color: var(--success);
  color: var(--success);
}

.progress-line {
  flex: 1;
  height: 1px;
  background: var(--line);
  margin: 0 14px;
  min-width: 16px;
}

@media (max-width: 560px) {
  .progress-step .label {
    display: none;
  }
  .progress-line {
    margin: 0 8px;
  }
}

/* ---------- Step Panels ---------- */
.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.step-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 14px;
}

.step-hint {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 36px;
  padding-bottom: 12px;
}

/* ---------- Service Cards ---------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px; 
  margin-bottom: 24px;
}

@media (max-width: 560px) {
  .service-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px; 
  cursor: pointer;
  text-align: left;
  color: var(--cream);
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.service-card:hover {
  background: var(--bg-card-hover);
}

.service-card.selected {
  border-color: var(--brass);
  background: var(--bg-card-hover);
}

.service-card.selected::after {
  content: "✓";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brass);
  color: #201b12;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.service-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 12px;
  padding-right: 24px;
}

.service-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.service-meta .price {
  font-family: var(--font-mono);
  color: var(--brass);
}

/* ---------- Staff Selector ---------- */
.staff-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.staff-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px; 
  cursor: pointer;
  color: var(--cream);
  font-family: inherit;
  text-align: center;
  min-width: 124px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.staff-card:hover {
  background: var(--bg-card-hover);
}

.staff-card.selected {
  border-color: var(--brass);
  background: var(--bg-card-hover);
}

.staff-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--brass-dim), var(--brass));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: #201b12;
  font-size: 16px;
}

.staff-name {
  font-size: 13.5px;
  font-weight: 500;
}

.staff-role {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Date & Slot Grid ---------- */
.date-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 36px;
}

.date-pill {
  flex: 0 0 auto;
  width: 66px;
  padding: 14px 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--cream);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.date-pill:hover {
  background: var(--bg-card-hover);
}

.date-pill.selected {
  border-color: var(--brass);
  background: var(--bg-card-hover);
}

.date-pill .dow {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.date-pill .dnum {
  font-family: var(--font-display);
  font-size: 20px;
  margin-top: 6px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; 
  margin-bottom: 24px;
}

@media (max-width: 560px) {
  .slot-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

.slot-btn {
  padding: 12px 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.slot-btn:hover {
  background: var(--bg-card-hover);
}

.slot-btn.selected {
  border-color: var(--brass);
  background: var(--brass);
  color: #201b12;
  font-weight: 600;
}

.slot-btn.taken {
  opacity: 0.3;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ---------- Form Inputs ---------- */
.form-grid {
  display: grid;
  gap: 20px;
  max-width: 440px;
  margin-bottom: 24px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--cream);
  font-family: inherit;
  font-size: 14px;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
  border-color: var(--brass);
}

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

/* ---------- General Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  padding: 14px 26px; 
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--brass);
  color: #201b12;
}

.btn-primary:hover {
  background: #d9b878;
}

.btn-primary:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.btn-ghost:hover {
  color: var(--cream);
  border-color: var(--muted);
}

/* ---------- Sidebar / Ticket Panel ---------- */
.ticket {
  position: sticky;
  top: 40px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px 28px; 
  font-family: var(--font-mono);
  box-sizing: border-box;
}

.ticket-head {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-head .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0; 
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  gap: 16px;
}

.ticket-row:last-of-type {
  border-bottom: none;
}

.ticket-row .k {
  color: var(--muted);
  flex-shrink: 0;
}

.ticket-row .v {
  color: var(--cream);
  text-align: right;
}

.ticket-row .v.empty {
  color: var(--line);
}

.ticket-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
}

.ticket-total .k {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.ticket-total .v {
  font-size: 24px;
  color: var(--brass);
}

.ticket-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  width: 100%;
}

.ticket-btn {
  width: 100%;
  padding: 16px;
  font-size: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}

.ticket-btn-back {
  width: 100%;
  padding: 12px;
  font-size: 13.5px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}

.ticket-perf {
  height: 14px;
  margin: 22px -28px -28px;
  background-image: radial-gradient(circle, var(--bg) 5.5px, transparent 5.6px);
  background-size: 18px 18px;
  background-position: -4px -7px;
  background-repeat: repeat-x;
}

/* ---------- Confirm Box ---------- */
.confirm-box {
  display: none;
  text-align: center;
  padding: 16px 0 8px;
}

.confirm-box.show {
  display: block;
}

.confirm-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(126, 162, 127, 0.15);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 24px;
}

.confirm-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--cream);
  margin-bottom: 8px;
}

.confirm-sub {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.confirm-code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brass);
  letter-spacing: 1.5px;
}

/* ============================================================
   STILI POP-UP CALENDAR (MODAL)
   ============================================================ */

/* Trigger Card Nello Step 3 */
.picker-trigger {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  margin-bottom: 24px;
}

.picker-trigger:hover {
  border-color: var(--brass);
  background: var(--bg-card-hover);
}

.picker-icon {
  font-size: 28px;
}

.picker-info {
  display: flex;
  flex-direction: column;
}

.picker-label {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.picker-value {
  font-size: 15px;
  color: var(--cream);
  font-weight: 500;
  margin-top: 4px;
}

/* Struttura Modale */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  animation: modalUp 0.25s ease;
}

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

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--cream);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-section-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
}

/* Media Query Mobile originale inalterata */
@media (max-width: 860px) {
  html, body {
    overflow-x: hidden;
  }

  body {
    padding: 24px 16px;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    gap: 32px;
  }

  .brand {
    margin-bottom: 32px;
    flex-direction: column;
    gap: 4px;
  }

  .progress {
    margin-bottom: 36px;
    justify-content: space-between;
  }

  .staff-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
  }

  .staff-card {
    min-width: 0;
    width: 100%;
    padding: 16px 12px;
  }

  .ticket {
    position: static;
    padding: 24px 20px 20px;
    width: 100%;
  }

  .ticket-perf {
    margin: 20px -20px -20px;
  }
}

@media (max-width: 400px) {
  .slot-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .staff-row {
    grid-template-columns: 1fr;
  }
}