/* Colori e misure: gli stessi del sito. I colori del marchio stanno anche in src/config/brand.js */
:root {
  --header: #f5f5f4;
  --panel: #e0d3b3;
  --gold: #a89660;
  --ink: #1c1c1a;
  --muted: #6b6a64;
  --bg: #ffffff;
  --card: #ffffff;
  --line: #d9d6cc;
  --accent: #2563eb;
  --danger: #b42318;
  --radius: 8px;
  --gutter: 16px;
  --font: 'Didact Gothic', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}
img { max-width: 100%; }
a { color: inherit; }
h1 { font-weight: 400; font-size: 1.6rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }

/* Pulsanti: principale nero, secondario col bordo oro, come sul sito */
.btn {
  font: inherit; cursor: pointer; border-radius: 4px; padding: .7rem 1.4rem;
  border: 3px solid var(--gold); background: #fff; color: var(--gold); text-transform: uppercase;
  min-height: 44px;
}
.btn-primary { border-color: var(--ink); color: var(--ink); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn:focus-visible, .nav-link:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Accesso */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--gutter); background: var(--header); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: var(--radius); padding: 28px 24px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.login-logo { display: block; height: 56px; margin: 0 auto 20px; }
.login form { display: grid; gap: 14px; margin-top: 16px; }
.login label { display: grid; gap: 6px; font-size: .95rem; }
input {
  font: inherit; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 4px; min-height: 44px; width: 100%;
  background: #fff; color: var(--ink);
}
.form-error { color: var(--danger); margin: 0; }

/* Intestazione */
.dev-banner { background: #fde68a; color: #713f12; text-align: center; font-size: .85rem; padding: 4px var(--gutter); }
.header {
  background: var(--header); padding: 12px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.brand-logo { height: 44px; display: block; }
.menu-toggle { font: inherit; background: none; border: 1px solid var(--line); border-radius: 4px; padding: .5rem .9rem; min-height: 44px; cursor: pointer; }
.nav { display: none; width: 100%; flex-direction: column; }
.nav.is-open { display: flex; }
.nav-link {
  display: block; padding: 12px 4px; text-decoration: none; border-top: 1px solid var(--line);
  font: inherit; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: inherit; cursor: pointer;
}
.nav-link.is-current { font-weight: 700; }

.content { padding: 20px var(--gutter) 40px; max-width: 1400px; margin: 0 auto; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 18px 20px; }

/* Pagina iniziale */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.tile {
  background: var(--panel); border-radius: var(--radius); padding: 18px 16px; text-decoration: none; min-height: 84px;
  display: flex; align-items: flex-end;
}
.tile:hover { outline: 2px solid var(--gold); }

/* Computer: menu in riga, sempre visibile */
@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .header { flex-wrap: nowrap; padding: 18px 40px; }
  .nav { display: flex; flex-direction: row; width: auto; gap: 4px 20px; flex-wrap: wrap; justify-content: flex-end; }
  .nav-link { border: 0; padding: 6px 2px; }
  .nav-link.is-current { text-decoration: underline; text-underline-offset: 6px; font-weight: 400; }
  .content { padding: 32px 40px 60px; }
  .brand-logo { height: 52px; }
}

/* ---------- Elementi comuni ---------- */
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; }
.btn-small { font: inherit; font-size: .9rem; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: .45rem .8rem; min-height: 40px; cursor: pointer; color: var(--ink); }
.btn-small:disabled { opacity: .5; cursor: default; }
.btn-compact { padding: .5rem 1rem; min-height: 40px; font-size: .9rem; }
select { font: inherit; padding: .5rem; border: 1px solid var(--line); border-radius: 4px; background: #fff; min-height: 40px; color: var(--ink); }
.badge { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: #e7eefc; color: #1e3a8a; vertical-align: middle; margin-left: 4px; white-space: nowrap; }
.badge.warn { background: #fdecc8; color: #7a4b00; }
.notice { background: #fff8e1; border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 4px; margin: 0 0 14px; }
.empty { padding: 24px 0; color: var(--muted); }
.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.toast-error { background: var(--danger); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }

/* ---------- Filtri ---------- */
.quick { display: grid; gap: 14px; background: var(--panel); border-radius: var(--radius); padding: 16px; }
.filter { display: grid; gap: 8px; }
.filter-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.filter-label { font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; background: #fff; border: 2px solid transparent; border-radius: 4px; padding: .45rem .75rem; min-height: 40px; cursor: pointer; color: var(--ink); }
.chip.is-on { border-color: var(--ink); font-weight: 700; }
.range { display: flex; align-items: center; gap: 8px; }
.range input { width: 8rem; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 20px; height: 20px; min-height: 0; }
.switch.small { font-size: .88rem; color: var(--muted); }
.filter-extra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-section { background: var(--panel); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 14px; }
.filter-section h2 { font-size: 1.15rem; font-weight: 400; margin: 0; }

/* pannello «Tutti i filtri»: sul telefono copre lo schermo */
.filters-panel { display: none; }
.filters-panel.is-open {
  display: flex; flex-direction: column; gap: 12px; position: fixed; inset: 0; z-index: 40;
  background: var(--bg); overflow-y: auto; padding: 0 var(--gutter) 90px;
}
.panel-head { position: sticky; top: 0; background: var(--bg); display: flex; gap: 12px; align-items: center; padding: 12px 0; z-index: 1; }
.panel-head h2 { margin: 0 auto 0 0; font-weight: 400; }
.panel-close { font: inherit; font-size: 1.2rem; background: none; border: 1px solid var(--line); border-radius: 4px; width: 44px; height: 44px; cursor: pointer; }
.panel-foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px var(--gutter); background: var(--bg); border-top: 1px solid var(--line); }

.search-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.search-bar .count { margin-right: auto; font-weight: 700; min-width: 8rem; }
.results-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0; }
.results-head > span:first-child { margin-right: auto; }
.selection-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.sel-first { display: inline-flex; gap: 6px; align-items: center; }
.input-n { width: 5.5rem; min-height: 40px; }
.sel-count { font-weight: 700; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 18px 0; }

/* risultati: tabella sul computer, schede sul telefono */
.only-desktop { display: none; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table.results { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.results th { background: var(--header); text-align: left; font-weight: 400; padding: 8px; position: sticky; top: 0; white-space: nowrap; }
table.results td { padding: 7px 8px; border-top: 1px solid var(--line); }
table.results tr:hover td { background: #faf8f2; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.card { position: relative; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.card-select { position: absolute; top: 8px; left: 8px; z-index: 1; background: #fff; border-radius: 4px; padding: 4px; }
.card-select input { width: 22px; height: 22px; min-height: 0; }
.card-link { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px; text-decoration: none; }
.card-img { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; background: var(--header); }
.card-title { font-weight: 700; }
.card-price { font-size: 1.15rem; font-weight: 700; margin-top: 4px; }

/* ---------- Scheda della pietra ---------- */
.back { display: inline-block; margin-bottom: 12px; }
.stone-layout { display: grid; gap: 20px; }
.stone-gallery { display: grid; gap: 10px; align-content: start; }
.stone-media { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--header); border-radius: 6px; }
.stone-media.placeholder { display: grid; place-items: center; color: var(--muted); }
.stone-sub { color: var(--muted); margin-top: 0; }
.price-box { background: var(--panel); border-radius: 6px; padding: 14px 16px; margin: 12px 0; display: grid; gap: 4px; }
.price-total { font-size: 1.6rem; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.actions .btn { text-decoration: none; display: inline-flex; align-items: center; }
.specs { display: grid; grid-template-columns: 1fr; margin: 0; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 9.5rem 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pairs { margin-top: 24px; }
.pairs h2 { font-weight: 400; }
.pair-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.pair { border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: grid; gap: 4px; }
.pair a { text-decoration: none; }
.pair-actions { margin-top: 6px; }

@media (min-width: 900px) {
  .only-desktop { display: block; }
  .only-phone { display: none; }
  .cert-layout { display: grid; grid-template-columns: 1fr; }
  .cert-layout:has(.filters-panel.is-open) { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
  .filters-panel.is-open { position: static; padding: 0; max-height: calc(100vh - 140px); position: sticky; top: 20px; z-index: auto; }
  .panel-foot { position: static; border: 0; padding: 0; }
  .stone-layout { grid-template-columns: minmax(280px, 440px) 1fr; gap: 36px; }
  .specs { grid-template-columns: 1fr 1fr; column-gap: 28px; }
}
