/* ===== Portale Sostituzioni — Design system Stradilab ===== */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e4e0d7;
  --primary: #9b2335;      /* bordeaux */
  --primary-dark: #7a1a29;
  --blu: #1F3864;          /* navy */
  --accent: #2d5a3d;       /* verde */
  --accent-soft: #e7efe9;
  --warn: #b5651d;
  --warn-soft: #f6ecdf;
  --gold: #b8860b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --font-body: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .2px; margin: 0; }
a { color: var(--blu); }

/* ---- Header ---- */
.topbar {
  background: var(--blu);
  color: #fff;
  padding: 14px 22px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
}
.topbar .brand { display: flex; flex-direction: column; }
.topbar .brand .kicker { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: .8; }
.topbar .brand h1 { font-size: 24px; color: #fff; line-height: 1.1; }
.topbar .spacer { flex: 1; }
.topbar .whoami { font-size: 13px; text-align: right; opacity: .95; }
.topbar .whoami b { display: block; font-size: 14px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 22px; }

/* ---- Simulatore ruolo (solo prototipo) ---- */
.sim {
  background: var(--warn-soft);
  border: 1px dashed var(--warn);
  border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13px;
}
.sim label { font-weight: 600; color: var(--warn); }
.sim select { font-family: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.sim .tag { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--warn); font-weight: 700; }

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card > h2 { font-size: 22px; color: var(--blu); margin-bottom: 4px; }
.card > .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 14px;
  margin-right: 8px;
}

/* ---- Form controls ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
select, input[type=text], input[type=date], textarea {
  width: 100%; font-family: inherit; font-size: 15px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--blu); outline-offset: 1px; }

.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day-chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  cursor: pointer; user-select: none; font-size: 14px; background: #fff;
}
.day-chip.on { background: var(--blu); color: #fff; border-color: var(--blu); }
.day-chip small { display: block; font-size: 10px; opacity: .8; }

/* ---- Buttons ---- */
button {
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 9px; border: 1px solid transparent;
  cursor: pointer; transition: filter .15s;
}
button:hover { filter: brightness(1.05); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-blu { background: var(--blu); color: #fff; }
.btn-ghost { background: #fff; color: var(--blu); border-color: var(--line); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---- Ore scoperte ---- */
.hour-block { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.hour-head {
  background: #fbfaf7; padding: 11px 15px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.hour-head .slot { font-family: var(--font-mono); font-size: 13px; color: var(--blu); font-weight: 500; }
.hour-head .classe { font-weight: 700; }
.hour-head .pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.hour-head .assigned { margin-left: auto; font-size: 13px; }
.hour-head .assigned.ok { color: var(--accent); font-weight: 700; }
.hour-head .assigned.none { color: var(--muted); }

.cands { padding: 6px 15px 12px; }
.cand {
  display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-bottom: 1px dashed var(--line);
}
.cand:last-child { border-bottom: none; }
.cand .name { font-weight: 600; min-width: 150px; }
.cand .name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.cand .why { font-size: 12px; color: var(--muted); flex: 1; }
.cand .badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}
.badge.DISP { background: var(--accent-soft); color: var(--accent); }
.badge.R    { background: #e6edf6; color: var(--blu); }
.badge.E    { background: var(--warn-soft); color: var(--warn); }
.badge.SOST { background: #f5e3e6; color: var(--primary); }
.badge.S, .badge.A { background: #eee9df; color: var(--gold); }
.cand .load { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.cand.chosen { background: var(--accent-soft); border-radius: 8px; }

.empty-note { color: var(--warn); font-size: 13px; padding: 8px 6px; }

/* ---- Riepilogo / mail ---- */
.mail-preview {
  background: #fbfaf7; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 12px; font-size: 14px;
}
.mail-preview .to { font-family: var(--font-mono); font-size: 12px; color: var(--blu); }
.mail-preview .subj { font-weight: 700; margin: 4px 0 8px; }
.mail-preview ul { margin: 6px 0; padding-left: 18px; }
.mail-preview .conf-link { display: inline-block; margin-top: 6px; color: var(--primary); font-weight: 600; }

table.registro { width: 100%; border-collapse: collapse; font-size: 13px; }
table.registro th, table.registro td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; }
table.registro th { background: var(--blu); color: #fff; font-weight: 600; }
table.registro tr:nth-child(even) td { background: #fbfaf7; }
.cost { font-family: var(--font-mono); }
.cost.paid { color: var(--warn); font-weight: 700; }
.cost.free { color: var(--accent); }

.toggle-pill {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-size: 12px;
}
.toggle-pill button { border-radius: 0; padding: 4px 10px; background: #fff; color: var(--muted); font-weight: 600; }
.toggle-pill button.on-free { background: var(--accent); color: #fff; }
.toggle-pill button.on-paid { background: var(--warn); color: #fff; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.note-inline { font-size: 12px; color: var(--muted); margin-top: 4px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 0; }
.badge-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-top: 6px; }
.badge-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
