:root{
  --bg:#f6f6f7;
  --text:#1f2328;
  --muted:#6b7280;

  /* Questi tre vengono sovrascritti da index.php/admin.php via <style> */
  --brand1:#1d1d9c;
  --brand2:#2f2fc1;
  --brand1-rgb:29,29,156;
  --brand2-rgb:47,47,193;
  --title-alpha:.88;

  --adminbar:#2f3f50;
  --footer:#2f3f50;

  --card:#ffffff;
  --border:#e5e7eb;
  --shadow:0 10px 30px rgba(0,0,0,.08);

  --radius:14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Noto Sans",Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

a{color:inherit}
img{max-width:100%;display:block}

/* --------- Shared --------- */
.container{
  width:min(1080px,calc(100% - 48px));
  margin:0 auto;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:22px;
}

.hr{
  height:1px;
  background:var(--border);
  margin:26px 0;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 16px;
  border-radius:10px;
  border:1px solid transparent;
  text-decoration:none;
  cursor:pointer;
  font-weight:700;
  font-size:14px;
  user-select:none;
}
.btn:disabled{opacity:.6;cursor:not-allowed}

.btn-primary{background:var(--brand2);color:#fff}
.btn-primary:hover{filter:brightness(.95)}

.btn-secondary{background:#eef2f7;border-color:#dbe3ef;color:#2f3f50}
.btn-secondary:hover{filter:brightness(.98)}

.btn-danger{background:#c81e1e;color:#fff}
.btn-danger:hover{filter:brightness(.95)}

.btn-success{background:#2ea44f;color:#fff}
.btn-success:hover{filter:brightness(.95)}

.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  font-size:12px;
  color:#334155;
  background:#fff;
}

/* --------- Frontend (index) --------- */
.hero{
  color:#fff;
  padding:52px 0 46px;
  text-align:center;
  background-image:
    linear-gradient(90deg,
      rgba(var(--brand2-rgb), var(--title-alpha)),
      rgba(var(--brand1-rgb), var(--title-alpha))
    ),
    var(--hero-bg, none);
  background-size:cover;
  background-position:center;
}
.hero h1{
  margin:0;
  font-family:Georgia,"Times New Roman",serif;
  font-size:44px;
  letter-spacing:.2px;
}
.hero p{
  margin:10px 0 0;
  font-style:italic;
  opacity:.95;
}

/* ---- Menu solo in alto (dentro l'header) ---- */
.site-nav,
.site-subnav{
  margin-top:18px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
}

.site-nav a,
.site-subnav a{
  border:1px solid rgba(255,255,255,.45);
  background:rgba(255,255,255,.10);
  color:#fff;
  padding:10px 16px;
  border-radius:999px;
  text-decoration:none;
  font-weight:900;
  font-size:13px;
  backdrop-filter: blur(6px);
}

.site-nav a.active,
.site-subnav a.active{
  background:rgba(255,255,255,.92);
  color:#111827;
  border-color:rgba(255,255,255,.92);
}

.site-nav a:hover,
.site-subnav a:hover{
  filter:brightness(1.05);
}

/* ---- Titolo sezione (opzionale, leggero) ---- */
.section-head{
  margin-bottom:16px;
}
.section-head h2{
  margin:0;
  font-family:Georgia,"Times New Roman",serif;
  font-size:30px;
  color:#0f172a;
}
.section-head p{
  margin:6px 0 0;
  color:#64748b;
  font-weight:800;
}


.navline{
  background:#fff;
  border-bottom:1px solid var(--border);
  box-shadow:0 6px 14px rgba(0,0,0,.05);
}
.navline .bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 0;
  gap:12px;
}
.crumb{
  font-weight:900;
  color:#0f172a;
}
.nav-actions{display:flex;gap:10px;align-items:center}

.main{
  padding:40px 0 72px;
  min-height:calc(100vh - 330px);
}

.empty{
  text-align:center;
  color:#111827;
  font-family:Georgia,"Times New Roman",serif;
  font-size:24px;
  margin-top:30px;
}

.cat-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:18px;
}
@media (max-width: 720px){.cat-grid{grid-template-columns:1fr}}

.cat-card{
  text-decoration:none;
  display:block;
  padding:20px;
}
.cat-title{
  font-family:Georgia,"Times New Roman",serif;
  font-size:26px;
  margin:0 0 6px;
}
.cat-sub{
  color:#64748b;
  font-weight:700;
  font-size:13px;
}

.home-card{padding:0; overflow:hidden}
.home-img{
  border-bottom:1px solid var(--border);
  background:#f3f4f6;
}
.home-img img{
  width:100%;
  max-height:420px;
  object-fit:cover;
}
.home-html{
  padding:22px;
  line-height:1.5;
  color:#0f172a;
}
.home-html h2, .home-html h3{
  font-family:Georgia,"Times New Roman",serif;
}
.home-html a{color:var(--brand2);font-weight:800}
.home-html ul{padding-left:22px}

.grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:20px;
}
@media (max-width: 980px){.grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width: 640px){.grid{grid-template-columns:1fr}}

.product{padding:0; overflow:hidden;}
.product .img{
  height:160px;
  background:#f3f4f6;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
}
.product .img img{
  width:100%;
  height:160px;
  object-fit:cover;
}
.img-ph{
  color:#94a3b8;
  font-weight:900;
  letter-spacing:.5px;
}
.product .body{padding:16px;}
.product .title{
  margin:0;
  font-size:18px;
  font-family:Georgia,"Times New Roman",serif;
}
.product .desc{
  margin:8px 0 14px;
  color:#475569;
  font-size:14px;
  line-height:1.35;
  min-height:38px;
}
.product .row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.product .price{
  font-weight:900;
  color:#111827;
}

/* --------- Footer --------- */
.footer{
  background:var(--footer);
  color:#e6edf3;
  padding:18px 0;
  font-size:13px;
  text-align:center;
}

/* --------- Admin --------- */
.topbar{
  background:var(--adminbar);
  color:#fff;
}
.topbar .bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 0;
  gap:16px;
}
.topbar h1{
  margin:0;
  font-family:Georgia,"Times New Roman",serif;
  font-size:34px;
  letter-spacing:.2px;
}
.topbar .right{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.topbar .welcome{
  opacity:.95;
  font-size:14px;
}

.admin-main{
  padding:28px 0 48px;
  min-height:calc(100vh - 130px);
}

.admin-tabs{
  margin-top:18px;
  margin-bottom:14px;
  display:flex;
  justify-content:flex-start;
  gap:12px;
  padding:10px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:0 6px 14px rgba(0,0,0,.05);
  flex-wrap:wrap;
}
.admin-tabs a{
  border:1px solid #d7d7d7;
  background:#fff;
  color:#344054;
  padding:10px 18px;
  border-radius:999px;
  text-decoration:none;
  font-weight:800;
  font-size:13px;
}
.admin-tabs a.active{
  background:var(--adminbar);
  border-color:var(--adminbar);
  color:#fff;
}

.flash{
  margin-top:16px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  font-weight:700;
}
.flash.ok{background:#ecfdf3;border-color:#abefc6;color:#027a48}
.flash.err{background:#fff1f3;border-color:#fecdd3;color:#b42318}

.form-wrap h2,
.card h2{
  margin:0 0 14px;
  font-family:Georgia,"Times New Roman",serif;
  font-size:28px;
}

.form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px 18px;
}
@media (max-width: 720px){.form-grid{grid-template-columns:1fr}}

.field label{
  display:block;
  font-weight:800;
  font-size:13px;
  margin-bottom:7px;
  color:#0f172a;
}
.field small{
  display:block;
  color:#64748b;
  margin-top:7px;
  font-size:12px;
}

input[type="text"],
input[type="number"],
select,
textarea{
  width:100%;
  padding:12px 12px;
  border:1px solid #d0d5dd;
  border-radius:10px;
  outline:none;
  background:#fff;
  font-size:14px;
}
textarea{
  min-height:140px;
  resize:vertical;
}
input[type="file"]{
  width:100%;
  padding:10px 0;
}

input:focus, select:focus, textarea:focus{
  border-color:#c66;
  box-shadow:0 0 0 3px rgba(193,47,47,.15);
}

.actions{
  display:flex;
  gap:10px;
  margin-top:16px;
  flex-wrap:wrap;
}

.preview{
  margin-top:10px;
  border-radius:14px;
  border:1px solid var(--border);
  box-shadow:0 6px 18px rgba(0,0,0,.06);
  max-height:260px;
  object-fit:cover;
}

/* Table */
.table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}
.table th, .table td{
  padding:12px 12px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:middle;
}
.table thead th{
  background:#f8fafc;
  font-weight:900;
  color:#0f172a;
}
.actions-td{white-space:nowrap}

/* QRAuth section */
.qrauth-wrap{
  padding:26px;
  text-align:center;
}
.qrauth-title{
  margin:0;
  font-family:Georgia,"Times New Roman",serif;
  font-size:30px;
}
.qrauth-sub{
  margin:10px 0 0;
  color:#64748b;
}
.qr{
  margin:18px auto 0;
  width:260px;
  height:260px;
  border-radius:18px;
  border:1px solid var(--border);
  background:#fff;
  padding:10px;
}
.qrauth-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}
@media (max-width: 900px){.qrauth-grid{grid-template-columns:1fr}}
