/* Dolomia · Area commerciali
   Palette e caratteri dal sito acquadolomia: enrosadira (#D13D3D / #CF867F), testi e titoli grigio #707070,
   titoli in Museo, testo in Montserrat. */

@font-face { font-family: "Museo"; src: url("../fonts/Museo-500.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Museo"; src: url("../fonts/Museo-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Museo"; src: url("../fonts/Museo-900.woff") format("woff"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/Montserrat-var.woff") format("woff"); font-weight: 100 900; font-display: swap; }

:root {
  --rose: #D13D3D;
  --rose-dark: #B12F2F;
  --blush: #CF867F;
  --blush-soft: #F8E9E6;
  --blush-tint: #FCF5F3;
  --ink: #707070;     /* grigio scuro del sito Dolomia: titoli e testi */
  --ink-2: #707070;
  --muted: #8C8C8C;   /* testi secondari, più chiari */
  --line: #E8E1DD;
  --line-strong: #D8CFCA;
  --bg: #F7F4F2;
  --surface: #FFFFFF;
  --ok: #2F7D4F;
  --ok-soft: #E7F3EC;
  --warn: #9A6A12;
  --warn-soft: #FBF2DF;
  --err: #B3261E;
  --err-soft: #FBE9E7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(38, 38, 38, .05), 0 6px 18px rgba(38, 38, 38, .06);
  --shadow-lg: 0 24px 60px rgba(38, 38, 38, .22);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Museo", "Montserrat", Georgia, serif;
  --gutter: 16px;
  --maxw: 1320px;
  color-scheme: light;
}
@media (min-width: 768px) { :root { --gutter: 28px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
/* spazio della barra di scorrimento sempre riservato: la testata non si sposta tra pagine corte e lunghe */
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img, video, iframe { max-width: 100%; display: block; }
a { color: var(--rose); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.005em; }
h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 900; }
h2 { font-size: 20px; }
p { margin: 0; }
code { background: var(--blush-tint); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(209, 61, 61, .35); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--blush); margin-bottom: 6px; }
.spacer { flex: 1; }

/* ---------- Icone ---------- */
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.xl { width: 40px; height: 40px; stroke-width: 1.4; }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--rose); color: #fff; }
.btn-primary:hover { background: var(--rose-dark); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--blush); color: var(--rose); }
.btn-danger-ghost { background: transparent; color: var(--err); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--err-soft); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--blush-tint); color: var(--rose); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn[disabled] { opacity: .3; pointer-events: none; }
.link-like { color: var(--rose); display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Testata ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); height: 64px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--blush); text-decoration: none; flex: none; }
.brand-logo { height: 34px; width: auto; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--line-strong); line-height: 1.2; }
.nav { display: flex; gap: 2px; margin-left: 8px; flex: 1; }
.nav > a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav > a .ic { width: 18px; height: 18px; color: var(--muted); }
.nav > a:hover { background: var(--blush-tint); color: var(--ink); }
.nav > a.is-active { background: var(--blush-soft); color: var(--rose); }
.nav > a.is-active .ic { color: var(--rose); }
.nav-user-mobile { display: none; }
.usermenu { position: relative; margin-left: auto; }
.avatar-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 999px; color: var(--ink-2); }
.avatar-btn:hover { background: var(--blush-tint); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blush-soft); color: var(--rose); font: 700 14px/1 var(--font-head); flex: none; }
.avatar-name { font-size: 14px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.pop-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: grid; }
.pop-head small { color: var(--muted); }
.pop a, .pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 0; background: none; text-decoration: none; color: var(--ink); font-size: 14px; cursor: pointer; text-align: left; }
.pop a:hover, .pop button:hover { background: var(--blush-tint); }
.menu-btn { display: none; margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; cursor: pointer; color: var(--ink); }

.nav > a { white-space: nowrap; }
@media (max-width: 1180px) {
  .avatar-name { display: none; }
  .nav > a .ic { display: none; }
  .nav > a { padding: 8px 10px; }
}
@media (max-width: 900px) {
  .brand-logo { height: 28px; }
  .menu-btn { display: inline-grid; place-items: center; }
  .usermenu { display: none; }
  .nav {
    position: fixed; inset: 64px 0 auto 0; margin: 0; flex-direction: column; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
    padding: 10px var(--gutter) 16px; transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .18s, transform .18s, visibility .18s; max-height: calc(100vh - 64px); overflow: auto;
  }
  .nav.is-open { opacity: 1; transform: none; visibility: visible; }
  .nav > a { padding: 14px 12px; font-size: 16px; border-radius: 12px; }
  .nav-user-mobile { display: block; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
  .nav-user-mobile a, .nav-user-mobile button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 12px; font-size: 16px; color: var(--ink-2); text-decoration: none; background: none; border: 0; cursor: pointer; border-radius: 12px; }
}
@media (max-width: 480px) { .brand-sub { display: none; } }

.main { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 80px; }

/* ---------- Messaggi ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: #CBE6D5; }
.flash-error { background: var(--err-soft); color: var(--err); border-color: #F3CBC6; }
.flash-info { background: var(--blush-tint); color: var(--ink-2); border-color: var(--blush-soft); }
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; z-index: 200;
  box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); text-align: center;
}

/* ---------- Libreria ---------- */
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; margin-bottom: 22px; }
.lib-title p.muted { margin-top: 6px; }
.search { position: relative; flex: 1 1 340px; max-width: 520px; }
.search .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 50px; padding: 0 18px 0 46px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 16px; box-shadow: var(--shadow);
}
.search input:focus { outline: none; border-color: var(--blush); box-shadow: 0 0 0 4px rgba(207, 134, 127, .2); }
.search-sm { flex: 0 1 260px; }
.search-sm input { height: 40px; font-size: 14px; box-shadow: none; padding-left: 42px; }

.chips-wrap { margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips-wrap::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 8px; padding: 2px 24px 6px 0; width: max-content; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--blush); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-n { font-size: 12px; color: var(--muted); font-weight: 600; }
.chip[aria-pressed="true"] .chip-n { color: rgba(255, 255, 255, .7); }
.chip-new { border-color: var(--blush-soft); background: var(--blush-tint); color: var(--rose); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin: 16px 0 20px; }
.cat-desc { font-size: 14px; flex: 1 1 280px; }
.cat-desc:empty { display: none; }
.toolbar-right { margin-left: auto; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: #EDE7E3; border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
select, .select-sm select {
  height: 40px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23736B67' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  padding: 0 36px 0 14px; font-size: 14px; -webkit-appearance: none; appearance: none; cursor: pointer; max-width: 100%;
}

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

.card-asset {
  position: relative; display: flex; flex-direction: column; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--radius); overflow: hidden; color: inherit;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card-open { all: unset; cursor: pointer; display: block; }
.card-open::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-open:focus-visible::after { outline: 3px solid rgba(209, 61, 61, .45); outline-offset: -3px; border-radius: var(--radius); }
.btn-primary .muted-on-dark { opacity: .75; font-weight: 500; }
.card-asset:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-strong); }
.card-media { position: relative; aspect-ratio: 4 / 3; background: #F1ECE9; display: grid; place-items: center; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media.is-contain img { object-fit: contain; padding: 12px; }
.card-media .ic.xl { color: var(--blush); }
.card-ext { position: absolute; left: 10px; top: 10px; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 4px 8px; border-radius: 6px; }
.card-new { position: absolute; right: 10px; top: 10px; background: var(--rose); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; }
.card-play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.card-play span { width: 48px; height: 48px; border-radius: 50%; background: rgba(38, 38, 38, .55); display: grid; place-items: center; color: #fff; backdrop-filter: blur(4px); }
.card-play .ic { width: 20px; height: 20px; margin-left: 3px; }
.card-body { padding: 12px 14px 14px; display: grid; gap: 4px; flex: 1; align-content: start; }
.card-title { font: 600 14px/1.35 var(--font); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 12px; color: var(--muted); }
.card-dl {
  position: absolute; z-index: 2; right: 10px; bottom: 10px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--rose); border: 1px solid var(--line); box-shadow: var(--shadow); opacity: 0; transition: opacity .15s;
}
.card-asset:hover .card-dl, .card-dl:focus-visible { opacity: 1; }
.card-dl:hover { background: var(--rose); color: #fff; border-color: var(--rose); }
@media (hover: none) { .card-dl { display: none; } }

.empty { text-align: center; padding: 60px 20px; display: grid; justify-items: center; gap: 8px; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* ---------- Visualizzatore ---------- */
dialog { border: 0; padding: 0; color: inherit; }
dialog::backdrop { background: rgba(28, 24, 22, .72); backdrop-filter: blur(3px); }
.viewer { width: min(1240px, calc(100vw - 48px)); max-width: none; height: min(820px, calc(100vh - 48px)); max-height: none; border-radius: 18px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow-lg); }
.viewer-in { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: 100%; }
.viewer-media { background: #1E1B1A; display: grid; place-items: center; min-height: 0; position: relative; overflow: hidden; }
.viewer-media > img, .viewer-media > video, .viewer-media > iframe { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.viewer-media > video { background: #000; }
.viewer-media > iframe { border: 0; background: #fff; }
.viewer-media .ic.xl { width: 72px; height: 72px; color: var(--blush); }
.viewer-media .media-msg { color: #EDE5E1; text-align: center; display: grid; gap: 12px; justify-items: center; padding: 24px; }
.viewer-side { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px 18px; overflow-y: auto; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.viewer-side h2 { font-size: 24px; font-weight: 900; }
.viewer-desc { color: var(--ink-2); font-size: 14px; white-space: pre-line; }
.viewer-desc:empty { display: none; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; margin: 6px 0 4px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 500; }
.viewer-actions { display: grid; gap: 8px; margin-top: 6px; }
.share-note { font-size: 13px; background: var(--blush-tint); padding: 10px 12px; border-radius: var(--radius-sm); word-break: break-all; }
.viewer-nav { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; background: var(--blush-soft); color: var(--rose); }
.badge-soft { background: #EFEAE7; color: var(--ink-2); text-transform: none; letter-spacing: 0; font-weight: 600; }
.badge-off { background: var(--err-soft); color: var(--err); text-transform: none; letter-spacing: 0; }

@media (max-width: 860px) {
  .viewer { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .viewer-in { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 46%) 1fr; }
  .viewer-side { padding: 14px var(--gutter) max(16px, env(safe-area-inset-bottom)); }
  .viewer-side h2 { font-size: 21px; }
  .viewer-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 2; margin: 0; pointer-events: none; }
  .viewer-top > * { pointer-events: auto; }
  .viewer-top .badge { background: rgba(255, 255, 255, .92); }
  .viewer-top .icon-btn { background: rgba(255, 255, 255, .92); color: var(--ink); }
}

/* ---------- Pagine interne ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p.muted { margin-top: 8px; max-width: 720px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
@media (min-width: 768px) { .card { padding: 24px; } }
.card-title { font-size: 18px; margin-bottom: 14px; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title-row .card-title { margin: 0; }
.narrow { max-width: 560px; }
.two-col { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 960px) { .two-col { grid-template-columns: 360px 1fr; } .two-col-wide { grid-template-columns: 1fr 1.3fr; } }

/* ---------- Moduli ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field em { font-weight: 400; font-style: normal; }
.field small { font-weight: 400; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 16px; font-weight: 400; color: var(--ink);
}
.field select { border-radius: var(--radius-sm); height: 46px; }
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--blush); box-shadow: 0 0 0 4px rgba(207, 134, 127, .2); }
.field-row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field-xs { max-width: 160px; }
.field-inline { grid-template-columns: auto minmax(0, 320px); align-items: center; gap: 12px; }
@media (max-width: 560px) { .field-inline { grid-template-columns: 1fr; } }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 84px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--rose); font-size: 13px; font-weight: 600; padding: 8px 10px; cursor: pointer; }
.kv { display: grid; gap: 8px; margin: 0 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.kv div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- Accesso ---------- */
.page-login { background: var(--surface); }
.login { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; min-height: 100dvh; }
.login-visual { position: relative; overflow: hidden; background: #2b2523; }
.login-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 62%; }
.login-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 16, 15, 0) 40%, rgba(20, 16, 15, .72)); }
.login-visual-text { position: absolute; left: 48px; right: 48px; bottom: 48px; z-index: 1; color: #fff; }
.login-visual-text .eyebrow { color: #F3D3CD; }
.login-claim { font: 700 clamp(24px, 2.6vw, 34px)/1.2 var(--font-head); max-width: 460px; }
.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.login-logo { width: 150px; height: auto; color: var(--blush); margin-bottom: 8px; }
.login-box h1 { font-size: 30px; }
.login-help { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.login-help .ic { margin-top: 2px; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: 30vh auto; }
  .login-visual-text { left: 20px; right: 20px; bottom: 20px; }
  .login-visual-text .login-claim { font-size: 20px; }
  .login-panel { place-items: start center; padding: 28px 20px 40px; }
  .login-logo { width: 120px; }
}

/* ---------- Caricamento ---------- */
.upload-card { margin-bottom: 32px; display: grid; gap: 16px; }
.dropzone {
  display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 20px; border: 2px dashed var(--line-strong);
  border-radius: var(--radius); background: var(--blush-tint); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone .ic { color: var(--blush); }
.dropzone strong { font-weight: 600; }
.dropzone span { max-width: 560px; }
.dropzone:hover, .dropzone.is-over { border-color: var(--blush); background: var(--blush-soft); }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queue:empty { display: none; }
.q-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.q-thumb { width: 52px; height: 52px; border-radius: 8px; background: #F1ECE9 center/cover no-repeat; display: grid; place-items: center; color: var(--blush); }
.q-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-status { font-size: 12px; color: var(--muted); }
.q-item.is-error .q-status { color: var(--err); }
.q-item.is-done .q-status { color: var(--ok); }
.q-bar { height: 6px; border-radius: 99px; background: #EEE7E3; overflow: hidden; margin-top: 6px; }
.q-bar span { display: block; height: 100%; width: 0; background: var(--rose); border-radius: 99px; transition: width .2s; }
.q-item.is-done .q-bar span { background: var(--ok); }

.admin-list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: visible; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table tr.is-off td { opacity: .6; }
.a-cell, .u-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.a-thumb { width: 56px; height: 42px; border-radius: 6px; background: #F1ECE9 center/contain no-repeat; flex: none; display: grid; place-items: center; color: var(--blush); }
.a-thumb .ic { width: 20px; height: 20px; }
.a-title { font-weight: 600; }
.a-file { font-size: 12px; color: var(--muted); word-break: break-all; }
.empty-row { padding: 24px; text-align: center; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 2px 0; border: 0; }
  .table td[data-label]:not(:first-child) { display: flex; gap: 8px; font-size: 13px; padding-left: 68px; }
  .table-users td[data-label]:not(:first-child) { padding-left: 46px; }
  .table td[data-label]:not(:first-child)::before { content: attr(data-label) ":"; color: var(--muted); }
  .table .actions { text-align: left; padding: 8px 0 0 68px; }
  .table-users .actions { padding-left: 46px; }
}

/* Menu a tendina nelle righe */
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; text-align: left; white-space: normal; display: grid; gap: 2px; }
@media (max-width: 760px) { .row-menu { display: block; } .row-menu-pop { position: static; width: auto; max-width: none; margin-top: 10px; box-shadow: none; } }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink); text-align: left; }
.menu-item:hover { background: var(--blush-tint); }
.menu-item.danger { color: var(--err); }

/* Credenziali generate */
.creds { margin-bottom: 24px; border-color: #CBE6D5; background: linear-gradient(180deg, var(--ok-soft), var(--surface) 70%); display: grid; gap: 14px; }
.creds-head { display: flex; gap: 14px; align-items: flex-start; }
.creds-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; flex: none; }
.creds-box { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; font: 500 14px/1.7 ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

/* Modali */
.modal { width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: auto; }
.modal-in { padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.edit-grid { display: grid; gap: 20px; grid-template-columns: 220px minmax(0, 1fr); }
.edit-cover .btn { white-space: normal; width: 100%; }
.edit-grid > div:last-child { display: grid; gap: 14px; }
.edit-cover { display: grid; gap: 8px; align-content: start; }
.edit-thumb { aspect-ratio: 4 / 3; border-radius: var(--radius-sm); background: #F1ECE9 center/contain no-repeat; display: grid; place-items: center; color: var(--blush); }
@media (max-width: 600px) { .edit-grid { grid-template-columns: 1fr; } .edit-cover { grid-template-columns: 120px 1fr; } .edit-thumb { grid-row: span 3; } }

/* Categorie */
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cat-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px 16px; }
.cat-order { display: grid; gap: 2px; align-content: start; }
.cat-order form { margin: 0; }
.cat-body > summary { list-style: none; cursor: pointer; display: grid; gap: 2px; }
.cat-body > summary::-webkit-details-marker { display: none; }
.cat-body[open] > summary { margin-bottom: 14px; }
.cat-body .cat-d { display: block; }
.cat-delete { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Statistiche */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 20px; }
.stat { display: grid; gap: 4px; }
.stat-n { font: 900 34px/1 var(--font-head); color: var(--rose); }
.stat-l { font-size: 13px; color: var(--muted); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.bars-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { grid-column: 1; height: 8px; background: #F1ECE9; border-radius: 99px; overflow: hidden; }
.bars-fill { display: block; height: 100%; background: var(--blush); border-radius: 99px; }
.bars-n { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; }
.inline-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.log { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow: auto; }
.log li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log li.log-login_fail .log-what { color: var(--err); }
@media (max-width: 560px) { .log li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Link condiviso ---------- */
.page-shared { background: var(--bg); }
.shared { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; padding: 32px var(--gutter); gap: 18px; }
.shared-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.shared-logo { width: 110px; height: auto; color: var(--blush); margin-bottom: 8px; }
.shared-media { border-radius: var(--radius); overflow: hidden; background: #F1ECE9; margin-bottom: 6px; }
.shared-media img { width: 100%; max-height: 420px; object-fit: contain; }
.shared-media-icon { aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--blush); }
.shared-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.shared-actions .btn { flex: 1; }

/* ---------- Installazione ---------- */
.install { padding: 40px var(--gutter) 80px; display: grid; justify-items: center; }
.install-box { width: 100%; max-width: 680px; display: grid; gap: 16px; }
.install-logo { width: 120px; height: auto; color: var(--blush); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.checks li { display: flex; gap: 8px; align-items: center; }
.checks .ok .ic { color: var(--ok); }
.checks .ko { color: var(--err); }
.checks .warn { color: var(--warn); }
.radio-cards { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .radio-cards { grid-template-columns: 1fr 1fr; } }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; font-size: 14px; }
.radio-card:has(input:checked) { border-color: var(--rose); background: var(--blush-tint); }
.radio-card input { margin-top: 4px; accent-color: var(--rose); }
.mysql-fields { display: grid; gap: 14px; }
.mysql-fields[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* =========================================================
   v2 — categorie e sottocategorie, clienti, impostazioni
   ========================================================= */

/* Percorso (breadcrumb) */
.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.link-plain { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--rose); font-weight: 600; }
.link-plain:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-plain:focus-visible { outline: 3px solid rgba(209, 61, 61, .35); border-radius: 4px; }

/* Riquadri delle categorie */
.cat-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 560px) { .cat-grid { grid-template-columns: 1fr 1fr; gap: 12px; } }
@media (max-width: 380px) { .cat-grid { grid-template-columns: 1fr; } }
.cat-tile {
  all: unset; box-sizing: border-box; position: relative; display: flex; flex-direction: column; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.cat-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-strong); }
.cat-tile:focus-visible { outline: 3px solid rgba(209, 61, 61, .45); outline-offset: 2px; }
.cat-tile-media { aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--blush-tint), #EFE7E3); display: grid; place-items: center; color: var(--blush); overflow: hidden; }
.cat-tile-media img { width: 100%; height: 100%; object-fit: cover; }
.cat-tile-body { padding: 14px 16px 16px; display: grid; gap: 4px; }
.cat-tile-name { font: 700 19px/1.2 var(--font-head); color: var(--ink); }
.cat-tile-meta { font-size: 13px; color: var(--muted); font-weight: 500; }
.cat-tile-desc { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 560px) { .cat-tile-name { font-size: 16px; } .cat-tile-desc { display: none; } }

/* Sezioni (una per sottocategoria) */
.lib-section { margin-bottom: 34px; }
.lib-section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.lib-section-head h2 { font-size: 20px; }
#subs-wrap { margin-bottom: 4px; }

/* Utenti */
.users-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; padding: 16px; }
.users-search { flex: 1 1 280px; max-width: none; }
.users-selects { display: flex; gap: 8px; flex-wrap: wrap; }
.users-count { width: 100%; margin: 0; }
.seg-n { font-size: 11px; color: var(--muted); margin-left: 2px; }
.seg { flex-wrap: wrap; }
.role { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #EFEAE7; color: var(--ink-2); white-space: nowrap; }
.role-admin { background: var(--ink); color: #fff; }
.role-sales { background: var(--blush-soft); color: var(--rose); }
.role-client { background: #E6F0F4; color: #2D5A6B; }
.avatar-client { background: #E6F0F4; color: #2D5A6B; }
.badge-warn { background: var(--warn-soft); color: var(--warn); text-transform: none; letter-spacing: 0; }
.table-users td { font-size: 14px; }
@media (max-width: 760px) {
  .table-users td[data-label]:not(:first-child) { padding-left: 46px; }
  .users-selects select { flex: 1 1 140px; }
}

/* Scheda utente */
.modal-wide { width: min(780px, calc(100vw - 32px)); }
.req { color: var(--rose); font-weight: 700; }
.radio-cards-3 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .radio-cards-3 { grid-template-columns: repeat(3, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; line-height: 1.4; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--rose); flex: none; }
fieldset.field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.cat-tree { display: grid; gap: 10px; max-height: 300px; overflow: auto; padding: 4px 2px; }
@media (min-width: 640px) { .cat-tree { grid-template-columns: 1fr 1fr; } }
.cat-node { background: var(--blush-tint); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; align-content: start; }
.cat-kids { display: grid; gap: 6px; padding-left: 28px; }
.cat-kids .check { font-weight: 400; }
.cat-kids .is-included { color: var(--muted); }
.expiry { display: grid; gap: 8px; }
.date-input { width: 100%; max-width: 220px; min-height: 46px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; }
[hidden] { display: none !important; }
.mail-ok { color: var(--ok); display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.mail-ko { color: var(--err); display: flex; gap: 6px; align-items: flex-start; margin-top: 2px; }

/* Categorie (gestione) */
.cat-item { display: grid; gap: 8px; grid-template-columns: 1fr; padding: 14px 16px; }
.cat-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.cat-subs { display: grid; gap: 8px; margin-left: 30px; padding-left: 14px; border-left: 2px solid var(--blush-soft); }
.cat-row.is-sub { padding: 6px 0; }
.cat-add-sub { all: unset; cursor: pointer; justify-self: start; margin-left: 44px; color: var(--rose); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }

/* Impostazioni */
.settings { display: grid; gap: 20px; max-width: 860px; }
.smtp-fields { display: grid; gap: 14px; padding: 16px; background: var(--blush-tint); border-radius: var(--radius-sm); }
.field-row-tight { grid-template-columns: 110px 1fr !important; }
.test-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.test-row .field { flex: 1 1 260px; }
.settings-actions { display: flex; justify-content: flex-end; }
/* La tabella utenti ha molte colonne: sotto i 1100 px diventa a schede */
@media (max-width: 1100px) {
  .table-users thead { display: none; }
  .table-users, .table-users tbody, .table-users tr, .table-users td { display: block; width: 100%; }
  .table-users tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-users tr:last-child { border-bottom: 0; }
  .table-users td { padding: 2px 0; border: 0; }
  .table-users td[data-label]:not(:first-child) { display: flex; gap: 8px; font-size: 13px; padding-left: 46px; }
  .table-users td[data-label]:not(:first-child)::before { content: attr(data-label) ":"; color: var(--muted); flex: none; min-width: 104px; }
  .table-users .actions { text-align: left; padding: 8px 0 0 46px; }
  .table-users .row-menu { display: block; }
  .table-users .row-menu-pop { position: static; width: auto; max-width: 420px; margin-top: 10px; box-shadow: none; }
}
/* caselle e radio dentro i moduli: niente stile da campo di testo */
.field input[type="checkbox"], .field input[type="radio"], .check input, .radio-card input {
  width: 18px; height: 18px; min-height: 0; padding: 0; border-radius: 4px; box-shadow: none; flex: none; margin: 2px 0 0; accent-color: var(--rose);
}
.field .check { font-weight: 500; }
.radio-card { align-items: flex-start; }

.expiry > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.expiry-date { display: grid; gap: 6px; }

/* Passaggio morbido tra le pagine (Chrome, Edge, Safari recenti): la testata resta ferma */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Filtri con menu a tendina: non devono allargarsi oltre lo schermo con nomi lunghi */
select { min-width: 0; text-overflow: ellipsis; }
.admin-list-head > *, .admin-filters, .users-selects { min-width: 0; max-width: 100%; }
.admin-filters select, .users-selects select { max-width: 100%; }
@media (max-width: 760px) {
  .admin-filters, .users-selects { width: 100%; }
  .admin-filters > *, .users-selects select { flex: 1 1 100%; width: 100%; }
}
/* Griglie: i riquadri possono restringersi fino alla larghezza dello schermo (telefoni da 320 px) */
.two-col > *, .settings > *, .field-row > *, .card { min-width: 0; }
.stats { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
@media (max-width: 400px) { .field-row-tight { grid-template-columns: 1fr !important; } .log li { grid-template-columns: 1fr; } }
.inline-filters { min-width: 0; max-width: 100%; }
.inline-filters select { max-width: 100%; }
@media (max-width: 560px) { .inline-filters { width: 100%; } .inline-filters select { flex: 1 1 100%; width: 100%; } }
/* email e nomi lunghi vanno a capo invece di uscire dallo schermo */
.u-cell > div, .a-cell > div { min-width: 0; }
.u-cell .muted, .a-file, .creds-box, .kv dd { overflow-wrap: anywhere; }

/* Sottocategorie a più livelli */
.cat-node-wrap { display: grid; gap: 8px; }
.cat-subs .cat-subs { margin-left: 22px; }
.cat-subs .cat-add-sub { margin-left: 44px; }
@media (max-width: 560px) {
  .cat-subs { margin-left: 10px; padding-left: 10px; }
  .cat-subs .cat-subs { margin-left: 6px; }
  .cat-add-sub, .cat-subs .cat-add-sub { margin-left: 0; }
}
.cat-tree .cat-kids .cat-node { background: none; padding: 0; gap: 6px; }
.cat-tree .cat-kids .cat-kids { padding-left: 24px; }
