:root {
  --brand: #1b4d3e;
  --ink: #1f2d29;
  --muted: #5f6f6a;
  --bg: #f5f8f6;
  --card: #ffffff;
  --line: #dde7e2;
  --danger: #b3261e;
  --ok: #1b6b46;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#app { min-height: 100dvh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); outline: none; }
.boot { padding: 40px 20px; text-align: center; color: var(--muted); }
.top { background: var(--brand); color: #fff; padding: calc(14px + env(safe-area-inset-top)) 20px 14px; }
.brand { font-weight: 700; font-size: 18px; }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }
.wrap.narrow { padding-top: 40px; }
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin: 0 0 14px; display: block; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.field { margin: 0 0 14px; }
label { display: block; font-weight: 600; margin: 0 0 6px; }
input[type=text], input[type=email], input[type=number], select {
  width: 100%; font: inherit; padding: 12px 14px; min-height: 48px; border: 1px solid #b9c7c1; border-radius: 12px; background: #fff; color: var(--ink);
}
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 44px; margin: 4px 0 14px; }
.check input { width: 22px; height: 22px; }
.btn { display: block; width: 100%; min-height: 48px; padding: 12px 18px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.btn.small { width: auto; min-height: 40px; padding: 8px 14px; margin: 8px 0; }
.btn.ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.btn:disabled { opacity: .6; cursor: progress; }
.stack > * + * { margin-top: 10px; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.notice { padding: 10px 12px; border-radius: 10px; margin: 0 0 12px; font-size: 15px; }
.notice.error { background: #fdecea; color: var(--danger); }
.notice.ok { background: #e6f4ec; color: var(--ok); }
.qr { width: min(260px, 70vw); margin: 8px auto; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.code { font: 700 20px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; margin: 8px 0 0; }
.points { font-size: 18px; margin: 0 0 10px; }
.points strong { font-size: 40px; color: var(--brand); }
.bar { height: 12px; background: #e6eeea; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--brand); border-radius: 99px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.offer .badge { display: inline-block; background: var(--brand); color: #fff; border-radius: 99px; padding: 2px 12px; font-weight: 700; margin-bottom: 8px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; padding: 14px 8px; min-height: 56px; color: var(--muted); text-decoration: none; font-weight: 600; }
.tabs a.on { color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) { .fill { transition: width .4s ease; } }
@media (prefers-color-scheme: dark) {
  :root { --ink: #e8f0ec; --muted: #a3b3ad; --bg: #101916; --card: #17231f; --line: #2a3a34; color-scheme: dark; }
  input[type=text], input[type=email], input[type=number], select { background: #101916; color: var(--ink); border-color: #3a4d46; }
  .tabs { background: #17231f; }
  .tabs a.on { color: #fff; }
  .points strong { color: var(--ink); }
  .btn.ghost { color: var(--ink); border-color: var(--ink); }
  .notice.error { background: #3a1b18; color: #ffb4ab; } .notice.ok { background: #153326; color: #8fd9b0; }
}

/* Stili aggiuntivi del gestionale del personale (si sommano a app.css). */
.wrap { max-width: 720px; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.who { font-size: 13px; opacity: .9; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
.member { padding: 12px 0; border-top: 1px solid var(--line); }
.member:first-of-type { border-top: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions select { width: auto; min-height: 40px; padding: 6px 10px; }
.linkbtn { background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 600; color: var(--brand); text-decoration: underline; cursor: pointer; text-align: left; min-height: 32px; }
.pick li { align-items: center; }
.codes { list-style: none; margin: 12px 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes li { font: 700 17px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; padding: 10px; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.code.small { font-size: 13px; word-break: break-all; letter-spacing: 0; }
input[type=search], input[type=tel], input[type=password] { width: 100%; font: inherit; padding: 12px 14px; min-height: 48px; border: 1px solid #b9c7c1; border-radius: 12px; background: #fff; color: var(--ink); }
#toasts { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; z-index: 50; pointer-events: none; }
.toast { max-width: 560px; margin: 6px auto; box-shadow: 0 4px 16px rgba(0,0,0,.18); pointer-events: auto; }
dialog { width: min(440px, calc(100vw - 24px)); border: 0; border-radius: 16px; padding: 20px; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog video { width: 100%; border-radius: 12px; background: #000; margin: 8px 0; }
@media (prefers-color-scheme: dark) {
  input[type=search], input[type=tel], input[type=password] { background: #101916; color: var(--ink); border-color: #3a4d46; }
  .codes li { background: #101916; }
}

/* Stili aggiuntivi della console (si sommano a app.css e admin.css, uniti dalla costruzione). */
.wrap { max-width: 980px; }
.wrap.narrow { max-width: 460px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.topnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topnav a { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; opacity: .85; }
.topnav a.on { background: rgba(255,255,255,.18); opacity: 1; }
.bar-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.bar-title .btn { width: auto; }
.tablewrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-size: 13px; color: var(--muted); }
td a { font-weight: 600; color: var(--brand); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; margin-right: 6px; }
.pill.ok { background: #e6f4ec; color: #1b6b46; }
.pill.warn { background: #fdecea; color: #b3261e; }
.pill.todo { background: #fff3d6; color: #8a5a00; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.checklist { list-style: none; padding: 0; margin: 8px 0 12px; }
.checklist li { padding: 4px 0; }
.modrow { padding: 6px 0; border-top: 1px solid var(--line); }
.modrow .hint { margin: 0 0 0 32px; }
h3 { font-size: 15px; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input[type=color] { width: 72px; min-height: 44px; padding: 2px; border: 1px solid #b9c7c1; border-radius: 10px; background: #fff; }
input[type=datetime-local] { width: 100%; font: inherit; padding: 12px 14px; min-height: 48px; border: 1px solid #b9c7c1; border-radius: 12px; background: #fff; color: var(--ink); }
details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; }
#app { padding-bottom: 40px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) {
  .pill.ok { background: #153326; color: #8fd9b0; } .pill.warn { background: #3a1b18; color: #ffb4ab; } .pill.todo { background: #3a2f12; color: #f2cf7a; }
  input[type=datetime-local], input[type=color] { background: #101916; color: var(--ink); border-color: #3a4d46; }
}
