/* Gestore — schermo di lavoro: superfici piatte, colore solo sui dati e sull'azione principale. */
:root {
  --canvas: #FAF4F5;
  --panel: #FFFFFF;
  --line: rgba(43, 15, 27, .11);
  --line-strong: rgba(43, 15, 27, .2);
  --ink: #2B0F1B;
  --muted: #6B4F58;
  --accent: #C2185B;
  --accent-pale: #FBE3EC;
  --ok: #1F6B46;
  --ok-pale: #E3F2EA;
  --warn-pale: #FFF1D6;
  --warn: #7A5200;
  --text: "Figtree", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --display: "Bodoni Moda", "Didot", Georgia, serif;
  --r: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 15px/1.45 var(--text); }
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .12s, transform .12s; }
.btn:hover { background: #F6ECEF; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #A5124C; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn.danger { color: #9A0F45; }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: #F1E4E8; }

/* Login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 32px; display: grid; gap: 14px; }
.login img { border-radius: 50%; }
.login h1 { font: 700 30px/1.1 var(--display); letter-spacing: -.02em; }
.login p { color: var(--muted); }
.login .demo { background: var(--warn-pale); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.login .err { color: #9A0F45; font-weight: 600; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input[type=text], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea { height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); padding: 0 12px; font-weight: 400; min-width: 0; width: 100%; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

/* Shell */
.app { display: grid; grid-template-columns: 224px 1fr; min-height: 100svh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100svh; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; line-height: 1.2; padding: 0 6px; }
.brand img { border-radius: 50%; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.side nav { display: grid; gap: 2px; }
.side nav button { display: flex; justify-content: space-between; align-items: center; text-align: left; border: 0; background: none; border-radius: 8px; padding: 10px 12px; cursor: pointer; font-weight: 500; color: var(--muted); }
.side nav button:hover { background: #F6ECEF; color: var(--ink); }
.side nav button[aria-current=page] { background: #F1E4E8; color: var(--ink); font-weight: 700; }
.count { background: var(--accent); color: #fff; border-radius: 999px; font-size: 13px; font-weight: 700; min-width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0 6px; }
.side-foot { margin-top: auto; display: grid; gap: 4px; padding: 0 12px; font-size: 14px; }
.side-foot button { border: 0; background: none; text-align: left; padding: 6px 0; cursor: pointer; color: var(--muted); }
.side-foot a { padding: 6px 0; }

.canvas { padding: 28px clamp(16px, 3vw, 40px) 64px; min-width: 0; outline: none; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { font: 700 26px/1.15 var(--display); letter-spacing: -.02em; }
.head h1 small { display: block; font: 500 14px/1.4 var(--text); color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; }
.kpis div { padding: 16px 20px; border-left: 1px solid var(--line); }
.kpis div:first-child { border-left: 0; }
.kpis dt { font-size: 14px; color: var(--muted); }
.kpis dd { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpis dd small { font-size: 14px; font-weight: 500; color: var(--muted); }
.kpis dd.alert { color: var(--accent); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.week button { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 10px 8px 8px; cursor: pointer; text-align: left; display: grid; gap: 6px; min-width: 0; }
.week button:hover { border-color: var(--line-strong); }
.week button[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.week .d { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week .d b { color: var(--ink); }
.week .bar { height: 6px; border-radius: 3px; background: #F1E4E8; overflow: hidden; }
.week .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.week .n { font-size: 13px; color: var(--muted); }
.week button.closed { background: transparent; }

.cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.panel > h2 { font-size: 16px; font-weight: 700; padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel > h2 small { font-weight: 500; color: var(--muted); font-size: 14px; }
.panel .body { padding: 16px 20px; }
.empty { padding: 28px 20px; color: var(--muted); }

.day li { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.day li:first-child { border-top: 0; }
.day .t { font-variant-numeric: tabular-nums; font-weight: 700; }
.day .t small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.day .who b { display: block; }
.day .who span { color: var(--muted); font-size: 14px; }
.day .act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.day li.free { color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.day li.free .t { font-weight: 500; }
.day li.gone .who b, .day li.gone .t { text-decoration: line-through; color: var(--muted); }

.st { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.st.nuova { background: var(--accent-pale); color: #8E1045; }
.st.confermata { background: var(--ok-pale); color: var(--ok); }
.st.completata { background: #EFE9EB; color: var(--muted); }
.st.annullata { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; font-weight: 500; }

.inbox li { padding: 12px 20px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.inbox li:first-child { border-top: 0; }
.inbox .when { font-size: 14px; color: var(--muted); }
.inbox .row { display: flex; gap: 6px; }

.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formgrid .wide { grid-column: 1 / -1; }
.formrow { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.note { color: var(--muted); font-size: 14px; }
.err { color: #9A0F45; font-weight: 600; font-size: 14px; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td input[type=number] { width: 84px; text-align: right; }
td input[type=text] { min-width: 220px; }
td select { min-width: 150px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--panel); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 0 12px; min-height: 38px; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed=true] { background: #F1E4E8; color: var(--ink); font-weight: 700; }

.hours li { display: grid; grid-template-columns: 120px 110px 1fr; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--line); }
.hours li:first-child { border-top: 0; }
.hours .range { display: flex; gap: 8px; align-items: center; }
.hours .range input { width: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #F1E4E8; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; font-weight: 500; }
.chip button { border: 0; background: none; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; font-size: 16px; line-height: 1; }
.chip button:hover { background: #E4CFD6; }
.stack { display: grid; gap: 16px; max-width: 820px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.fade { animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand span, .side-foot a { display: none; }
  .side nav { display: flex; gap: 2px; }
  .side nav button { padding: 10px; white-space: nowrap; gap: 6px; min-height: 44px; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .side-foot button { padding: 10px; min-height: 44px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis div:nth-child(3) { border-left: 0; }
  .kpis div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .week { grid-template-columns: repeat(7, minmax(74px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
  .day li { grid-template-columns: 64px 1fr; }
  .day .act { grid-column: 1 / -1; justify-content: flex-start; }
  .formgrid { grid-template-columns: 1fr; }
  .hours li { grid-template-columns: 1fr 1fr; }
  .hours .range { grid-column: 1 / -1; }
  .btn, .seg button { min-height: 44px; }
}
