:root {
  --bg: #f6efe6;
  --bg-2: #efe4d6;
  --surface: #ffffff;
  --surface-2: #fbf7f1;
  --ink: #2a1f18;
  --muted: #7e6d5f;
  --line: #eadfd2;
  --brand: #8b3f2a;
  --brand-2: #b8643f;
  --gold: #c99a4b;
  --sold: #3c6e52;
  --sold-soft: #e1efe6;
  --danger: #b03a2e;
  --danger-soft: #f8e4e1;
  --shadow: 0 1px 2px rgba(42, 31, 24, .05), 0 8px 24px rgba(42, 31, 24, .07);
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1410;
    --bg-2: #241a14;
    --surface: #2a1f19;
    --surface-2: #32261e;
    --ink: #f4e9dc;
    --muted: #b3a091;
    --line: #3d2e25;
    --brand: #d9825d;
    --brand-2: #b8643f;
    --sold: #7fbf97;
    --sold-soft: #203a2b;
    --danger: #f08a7e;
    --danger-soft: #3d2320;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(201, 154, 75, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(139, 63, 42, .14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin-bottom: 14px; }
h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.logo {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--gold)); color: #fff;
  font-family: var(--serif); font-size: 1.1rem; box-shadow: 0 4px 12px rgba(139, 63, 42, .3);
}

/* ---------- contenuto ---------- */
.container {
  max-width: 1040px; margin: 0 auto;
  padding: 20px 16px 120px;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--brand-2); font-weight: 700; margin-bottom: 4px; }

.search {
  position: relative; margin-bottom: 14px;
}
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: var(--muted); }
.search input {
  width: 100%; padding: 14px 16px 14px 44px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 16px; box-shadow: var(--shadow); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(184, 100, 63, .18); }

/* ---------- filtri rapidi: barra con bottoni, pannello a scomparsa ---------- */
.filtri-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.filtro-btn, .filtro-azzera {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .9rem; font-weight: 600; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.filtro-btn:hover, .filtro-btn.aperto { border-color: var(--brand-2); }
.filtro-btn .caret { font-size: .75rem; color: var(--muted); transition: transform .15s; }
.filtro-btn.aperto .caret { transform: rotate(180deg); }
.filtro-btn.attivo { padding: 0; gap: 0; background: var(--brand); border-color: var(--brand); color: #fff; }
.filtro-btn.attivo button {
  min-height: 40px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.filtro-btn.attivo button:first-child { padding: 0 6px 0 14px; }
.filtro-btn.attivo .togli { padding: 0 14px 0 8px; font-size: .85rem; opacity: .85; }
.filtro-btn.attivo .togli:hover { opacity: 1; }
.filtro-btn .muted-on { font-weight: 500; opacity: .8; }
.filtro-azzera { background: none; border-color: transparent; color: var(--brand); }
.filtro-btn:focus-visible, .filtro-btn button:focus-visible, .filtro-azzera:focus-visible, .chip:focus-visible {
  outline: none; box-shadow: 0 0 0 4px rgba(184, 100, 63, .25);
}

.filtro-pannello {
  margin: -4px 0 14px; padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  animation: rise .18s ease both;
}
.pannello-cerca {
  width: 100%; margin-bottom: 10px; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit; font-size: 16px; outline: none;
}
.pannello-cerca:focus { border-color: var(--brand-2); }
.chips-wrap {
  display: flex; flex-wrap: wrap; gap: 8px;
  max-height: min(46vh, 340px); overflow-y: auto; overscroll-behavior: contain;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .88rem; max-width: 100%;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.chip[hidden] { display: none; }
.chip:hover { border-color: var(--brand-2); }
.chip .n { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on .n { color: rgba(255, 255, 255, .8); }

/* ---------- griglia pezzi ---------- */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); }
.card:active { transform: scale(.98); }
.card-img { position: relative; aspect-ratio: 1 / 1; background: var(--bg-2); }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.placeholder {
  width: 100%; height: 100%; display: grid; place-items: center; font-size: 2.6rem;
  background: linear-gradient(145deg, var(--bg-2), var(--line));
}
.ribbon {
  position: absolute; top: 10px; left: 10px; font-size: .72rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--sold); color: #fff;
  letter-spacing: .03em;
}
.count {
  position: absolute; right: 10px; bottom: 10px; font-size: .72rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff;
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-body h3 { font-family: var(--serif); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body .sub { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
.card-foot { margin-top: auto; padding-top: 8px; }
.price { font-weight: 700; color: var(--brand); }
.is-sold .price { color: var(--sold); }

.empty {
  grid-column: 1 / -1; text-align: center; padding: 56px 20px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.empty .big { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.loading { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- pannelli ---------- */
.stack { display: grid; gap: 16px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.full { grid-column: 1 / -1; }

/* ---------- campi ---------- */
.field { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 500; }
input[type="text"], input[type="date"], input[type="number"], input:not([type]) {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(184, 100, 63, .16); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 10px; }

/* interruttore */
.switch { position: relative; display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--line);
  transition: background .2s; flex: 0 0 46px;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--sold); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(60, 110, 82, .25); }
.sale-fields[hidden] { display: none; }
.sale-fields { margin-top: 16px; }

/* foto */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-bottom: 14px; }
.photo-grid:empty { display: none; }
.photo-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden; background: var(--bg-2); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .x {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(20, 12, 8, .7); color: #fff; font-size: 17px; line-height: 1; cursor: pointer;
}
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
  background: var(--surface); color: var(--ink); border-color: var(--line);
  transition: transform .1s, filter .15s, background .15s;
  text-align: center;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.small { padding: 8px 14px; font-size: .88rem; border-radius: 999px; }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 6px 16px rgba(139, 63, 42, .28);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.soft { background: var(--surface-2); color: var(--brand); border-color: var(--line); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.block { width: 100%; }

.form-bar {
  position: sticky; bottom: 92px; display: flex; gap: 10px; justify-content: flex-end;
  padding: 12px; border-radius: 20px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.form-bar .btn.primary { min-width: 180px; }

/* ---------- dettaglio ---------- */
.back-btn { display: inline-flex; margin: 2px 0 6px; }
.detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.badge {
  display: inline-block; font-size: .78rem; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: var(--bg-2); color: var(--brand);
}
.badge.sold { background: var(--sold-soft); color: var(--sold); }
.gallery {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img {
  /* la foto intera, nella sua proporzione, entro la pagina; un clic la ingrandisce */
  flex: 0 0 100%; width: 100%; height: auto; max-height: 72vh; object-fit: contain; cursor: zoom-in;
  border-radius: var(--radius); scroll-snap-align: center; box-shadow: var(--shadow); background: var(--bg-2);
}
.gallery-count { text-align: center; font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.hero-empty {
  aspect-ratio: 4 / 3; border-radius: var(--radius); display: grid; place-items: center; align-content: center;
  gap: 6px; background: linear-gradient(145deg, var(--bg-2), var(--line)); font-size: 3rem; color: var(--muted);
}
.hero-empty span { font-size: .95rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.panel-sold { border-color: color-mix(in srgb, var(--sold) 35%, var(--line)); }
.actions { display: flex; gap: 10px; margin-top: 4px; }
.actions .btn { flex: 1; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 8px 26px; }
.timeline li::before {
  content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--gold);
}
.timeline li:first-child::before { border-color: var(--brand); background: var(--brand); }
.timeline strong { font-size: 1.02rem; }

/* ---------- riepilogo ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: grid; gap: 6px; align-content: start;
}
.stat .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.hero {
  grid-column: 1 / -1; color: #fff; border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2) 60%, var(--gold));
}
.stat.hero .label, .stat.hero .sub { color: rgba(255, 255, 255, .8); }
.stat.hero .value { font-size: 2.1rem; }
.stat.positive .value { color: var(--sold); }
.stat.negative .value { color: var(--danger); }

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ranking li {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; background: var(--surface-2);
}
.ranking .pos {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; background: var(--bg-2); color: var(--brand);
}
.ranking li:first-child .pos { background: linear-gradient(135deg, var(--gold), #e7c27d); color: #3b2a12; }
.ranking .price { white-space: nowrap; }

.bars { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 6px; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: .95rem; }
.bar-top .muted { font-weight: 400; font-size: .82rem; }
.bar-track { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-2), var(--gold));
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}

/* ---------- grafici del riepilogo ---------- */
:root {
  --viz-mark: #b8643f;   /* serie unica (validato su #fff) */
  --viz-pos: #2f6fb0;    /* divergente: guadagno */
  --viz-neg: #b8643f;    /* divergente: perdita */
}
@media (prefers-color-scheme: dark) {
  :root { --viz-mark: #d9825d; --viz-pos: #5b9bd8; --viz-neg: #d9825d; }
}
.sez-titolo { font-family: var(--serif); font-size: 1.25rem; margin: 6px 0 12px; }
@media (min-width: 720px) { .stats.stats-3 { grid-template-columns: repeat(3, 1fr); } }
.viz-grid-layout { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 820px) {
  .viz-grid-layout { grid-template-columns: 1fr 1fr; }
  .viz-wide { grid-column: 1 / -1; }
}
.viz-panel { min-width: 0; }
.viz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.viz-head h2 { margin: 0; }
.viz-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg-2); }
.viz-seg button {
  min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: none; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 600;
}
.viz-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.hbars, .dbars { display: grid; gap: 2px; }
.hbar, .dbar {
  display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: 10px;
  padding: 6px 4px; border-radius: 8px; outline: none; cursor: default;
}
.hbar:hover, .hbar:focus-visible, .dbar:hover, .dbar:focus-visible { background: var(--surface-2); }
.hbar-label { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-val { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hbar-track { height: 12px; }
.hbar-fill { display: block; height: 100%; background: var(--viz-mark); border-radius: 0 4px 4px 0; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.dbar-track { position: relative; height: 12px; }
.dbar-track::before { content: ''; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 1px; background: var(--muted); opacity: .6; }
.dbar-fill { position: absolute; top: 0; bottom: 0; }
.dbar-fill.pos { background: var(--viz-pos); border-radius: 0 4px 4px 0; }
.dbar-fill.neg { background: var(--viz-neg); border-radius: 4px 0 0 4px; }
.viz-panel > p + .dbars { margin-top: 12px; }
.viz-key { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; }
.viz-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.viz-key i.pos { background: var(--viz-pos); }
.viz-key i.neg { background: var(--viz-neg); }

.viz-box { margin-top: 10px; touch-action: pan-y; }
.viz-svg { display: block; overflow: visible; }
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-line { fill: none; stroke: var(--viz-mark); stroke-width: 2; stroke-linejoin: round; }
.viz-dot-end { fill: var(--viz-mark); stroke: var(--surface); stroke-width: 2; }
.viz-cross-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.viz-dot { fill: var(--viz-mark); stroke: var(--surface); stroke-width: 2; }
.viz-hit { fill: transparent; cursor: crosshair; }
.viz-dati { margin-top: 10px; font-size: .85rem; }
.viz-dati summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.viz-dati table { margin-top: 8px; border-collapse: collapse; width: 100%; }
.viz-dati th, .viz-dati td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.viz-tip {
  position: fixed; z-index: 80; max-width: min(320px, calc(100vw - 16px)); pointer-events: none;
  padding: 7px 10px; border-radius: 8px; background: var(--ink); color: var(--surface);
  font-size: .8rem; line-height: 1.35; box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.viz-tip[hidden] { display: none; }

/* ---------- prenotazioni / pacchi ---------- */
:root { --reserved: #85590c; --reserved-soft: #fbf0d9; }
@media (prefers-color-scheme: dark) { :root { --reserved: #e3b866; --reserved-soft: #3a2e17; } }
.badge.reserved { background: var(--reserved-soft); color: var(--reserved); }
.ribbon.reserved { background: var(--reserved); }
.panel-reserved { border-color: color-mix(in srgb, var(--reserved) 40%, var(--line)); background: color-mix(in srgb, var(--reserved-soft) 45%, var(--surface)); }
.panel-reserved a { color: var(--reserved); }
.pacchi-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pacco-card {
  display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.pacco-card:hover { border-color: var(--brand-2); transform: translateY(-1px); }
.pacco-card.is-shipped { opacity: .85; }
.pacco-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pacco-dest { font-size: .92rem; }
.pacco-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.pacco-thumbs .more { display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--muted); }
.pacco-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: .9rem; }
.small-empty { padding: 22px 16px; }
.grid-4 { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 16px; resize: vertical;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); outline: none;
}
textarea:focus, input[type="tel"]:focus, input[type="email"]:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(184, 100, 63, .16); }
input[type="tel"], input[type="email"] {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); outline: none;
}
.form-bar .spacer { flex: 1; }
.pacco-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pacco-lista li {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: 8px; border-radius: 12px; background: var(--surface-2);
}
.pacco-lista .cinfo, .scelta-lista .cinfo { display: grid; gap: 2px; min-width: 0; }
.pacco-lista .cinfo strong, .scelta-lista .cinfo strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prezzo-pacco { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.prezzo-pacco input { width: 104px; padding: 9px 10px; text-align: right; }
.form-bar .btn { white-space: nowrap; }
@media (max-width: 480px) {
  .form-bar { flex-wrap: wrap; }
  .form-bar #spedisci { flex: 1 1 100%; order: -1; }
  .form-bar .spacer { display: none; }
  .form-bar #elimina-pacco, .form-bar #salva-pacco { flex: 1; min-width: 0; }
}
.x-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; flex: none;
}
.x-btn:hover { color: var(--danger); border-color: var(--danger); }
.pacco-totale { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 8px 0; font-size: 1rem; }
.pacco-totale strong { font-family: var(--serif); font-size: 1.3rem; color: var(--brand); }
@media (max-width: 480px) {
  .pacco-lista li { grid-template-columns: auto 1fr auto; }
  .pacco-lista .prezzo-pacco { grid-column: 2; }
  .pacco-lista .x-btn { grid-row: 1; grid-column: 3; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* finestra di scelta dei pezzi: foglio dal basso su cellulare, riquadro al centro su schermo largo */
body.no-scroll { overflow: hidden; }
.sheet-overlay {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 12, 8, .45); animation: fade .15s ease both;
}
@keyframes fade { from { opacity: 0; } }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column; gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0;
  background: var(--bg); box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); animation: rise .2s ease both;
}
@media (min-width: 720px) {
  .sheet-overlay { align-items: center; }
  .sheet-panel { border-radius: 22px; max-height: 80vh; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; }
.sheet-panel .search { margin: 0; }
.scelta-lista { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 6px; flex: 1; }
.scelta-lista li[hidden] { display: none; }
.scelta-lista label {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.scelta-lista li.on label { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 10%, var(--surface)); }
.scelta-lista input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand); }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; }
.sheet-foot .btn.primary { min-width: 140px; }

/* ---------- navigazione in basso ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  display: flex; gap: 4px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 10px 30px rgba(42, 31, 24, .18);
  z-index: 30;
}
.nav a {
  display: flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; color: var(--muted); transition: background .2s, color .2s;
}
.nav a svg { width: 20px; height: 20px; fill: currentColor; }
.nav a.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
@media (max-width: 480px) {
  .nav a span { display: none; }
  .nav a { padding: 12px 16px; }
}

/* ---------- avvisi ---------- */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 70px); transform: translateX(-50%);
  padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-weight: 600; z-index: 50;
  animation: pop .25s ease both; max-width: calc(100vw - 32px);
}
.toast.errore { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transition: opacity .35s; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 1.2rem; }
  .kv { grid-template-columns: 1fr 1fr; }
  .kv dd { text-align: left; }
  .form-bar { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- regole di supporto ---------- */
[hidden] { display: none !important; }

/* ---------- barra: utente e logout ---------- */
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  font-size: .85rem; font-weight: 600; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 560px) { .user-chip { display: none; } }

/* ---------- accesso e registrazione ---------- */
.auth { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 10px 0; }
.auth-card { width: min(420px, 100%); padding: 26px; }
.auth-brand { text-align: center; margin-bottom: 18px; display: grid; justify-items: center; gap: 6px; }
.auth-brand .logo { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 16px; }
.auth-brand h1 { font-size: 1.8rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tabs a { text-align: center; padding: 10px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.auth-tabs a.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.auth form { display: grid; gap: 14px; }
.auth input[type="password"] {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); outline: none;
}
.auth input[type="password"]:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(184, 100, 63, .16); }
.check-row { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--ink); cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--sold); }
.auth-msg { min-height: 1.2em; font-size: .9rem; font-weight: 600; color: var(--danger); text-align: center; margin: 0; }
.auth-msg.ok { color: var(--sold); }
.auth-done { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 10px 0; }
.auth-done .big { font-size: 2.4rem; }

/* ---------- stato, scatola, posizione ---------- */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: .78rem; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  background: var(--bg-2); color: var(--ink); border: 1px solid var(--line);
}
.pill.cond-Nuovo, .pill.cond-Ottimo { background: var(--sold-soft); color: var(--sold); border-color: transparent; }
.pill.cond-Buono { background: #f4ecd8; color: #7a5a1c; border-color: transparent; }
.pill.cond-Discreto { background: #f6e3cf; color: #8a4f1f; border-color: transparent; }
.pill.cond-Da-restaurare { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.box { background: var(--surface-2); }
.pill.nobox { color: var(--muted); }
.select {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); outline: none;
}
.select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(184, 100, 63, .16); }
.loc-line { font-size: .9rem; color: var(--muted); margin-top: 6px; }

/* ---------- note ---------- */
.notes { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.note {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  display: grid; gap: 6px;
}
.note p { white-space: pre-wrap; margin: 0; line-height: 1.45; }
.note footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .78rem; color: var(--muted); }
.note .del { border: 0; background: none; color: var(--danger); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.note-form { display: grid; gap: 10px; }
.note-form textarea {
  width: 100%; min-height: 84px; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); outline: none; resize: vertical;
}
.note-form textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(184, 100, 63, .16); }
.note-form .btn { justify-self: end; }

/* ---------- più pezzi dello stesso articolo ---------- */
.copies-badge {
  position: absolute; top: 10px; right: 10px; font-size: .78rem; font-weight: 800;
  padding: 4px 9px; border-radius: 999px; background: var(--gold); color: #3b2a12;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.copies-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.copies-list a {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); min-height: 64px;
}
.thumb-sm {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 10px; overflow: hidden;
  background: var(--bg-2); display: grid; place-items: center; font-size: 1.4rem;
}
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.cinfo { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cinfo strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pills-col { display: grid; gap: 4px; justify-items: end; }
.pill.sold-pill { background: var(--sold-soft); color: var(--sold); border-color: transparent; }

/* ---------- ottimizzazione per cellulare ---------- */
.nav a, .btn, .chip, .copies-list a { -webkit-tap-highlight-color: transparent; }
.btn { min-height: 44px; }
.btn.small { min-height: 38px; }

@media (max-width: 560px) {
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .brand-name { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .btn.small { padding: 8px 12px; }
  .top-actions .long { display: none; }
  .container { padding: 14px 12px 130px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-body { padding: 10px 11px 12px; }
  .card-body h3 { font-size: .95rem; }
  .panel { padding: 15px; border-radius: 16px; }
  .photo-actions { grid-template-columns: 1fr 1fr; }
  .photo-actions .btn { font-size: .88rem; padding: 12px 8px; }
  .form-bar { bottom: 84px; left: 8px; right: 8px; }
  .form-bar .btn { flex: 1; min-width: 0; }
  .form-bar .btn.primary { min-width: 0; }
  .nav { width: calc(100% - 24px); justify-content: space-between; }
  .nav a { flex: 1; justify-content: center; }
  .gallery img { flex-basis: 92%; }
  .actions { position: sticky; bottom: 92px; background: transparent; }
  .copies-list a { flex-wrap: wrap; }
  .pills-col { justify-items: start; grid-auto-flow: column; }
  .toast { top: calc(env(safe-area-inset-top) + 64px); }
}

@media (hover: none) {
  .card:hover { transform: none; }
  .card:active { opacity: .92; }
}

/* ---------- suggerimenti ordinati per frequenza ---------- */
.field.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; z-index: 40;
  list-style: none; margin-left: 0; margin-right: 0; padding: 6px;
  max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.combo-list.combo-float { position: fixed; right: auto; top: auto; margin-top: 0; z-index: 60; max-width: 360px; }
.combo-float li { min-height: 36px; padding: 8px 10px; font-size: .88rem; }
.search.combo .combo-list { margin-top: 6px; }
.combo-list .combo-head { min-height: 0; padding: 6px 12px 4px; cursor: default; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.combo-list .combo-head:hover { background: none; }
.combo-tag { display: inline-block; min-width: 76px; margin-right: 8px; font-size: .72rem; font-weight: 600; color: var(--muted); }
.combo-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 12px; min-height: 44px; border-radius: 10px; cursor: pointer;
  color: var(--ink); font-size: .95rem; font-weight: 500;
}
.combo-list li:hover, .combo-list li.active { background: var(--bg-2); }
.combo-list .cnt { color: var(--muted); font-size: .8rem; font-weight: 600; flex: 0 0 auto; }

/* ---------- foto: pulsante sulla miniatura, ingrandimento ---------- */
.tile-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.photo-tile .x { z-index: 1; }
.lightbox {
  --lb: 70;
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 12px;
  background: rgba(12, 8, 6, .94); cursor: zoom-out;
}
/* la foto occupa il 50% o il 70% della larghezza e dell'altezza dello schermo */
.lightbox img {
  width: calc(var(--lb) * 1vw); height: calc(var(--lb) * 1vh); max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: 8px; cursor: zoom-out;
}
.lb-bar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.lb-bar button {
  border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-weight: 600;
}
.lb-bar button.on { background: var(--brand-2); }

/* ---------- vista tabella (computer) ---------- */
.head-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 899px) { .solo-pc { display: none; } }
.container:has(.table-wrap) { max-width: none; }
.table-wrap {
  overflow: auto; max-height: calc(100vh - 210px); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.sheet thead tr:first-child th { height: 40px; box-sizing: border-box; }
.sheet thead tr.filtri th {
  top: 40px; background: var(--surface); padding: 6px; text-transform: none; letter-spacing: 0; font-weight: 400;
}
.sheet .filtri input, .sheet .filtri select { width: 100%; min-width: 90px; padding: 5px 7px; font-size: .8rem; }
.sheet .filtri .f-range { display: grid; gap: 4px; }
.th-sort {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; white-space: nowrap;
}
.th-sort:hover { color: var(--brand); }
.th-sort { user-select: none; }
.th-sort .prio { font-size: .7em; font-weight: 700; color: var(--brand); }
.th-sort .freccia { min-width: .8em; color: var(--brand); }
.th-sort[data-dir="1"] .freccia::after { content: "▲"; }
.th-sort[data-dir="-1"] .freccia::after { content: "▼"; }
.th-sort:not([data-dir="1"]):not([data-dir="-1"]) .freccia::after { content: "↕"; opacity: .35; }
.sheet { border-collapse: collapse; width: max-content; min-width: 100%; font-size: .88rem; }
.sheet th {
  position: sticky; top: 0; z-index: 1; text-align: left; white-space: nowrap; padding: 10px 8px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.sheet td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sheet tr.dirty td { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.sheet input[type="text"], .sheet input[type="number"], .sheet input[type="date"], .sheet select {
  width: 100%; min-width: 110px; padding: 7px 9px; border-radius: 9px; font-size: .88rem;
}
.sheet input[type="number"] { min-width: 80px; }
.sheet input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--sold); }
.sheet .t-check { text-align: center; }
.sheet .t-foto { width: 64px; }
.sheet .t-nota a { white-space: nowrap; }
.sheet .t-salva { white-space: nowrap; }
.t-thumb { display: block; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--bg-2); }
.t-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-vuoto { font-size: 1.6rem; }

/* ---------- modifica foto a schermo intero ---------- */
.editor {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--bg);
}
.ed-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ed-title { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.ed-stage-wrap { display: flex; justify-content: center; }
.ed-stage {
  position: relative; width: min(100%, calc(48vh * var(--ar))); aspect-ratio: var(--ar);
  overflow: hidden; touch-action: none; user-select: none; border-radius: 12px;
  background: var(--bg-2); box-shadow: var(--shadow);
}
.ed-stage canvas { display: block; width: 100%; height: 100%; }
.ed-crop { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(20, 12, 8, .55); cursor: move; }
.ed-h {
  position: absolute; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  border: 2px solid var(--brand); transform: translate(-50%, -50%);
}
.ed-h[data-h="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.ed-h[data-h="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.ed-h[data-h="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.ed-h[data-h="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.ed-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
}
.ed-tabs button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600;
  padding: 10px 4px; border-radius: 10px; cursor: pointer;
}
.ed-tabs button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.ed-panel {
  display: grid; gap: 14px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.ed-panel .hint { margin: 0; }
.ed-panel input[type="text"] { font-size: 16px; }
.ed-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-seg button {
  flex: 1 1 auto; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 600;
}
.ed-seg button.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.ed-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-slider { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; font-size: .9rem; font-weight: 600; }
.ed-slider span { grid-column: 1 / -1; }
.ed-slider input[type="range"] { width: 100%; accent-color: var(--brand); }
.ed-slider output { min-width: 3ch; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ed-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.sw.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand); }
@media (min-width: 720px) {
  .ed-stage { width: min(100%, calc(60vh * var(--ar))); }
}
