/* GoldAlert — foglio di stile unico.
   Regole: nessuno stile inline (CSP style-src 'self'), font in rem, nessuno scroll orizzontale. */

:root {
  --oro: #9a7b3a;
  --oro-chiaro: #c9a227;
  --fondo: #faf6ed;
  --card: #ffffff;
  --bordo: #e8e0c8;
  --testo: #1a1a1a;
  --testo-muto: #6b5c42;
  --errore: #a33b2e;
  --ok: #2f6b45;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  font-size: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--testo);
  line-height: 1.55;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

* { max-width: 100%; }

.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 64px; }
.wrap.narrow { max-width: 560px; }

header.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bordo);
  background: var(--fondo);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.bar .inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }

.brand { font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; letter-spacing: 0.3px; color: var(--testo); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--oro); font-style: italic; }

nav.main { display: flex; gap: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
nav.main a { color: var(--testo-muto); text-decoration: none; font-size: 0.88rem; white-space: nowrap; padding: 4px 0; border-bottom: 2px solid transparent; }
nav.main a:hover, nav.main a:focus-visible { color: var(--oro); border-bottom-color: var(--oro); }
nav.main a[aria-current="page"] { color: var(--testo); border-bottom-color: var(--oro); font-weight: 600; }

h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 1.7rem; line-height: 1.25; margin: 28px 0 10px; letter-spacing: -0.2px; }
h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 1.25rem; margin: 32px 0 12px; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.lead { color: var(--testo-muto); font-size: 1rem; margin-bottom: 18px; }
.muted { color: var(--testo-muto); font-size: 0.86rem; }
.small { font-size: 0.8rem; }
.center { text-align: center; }
body.center-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.card {
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.04);
}
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--testo-muto); margin-bottom: 5px; letter-spacing: 0.3px; text-transform: uppercase; }
.field .help { font-size: 0.8rem; color: var(--testo-muto); margin-top: 5px; }

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--testo);
  background: #fffdf8;
  border: 1px solid var(--bordo);
  border-radius: 10px;
  padding: 12px 13px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--oro); outline-offset: 1px; border-color: var(--oro); }
textarea { min-height: 96px; resize: vertical; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; min-width: 0; }

.btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  background: var(--oro);
  color: #fff;
  border: 1px solid var(--oro);
  border-radius: 10px;
  padding: 13px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--oro); }
.btn.danger { background: transparent; color: var(--errore); border-color: #e3c8c3; }
.btn.small { width: auto; padding: 8px 14px; font-size: 0.86rem; }

.msg { padding: 12px 14px; border-radius: 10px; font-size: 0.92rem; margin-bottom: 14px; display: none; }
.msg.err { display: block; background: #fbf0ee; border: 1px solid #e3c8c3; color: var(--errore); }
.msg.ok { display: block; background: #eff6f1; border: 1px solid #c7ddd0; color: var(--ok); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.price-cell { background: #fffdf8; border: 1px solid var(--bordo); border-radius: 10px; padding: 12px; }
.price-cell .cur { font-size: 0.76rem; color: var(--testo-muto); text-transform: uppercase; letter-spacing: 1px; }
.price-cell .val { font-family: Georgia, serif; font-size: 1.12rem; margin-top: 3px; }
.price-cell .unit { font-size: 0.78rem; color: var(--testo-muto); }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--bordo); vertical-align: top; }
th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--testo-muto); font-weight: 700; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.item { border: 1px solid var(--bordo); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: #fffdf8; }
.item .title { font-weight: 600; margin-bottom: 4px; }
.item .meta { font-size: 0.86rem; color: var(--testo-muto); }
.item .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.tag { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--bordo); color: var(--testo-muto); background: #fff; }
.tag.on { border-color: var(--oro); color: var(--oro); }

.total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 4px; border-top: 2px solid var(--oro); margin-top: 12px; }
.total .val { font-family: Georgia, serif; font-size: 1.5rem; }

.pill-nav { display: flex; gap: 8px; margin: 18px 0 6px; }
.pill-nav a { flex: 1; text-align: center; padding: 10px 6px; border: 1px solid var(--bordo); border-radius: 10px; text-decoration: none; color: var(--testo-muto); font-size: 0.88rem; background: #fff; }
.pill-nav a[aria-current="page"] { border-color: var(--oro); color: var(--oro); font-weight: 600; }

.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.check input { width: auto; margin-top: 3px; }
.check label { font-size: 0.92rem; color: var(--testo); text-transform: none; letter-spacing: 0; font-weight: 400; }

footer.legal { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--bordo); font-size: 0.78rem; color: var(--testo-muto); }
footer.legal a { color: var(--oro); }

.gold-line { height: 2px; background: linear-gradient(90deg, var(--oro-chiaro), var(--oro)); border-radius: 2px; margin: 14px 0 22px; }

@media (max-width: 480px) {
  h1 { font-size: 1.45rem; }
  .row > * { flex: 1 1 100%; }
}
