:root {
  /* Palette ufficiale LA BIOMEDICA (dal logo) */
  --teal: #2d608f;        /* blu primario del marchio */
  --teal-dark: #24506f;   /* blu scuro (hover) */
  --teal-050: #eaf1f8;    /* velatura blu chiara */
  --brand-100: #b2d1ef;   /* blu chiaro del pattern */
  --brand-300: #83afd6;   /* blu medio del pattern */
  --brand-secondario: #2d608f;      /* colore secondario configurabile */
  --brand-secondario-050: #eaf1f8;
  --brand-terziario: #2d608f;       /* colore terziario configurabile */
  --brand-terziario-050: #eaf1f8;
  --accent: #d81c17;      /* rosso accento (i 4 quadratini) */
  --accent-dark: #b31812;
  --ink: #1a3a52;
  --muted: #5c7280;
  --line: #dbe4ec;
  --bg: #f4f7fa;
  --white: #ffffff;
  --ok: #1a9c6b;
  --warn: #c9781a;
  --err: #d81c17;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(16, 50, 58, .06);
  /* Testi in Inter se disponibile, altrimenti font di sistema (offline, GDPR-friendly).
     Per il match pixel-perfect: metti inter.woff2 in /assets e attiva @font-face qui sotto. */
  font-family: "Inter", "Inter Variable", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Per incorporare il vero Inter self-hosted, scarica inter.woff2 in app/frontend/assets/
   e togli il commento a questo blocco:
@font-face {
  font-family: "Inter";
  src: url("/assets/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
*/

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--white); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark { flex: none; height: 42px; width: auto; display: block; }
.brand__word { height: 40px; width: auto; max-width: 60vw; object-fit: contain; display: block; }
@media (max-width: 420px) {
  .brand__mark { height: 34px; }
  .brand__word { height: 32px; max-width: 56vw; }
}
.account-btn {
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-weight: 600; cursor: pointer;
}

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto;
  background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 59px; z-index: 9; }
.tab {
  border: 0; background: transparent; color: var(--muted); font-weight: 600;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tab.is-active { background: var(--teal-050); color: var(--teal-dark); }

/* Layout */
.app { max-width: 760px; margin: 0 auto; padding: 18px 16px 60px; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
h1 { font-size: 22px; margin: 4px 0 2px; color: var(--teal); }
h2 { font-size: 17px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.muted { color: var(--muted); }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--teal-050); border-color: var(--teal); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

button.primary {
  width: 100%; margin-top: 16px; padding: 13px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
button.primary:hover { background: var(--accent-dark); }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
button.ghost {
  padding: 9px 14px; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font-weight: 600; cursor: pointer; color: var(--ink);
}
button.ghost:hover { border-color: var(--brand-secondario); color: var(--brand-secondario); }
button.link { border: 0; background: none; color: var(--brand-secondario); font-weight: 600; cursor: pointer; padding: 0; }

/* Slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 8px; }
.slot {
  padding: 10px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  text-align: center; cursor: pointer; font-weight: 600;
}
.slot small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.slot.is-sel { border-color: var(--teal); background: var(--teal-050); color: var(--teal-dark); }

/* Listino / pacchetti / prenotazioni */
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item__meta { display: flex; align-items: center; gap: 10px; }
.price { font-weight: 700; white-space: nowrap; }
.chip {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-terziario-050); color: var(--brand-terziario); font-weight: 600;
}
.loinc { font-size: 11px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.total-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 12px; margin-top: 14px;
}
.total-bar b { font-size: 20px; }

.badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge.ok { background: #e4f6ee; color: var(--ok); }
.badge.warn { background: #fbeedd; color: var(--warn); }
.badge.err { background: #fbe4e4; color: var(--err); }
.badge.neutral { background: #eef2f3; color: var(--muted); }

.code-box {
  text-align: center; padding: 22px; border: 2px dashed var(--teal); border-radius: 14px;
  background: var(--teal-050); margin-top: 12px;
}
.code-box .code { font-size: 30px; font-weight: 800; letter-spacing: 3px; color: var(--teal-dark); }
.qr { margin: 12px auto 0; display: block; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-weight: 600; box-shadow: var(--shadow); z-index: 50; max-width: 90%;
}
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* Modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(16,50,58,.45); display: grid; place-items: center;
  padding: 16px; z-index: 40;
}
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 420px; padding: 22px; }
.modal h2 { margin-bottom: 4px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .big { font-size: 34px; }
.hint { background: #fffdf4; border: 1px solid #f0e6c8; color: #7a6520; padding: 10px 12px;
  border-radius: 10px; font-size: 13px; margin-top: 10px; }

/* Home a riquadri */
.home-hero { padding: 20px 18px; }
.home-hero h1 { margin: 0 0 2px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 3px;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; cursor: pointer; box-shadow: var(--shadow); font: inherit;
  transition: border-color .15s, transform .05s;
}
.tile:hover { border-color: var(--teal); }
.tile:active { transform: scale(.985); }
.tile__ic-box { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; }
.tile__ic { width: 40px; height: 40px; object-fit: contain; display: block; }
.tile__t { font-size: 15px; font-weight: 800; color: var(--ink); }
.tile__s { font-size: 12px; color: var(--muted); line-height: 1.35; }
@media (max-width: 360px) { .tiles { grid-template-columns: 1fr; } }

/* Footer (social + scarica l'app) */
.site-footer { background: var(--teal); color: #fff; margin-top: 34px; padding: 30px 16px 40px; }
.foot-wrap { max-width: 760px; margin: 0 auto; }
.foot-app { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.foot-app > span { font-size: 18px; font-weight: 800; }
.foot-row { display: flex; gap: 12px; flex-wrap: wrap; }
.foot-soc { margin: 18px 0 22px; }
.soc, .appbtn {
  width: 46px; height: 46px; border: 1.6px solid rgba(255, 255, 255, .7); border-radius: 50%;
  display: grid; place-items: center; color: #fff; transition: background .15s, border-color .15s;
}
.soc:hover, .appbtn:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.soc svg, .appbtn svg { display: block; }
.foot-info { font-size: 12px; color: rgba(255, 255, 255, .78); border-top: 1px solid rgba(255, 255, 255, .22); padding-top: 16px; }

/* ---- Cruscotto admin ---- */
.admin-title { font-size: 17px; font-weight: 700; color: var(--teal-dark); letter-spacing: .3px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.stat__n { font-size: 30px; font-weight: 800; color: var(--teal); }
.stat__l { font-size: 13px; color: var(--muted); margin-top: 2px; }
.row-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form { display: flex; flex-direction: column; }
.form textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; resize: vertical; }
.chk { display: flex; align-items: center; gap: 8px; margin: 12px 0 2px; font-weight: 600; font-size: 14px; }
.chk input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions .ghost, .modal-actions .primary { width: auto; }
.cfg { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cfg:last-child { border-bottom: 0; }
.cfg__k { min-width: 180px; flex: 1; word-break: break-word; }
.cfg__v { display: flex; gap: 8px; align-items: center; }
.cfg__v input { min-width: 160px; }
.cfg__v .ghost { width: auto; white-space: nowrap; }
