/* PodoFat — foglio di stile.
   Priorità: leggibilità, bottoni grandi, uso da tablet con un dito. */

:root {
  --bg: #eef3f6;
  --surface: #ffffff;
  --ink: #17313a;
  --ink-soft: #4b6069;
  --primary: #0b8f7a;       /* verde acqua */
  --primary-dark: #06705f;
  --primary-ink: #ffffff;
  --accent: #1466b8;
  --warn-bg: #fff4d6;
  --warn-ink: #7a5a00;
  --danger: #c0392b;
  --ok: #1e8e50;
  --line: #d6e0e5;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(20, 55, 70, .10);
  --tap: 92px;              /* altezza minima area tap */
  font-size: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  line-height: 1.4;
}

/* ---------- Layout kiosk (operatrice) ---------- */
.kiosk {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.kiosk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.kiosk-header .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.25rem; color: var(--primary-dark);
}
.kiosk-header .brand .dot { font-size: 1.6rem; }
.kiosk-main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 22px 18px 40px;
}
.step-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 6px 0 4px;
}
.step-sub {
  color: var(--ink-soft);
  margin: 0 0 20px;
  font-size: 1.05rem;
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 16px 24px;
  font-size: 1.25rem;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  transition: transform .05s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn .ico { font-size: 1.6rem; }

.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:active { background: var(--primary-dark); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-ghost   { background: var(--surface); border-color: var(--line); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-lg      { min-height: 120px; font-size: 1.5rem; }
.btn-xl      { min-height: 150px; font-size: 1.8rem; }
.btn-block   { display: flex; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }

.stack > * + * { margin-top: 16px; }

/* Lista pazienti/prestazioni a bottoni */
.list-btn {
  text-align: left;
  justify-content: space-between;
}
.list-btn .meta { color: var(--ink-soft); font-weight: 500; font-size: 1rem; }
.list-btn .amt  { color: var(--primary-dark); font-weight: 800; }

/* ---------- Riepilogo ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.riepilogo .row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 1.15rem;
}
.riepilogo .row:last-child { border-bottom: none; }
.riepilogo .row .lbl { color: var(--ink-soft); }
.riepilogo .row .val { font-weight: 700; }
.riepilogo .total { font-size: 1.6rem; }
.riepilogo .total .val { color: var(--primary-dark); }

/* Avviso bollo */
.avviso-bollo {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  display: flex; gap: 10px; align-items: center;
}

/* ---------- Tastierino numerico ---------- */
.keypad-display {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 16px;
  text-align: right;
  font-size: 3rem;
  font-weight: 800;
  padding: 18px 24px;
  margin-bottom: 18px;
  min-height: 90px;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.key {
  min-height: 84px;
  font-size: 2rem;
  font-weight: 800;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.key:active { transform: scale(.97); background: #f1f6f8; }
.key-wide { grid-column: span 1; }

/* Toggle grandi (pagamento, sì/no) */
.toggle-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle {
  min-height: 76px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); font-size: 1.15rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.toggle.on { border-color: var(--primary); background: #e7f6f2; color: var(--primary-dark); }

/* Campo ricerca grande */
.search {
  width: 100%; min-height: 68px; font-size: 1.25rem; padding: 12px 18px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
  margin-bottom: 16px;
}

/* Numero riservato (cliente non censito) */
.numero-box {
  text-align: center; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 20px; margin: 10px 0 24px;
}
.numero-box .n { font-size: 5rem; font-weight: 900; color: var(--primary-dark); line-height: 1; }
.numero-box .cap { font-size: 1.2rem; color: var(--ink-soft); margin-top: 10px; }

/* Flash */
.flash { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-weight: 600; }
.flash.ok    { background: #e3f6ea; color: var(--ok); }
.flash.error { background: #fdecea; color: var(--danger); }
.flash.info  { background: #e6f0fb; color: var(--accent); }
.flash.warn  { background: var(--warn-bg); color: var(--warn-ink); }

/* Link piccolo header */
.mini-link {
  font-size: .95rem; color: var(--ink-soft); text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface);
}

/* ---------- Login operatrice ---------- */
.login-wrap { max-width: 460px; margin: 6vh auto; padding: 0 18px; text-align: center; }
.login-hello { font-size: 2rem; font-weight: 800; margin-bottom: 4px; }
.login-sub { color: var(--ink-soft); margin-bottom: 22px; font-size: 1.1rem; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 10px 0 24px; }
.pin-dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--primary); }
.pin-dot.filled { background: var(--primary); }

/* ---------- Admin ---------- */
.admin { min-height: 100vh; display: flex; flex-direction: column; }
.admin-top {
  background: var(--primary-dark); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.admin-top a { color: #dff3ee; text-decoration: none; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; background: #075848; padding: 8px 12px; }
.admin-nav a { color: #cfe; padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,.15); color: #fff; }
.admin-main { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 22px 18px 60px; }

.h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 16px; }
.h2 { font-size: 1.2rem; font-weight: 800; margin: 24px 0 10px; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
table.tbl th, table.tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.tbl th { background: #f2f7f9; font-size: .9rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); }
table.tbl tr:last-child td { border-bottom: none; }
.tbl .right { text-align: right; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge.emessa { background: #e3f6ea; color: var(--ok); }
.badge.completa { background: #e6f0fb; color: var(--accent); }
.badge.manuale_incompleta { background: var(--warn-bg); color: var(--warn-ink); }
.badge.annullata { background: #eee; color: #777; }
.badge.si { background: #e3f6ea; color: var(--ok); }
.badge.no { background: #f3f3f3; color: #888; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.col-2 { grid-column: span 2; }
@media (max-width: 700px) { .field.col-2 { grid-column: span 1; } }
.field label { font-weight: 700; font-size: .95rem; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  padding: 12px 14px; font-size: 1.05rem; border: 2px solid var(--line); border-radius: 10px; background: #fff;
}
.actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.btn-sm { min-height: 48px; padding: 8px 16px; font-size: 1rem; width: auto; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 800px) { .stat-cards { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; }
.stat .n { font-size: 2rem; font-weight: 900; color: var(--primary-dark); }
.stat .l { color: var(--ink-soft); font-weight: 600; }

.alert-blocco { background: var(--warn-bg); color: var(--warn-ink); border-radius: 14px; padding: 16px 18px; font-weight: 700; }
.alert-ok { background: #e3f6ea; color: var(--ok); border-radius: 14px; padding: 16px 18px; font-weight: 700; }
