/* FlowWedding — stile di pannello, configuratore e vetrina.
   I colori del marchio (--brand, --accent) arrivano da brand_css_vars(): cambiano per ogni location in white label. */
@font-face { font-family: 'Jost'; src: url('../fonts/jost-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('../fonts/cormorant-garamond-latin-wght-normal.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
  --brand: #2f4a3a; --brand-ink: #fff; --brand-soft: #eaeee9;
  --accent: #b08d57; --accent-ink: #1f1b16; --accent-soft: #f3ece0;
  --bg: #faf7f2;
  --bg-2: #f3eee6;
  --card: #ffffff;
  --ink: #26221d;
  --muted: #6f665b;
  --line: rgb(38 34 29 / 0.12);
  --line-2: rgb(38 34 29 / 0.07);
  --ok: #2c6e49; --ok-bg: #e5f2ea;
  --warn: #8a5a00; --warn-bg: #fdf1d8;
  --err: #a33a2a; --err-bg: #fbe8e4;
  --f-ui: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-display: 'Cormorant Garamond', Georgia, serif;
  --r: 14px;
  --shadow: 0 1px 2px rgb(38 34 29 / .05), 0 8px 24px -16px rgb(38 34 29 / .25);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--f-ui); }
a { color: var(--brand); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0; }
h1, h2 { font-family: var(--f-display); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline { display: inline; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  border-radius: 999px; padding: 11px 20px; font-weight: 500; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none; min-height: 44px; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); filter: none; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: transparent; color: var(--err); border-color: rgb(163 58 42 / .4); }
.btn.danger:hover { background: var(--err-bg); filter: none; }
.btn.small { padding: 6px 14px; min-height: 34px; font-size: 14px; }
.btn.tiny { padding: 3px 10px; min-height: 28px; font-size: 13px; }
.btn.link { background: none; border: 0; color: var(--brand); padding: 0; min-height: 0; text-decoration: underline; text-underline-offset: 3px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: none; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink); }
.icon-btn.plain { border: 0; background: none; }
.icon-btn:hover { background: var(--bg-2); }
.icon-btn .ic { width: 18px; height: 18px; }

/* ---------- moduli ---------- */
.f { display: grid; gap: 5px; font-size: 14px; font-weight: 500; min-width: 0; }
.f > span em, .f .opt { font-style: normal; font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); min-height: 44px; font-size: 15px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=color] { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--card); cursor: pointer; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.row.tight { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stack { display: grid; gap: 14px; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 12px; }
legend { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 0; margin-bottom: 8px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; cursor: pointer; background: var(--card); }
.chips input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.chips label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--card); flex-wrap: wrap; gap: 2px; }
.seg a, .seg button, .seg label { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--muted); }
.seg [aria-current], .seg [aria-pressed="true"], .seg label:has(input:checked) { background: var(--brand); color: var(--brand-ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- messaggi ---------- */
.flash { border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; font-size: 15px; background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.note { border-radius: 12px; padding: 12px 16px; font-size: 14px; background: var(--accent-soft); color: var(--ink); }
.note.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- etichette ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 500; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.no { background: var(--err-bg); color: var(--err); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.accent { background: var(--accent-soft); color: #6b5226; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- schede e griglie ---------- */
.card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h2 { font-size: 24px; }
.card-h h3 { font-size: 17px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid > .card + .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.stat { display: grid; gap: 2px; }
.stat b { font: 600 34px/1.1 var(--f-display); font-variant-numeric: lining-nums tabular-nums; }
.stat span { color: var(--muted); font-size: 14px; }
.stat small { font-size: 13px; color: var(--muted); }
.meter { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; background: var(--brand); }
.meter i.ok { background: var(--ok); }
.meter i.no { background: #c9a59d; }
.meter i.acc { background: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty .ic { width: 36px; height: 36px; color: var(--accent); }
.empty b { color: var(--ink); font-size: 17px; font-weight: 500; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.spacer { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- tabelle (su telefono diventano schede) ---------- */
.tbl-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.r, table.list th.r { text-align: right; }
table.list tr.sub td { background: var(--bg); font-size: 14px; }
table.list .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 720px) {
  table.list.cards thead { display: none; }
  table.list.cards, table.list.cards tbody, table.list.cards tr, table.list.cards td { display: block; width: 100%; }
  table.list.cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--card); }
  table.list.cards td { border: 0; padding: 4px 0; display: flex; gap: 10px; justify-content: space-between; text-align: right; }
  table.list.cards td::before { content: attr(data-l); color: var(--muted); font-size: 13px; text-align: left; }
  table.list.cards td[data-l=""]::before { content: none; }
  table.list.cards td.main { font-weight: 600; text-align: left; justify-content: flex-start; }
  table.list.cards .actions { justify-content: flex-end; }
}

/* ---------- finestre ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45); color: var(--ink); background: var(--card); }
dialog::backdrop { background: rgb(28 24 20 / .45); }
dialog .dlg { padding: 22px; display: grid; gap: 14px; }
dialog .dlg-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
dialog .dlg-h h2 { font-size: 26px; }
dialog.wide { width: min(820px, calc(100vw - 24px)); }

/* ---------- area riservata ---------- */
.as-bar { background: var(--accent); color: var(--accent-ink); padding: 8px 16px; font-size: 14px; text-align: center; }
.as-bar a { color: inherit; font-weight: 600; margin-left: 8px; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; gap: 14px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.side-close { display: none; }
.brandmark { display: inline-flex; align-items: center; text-decoration: none; color: var(--brand); font: 600 24px/1 var(--f-display); letter-spacing: -.01em; min-height: 36px; }
.brandmark img { max-height: 40px; max-width: 170px; width: auto; display: block; }
.side-couple { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.side-couple b { font: 600 20px/1.15 var(--f-display); color: var(--brand); }
.side-couple span { font-size: 13px; color: var(--muted); }
.side-couple .side-count { color: var(--brand); font-weight: 500; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-foot a, .side-foot button { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; border: 0; background: none; cursor: pointer; width: 100%; text-align: left; }
.side-nav a:hover, .side-foot a:hover, .side-foot button:hover { background: var(--bg-2); }
.side-nav a[aria-current] { background: var(--brand); color: var(--brand-ink); }
.side-nav .ic { width: 19px; height: 19px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 2px; }
.side-foot form { margin: 0; }
.topbar { display: none; }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1180px; width: 100%; }
.main.wide { max-width: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(32px, 4vw, 42px); }
.page-head .sub { color: var(--muted); margin-top: 4px; max-width: 62ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-scrim { display: none; }
@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-105%); transition: transform .25s ease; box-shadow: 0 0 40px rgb(0 0 0 / .2); }
  body.nav-open .side { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgb(28 24 20 / .35); z-index: 40; }
  .side-close { display: inline-grid; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .topbar-title { font: 600 20px/1 var(--f-display); }
  .main { padding: 20px 16px 60px; }
}

/* ---------- pagine pubbliche ---------- */
.pub-bar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
.pub-bar-in { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.pub-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 15px; }
.pub-nav > a:not(.btn) { color: var(--ink); text-decoration: none; }
.pub-foot { border-top: 1px solid var(--line); margin-top: 60px; background: var(--card); }
.pub-foot-in { max-width: 1180px; margin: 0 auto; padding: 28px 20px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.pub-foot-in p { color: var(--muted); margin-top: 4px; }
.pub-foot-links { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.pub-foot-links a { color: var(--ink); }
.narrow { max-width: 460px; margin: 48px auto; padding: 0 16px; }
.narrow h1 { font-size: 40px; margin-bottom: 6px; }
.narrow .lead { color: var(--muted); margin-bottom: 22px; }

@media print {
  .side, .topbar, .as-bar, .page-actions, .toolbar, .no-print, .flash, .pub-bar, .pub-foot { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .main { padding: 0; max-width: none; }
}

/* telefoni stretti: barra delle pagine pubbliche senza sbordare */
@media (max-width: 420px) {
  .pub-bar-in { padding: 10px 14px; gap: 10px; }
  .pub-nav { gap: 10px; font-size: 14px; }
  .pub-nav .btn.small { padding: 6px 12px; font-size: 13px; }
  .brandmark img { max-width: 120px; max-height: 34px; }
}
.stack > .card + .card { margin-top: 0; }
