/* Brushlore — Material Design 3
   Colori: Material You. Su Android 12 e successivi i ruoli colore arrivano dallo sfondo
   del telefono (vedi applicaColori in main.js); sul web e sui telefoni più vecchi si usa
   la palette qui sotto, generata con il sistema colori di Material da un blu di partenza.
   Le campionature dei colori restano protagoniste: tutto il resto è neutro e tonale. */

@font-face { font-family: 'Roboto'; src: url(../fonts/roboto-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url(../fonts/roboto-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url(../fonts/roboto-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Material Symbols'; src: url(../fonts/material-symbols.woff2) format('woff2'); font-weight: 400; font-display: block; }

/* ===================== ruoli colore (chiaro) ===================== */
:root {
  --font-body: 'Roboto', system-ui, 'Segoe UI', sans-serif;

  --md-primary: #245fa6;
  --md-on-primary: #ffffff;
  --md-primary-container: #d5e3ff;
  --md-on-primary-container: #001b3c;
  --md-secondary: #555f71;
  --md-on-secondary: #ffffff;
  --md-secondary-container: #d9e3f8;
  --md-on-secondary-container: #121c2b;
  --md-tertiary: #65529f;
  --md-on-tertiary: #ffffff;
  --md-tertiary-container: #e8ddff;
  --md-on-tertiary-container: #210558;
  --md-error: #ba1a1a;
  --md-on-error: #ffffff;
  --md-error-container: #ffdad6;
  --md-on-error-container: #410002;
  --md-surface: #faf9fd;
  --md-surface-container-lowest: #ffffff;
  --md-surface-container-low: #f4f3f7;
  --md-surface-container: #eeedf1;
  --md-surface-container-high: #e9e7eb;
  --md-surface-container-highest: #e3e2e6;
  --md-on-surface: #1a1c1e;
  --md-on-surface-variant: #43474e;
  --md-outline: #74777f;
  --md-outline-variant: #c4c6cf;
  --md-inverse-surface: #2f3033;
  --md-inverse-on-surface: #f1f0f4;
  --md-inverse-primary: #a7c8ff;

  --md-elev-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
  --md-elev-2: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 6px 2px rgba(0, 0, 0, .15);
  --md-elev-3: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);
  --scrim: rgba(0, 0, 0, .32);

  --sw-ring: rgba(0, 0, 0, .12);
  --sw-paper: #f2f3f5;
  color-scheme: light;
}

/* ===================== ruoli colore (scuro) ===================== */
:root[data-theme="dark"] {
  --md-primary: #a7c8ff;
  --md-on-primary: #003061;
  --md-primary-container: #004689;
  --md-on-primary-container: #d5e3ff;
  --md-secondary: #bdc7dc;
  --md-on-secondary: #273141;
  --md-secondary-container: #3d4758;
  --md-on-secondary-container: #d9e3f8;
  --md-tertiary: #cebdff;
  --md-on-tertiary: #36216d;
  --md-tertiary-container: #4d3985;
  --md-on-tertiary-container: #e8ddff;
  --md-error: #ffb4ab;
  --md-on-error: #690005;
  --md-error-container: #93000a;
  --md-on-error-container: #ffdad6;
  --md-surface: #121316;
  --md-surface-container-lowest: #0d0e11;
  --md-surface-container-low: #1a1c1e;
  --md-surface-container: #1e2023;
  --md-surface-container-high: #292a2d;
  --md-surface-container-highest: #343538;
  --md-on-surface: #e3e2e6;
  --md-on-surface-variant: #c4c6cf;
  --md-outline: #8e9199;
  --md-outline-variant: #43474e;
  --md-inverse-surface: #e3e2e6;
  --md-inverse-on-surface: #2f3033;
  --md-inverse-primary: #245fa6;
  --scrim: rgba(0, 0, 0, .5);

  --sw-ring: rgba(255, 255, 255, .14);
  --sw-paper: #e4e6e9;
  color-scheme: dark;
}

/* nomi usati dal resto del foglio (e da qualche stile scritto nel codice) */
:root {
  --bg: var(--md-surface);
  --surface: var(--md-surface-container-low);
  --surface-2: var(--md-surface-container-high);
  --line: var(--md-outline-variant);
  --text: var(--md-on-surface);
  --text-2: var(--md-on-surface-variant);
  --accent: var(--md-primary);
  --accent-ink: var(--md-on-primary);
  --accent-soft: var(--md-secondary-container);
  --accent-line: var(--md-outline);
  --danger: var(--md-error);
  --danger-line: var(--md-error);
  --ok: var(--md-tertiary);
  --ok-soft: var(--md-tertiary-container);
  /* stati delle miniature: ruoli tonali, così seguono anche i colori dello sfondo.
     Montaggio in scala di grigi (dal chiaro allo scuro), pittura a colori */
  --kit: var(--md-outline-variant);
  --building: var(--md-outline);
  --built: var(--md-secondary);
  --todo: var(--md-inverse-primary);
  --wip: var(--md-primary);
  --st-done: var(--md-tertiary);
  /* livello di stato (hover, pressione) */
  --state: color-mix(in srgb, var(--md-on-surface) 8%, transparent);
  --state-press: color-mix(in srgb, var(--md-on-surface) 12%, transparent);
}

/* ===================== base ===================== */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html[data-text="large"] { font-size: 18.5px; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; letter-spacing: inherit; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--md-secondary); outline-offset: 2px; }

/* icone: Material Symbols (carattere) e qualche disegno nostro (svg) */
.i { width: 1.5rem; height: 1.5rem; flex: none; }
.ms {
  font-family: 'Material Symbols'; font-weight: normal; font-style: normal;
  font-size: 1.5rem; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; overflow: hidden; white-space: nowrap; direction: ltr;
  -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0;
  user-select: none; -webkit-user-select: none;
}
svg.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }

#app { display: flex; flex-direction: column; height: 100%; }
#view { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--bg); }
.pad-bottom { height: 112px; }

/* ===================== barre superiori e testate ===================== */
.bench { background: var(--md-surface); color: var(--md-on-surface); }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  height: 64px; padding: 0 4px;
  background: var(--md-surface);
}
.topbar.solid { background: var(--md-surface-container); }
.topbar .t {
  flex: 1; min-width: 0;
  font-weight: 400; font-size: 1.375rem; line-height: 1.75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 4px;
}
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; color: var(--md-on-surface-variant);
}
.topbar .icon-btn[data-act="back"] { color: var(--md-on-surface); }
.icon-btn:active { background: var(--state-press); }
.bench-hero { padding: 4px 16px 16px; }
.root-hero { padding-top: 20px; }
.tb-gap { width: 12px; flex: none; }
.tb-save { margin-right: 4px; }
.brand-title {
  font-family: var(--font-body); font-weight: 400;
  font-size: 2rem; line-height: 2.5rem; letter-spacing: 0;
  margin: 0;
}
.bench-sub { color: var(--md-on-surface-variant); font-size: .875rem; line-height: 1.25rem; margin: 2px 0 12px; }
.page-title { font-weight: 400; font-size: 1.75rem; line-height: 2.25rem; margin: 2px 0 4px; word-break: break-word; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; color: var(--md-on-surface-variant); font-size: .875rem; margin-bottom: 4px; }
.crumbs button { padding: 4px 2px; color: var(--md-on-surface-variant); border-radius: 4px; }
.crumbs button:active { background: var(--state-press); }
.crumbs .sep { opacity: .7; }
.level-tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; margin-top: 8px;
  font-size: .75rem; font-weight: 500; letter-spacing: .03em;
  color: var(--md-on-secondary-container); background: var(--md-secondary-container); border-radius: 6px;
}

/* barra di ricerca */
.search {
  display: flex; align-items: center; gap: 16px;
  background: var(--md-surface-container-high); border-radius: 28px;
  padding: 0 16px; min-height: 56px; color: var(--md-on-surface);
}
.search > .i { color: var(--md-on-surface); }
.search input[type="search"] {
  flex: 1; border-radius: 0; min-width: 0; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 1rem; padding: 12px 0; min-height: 0; box-shadow: none;
}
.search input[type="search"]:focus { border: 0; box-shadow: none; }
.search input::placeholder { color: var(--md-on-surface-variant); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus-visible { outline: none; }
.search .clear { width: 40px; height: 40px; margin-right: -8px; border-radius: 50%; display: grid; place-items: center; color: var(--md-on-surface-variant); }
.content-search { margin: 0; }

/* ===================== barra di navigazione (telefono) ===================== */
.nav {
  display: flex; background: var(--md-surface-container);
  min-height: 80px; padding: 0 0 4px;
}
.nav button {
  flex: 1; min-width: 0; min-height: 80px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; padding: 12px 0 12px;
  color: var(--md-on-surface-variant); position: relative;
}
.nav .ni {
  width: 64px; height: 32px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.nav .nl { font-size: .75rem; line-height: 1rem; font-weight: 500; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
.nav button.on { color: var(--md-on-surface); }
.nav button.on .nl { font-weight: 700; }
.nav button.on .ni { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.nav button.on .ms { font-variation-settings: 'FILL' 1; }
.nav button:active .ni { background: var(--state-press); }
.nav button.on:active .ni { background: color-mix(in srgb, var(--md-secondary-container) 85%, var(--md-on-surface)); }
/* con la tastiera a schermo (telefono e tablet) barra e pulsante si tolgono di mezzo;
   sul computer la barra sta a sinistra e deve restare visibile */
@media (max-width: 999px) {
  body.kb-open .nav, body.kb-open .fab { display: none; }
}

/* ===================== pulsanti ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 24px; border-radius: 20px;
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
  font-weight: 500; font-size: .875rem; letter-spacing: .01em; line-height: 1.25rem;
  position: relative; overflow: hidden; text-align: center;
}
.btn .i { width: 18px; height: 18px; font-size: 18px; margin-left: -8px; }
.btn::after { content: ''; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none; }
.btn:active::after { opacity: .12; }
.btn.primary { background: var(--md-primary); color: var(--md-on-primary); }
.btn.ghost { background: transparent; color: var(--md-primary); padding: 0 12px; }
.btn.ghost .i { margin-left: -4px; }
.btn.danger { background: transparent; color: var(--md-error); box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 36px; padding: 0 16px; font-size: .875rem; border-radius: 18px; }
.btn.small .i { margin-left: -4px; }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }

/* pulsante d'azione esteso (FAB) */
.fab {
  position: fixed; right: 16px; bottom: 96px; z-index: 6;
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 20px 0 16px; border-radius: 16px;
  background: var(--md-primary-container); color: var(--md-on-primary-container);
  font-weight: 500; font-size: 1rem; letter-spacing: .01em;
  box-shadow: var(--md-elev-3);
}
.fab:active { box-shadow: var(--md-elev-2); filter: brightness(.96); }

/* ===================== chip ===================== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 32px; padding: 0 16px; border-radius: 8px;
  background: transparent; color: var(--md-on-surface-variant);
  box-shadow: inset 0 0 0 1px var(--md-outline-variant);
  font-size: .875rem; font-weight: 500; letter-spacing: .01em; white-space: nowrap;
}
.chip .i { width: 18px; height: 18px; font-size: 18px; }
.chip:active { background: var(--state-press); }
/* chip selezionato: tonale con la spunta davanti */
.chip.on, .status-chips .chip[aria-checked="true"] {
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
  box-shadow: none; padding-left: 8px;
}
.chip.on::before, .status-chips .chip[aria-checked="true"]::before,
.mchip.on::before, .fbtn.on:not(:has(.i))::before {
  content: '\e5ca'; font-family: 'Material Symbols'; font-size: 18px; line-height: 1;
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.chip.add { color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.chip.mine .i { color: var(--md-primary); }

/* pulsanti segmentati */
.seg { display: flex; border-radius: 20px; border: 1px solid var(--md-outline); overflow: hidden; min-height: 40px; }
.seg button {
  flex: 1; min-width: 0; min-height: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: .875rem; font-weight: 500; letter-spacing: .01em; text-align: center;
  color: var(--md-on-surface);
}
.seg button + button { box-shadow: inset 1px 0 0 var(--md-outline); }
.seg button.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.seg button.on:not(:has(.i))::before {
  content: '\e5ca'; font-family: 'Material Symbols'; font-size: 18px; line-height: 1;
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.seg button:active { background: var(--state-press); }
.seg button .i { width: 18px; height: 18px; font-size: 18px; }

/* ===================== sezioni, liste, righe ===================== */
.sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 16px 4px; min-height: 40px; }
.sec h2 { font-size: 1rem; line-height: 1.5rem; margin: 0; font-weight: 500; letter-spacing: .01em; }
.sec .aside { color: var(--md-on-surface-variant); font-size: .75rem; font-weight: 500; letter-spacing: .03em; }
.sec .link { padding: 0 12px; margin-right: -12px; }

.list { background: transparent; }
.row {
  display: flex; align-items: center; gap: 16px; width: 100%;
  min-height: 72px; padding: 8px 24px 8px 16px; position: relative;
}
.row:active { background: var(--state-press); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 400; font-size: 1rem; line-height: 1.5rem; letter-spacing: .01em; overflow-wrap: anywhere; color: var(--md-on-surface); }
.row .sub { color: var(--md-on-surface-variant); font-size: .875rem; line-height: 1.25rem; margin-top: 0; overflow-wrap: anywhere; }
.row .end { flex: none; display: flex; align-items: center; gap: 6px; color: var(--md-on-surface-variant); font-size: .75rem; }
.row .end .i { width: 24px; height: 24px; }
.row.compact { min-height: 56px; }

.folder-ico {
  width: 56px; height: 56px; border-radius: 16px; flex: none;
  display: grid; place-items: center;
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
  overflow: hidden; position: relative;
}
.folder-ico .strip-mini { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; display: flex; }
.folder-ico .strip-mini span { flex: 1; }
.thumb {
  width: 56px; height: 56px; border-radius: 12px; flex: none; object-fit: cover;
  background: var(--md-surface-container-highest);
  display: grid; place-items: center; color: var(--md-on-surface-variant); overflow: hidden;
}
img.thumb { display: block; }

.strip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.strip .more { font-size: .75rem; color: var(--md-on-surface-variant); margin-left: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 500; line-height: 1; letter-spacing: .03em;
  height: 24px; padding: 0 8px; border-radius: 6px; white-space: nowrap;
  background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
}
.badge.todo::before, .badge.wip::before, .badge.done::before,
.badge.kit::before, .badge.building::before, .badge.built::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge.todo::before { background: var(--todo); }
.badge.wip { color: var(--md-on-primary-container); background: var(--md-primary-container); } .badge.wip::before { background: var(--wip); }
.badge.done { color: var(--md-on-tertiary-container); background: var(--md-tertiary-container); } .badge.done::before { background: var(--st-done); }
.badge.kit::before { background: var(--kit); box-shadow: inset 0 0 0 1px var(--md-outline); }
.badge.building { color: var(--md-on-secondary-container); background: var(--md-secondary-container); } .badge.building::before { background: var(--building); }
.badge.built::before { background: var(--built); }
.badge.old { font-weight: 400; }
.badge.accent { color: var(--md-on-primary-container); background: var(--md-primary-container); }

/* ===================== campioni colore ===================== */
.sw {
  --sz: 40px;
  display: inline-block; flex: none; position: relative;
  width: var(--sz); height: var(--sz); border-radius: 12px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px var(--sw-ring), inset 0 -3px 6px rgba(0,0,0,.16);
  overflow: hidden;
}
.sw.s-xs { --sz: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--sw-ring); }
.sw.s-sm { --sz: 24px; border-radius: 8px; }
.sw.s-lg { --sz: 56px; border-radius: 16px; }
.sw.s-hero { width: 100%; height: 132px; border-radius: 28px; }

.sw.k-solid, .sw.k-spray-solid {
  background: radial-gradient(120% 90% at 22% 12%, rgba(255,255,255,.2), rgba(255,255,255,0) 46%), var(--c);
}
.sw.k-metal {
  background: linear-gradient(128deg, var(--d) 0%, var(--l) 26%, var(--c) 44%, var(--d) 68%, var(--l) 90%, var(--c) 100%);
}
.sw.k-shade {
  background:
    radial-gradient(circle at 36% 34%, rgba(255,255,255,.55) 0 4%, transparent 7%),
    radial-gradient(ellipse 46% 36% at 52% 60%, var(--c) 0 88%, transparent 100%),
    linear-gradient(155deg, var(--p), var(--l));
}
.sw.k-contrast { background: linear-gradient(158deg, var(--l) 0%, var(--c) 52%, var(--d) 100%); }
.sw.k-dry {
  background:
    repeating-linear-gradient(112deg, var(--l) 0 2px, transparent 2px 4px, var(--c) 4px 6px, transparent 6px 9px),
    var(--dd);
}
.sw.k-texture {
  background:
    radial-gradient(var(--d) 22%, transparent 26%) 0 0 / 7px 7px,
    radial-gradient(var(--l) 18%, transparent 22%) 3px 4px / 7px 7px,
    var(--c);
}
.sw.k-gloss {
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,.9) 0 8%, rgba(255,255,255,0) 24%),
    radial-gradient(circle at 58% 62%, var(--c) 0 50%, var(--d) 100%);
}
.sw.k-gem {
  background: radial-gradient(circle at 32% 28%, #fff 0 6%, var(--l) 16%, var(--c) 46%, var(--d) 100%);
}
.sw.k-medium {
  background:
    linear-gradient(var(--ca), var(--ca)),
    conic-gradient(#C9CDD2 25%, #F3F4F6 0 50%, #C9CDD2 0 75%, #F3F4F6 0) 0 0 / 12px 12px;
}
.sw.k-air {
  background:
    radial-gradient(circle at 50% 50%, var(--c) 0 34%, var(--ca) 58%, transparent 74%),
    var(--sw-paper);
}
.sw.k-spray {
  background:
    radial-gradient(circle at 16% 22%, var(--c) 0 3%, transparent 4.5%),
    radial-gradient(circle at 84% 16%, var(--c) 0 2.5%, transparent 4%),
    radial-gradient(circle at 88% 80%, var(--c) 0 3%, transparent 4.5%),
    radial-gradient(circle at 12% 84%, var(--c) 0 2.5%, transparent 4%),
    radial-gradient(circle at 56% 7%, var(--c) 0 2%, transparent 3.5%),
    radial-gradient(circle at 50% 52%, var(--c) 0 44%, var(--ca) 60%, transparent 70%),
    var(--sw-paper);
}
.sw.s-xs.k-spray, .sw.s-xs.k-air { background: radial-gradient(circle, var(--c) 0 52%, var(--ca) 70%, transparent 80%), var(--sw-paper); }
.sw.k-missing { background: repeating-linear-gradient(45deg, var(--md-surface-container-high) 0 5px, var(--md-outline-variant) 5px 10px); }
.sw .hex {
  position: absolute; right: 12px; bottom: 12px; font-size: .75rem; font-weight: 500;
  padding: 4px 8px; border-radius: 8px; background: rgba(0,0,0,.5); color: #fff;
}
.mix { display: inline-flex; align-items: center; }
.mix .sw + .sw { margin-left: -12px; box-shadow: 0 0 0 2px var(--md-surface-container-low), inset 0 0 0 1px var(--sw-ring); }

.kind-legend { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.kind-legend > div { display: flex; align-items: center; gap: 8px; font-size: .875rem; }

/* ===================== ricetta: zone e passaggi ===================== */
.zone { margin: 8px 16px 12px; background: var(--md-surface-container-low); border-radius: 16px; overflow: hidden; }
.zone-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 4px 4px 0 16px; }
.zone-head .zn { flex: 1; font-weight: 500; font-size: .875rem; letter-spacing: .01em; color: var(--md-primary); overflow-wrap: anywhere; }
.zone-head .count { color: var(--md-on-surface-variant); font-size: .75rem; font-weight: 500; }
.step {
  display: flex; align-items: center; gap: 16px; width: 100%;
  min-height: 64px; padding: 8px 16px;
}
button.step:active { background: var(--state-press); }
.step .n {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: .75rem; font-weight: 500;
  color: var(--md-on-surface-variant); box-shadow: inset 0 0 0 2px var(--md-outline); font-variant-numeric: tabular-nums;
}
.step .body { flex: 1; min-width: 0; }
.step .pn { font-weight: 400; font-size: 1rem; line-height: 1.5rem; overflow-wrap: anywhere; }
.step .ps { color: var(--md-on-surface-variant); font-size: .875rem; line-height: 1.25rem; overflow-wrap: anywhere; }
.step .note { font-size: .875rem; margin-top: 2px; color: var(--md-on-surface-variant); font-style: italic; overflow-wrap: anywhere; }
.tech {
  display: inline-flex; align-items: center; height: 24px; margin-top: 4px; padding: 0 8px;
  font-size: .75rem; font-weight: 500; letter-spacing: .03em; border-radius: 6px;
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
}
.zone-add { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 16px 4px; color: var(--md-primary); font-weight: 500; font-size: .875rem; }
.zone-add:active { background: var(--state-press); }
.zone-add .i { width: 18px; height: 18px; font-size: 18px; }
.inherit { margin: 12px 16px 0; padding: 4px 16px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.inherit summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 12px; min-height: 48px; }
.inherit summary::-webkit-details-marker { display: none; }
.inherit summary::after { content: '\e5cf'; font-family: 'Material Symbols'; font-size: 24px; margin-left: auto; color: var(--md-on-surface-variant); transition: transform .2s; }
.inherit[open] summary::after { transform: rotate(180deg); }
.inherit summary .i { color: var(--md-primary); }
.inherit .zone { margin: 8px 0 4px; background: var(--md-surface-container); }

/* ===================== dettaglio ===================== */
.hero-photo { display: block; width: calc(100% - 32px); margin: 0 16px; aspect-ratio: 4 / 3; object-fit: cover; background: var(--md-surface-container-high); border-radius: 28px; }
.photo-btn { display: block; width: 100%; }
.detail-head { padding: 4px 16px 16px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.note-box { margin: 8px 16px; padding: 16px; background: var(--md-surface-container-low); border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; font-size: .875rem; line-height: 1.25rem; }
.status-seg { margin: 12px 16px 0; }
.dates { color: var(--md-on-surface-variant); font-size: .75rem; margin: 16px 16px 0; }
.empty { text-align: center; padding: 32px 24px 24px; color: var(--md-on-surface-variant); }
.empty h3 { color: var(--md-on-surface); font-size: 1.5rem; line-height: 2rem; font-weight: 400; margin: 16px 0 8px; }
.empty p { margin: 0 auto 20px; max-width: 32ch; font-size: .875rem; line-height: 1.25rem; }
.dots { display: inline-flex; }
.dots span { width: 36px; height: 36px; border-radius: 12px; margin: 0 -5px; box-shadow: 0 0 0 3px var(--bg); }
.hint {
  margin: 12px 16px; padding: 16px; border-radius: 12px;
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
  font-size: .875rem; line-height: 1.25rem;
}
.hint b { color: inherit; }

/* ===================== livelli: fogli, finestre, dialoghi ===================== */
.layer { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .2s ease-out; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%;
  display: flex; flex-direction: column;
  background: var(--md-surface-container-low); color: var(--md-on-surface);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--md-elev-1);
  animation: rise .26s cubic-bezier(.2, 0, 0, 1);
  --field-bg: var(--md-surface-container-low);
}
.grip { width: 32px; height: 4px; border-radius: 2px; background: var(--md-on-surface-variant); opacity: .4; margin: 22px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 12px 8px 4px 24px; }
.sheet-head h3 { flex: 1; margin: 0; font-size: 1.5rem; line-height: 2rem; font-weight: 400; overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; padding: 8px 24px 24px; }
.menu-item { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 0 16px; font-size: 1rem; border-radius: 28px; color: var(--md-on-surface); }
.menu-item .i { color: var(--md-on-surface-variant); }
.menu-item:active { background: var(--state-press); }
.menu-item.danger, .menu-item.danger .i { color: var(--md-error); }
.modal {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--md-surface); animation: slide .24s cubic-bezier(.2, 0, 0, 1);
  --field-bg: var(--md-surface);
}
.modal-body { flex: 1; overflow-y: auto; }
.modal-foot { padding: 12px 16px; background: var(--md-surface-container); }
.dialog {
  position: absolute; left: 24px; right: 24px; top: 50%; transform: translateY(-50%);
  max-width: 560px; min-width: 0; margin: 0 auto; max-height: 86%; overflow-y: auto;
  background: var(--md-surface-container-high); border-radius: 28px; padding: 24px;
  box-shadow: var(--md-elev-3); animation: pop .2s cubic-bezier(.2, 0, 0, 1);
  --field-bg: var(--md-surface-container-high);
}
.dialog h3 { margin: 0 0 16px; font-size: 1.5rem; line-height: 2rem; font-weight: 400; }
.dialog p { margin: 0 0 16px; color: var(--md-on-surface-variant); font-size: .875rem; line-height: 1.25rem; white-space: pre-line; }
.dialog .btn-row { margin-top: 24px; justify-content: flex-end; gap: 8px; }
.dialog .btn-row .btn { flex: 0 1 auto; }
.dialog .btn-row .btn:not(.primary) { background: transparent; color: var(--md-primary); padding: 0 12px; box-shadow: none; }
.dialog .btn-row .btn.danger { color: var(--md-error); }
.photo-view { position: absolute; inset: 0; background: #000; overflow: auto; display: flex; align-items: center; justify-content: center; }
.photo-view img { max-width: 100%; max-height: 100%; object-fit: contain; }
.photo-view.zoom { display: block; }
.photo-view.zoom img { max-width: none; max-height: none; width: 250%; }
.photo-close { position: fixed; top: 10px; right: 10px; z-index: 2; color: #fff; background: rgba(0,0,0,.5); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(48px); opacity: .5; } }
@keyframes slide { from { transform: translateY(24px); opacity: .6; } }
@keyframes pop { from { transform: translateY(-48%) scale(.96); opacity: .4; } }

/* avviso in basso (snackbar) */
.snack {
  position: fixed; left: 16px; right: 16px; bottom: 96px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 6px 8px 6px 16px; border-radius: 4px;
  background: var(--md-inverse-surface); color: var(--md-inverse-on-surface);
  box-shadow: var(--md-elev-3); animation: rise .2s ease-out;
}
.snack .msg { flex: 1; font-size: .875rem; line-height: 1.25rem; padding: 8px 0; }
.snack button { min-height: 40px; padding: 0 12px; border-radius: 20px; color: var(--md-inverse-primary); font-weight: 500; font-size: .875rem; }

/* ===================== moduli: campi Material (contorno ed etichetta sul bordo) ===================== */
.form { padding: 4px 16px 20px; --field-bg: var(--bg); }
.field { display: block; margin: 20px 0; position: relative; }
.field > .lbl { display: block; font-size: .875rem; font-weight: 500; letter-spacing: .01em; color: var(--md-on-surface-variant); margin-bottom: 8px; }
.field > .help { display: block; font-size: .75rem; line-height: 1rem; color: var(--md-on-surface-variant); margin: 4px 16px 0; }
/* quando il campo contiene direttamente un testo o un menu, l'etichetta si appoggia sul bordo */
.field:has(> input, > textarea, > select) > .lbl {
  position: absolute; top: -8px; left: 12px; z-index: 1; margin: 0; padding: 0 4px;
  font-size: .75rem; line-height: 1rem; font-weight: 400; letter-spacing: .03em;
  background: var(--field-bg, var(--bg)); border-radius: 2px; pointer-events: none;
}
.field:has(> input:focus, > textarea:focus, > select:focus) > .lbl { color: var(--md-primary); }
input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="number"], textarea, select {
  width: 100%; min-height: 56px; padding: 16px;
  border-radius: 4px; border: 0; box-shadow: inset 0 0 0 1px var(--md-outline);
  background: transparent; color: var(--md-on-surface);
  font: inherit; font-size: 1rem; line-height: 1.5rem;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--md-on-surface-variant) 50%), linear-gradient(135deg, var(--md-on-surface-variant) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select option, select optgroup { background: var(--md-surface-container); color: var(--md-on-surface); }
textarea { min-height: 112px; resize: vertical; }
input:focus, textarea:focus, select:focus { box-shadow: inset 0 0 0 2px var(--md-primary); }
input::placeholder, textarea::placeholder { color: var(--md-on-surface-variant); opacity: .8; }
.location-box {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--md-outline); width: 100%; min-height: 56px;
}
.location-box:active { background: var(--state-press); }
.location-box .path { flex: 1; font-weight: 400; overflow-wrap: anywhere; }
.location-box .ph { flex: 1; color: var(--md-on-surface-variant); }
.photo-box { display: flex; gap: 16px; align-items: center; }
.photo-box img, .photo-box .ph-empty {
  width: 112px; height: 112px; border-radius: 16px; object-fit: cover; flex: none;
  background: var(--md-surface-container-highest); display: grid; place-items: center; color: var(--md-on-surface-variant);
}
.photo-box .acts { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.lp-level { margin: 20px 0 8px; }
.lp-level h4 { margin: 0 0 8px; font-size: .875rem; font-weight: 500; color: var(--md-primary); display: flex; align-items: baseline; gap: 8px; }
.lp-level h4 small { color: var(--md-on-surface-variant); font-weight: 400; font-size: .75rem; }
.pick-sum { font-size: .875rem; color: var(--md-on-surface-variant); margin-bottom: 8px; overflow-wrap: anywhere; }
.pick-sum b { color: var(--md-on-surface); font-weight: 500; }
.color-input-row { display: flex; gap: 12px; align-items: center; }
.color-input-row input[type="color"] { width: 64px; height: 56px; border: 0; box-shadow: inset 0 0 0 1px var(--md-outline); border-radius: 12px; padding: 4px; background: transparent; flex: none; }

/* ===================== elenco dei colori ===================== */
.filters { padding: 8px 16px 4px; background: var(--bg); position: sticky; top: 64px; z-index: 4; }
.filters .chips.scroll + .chips.scroll { margin-top: 8px; }
.picker-filters { position: sticky; top: 0; background: var(--md-surface-container-low); }
.result-count { padding: 12px 16px 4px; color: var(--md-on-surface-variant); font-size: .75rem; font-weight: 500; letter-spacing: .03em; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; }
.flags { display: flex; gap: 2px; align-items: center; }
.flag { min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.flag.owned { color: var(--md-tertiary); }
.flag.owned .ms { font-variation-settings: 'FILL' 1; }
.flag.wish { color: var(--md-primary); }
.flag .i { width: 22px; height: 22px; font-size: 22px; }
.recent-strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 12px; scrollbar-width: none; }
.recent-strip::-webkit-scrollbar { display: none; }
.recent-strip button { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; flex: none; font-size: .75rem; text-align: center; line-height: 1.15; color: var(--md-on-surface-variant); }
.load-more { display: block; margin: 12px auto 20px; }

/* interruttori Material 3 */
.toggle-row { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 64px; padding: 8px 0; }
.toggle-row .body { flex: 1; font-size: 1rem; }
.toggle-row .sub { color: var(--md-on-surface-variant); font-size: .875rem; line-height: 1.25rem; }
.switch {
  width: 52px; height: 32px; border-radius: 16px; position: relative; flex: none;
  background: var(--md-surface-container-highest); box-shadow: inset 0 0 0 2px var(--md-outline);
  transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 8px; left: 8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--md-outline); transition: transform .2s, width .2s, height .2s, top .2s, left .2s;
}
.switch.on { background: var(--md-primary); box-shadow: none; }
.switch.on::after { top: 4px; left: 4px; width: 24px; height: 24px; background: var(--md-on-primary); transform: translateX(20px); }
.two-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 8px; }
.big-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 24px;
  box-shadow: inset 0 0 0 1px var(--md-outline); font-weight: 500; font-size: .875rem; color: var(--md-on-surface-variant);
}
.big-toggle .i { width: 18px; height: 18px; font-size: 18px; }
.big-toggle.on.owned { box-shadow: none; background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.big-toggle.on.wish { box-shadow: none; background: var(--md-primary-container); color: var(--md-on-primary-container); }
.big-toggle.on .ms { font-variation-settings: 'FILL' 1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .875rem; margin: 12px 0; }
.kv dt { color: var(--md-on-surface-variant); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.sim-brand { margin: 16px 0 4px; font-size: .875rem; font-weight: 500; color: var(--md-primary); }
.sheet .list { border-radius: 16px; overflow: hidden; background: var(--md-surface-container); }
.sheet .row { padding-left: 16px; padding-right: 16px; }
.sim-tag { font-size: .75rem; color: var(--md-on-surface-variant); white-space: nowrap; }
.sim-tag.good { color: var(--md-tertiary); font-weight: 500; }

/* gruppi delle impostazioni */
.settings-group { margin: 4px 16px 0; background: var(--md-surface-container-low); border-radius: 16px; padding: 4px 16px; --field-bg: var(--md-surface-container-low); }
.srow { display: flex; align-items: center; gap: 16px; min-height: 56px; width: 100%; padding: 8px 0; }
.srow > .i { color: var(--md-on-surface-variant); }
.srow .body { flex: 1; min-width: 0; font-size: 1rem; }
.srow .sub { color: var(--md-on-surface-variant); font-size: .875rem; line-height: 1.25rem; }
.srow:active { background: var(--state-press); }
.settings-group .field { margin: 16px 0; }
.stat-line { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 0; font-size: .875rem; color: var(--md-on-surface-variant); }
.stat-line b { font-size: 1.375rem; font-weight: 400; margin-right: 6px; color: var(--md-on-surface); }
.about { font-size: .875rem; line-height: 1.25rem; color: var(--md-on-surface-variant); padding: 12px 0; }
.about p { margin: 0 0 8px; }
.about a, .about button.lnk { color: var(--md-primary); text-decoration: underline; }
.guide ol { padding-left: 22px; margin: 8px 0 12px; }
.guide li { margin: 8px 0; }

@media (min-width: 700px) {
  #view > * { max-width: 760px; margin-left: auto; margin-right: auto; }
  #view > .topbar { max-width: none; }
  .sheet { max-width: 640px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===================== collegamenti e varie ===================== */
.link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 20px;
  color: var(--md-primary); font-weight: 500; font-size: .875rem; letter-spacing: .01em;
}
.link:active { background: color-mix(in srgb, var(--md-primary) 12%, transparent); }
.link .i { width: 18px; height: 18px; font-size: 18px; }
.lnk { color: var(--md-primary); text-decoration: underline; text-underline-offset: 3px; font: inherit; display: inline; }
.hint .lnk { color: inherit; }
.hint .lnk b { color: inherit; }
.hl { color: var(--text); }
.strong { color: var(--text) !important; font-weight: 500; padding-top: 0 !important; }
.thumb.mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; padding: 0; place-items: stretch; }
.thumb.mosaic span { display: block; }
.thumb.mosaic.n1 span { grid-column: span 2; grid-row: span 2; }
.thumb.mosaic.n2 span { grid-row: span 2; }
.thumb.mosaic.n3 span:first-child { grid-row: span 2; }
.img-missing { display: grid !important; place-items: center; color: var(--md-on-surface-variant); background: var(--md-surface-container-high); }
.hero-photo.img-missing { aspect-ratio: 4 / 3; }
.after-list { padding: 12px 16px 0; }
.sec.flush { margin: 20px 0 4px; }
.small-note { font-size: .75rem; line-height: 1rem; margin-top: 16px; }
.small-note .i { width: 1em; height: 1em; font-size: 1em; vertical-align: -2px; }
.legend-note { display: flex; align-items: center; gap: 6px; }
.legend-row { display: flex; align-items: center; gap: 16px; padding: 8px 0; }
.photo-hint { position: fixed; left: 0; right: 0; bottom: 18px; text-align: center; color: rgba(255,255,255,.75); font-size: .875rem; pointer-events: none; }
.step-top { display: flex; align-items: center; gap: 16px; padding: 4px 0 2px; }
.step-top .body { flex: 1; min-width: 0; }
.step-top .title { font-weight: 400; font-size: 1rem; overflow-wrap: anywhere; }
.step-top .sub { color: var(--md-on-surface-variant); font-size: .875rem; }
.note-box.inset { margin: 8px 0 4px; }
.compact-empty { padding-top: 12px; }
.row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sentinel { height: 1px; }
.picker-filters { top: 0; }
.dialog .field { margin-bottom: 0; }
.sheet-body > p:first-child { margin-top: 0; }
.status-seg { margin-top: 12px; }
body.has-snack .fab { bottom: 160px; }
.stack-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.backup-btns { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }

/* ===================== marchio ===================== */
.brand-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 4px; }
.brand-mark { height: 2rem; width: auto; flex: none; display: block; }
.about-head { display: flex; align-items: center; gap: 16px; padding: 16px 0 8px; color: var(--md-on-surface-variant); font-size: .875rem; }
.app-logo { width: 64px; height: 64px; border-radius: 16px; flex: none; display: block; }
.app-name { font-family: var(--font-body); font-weight: 400; font-size: 1.5rem; line-height: 2rem; color: var(--md-on-surface); margin-bottom: 2px; }
.about .maker { color: var(--md-on-surface); }
.about .copyright { color: var(--md-on-surface); font-weight: 500; margin-top: 4px; }
.welcome-logo { display: flex; justify-content: center; margin: 2px 0 12px; }
.welcome-logo img { width: 72px; height: 72px; border-radius: 18px; }
.settings-group.about { padding: 4px 16px 12px; }

.tone-row { display: flex; gap: 8px; justify-content: space-between; margin: 12px 0 4px; }
.tone-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .75rem; color: var(--md-on-surface-variant); }
.tone-item .sw { --sz: 48px; }

/* ===================== dashboard ===================== */
.dash { padding: 4px 0 2px; }
.card { margin: 12px 16px; background: var(--md-surface-container); border-radius: 12px; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 16px 8px; }
.card-head h2 { margin: 0; font-size: 1rem; line-height: 1.5rem; font-weight: 500; letter-spacing: .01em; }
.card-head .aside { font-size: .75rem; font-weight: 500; letter-spacing: .03em; color: var(--md-on-surface-variant); }
.card-head .link { padding: 0 8px; margin-right: -8px; min-height: 32px; }
.card-text { padding: 0 16px 16px; margin: 0; font-size: .875rem; line-height: 1.25rem; }
.card-list .row { padding-left: 16px; }
.ring-row { display: flex; align-items: center; gap: 12px; padding: 4px 12px 16px 16px; }
.ring { width: 116px; height: 116px; flex: none; }
.ring circle { fill: none; stroke-width: 14; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring .track { stroke: var(--md-surface-container-highest); }
.ring .s-done { stroke: var(--st-done); }
.ring .s-wip { stroke: var(--wip); }
.ring .s-todo { stroke: var(--todo); }
.ring .s-kit { stroke: var(--kit); }
.ring .s-building { stroke: var(--building); }
.ring .s-built { stroke: var(--built); }
.ring .ring-pct { font-size: 22px; font-weight: 500; fill: var(--md-on-surface); text-anchor: middle; font-family: var(--font-body); }
.ring .ring-lbl { font-size: 10px; fill: var(--md-on-surface-variant); text-anchor: middle; font-family: var(--font-body); }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.legend-item { display: flex; align-items: center; gap: 8px; min-height: 40px; width: 100%; font-size: .875rem; border-radius: 20px; padding: 0 4px 0 8px; }
.legend-item:active { background: var(--state-press); }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend-item .dot.done { background: var(--st-done); }
.legend-item .dot.wip { background: var(--wip); }
.legend-item .dot.todo { background: var(--todo); }
.legend-item .dot.kit { background: var(--kit); box-shadow: inset 0 0 0 1px var(--md-outline); }
.legend-item .dot.building { background: var(--building); }
.legend-item .dot.built { background: var(--built); }
.legend-item .lg-n { font-weight: 500; font-variant-numeric: tabular-nums; min-width: 1.6em; }
.legend-item .lg-l { flex: 1; min-width: 0; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-item .lg-p { color: var(--md-on-surface-variant); font-size: .75rem; font-variant-numeric: tabular-nums; }
.legend-item .i { width: 18px; height: 18px; font-size: 18px; color: var(--md-on-surface-variant); }
.prog-row { display: block; width: 100%; padding: 12px 16px 16px; }
.prog-row:active { background: var(--state-press); }
.prog-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.prog-head .pn { flex: 1; min-width: 0; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-head .pv { color: var(--md-on-surface-variant); font-size: .75rem; font-variant-numeric: tabular-nums; }
/* barra di avanzamento a tratti (stile indicatore lineare Material 3) */
.stack { display: flex; gap: 3px; height: 8px; border-radius: 4px; overflow: hidden; background: transparent; }
.stack span { display: block; height: 100%; border-radius: 4px; }
.stack .s-done { background: var(--st-done); }
.stack .s-wip { background: var(--wip); }
.stack .s-todo { background: var(--todo); }
.stack .s-kit { background: var(--kit); }
.stack .s-building { background: var(--building); }
.stack .s-built { background: var(--built); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 128px; padding: 4px 16px 16px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; }
.bar-n { font-size: .75rem; color: var(--md-on-surface-variant); height: 1.1rem; font-variant-numeric: tabular-nums; }
.bar-area { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar-fill { width: 72%; max-width: 28px; min-height: 3px; background: var(--md-primary); border-radius: 8px 8px 4px 4px; }
.bar-l { font-size: .75rem; color: var(--md-on-surface-variant); margin-top: 6px; }

/* ===================== passaggi con spunta e avanzamento ===================== */
.step-row { padding: 0; gap: 0; }
.step-check { display: flex; align-items: center; justify-content: center; width: 56px; flex: none; align-self: stretch; min-height: 64px; }
.step-check:active .n { background: var(--state-press); }
.step-check .n { width: 28px; height: 28px; }
.step-check .n.on { background: var(--md-primary); color: var(--md-on-primary); box-shadow: none; }
.step-check .n.on .i { width: 20px; height: 20px; font-size: 20px; }
.step-body { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; padding: 8px 16px 8px 0; min-height: 64px; }
.step-body:active { background: var(--state-press); }
div.step-body { cursor: default; }
div.step-body:active { background: none; }
.step.is-done .pn { color: var(--md-on-surface-variant); }
.step.is-done .sw { opacity: .7; }
.prog-card { margin: 8px 16px 0; background: var(--md-surface-container-low); border-radius: 12px; padding: 16px; }
.prog-card .stack { background: var(--md-secondary-container); height: 6px; border-radius: 3px; }
.prog-card .stack .s-done { background: var(--md-primary); border-radius: 3px; }
.mini-prog { display: block; height: 4px; border-radius: 2px; background: var(--md-secondary-container); margin-top: 8px; overflow: hidden; max-width: 220px; }
.mini-prog span { display: block; height: 100%; background: var(--md-primary); border-radius: 2px; }
.prog-txt { color: var(--md-on-surface-variant); font-size: .75rem; font-variant-numeric: tabular-nums; }
.sheet-recipe .zone { margin: 8px 0; background: var(--md-surface-container); }
.sheet-recipe .step { min-height: 56px; }

.scheme-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; margin: 2px 0 12px; background: var(--md-surface-container-high); }
.account-head { display: flex; align-items: center; gap: 16px; padding: 8px 0 12px; }
.account-head .body { flex: 1; min-width: 0; }
.account-head .sub { color: var(--md-on-surface-variant); font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-name { font-weight: 400; font-size: 1.375rem; line-height: 1.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--md-primary-container); display: block; }
.avatar-empty { display: grid; place-items: center; font-weight: 500; font-size: 1.375rem; color: var(--md-on-primary-container); }
.status-chips { margin: 12px 16px 0; }
/* quante boccette ho di un colore */
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 2px; }
.qty-row .lbl { font-size: .875rem; color: var(--md-on-surface-variant); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.25rem; font-weight: 500; line-height: 1;
  color: var(--md-on-surface-variant); box-shadow: inset 0 0 0 1px var(--md-outline);
  display: grid; place-items: center;
}
.stepper button:last-child { background: var(--md-secondary-container); color: var(--md-on-secondary-container); box-shadow: none; }
.stepper button:active { filter: brightness(.94); }
.stepper button[disabled] { opacity: .38; }
.stepper .n { min-width: 2.4em; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.flag.owned .qty { font-size: .75rem; margin-left: 1px; font-weight: 500; }

/* scorrere una riga verso sinistra per eliminarla */
.swipe-wrap { position: relative; overflow: hidden; }
.swipe-del { position: absolute; right: 0; top: 0; bottom: 0; width: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--md-error); color: var(--md-on-error); font-size: .75rem; font-weight: 500; }
.swipe-del .i { width: 22px; height: 22px; font-size: 22px; }
.swipe { position: relative; background: var(--bg); transition: transform .18s ease; touch-action: pan-y; }
.swipe.open { box-shadow: var(--md-elev-2); }
.zone .swipe, .sheet .swipe { background: inherit; }
.zone .swipe { background: var(--md-surface-container-low); }

/* foto della cartella come sfondo dell'intestazione */
.bench-hero.with-photo {
  position: relative; overflow: hidden; min-height: 184px; margin: 0 16px; border-radius: 28px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; padding: 18px 20px 20px; color: #fff;
}
.bench-hero.with-photo .hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.bench-hero.with-photo::after { content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, .10) 0%, rgba(0, 0, 0, .55) 62%, rgba(0, 0, 0, .78) 100%); }
.bench-hero.with-photo > *:not(.hero-bg) { position: relative; z-index: 2; }
.bench-hero.with-photo .page-title { text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.bench-hero.with-photo .crumbs, .bench-hero.with-photo .crumbs button { color: rgba(255, 255, 255, .88); }
.bench-hero.with-photo .level-tag { background: rgba(255, 255, 255, .2); color: #fff; }
/* icona accanto al titolo della cartella e riquadro del banner */
.hero-title { display: flex; align-items: center; gap: 12px; }
.hero-ico { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex: none; background: var(--md-surface-container-high); }
.banner-box { width: 100%; aspect-ratio: 16 / 7; border-radius: 16px; overflow: hidden; background: var(--md-surface-container-highest); }
.banner-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-box .ph-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--md-on-surface-variant); }
.update-row { margin-top: 12px; }
/* righe brevi dei widget */
.top-row { display: flex; align-items: center; gap: 16px; width: 100%; padding: 8px 16px; min-height: 56px; text-align: left; }
.top-row:active { background: var(--state-press); }
.top-row .body { flex: 1; min-width: 0; }
.top-row .tn { display: block; font-size: 1rem; line-height: 1.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-row .ts { display: block; font-size: .875rem; line-height: 1.25rem; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-row .tw { color: var(--md-primary); }
.top-row .tw .i { width: 16px; height: 16px; font-size: 16px; vertical-align: -3px; }
.top-bar { display: block; height: 4px; border-radius: 2px; background: var(--md-secondary-container); margin-top: 6px; overflow: hidden; }
.top-bar span { display: block; height: 100%; background: var(--md-primary); border-radius: 2px; }
.top-row .tv { color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; font-weight: 500; min-width: 1.6em; text-align: right; }
.card-foot {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: auto; margin: 0 4px 8px;
  min-height: 40px; padding: 0 12px; border-radius: 20px; color: var(--md-primary); font-weight: 500; font-size: .875rem;
}
.card-foot:active { background: color-mix(in srgb, var(--md-primary) 12%, transparent); }
.card-foot .i { width: 18px; height: 18px; font-size: 18px; }

/* ===================== dashboard a widget ===================== */
.dash-bar { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 16px 0; }
.dash-help { margin: 8px 16px 0; font-size: .875rem; }
.widget { position: relative; }
.dash.editing .widget > .card { pointer-events: none; }
.w-tools {
  display: flex; align-items: center; gap: 8px; margin: 12px 16px -4px;
  padding: 4px 8px; border-radius: 16px; background: var(--md-surface-container-high);
}
.w-drag { width: 44px; height: 40px; display: grid; place-items: center; border-radius: 20px; touch-action: none; cursor: grab; color: var(--md-on-surface-variant); }
.w-drag:active { cursor: grabbing; background: var(--state-press); }
.w-name { flex: 1; min-width: 0; font-weight: 500; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-del { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 20px; color: var(--md-error); }
.widget.dragging { opacity: .5; pointer-events: none; }
.w-size {
  min-width: 52px; height: 32px; padding: 0 12px; border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--md-outline-variant); font-weight: 500; font-size: .875rem; color: var(--md-on-surface-variant);
  font-variant-numeric: tabular-nums;
}
.w-size:hover { background: var(--state); }
.w-altri { margin: 4px 16px 6px; font-size: .75rem; color: var(--md-on-surface-variant); font-weight: 500; }

/* note nella dashboard: campo pieno (filled) Material */
.card.w-note { display: flex; flex-direction: column; }
.note-area {
  display: block; width: calc(100% - 32px); margin: 0 16px 16px; flex: 1 1 auto; min-height: 150px; resize: vertical;
  font: inherit; font-size: 1rem; line-height: 1.5rem; padding: 12px 16px;
  border-radius: 4px 4px 0 0; border: 0; box-shadow: inset 0 -1px 0 var(--md-on-surface-variant);
  background: var(--md-surface-container-highest); color: var(--md-on-surface);
}
.note-area:focus { outline: none; box-shadow: inset 0 -2px 0 var(--md-primary); }
.dash.griglia .note-area { resize: none; min-height: 0; }
.dash.editing .note-area { pointer-events: none; opacity: .7; }

/* novità della versione */
.cl-v { margin: 16px 0 6px; font-size: 1rem; font-weight: 500; }
.cl-list { margin: 6px 0 0; padding-left: 20px; }
.cl-list li { margin: 6px 0; line-height: 1.45; font-size: .875rem; }
.cl-link { margin-top: 6px; }
.cl-link .lnk { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--md-primary); min-height: 44px; text-decoration: none; }
.cl-blocco + .cl-blocco { margin-top: 12px; }
.cl-v .badge { vertical-align: 2px; margin-left: 6px; }

/* totale della lista da comprare */
.card-foot .spesa-tot, .result-count .spesa-tot { margin-left: auto; color: var(--md-on-surface); font-weight: 500; }
.result-count > span:first-child { display: flex; align-items: center; gap: 12px; flex: 1; }
.spesa-tot b { color: var(--md-primary); font-weight: 500; }
/* priorità alta nella lista della spesa */
.flag.wish.alta { color: var(--md-primary); }
.flag.wish.alta .ms { font-variation-settings: 'FILL' 1; }
.flag.wish .prio, .top-row .prio { color: var(--md-error); font-weight: 700; }
.sec-prio h2 { color: var(--md-primary); display: inline-flex; align-items: center; gap: 4px; }
.sec-prio h2::before { content: '\e645'; font-family: 'Material Symbols'; font-size: 20px; font-weight: 400; font-variation-settings: 'FILL' 1; }

/* ===================== filtri dei colori ===================== */
.fbar { display: flex; align-items: center; gap: 8px; padding: 8px 0 0; flex-wrap: wrap; }
.fbtn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 16px;
  border-radius: 8px; box-shadow: inset 0 0 0 1px var(--md-outline-variant); background: transparent;
  color: var(--md-on-surface-variant); font-weight: 500; font-size: .875rem;
}
.fbtn:has(.i) { padding-left: 8px; }
.fbtn .i { width: 18px; height: 18px; font-size: 18px; color: var(--md-primary); }
.fbtn:active { background: var(--state-press); }
.fbtn.on { box-shadow: none; background: var(--md-secondary-container); color: var(--md-on-secondary-container); padding-left: 8px; }
.fbtn.on .i { color: inherit; }
.fbtn .n {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--md-error); color: var(--md-on-error); font-size: .6875rem; font-weight: 500;
}
.fbtn.ghost { margin-left: auto; box-shadow: none; color: var(--md-primary); }
.fbtn.primary-soft { margin-left: auto; box-shadow: none; background: var(--md-primary-container); color: var(--md-on-primary-container); padding-left: 8px; }
.fbtn.primary-soft .i { color: inherit; }
.attivi { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px 0; }
#view .filters .attivi { padding-left: 0; padding-right: 0; }
.ftag {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 4px 0 12px;
  border-radius: 8px; background: var(--md-secondary-container); color: var(--md-on-secondary-container); font-size: .875rem; font-weight: 500;
}
.ftag b { font-weight: 500; }
.ftag button { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 12px; color: inherit; }
.ftag button .i { width: 18px; height: 18px; font-size: 18px; }

.gruppo { padding: 16px 0; }
.gruppo + .gruppo { box-shadow: inset 0 1px 0 var(--md-outline-variant); }
.gruppo .lbl { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; color: var(--md-primary); font-size: .875rem; font-weight: 500; }
.gruppo .lbl em { font-style: normal; font-weight: 400; color: var(--md-on-surface-variant); }
.mchips { display: flex; flex-wrap: wrap; gap: 8px; }
.mchip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 16px; border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--md-outline-variant); color: var(--md-on-surface-variant); font-size: .875rem; font-weight: 500;
}
.mchip .box { display: none; }
.mchip.on { box-shadow: none; background: var(--md-secondary-container); color: var(--md-on-secondary-container); padding-left: 8px; }
.pfoot { display: flex; align-items: center; gap: 8px; padding: 16px 0 4px; position: sticky; bottom: 0; background: var(--md-surface-container-low); }
.pfoot .btn { flex: 1; }

/* ===================== montaggio e accessori ===================== */
.obj-ico {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--md-primary-container); color: var(--md-on-primary-container); object-fit: cover;
}
.obj-ico .i { width: 22px; height: 22px; font-size: 22px; }
img.obj-ico { background: var(--md-surface-container-high); }
.step.is-done .obj-ico { opacity: .7; }
.obj-line {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; max-width: 100%;
  font-size: .75rem; font-weight: 500; letter-spacing: .03em; min-height: 24px; padding: 0 8px; border-radius: 6px;
  background: var(--md-surface-container-highest); color: var(--md-on-surface-variant); overflow-wrap: anywhere;
}
.obj-line .q { color: var(--md-primary); white-space: nowrap; }
.sec h2.sec-ico { display: inline-flex; align-items: center; gap: 8px; }
.sec h2.sec-ico .i { color: var(--md-primary); width: 20px; height: 20px; font-size: 20px; }
.ed-tabs { margin: 16px 16px 4px; }
.n-tab {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  font-size: .6875rem; font-weight: 500; border-radius: 10px; background: var(--md-primary); color: var(--md-on-primary);
}
.build-list { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 10px; font-size: .875rem; }
.build-list li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.35; }
.build-list .ok {
  width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; flex: none;
  background: var(--md-primary); color: var(--md-on-primary); margin-top: 1px;
}
.build-list .ok .i { width: 16px; height: 16px; font-size: 16px; }
.build-list li.todo .ok { background: none; box-shadow: inset 0 0 0 2px var(--md-on-surface-variant); }
.build-list .mut { color: var(--md-on-surface-variant); font-size: .8125rem; }
.paint-later .zone { margin: 8px 0 4px; }

/* Materiali: Colori e Accessori */
.pt-sez { margin: 0 0 12px; }
.filters .pt-sez + .search { margin-top: 0; }
#view .filters .fbar { padding-left: 0; padding-right: 0; }
/* voce «Accessori» e «Colori» sotto «Materiali»: solo nel pannello laterale del computer */
.nav .nav-sub { display: none; }
@media (max-width: 999px) { .fbtn.primary-soft { display: none; } }

/* ===================== computer (schermi larghi) ===================== */
@media (min-width: 1000px) {
  /* la barra di navigazione diventa un pannello laterale (navigation drawer) */
  #app { flex-direction: row-reverse; }
  .nav {
    flex-direction: column; justify-content: flex-start; gap: 0;
    width: 280px; flex: none; height: 100%; min-height: 0;
    background: var(--md-surface-container-low);
    padding: 12px 12px 16px; overflow-y: auto;
  }
  .nav::before {
    content: "Brushlore"; display: block; padding: 18px 16px 18px 52px; margin-bottom: 4px;
    font-family: var(--font-body); font-size: 1.375rem; line-height: 1.75rem; font-weight: 500; color: var(--md-on-surface);
    background: url(../img/logo.svg) no-repeat 16px 50% / 24px 26px;
  }
  .nav button {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 56px; padding: 0 24px 0 16px; border-radius: 28px;
  }
  .nav .ni { width: auto; height: auto; background: none !important; border-radius: 0; }
  .nav .nl { font-size: .875rem; line-height: 1.25rem; letter-spacing: .01em; }
  .nav button:hover { background: var(--state); }
  .nav button.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
  .nav button.on .nl { font-weight: 700; }
  /* «Materiali» con le sue due voci sotto */
  .nav button.on.sub-attivo { background: none; color: var(--md-on-surface); }
  .nav button.sub-attivo .ni { color: var(--md-primary); }
  .nav button.nav-sub { display: flex; min-height: 48px; margin-left: 28px; padding-left: 16px; border-radius: 24px; }
  .nav button.nav-sub .i { width: 20px; height: 20px; font-size: 20px; }
  .nav button.nav-sub.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

  /* contenuto più largo e centrato, sempre con un po' di margine */
  #view > * { max-width: min(1120px, calc(100% - 48px)); margin-left: auto; margin-right: auto; }
  #view > .topbar { max-width: none; padding-left: max(12px, calc((100% - 1120px) / 2)); padding-right: max(12px, calc((100% - 1120px) / 2)); }
  .bench-hero.with-photo { padding-left: 28px; padding-right: 28px; }

  /* il pulsante «+ Miniatura» resta dentro la colonna del contenuto */
  .fab { bottom: 28px; right: max(28px, calc((100vw - 280px - 1120px) / 2 + 24px)); }
  body.has-snack .fab { bottom: 92px; }

  /* fogli e finestre al centro, come dialoghi */
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(600px, 92vw); max-height: 86%;
    transform: translate(-50%, -50%); border-radius: 28px;
    background: var(--md-surface-container-high); box-shadow: var(--md-elev-3);
    animation: pop .2s cubic-bezier(.2, 0, 0, 1);
    --field-bg: var(--md-surface-container-high);
  }
  .sheet .pfoot { background: var(--md-surface-container-high); }
  .grip { display: none; }
  .modal {
    inset: 24px auto 24px 50%; width: min(880px, 94vw); transform: translateX(-50%);
    border-radius: 28px; overflow: hidden;
    box-shadow: var(--md-elev-3), 0 0 0 100vmax var(--scrim);
    animation: pop .2s cubic-bezier(.2, 0, 0, 1);
  }

  /* con il mouse: livello di passaggio */
  .row:hover, .srow:hover, .top-row:hover, .prog-row:hover, .legend-item:hover, .menu-item:hover,
  .step-body:hover, button.step:hover, .zone-add:hover, .location-box:hover { background: var(--state); }
  div.step-body:hover { background: none; }
  .chip:hover, .fbtn:hover, .mchip:hover, .seg button:hover, .icon-btn:hover { background-color: var(--state); }
  .btn:hover::after { opacity: .08; }
  .row, .btn, .chip, .srow, .menu-item { cursor: pointer; }

  .settings-group .seg, .status-seg { max-width: 600px; }
  /* le file di bottoni vanno a capo (col mouse non si scorrono di lato) */
  .chips.scroll { flex-wrap: wrap; overflow-x: visible; margin: 0; padding: 2px 0 4px; }

  /* avviso in basso, nella colonna del contenuto */
  .snack { left: calc(280px + 24px); right: 24px; bottom: 24px; max-width: 640px; margin: 0 auto; }

  /* dashboard a blocchi */
  #view > .dash, #view > .dash-bar, #view > .dash-help { max-width: none; margin-left: 0; margin-right: 0; }
  #view > .dash-hero { max-width: none; padding-left: 36px; padding-right: 36px; }
  .dash-bar, .dash-help { padding-left: 24px; padding-right: 24px; }
  .dash {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    grid-auto-rows: 400px; align-items: stretch;
    gap: 16px; padding: 16px 24px 24px;
  }
  .widget.largo { grid-column: auto; }
  .widget { display: flex; flex-direction: column; min-height: 0; }
  .dash > .widget { height: 100%; overflow: hidden; }
  .dash > .widget > .card, .dash .w-tools { margin: 0; }
  .dash .w-tools { margin-bottom: 8px; }
  .dash > .widget > .card {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    overflow: hidden; container-type: size; container-name: w;
  }
  .dash .card > .card-foot { margin-top: auto; }
  .dash .card > .ring-row { flex: 1; align-items: center; }
  .dash .card > .bars { flex: 1; height: auto; min-height: 160px; }
  .dash .card > .card-text { flex: 1; }
  .dash .ring { width: 128px; height: 128px; }
  .dash .ring-row { gap: 12px; }
  .dash .legend-item > .i { display: none; }

  /* griglia libera della dashboard */
  .dash.griglia { grid-auto-flow: row; }
  .dash.griglia .slot {
    border-radius: 12px; min-height: 0;
    box-shadow: inset 0 0 0 2px var(--md-outline-variant);
    background: repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in srgb, var(--md-on-surface) 3%, transparent) 10px 20px);
  }
  .dash.griglia.trascinando .slot { box-shadow: inset 0 0 0 2px var(--md-outline); }
  .dash.griglia .ghost {
    border-radius: 12px; z-index: 3; pointer-events: none;
    box-shadow: inset 0 0 0 2px var(--md-primary);
    background: color-mix(in srgb, var(--md-primary) 12%, transparent);
  }
  .dash.griglia .widget.dragging { opacity: .35; }

  /* blocchi alti (1×2, 2×2): torta grande in alto, stati sotto */
  @container w (min-height: 560px) {
    .ring-row { flex-direction: column; justify-content: center; gap: 26px; padding-top: 10px; }
    .dash .ring { width: min(62cqw, 42cqh); height: min(62cqw, 42cqh); }
    .legend { width: 100%; max-width: 640px; }
    .legend.molti { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
    .bars { min-height: 60cqh; }
    .dash .ring-row .legend { flex: none; align-content: start; }
  }
  /* blocchi larghi e bassi (2×1, 3×1): torta grande a sinistra, stati su due colonne */
  @container w (min-width: 620px) and (max-height: 559px) {
    .ring-row { gap: 34px; padding-left: 10px; }
    .dash .ring { width: min(34cqw, 68cqh); height: min(34cqw, 68cqh); }
    .legend.molti { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
  }
  @container w (min-height: 560px) or (min-width: 620px) {
    .ring .ring-pct { font-size: 18px; }
    .ring .ring-lbl { font-size: 8px; }
  }
}
/* telefono e tablet: in modifica i widget diventano una lista compatta, facile da riordinare */
@media (max-width: 999px) {
  .dash.editing .widget > .card { display: none; }
  .dash.editing .w-tools { margin-bottom: 0; padding: 8px; }
}
.dash [hidden] { display: none !important; }
