/* ============================================================
   VAULT PRO — design system "Silicon Valley"
   ============================================================ */
:root {
  /* Arancione scuro */
  --accent: 194 65 12;
  --accent-2: 154 52 18;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f4f5f7;
  --line: #e4e6ea;
  --line-soft: #edeef1;
  --text: #0d0f14;
  --text-dim: #545a66;
  --text-mute: #8b919e;
  --shadow-sm: 0 1px 2px rgba(15,20,35,.05);
  --shadow: 0 1px 3px rgba(15,20,35,.07), 0 8px 24px -12px rgba(15,20,35,.16);
  --shadow-lg: 0 12px 40px -12px rgba(15,20,35,.22);
  /* Angoli vivi in tutta l'app */
  --radius: 0px;
  --radius-sm: 0px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: -apple-system, "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, Roboto, Helvetica, Arial, sans-serif;
}

/* Nessun angolo arrotondato: neutralizza anche i raggi scritti a mano.
   Le eccezioni esplicite (avatar tondo) le ridichiara la regola dedicata. */
*, *::before, *::after { border-radius: 0 !important; }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  font-size: 14px; letter-spacing: -0.006em; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: rgb(var(--accent)); text-decoration: none; }
svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
::selection { background: rgb(var(--accent)/.18); }
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-thumb { background: rgba(130,140,160,.35); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(130,140,160,.6); background-clip: content-box; }

/* ============================================================ Auth (login/setup) */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 32px; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.auth-brand .mark { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(160deg, rgb(var(--accent-2)), rgb(var(--accent))); position: relative; flex: none; }
.auth-brand .mark::after { content: ""; position: absolute; inset: 9px; border-radius: 4px; border: 2px solid #fff; border-right-color: transparent; border-bottom-color: transparent; }
.auth-brand strong { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; display: block; line-height: 1.2; }
.auth-brand span { font-size: 11.5px; color: var(--text-mute); }
.auth-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-logo img { max-height: 72px; max-width: 100%; object-fit: contain; }
.auth-card h1 { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 5px; }
.auth-card .sub { font-size: 13.5px; color: var(--text-dim); margin-bottom: 22px; line-height: 1.5; }
.auth-card .field { margin-bottom: 14px; }
.auth-card button[type=submit] { width: 100%; margin-top: 8px; justify-content: center; height: 40px; }
.auth-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--text-mute); line-height: 1.6; }

.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; font-weight: 500; display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.alert svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.alert.error { background: #fef2f2; color: #b42318; border: 1px solid #fecaca; }
.alert.success { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.alert.info { background: #eff4ff; color: #3538cd; border: 1px solid #c7d7fe; }

/* ============================================================ Form */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--text-dim); font-weight: 550; }
.field .req { color: rgb(var(--accent)); }
.field input, .field textarea, .field select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; outline: none; width: 100%; font-size: 13.5px;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgb(var(--accent)); box-shadow: 0 0 0 3px rgb(var(--accent)/.12); }
.field textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.field .hint { font-size: 11px; color: var(--text-mute); line-height: 1.45; }
.field .err { font-size: 11.5px; color: #dc2626; font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================ Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 8px; font-weight: 550; font-size: 13.5px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); transition: all .12s; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: rgb(var(--accent)); color: #fff; border-color: rgb(var(--accent)); }
.btn.primary:hover { background: rgb(var(--accent-2)); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-dim); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: #dc2626; }
.btn.danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* ============================================================ App shell */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; flex: none; background: linear-gradient(160deg, rgb(var(--accent-2)), rgb(var(--accent))); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; border-radius: 4px; border: 2px solid #fff; border-right-color: transparent; border-bottom-color: transparent; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 14.5px; font-weight: 650; letter-spacing: -0.02em; }
.brand-text span { font-size: 11px; color: var(--text-mute); }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--radius-sm); color: var(--text-dim); font-weight: 500; text-align: left; font-size: 13.5px; transition: background .12s, color .12s; }
.nav-item svg { width: 16px; height: 16px; opacity: .7; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.nav-item.active svg { opacity: 1; color: rgb(var(--accent)); }
.nav-count { margin-left: auto; font-size: 11.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; }

.side-section { margin-top: 18px; padding: 0 6px; overflow-y: auto; flex: 1; }
.side-title { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); margin-bottom: 8px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-nav { padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 500; background: transparent; color: var(--text-dim); border: 1px solid var(--line); transition: all .12s; }
.chip-nav:hover { background: var(--panel-2); color: var(--text); }
.chip-nav.active { background: rgb(var(--accent)); color: #fff; border-color: rgb(var(--accent)); }

.sidebar-footer { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.user-box { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: var(--radius-sm); }
.avatar { width: 28px; height: 28px; background: rgb(var(--accent)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 650; font-size: 12px; flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-meta strong { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 10.5px; color: var(--text-mute); }
.logout-btn { margin-left: auto; width: 28px; height: 28px; border-radius: 6px; color: var(--text-mute); display: flex; align-items: center; justify-content: center; }
.logout-btn:hover { background: var(--panel-2); color: #dc2626; }
.logout-btn svg { width: 15px; height: 15px; }

/* ---- Main ---- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 340px; min-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; height: 34px; transition: border-color .12s, box-shadow .12s; }
.search:focus-within { border-color: rgb(var(--accent)); box-shadow: 0 0 0 3px rgb(var(--accent)/.12); }
.search svg { width: 15px; height: 15px; color: var(--text-mute); }
.search input { flex: 1; background: none; border: none; outline: none; height: 100%; font-size: 13.5px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.select {
  height: 34px; padding: 0 28px 0 10px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b919e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 8px center;
  border: 1px solid var(--line); color: var(--text-dim); appearance: none; cursor: pointer; max-width: 150px;
}
.select:focus { outline: none; border-color: rgb(var(--accent)); box-shadow: 0 0 0 3px rgb(var(--accent)/.12); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ---- Avviso server senza .htaccess ---- */
.server-warn { display: flex; gap: 10px; align-items: flex-start; padding: 11px 20px; background: #fef2f2; border-bottom: 1px solid #fecaca; color: #b42318; font-size: 12.5px; line-height: 1.5; }
.server-warn svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.server-warn code { background: rgba(180,35,24,.1); padding: 1px 4px; border-radius: 3px; }

/* ---- Selection bar ---- */
.selbar { display: flex; align-items: center; gap: 10px; padding: 9px 20px; background: rgb(var(--accent)/.06); border-bottom: 1px solid rgb(var(--accent)/.18); }
.selbar strong { font-size: 13px; color: rgb(var(--accent)); font-variant-numeric: tabular-nums; }
.selbar .grow { flex: 1; }

/* ---- Grid ---- */
.content { flex: 1; overflow: auto; padding: 18px 20px 28px; }
/* Anteprime un po' più compatte in "Tutti i prodotti" */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s var(--ease), border-color .15s, transform .15s var(--ease); cursor: pointer; display: flex; flex-direction: column; position: relative; box-shadow: var(--shadow-sm); }
.card:hover { box-shadow: var(--shadow); border-color: #d3d7de; transform: translateY(-2px); }
.card.selected { border-color: rgb(var(--accent)); box-shadow: 0 0 0 2px rgb(var(--accent)/.18); }
.card-thumb { aspect-ratio: 4/3; background: var(--panel-2); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-soft); }
.card-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8px; transition: transform .3s var(--ease); }
.card:hover .card-thumb img { transform: scale(1.04); }
.card-thumb .noimg { color: var(--text-mute); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; }
.card-thumb .noimg svg { width: 24px; height: 24px; }
.badge-count { position: absolute; bottom: 7px; right: 7px; display: flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); color: var(--text-dim); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; box-shadow: var(--shadow-sm); }
.badge-count svg { width: 12px; height: 12px; }

/* checkbox selezione */
.card-check { position: absolute; top: 7px; left: 7px; width: 22px; height: 22px; border-radius: 6px; background: var(--panel); border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; color: transparent; opacity: 0; transition: opacity .12s, background .12s, color .12s; box-shadow: var(--shadow-sm); z-index: 2; }
.card:hover .card-check, .card.selected .card-check { opacity: 1; }
.card.selected .card-check { background: rgb(var(--accent)); border-color: rgb(var(--accent)); color: #fff; }
.card-check svg { width: 13px; height: 13px; stroke-width: 3; }

.card-actions { position: absolute; top: 7px; right: 7px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; z-index: 2; }
.card:hover .card-actions { opacity: 1; }
.icon-btn { width: 26px; height: 26px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--text-mute); box-shadow: var(--shadow-sm); transition: all .12s; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 13px; height: 13px; }
.icon-btn.fav.on { color: #f59e0b; opacity: 1; }
.icon-btn.fav.on svg { fill: #f59e0b; }
.card .icon-btn.fav.on { opacity: 1; }

.card-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-sku { font-size: 10.5px; letter-spacing: .02em; color: rgb(var(--accent)); font-weight: 700; }
.card-name { font-weight: 550; font-size: 13.5px; line-height: 1.35; letter-spacing: -0.011em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }
.tag { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--line-soft); }

.empty { text-align: center; padding: 72px 20px; color: var(--text-mute); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 14px; opacity: .35; stroke-width: 1.4; }
.empty h3 { color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 13.5px; }

.statusbar { display: flex; align-items: center; gap: 8px; padding: 7px 20px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-mute); background: var(--panel); font-variant-numeric: tabular-nums; }
.statusbar .grow { flex: 1; }

/* ============================================================ Drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,20,35,.28); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 96vw); z-index: 50; background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideIn .22s var(--ease); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.016em; }
.drawer-head .sku-preview { font-size: 11.5px; color: rgb(var(--accent)); font-weight: 700; }
.drawer-close { margin-left: auto; width: 30px; height: 30px; border-radius: 7px; color: var(--text-mute); display: flex; align-items: center; justify-content: center; }
.drawer-close:hover { background: var(--panel-2); color: var(--text); }
.drawer-body { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.drawer-foot .grow { flex: 1; }
.section-label { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); border-top: 1px solid var(--line-soft); padding-top: 14px; }

/* tag input */
.tag-input { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; }
.tag-input:focus-within { border-color: rgb(var(--accent)); box-shadow: 0 0 0 3px rgb(var(--accent)/.12); }
.tag-input .t { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); color: var(--text-dim); padding: 2px 5px 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 500; border: 1px solid var(--line-soft); }
.tag-input .t button { color: var(--text-mute); display: flex; }
.tag-input .t button:hover { color: var(--text); }
.tag-input .t svg { width: 11px; height: 11px; }
.tag-input input { flex: 1; min-width: 80px; background: none; border: none; outline: none; padding: 3px; font-size: 13px; }

.dropzone { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--text-mute); transition: all .12s; cursor: pointer; font-size: 13px; background: var(--panel-2); }
.dropzone:hover, .dropzone.drag { border-color: rgb(var(--accent)); background: rgb(var(--accent)/.04); color: var(--text-dim); }
.dropzone svg { width: 20px; height: 20px; margin: 0 auto 6px; }
.dropzone strong { color: rgb(var(--accent)); font-weight: 600; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.img-cell { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); cursor: grab; }
.img-cell.dragging { opacity: .35; }
.img-cell.drop-target { outline: 2px solid rgb(var(--accent)); outline-offset: -2px; }
.img-cell img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.img-cell .idx { position: absolute; top: 4px; left: 4px; font-size: 9.5px; font-weight: 700; background: var(--panel); border: 1px solid var(--line); color: var(--text-dim); padding: 1px 5px; border-radius: 4px; }
.img-cell .primary-badge { position: absolute; bottom: 4px; left: 4px; font-size: 8.5px; font-weight: 700; background: rgb(var(--accent)); color: #fff; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; }
.img-cell .rm { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 5px; background: var(--panel); border: 1px solid var(--line); color: var(--text-mute); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; }
.img-cell:hover .rm { opacity: 1; }
.img-cell .rm:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.img-cell .rm svg { width: 11px; height: 11px; }
.img-note { font-size: 11px; color: var(--text-mute); line-height: 1.5; }
.img-note code { background: var(--panel-2); padding: 1px 4px; border-radius: 3px; border: 1px solid var(--line-soft); font-size: 10.5px; }

/* ============================================================ Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(248,249,251,.98); display: flex; flex-direction: column; }
.lb-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.lb-head .lb-sku { color: rgb(var(--accent)); font-size: 11.5px; font-weight: 700; }
.lb-head .lb-title { font-weight: 600; font-size: 14px; }
.lb-head .lb-counter { color: var(--text-mute); font-size: 12px; font-variant-numeric: tabular-nums; }
.lb-head .grow { flex: 1; }
.lb-icon { width: 32px; height: 32px; border-radius: 7px; color: var(--text-dim); display: flex; align-items: center; justify-content: center; }
.lb-icon:hover { background: var(--panel-2); color: var(--text); }
.lb-icon svg { width: 16px; height: 16px; }
.lb-stage { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.lb-stage img { max-width: 90%; max-height: 90%; object-fit: contain; user-select: none; will-change: transform; }
.lb-nav { position: absolute; top: 50%; width: 40px; height: 40px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); color: var(--text-dim); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.lb-nav:hover { background: var(--panel-2); color: var(--text); }
.lb-nav.prev { left: 18px; } .lb-nav.next { right: 18px; }
.lb-thumbs { display: flex; gap: 6px; padding: 12px 18px; overflow-x: auto; justify-content: center; background: var(--panel); border-top: 1px solid var(--line); }
.lb-thumbs img { width: 48px; height: 48px; object-fit: contain; padding: 3px; border-radius: 6px; opacity: .55; cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); }
.lb-thumbs img.active { opacity: 1; border-color: rgb(var(--accent)); }
.lb-hint { text-align: center; color: var(--text-mute); font-size: 11px; padding: 8px 0 10px; background: var(--panel); }

/* ============================================================ Toasts */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; animation: toastIn .2s var(--ease); max-width: 460px; }
.toast svg { width: 15px; height: 15px; flex: none; }
.toast.success svg { color: #059669; }
.toast.error svg { color: #dc2626; }
.toast.info svg { color: rgb(var(--accent)); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================ Pagine di gestione */
.page { flex: 1; overflow: auto; padding: 20px 22px 40px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.page-head p { font-size: 13px; color: var(--text-dim); margin-top: 4px; max-width: 760px; line-height: 1.5; }

.panel { background: var(--panel); border: 1px solid var(--line); margin-bottom: 14px; }
.panel-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font-size: 13.5px; font-weight: 650; letter-spacing: -0.012em; }
.panel > *:not(.panel-head) { padding-left: 14px; padding-right: 14px; }
.panel > .tbl-wrap, .panel > table { padding: 0; }
.muted { color: var(--text-mute); font-size: 12px; }
.empty-line { padding: 14px 0 16px; font-size: 13px; }
.ok-txt { color: #067647; font-weight: 600; }
.err-txt { color: #b42318; font-weight: 600; }
.warn-txt { color: #b45309; }
.mt { margin-top: 16px; }

.tax-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; }
.tax-grid .panel { margin-bottom: 0; }

.inline-form { display: flex; gap: 6px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.inline-form input[type=text] { flex: 1; min-width: 140px; background: var(--panel); border: 1px solid var(--line); padding: 7px 9px; font-size: 13px; outline: none; }
.inline-form input[type=text]:focus { border-color: rgb(var(--accent)); box-shadow: 0 0 0 3px rgb(var(--accent)/.12); }

.tax-list { list-style: none; padding-bottom: 12px; }
.tax-list li { border-top: 1px solid var(--line-soft); }
.row-form { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.tax-input { flex: 1; min-width: 0; background: transparent; border: 1px solid transparent; padding: 5px 7px; font-size: 13px; outline: none; }
.tax-input:hover { border-color: var(--line); }
.tax-input:focus { background: var(--panel); border-color: rgb(var(--accent)); box-shadow: 0 0 0 3px rgb(var(--accent)/.12); }
.pill { font-size: 11px; font-weight: 600; color: var(--text-mute); background: var(--panel-2); border: 1px solid var(--line-soft); padding: 1px 7px; min-width: 26px; text-align: center; }
.icon-btn.danger { color: #b42318; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.row-actions form { display: flex; gap: 5px; justify-content: flex-end; }

.merge-form { padding-top: 12px; padding-bottom: 14px; display: grid; gap: 12px; max-width: 460px; }
.merge-form select[multiple] { background: var(--panel); border: 1px solid var(--line); padding: 6px; font-size: 13px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); font-weight: 650; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl code { font-size: 11.5px; background: var(--panel-2); padding: 1px 5px; border: 1px solid var(--line-soft); }
.tbl-wrap { overflow-x: auto; }

.code { background: #0d0f14; color: #e6e8ee; padding: 12px 14px; font-size: 11.5px; line-height: 1.65; overflow-x: auto; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; margin-bottom: 14px; white-space: pre; }
.hint a { text-decoration: underline; }

.secret-box { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.secret { display: block; margin-top: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: rgba(6,118,71,.1); padding: 6px 8px; word-break: break-all; }

.brand-preview { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 88px; background: var(--panel-2); border: 1px dashed var(--line); margin: 12px 0 10px; padding: 10px; }
.brand-preview img { max-height: 64px; max-width: 100%; object-fit: contain; }
.brand-preview.small img { max-height: 32px; }
.brand-form { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; }
.brand-form input[type=file] { font-size: 12px; }
.brand-actions { display: flex; gap: 6px; }

/* ---- Import ---- */
.dropzone.big { padding: 34px; margin: 14px 0; }
.dropzone.big svg { width: 28px; height: 28px; }
.imp-opts { padding: 12px 0 4px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: rgb(var(--accent)); }
.imp-defaults { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 8px; }
.def-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; padding: 8px 0 12px; }
.def-grid .field label { font-size: 11px; }
.imp-tbl .files-cell { max-width: 380px; font-size: 11.5px; word-break: break-word; }
.badge { font-size: 10.5px; font-weight: 700; padding: 1px 6px; text-transform: uppercase; letter-spacing: .03em; }
.badge.ok { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.badge.new { background: rgb(var(--accent)/.1); color: rgb(var(--accent)); border: 1px solid rgb(var(--accent)/.3); }
.imp-actions { display: flex; gap: 8px; align-items: center; padding: 12px 0 14px; }
.imp-actions .grow { flex: 1; }
.imp-progress { height: 4px; background: var(--panel-2); margin: 12px 0; overflow: hidden; }
.imp-progress .bar { height: 100%; width: 0; background: rgb(var(--accent)); transition: width .25s var(--ease); }
.imp-log { list-style: none; font-size: 12.5px; max-height: 320px; overflow: auto; padding-bottom: 8px; }
.imp-log li { padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.imp-log li.ok::before { content: "✓"; color: #067647; font-weight: 700; margin-right: 7px; }
.imp-log li.ko::before { content: "✕"; color: #b42318; font-weight: 700; margin-right: 7px; }
.imp-log li.sum { font-weight: 650; border-bottom: none; padding-top: 10px; }
.imp-log .warn { color: #b45309; }

/* ---- Sidebar estesa ---- */
.side-scroll { flex: 1; overflow-y: auto; margin-top: 4px; }
.side-scroll .side-title { padding: 0 9px; margin-bottom: 6px; }
.side-scroll .chip-list { padding: 0 9px; }
.brand-logo { max-height: 40px; max-width: 190px; object-fit: contain; }
a.nav-item { text-decoration: none; }
.select.wide { max-width: 100%; width: 100%; }

/* utility (CSP: niente style inline, si usano classi) */
.is-hidden { display: none !important; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
