/* Pannello Level U.P. CMS — stessi colori e font del sito */
:root {
  --c-bg: #f4f4f6;
  --c-surface: #ffffff;
  --c-text: #111111;
  --c-muted: #6e6e78;
  --c-line: #e6e7ec;
  --c-accent: #6823cc;
  --c-accent-soft: #efe7fb;
  --c-ok: #0f9d6b;
  --c-ok-soft: #e1f5ec;
  --c-danger: #d93a3a;
  --c-danger-soft: #fdeaea;
  --radius: 16px;
  --radius-sm: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: 15px/1.5 'DM Sans', system-ui, sans-serif;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }

.h1 { margin: 0; font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.h2 { margin: 0 0 18px; font-size: 17px; font-weight: 600; }
.muted { color: var(--c-muted); font-weight: 400; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.shell { display: grid; min-height: 100vh; }

.side {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 20px 16px;
  background: #111;
  color: #fff;
}

.side__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.side__logo { font-size: 22px; letter-spacing: -0.03em; }
.side__logo b, .login__brand b { font-weight: 600; }
.side__tag {
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--c-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.side__nav { display: grid; gap: 4px; }
.side__nav a, .side__soon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.side__nav a:hover { background: rgba(255, 255, 255, 0.08); }
.side__nav a.-active { background: rgba(255, 255, 255, 0.12); }
.side__soon { color: rgba(255, 255, 255, 0.35); font-size: 13px; }
.side__nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side__foot { display: grid; gap: 14px; margin-top: auto; }
.side__user { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: rgba(255, 255, 255, 0.7); }
.side__user .link { color: #fff; }

.main { padding: 24px 16px 80px; min-width: 0; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 250px 1fr; }
  .side { position: sticky; top: 0; height: 100vh; padding: 28px 20px; }
  .main { padding: 40px 48px 100px; }
}

/* ── Elementi ───────────────────────────────────────────────────────── */
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.head p { margin: 6px 0 0; }
.back { display: inline-block; margin-bottom: 8px; color: var(--c-muted); font-size: 14px; text-decoration: none; }
.back:hover { color: var(--c-text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--c-line);
  border-radius: 99px;
  background: var(--c-surface);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.btn:hover { border-color: #cfd0d8; }
.btn:active { transform: scale(0.98); }
.btn.-accent { border-color: var(--c-accent); background: var(--c-accent); color: #fff; }
.btn.-accent:hover { background: #5a1db3; }
.btn.-danger { border-color: var(--c-danger-soft); background: var(--c-danger-soft); color: var(--c-danger); }
.btn.-block { width: 100%; }

.link { padding: 0; border: 0; background: none; color: var(--c-accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.flash {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--c-ok-soft);
  color: #0b6b49;
}
.flash.-error { background: var(--c-danger-soft); color: #a52323; }

.empty { display: grid; justify-items: start; gap: 12px; padding: 40px; border-radius: var(--radius); background: var(--c-surface); }
.empty p { margin: 0; color: var(--c-muted); }

/* ── Elenco progetti ────────────────────────────────────────────────── */
.list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

.row {
  display: grid;
  grid-template-columns: auto 56px 1fr;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 14px 10px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--c-surface);
  transition: border-color 0.2s, opacity 0.2s;
}
.row:hover { border-color: var(--c-line); }
.row.-draft .row__thumb, .row.-draft .row__main { opacity: 0.5; }
.row.-dragging { opacity: 0.4; }
.row > form { grid-column: 3; }
.row__grip { padding: 8px 4px; color: #b6b7c0; letter-spacing: -3px; cursor: grab; user-select: none; }
.row__thumb { width: 56px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--c-bg); }
.row__main { display: grid; min-width: 0; text-decoration: none; }
.row__main strong { font-weight: 500; }
.row__main .muted { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.row__main:hover strong { color: var(--c-accent); }
/* Loghi dei clienti: bianchi su trasparente, si vedono su fondo scuro. */
.row__thumb.-logo { object-fit: contain; background: #16161a; padding: 4px; }
.bulk { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; margin-bottom: 16px; }
.bulk .field { flex: 1 1 320px; margin: 0; }
.logo-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.logo-preview > * { width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm); background: #16161a; }
.logo-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.logo-preview .-site { border: 1px solid var(--c-line); background: #fff; }
.logo-preview .-site img { filter: brightness(0); }

@media (min-width: 700px) {
  .row { grid-template-columns: auto 72px 1fr auto auto; }
  .row > form { grid-column: auto; }
  .row__thumb { width: 72px; height: 50px; }
}

.chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--c-line);
  border-radius: 99px;
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.chip:hover { border-color: #cfd0d8; }
.chip.-on { border-color: var(--c-accent-soft); background: var(--c-accent-soft); color: var(--c-accent); }
.chip.-ok { border-color: var(--c-ok-soft); background: var(--c-ok-soft); color: var(--c-ok); }

/* ── Form ───────────────────────────────────────────────────────────── */
.form__grid { display: grid; gap: 16px; align-items: start; }
.form__col { display: grid; gap: 16px; min-width: 0; }

@media (min-width: 1100px) {
  .form__grid { grid-template-columns: 1fr 360px; }
  .form__col.-side { position: sticky; top: 24px; }
}

.card { padding: 22px; border: 1px solid transparent; border-radius: var(--radius); background: var(--c-surface); }
.card.-invalid { border-color: var(--c-danger); }

.field { display: grid; gap: 6px; margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field__label { padding: 0; font-size: 13px; font-weight: 500; color: #3c3c44; }
.field__hint { font-size: 12.5px; color: var(--c-muted); }
.field__error { font-size: 13px; color: var(--c-danger); }
.field__row { display: grid; grid-template-columns: 1fr 110px; gap: 12px; }

.field input:not([type='checkbox']):not([type='file']),
.field textarea,
.metrics input,
.gallery input:not([type='checkbox']) {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  background: #fbfbfc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field textarea { min-height: 0; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .metrics input:focus, .gallery input:focus {
  border-color: var(--c-accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.field.-invalid input, .field.-invalid textarea { border-color: var(--c-danger); }
.field input[type='file'] { font-size: 13px; }

.field__prefix { display: flex; align-items: stretch; border: 1px solid var(--c-line); border-radius: var(--radius-sm); background: #fbfbfc; overflow: hidden; }
.field__prefix span { display: flex; align-items: center; padding-left: 12px; color: var(--c-muted); font-size: 14px; }
.field .field__prefix input { border: 0; background: transparent; box-shadow: none; padding-left: 2px; }
.field__prefix:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checks .check { padding: 8px 14px; border: 1px solid var(--c-line); border-radius: 99px; }
.checks .check:has(input:checked) { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-accent); }
.check input { accent-color: var(--c-accent); }
.check.-danger { color: var(--c-danger); font-size: 13px; }

.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--c-accent); }

.metrics { display: grid; gap: 8px; margin-bottom: 18px; }
.metrics__row { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 8px; }
.metrics .link { justify-self: start; margin-top: 4px; }

.details { border-top: 1px solid var(--c-line); padding-top: 14px; }
.details summary { margin-bottom: 14px; font-weight: 500; cursor: pointer; }

.cover { width: 100%; aspect-ratio: 16 / 10; margin-bottom: 14px; border-radius: var(--radius-sm); object-fit: cover; background: var(--c-bg); }

.gallery { display: grid; gap: 10px; margin: 0 0 8px; padding: 0; list-style: none; }
.gallery__item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 6px 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  cursor: grab;
}
.gallery__item img,
.gallery__item video { grid-row: span 2; width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--c-bg); }
.gallery__item:has(input[type='checkbox']:checked) { border-color: var(--c-danger); opacity: 0.6; }
.gallery__item.-dragging { opacity: 0.4; }
.gallery__item input:not([type='checkbox']) { min-height: 36px; padding: 6px 10px; }

.danger { margin-top: 32px; }

/* ── Login ──────────────────────────────────────────────────────────── */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: #111; }
.login__card { width: min(400px, 100%); padding: 32px; border-radius: 24px; background: var(--c-surface); }
.login__card .h1 { margin: 18px 0 24px; }
.login__brand { display: flex; align-items: center; gap: 8px; font-size: 22px; letter-spacing: -0.03em; }
.login__card .btn { margin-top: 8px; }

/* ── Manutenzione ───────────────────────────────────────────────────── */
.side__badge { margin-left: auto; padding: 2px 8px; border-radius: 99px; background: var(--c-danger-soft); color: var(--c-danger); font-size: 11px; font-weight: 600; }
.flash.-warn { display: block; background: #fff4db; color: #7a4d00; text-decoration: none; }
.flash.-warn:hover { background: #ffecc2; }
.maint { display: grid; gap: 24px; max-width: 720px; }
.maint__state { display: flex; align-items: center; gap: 14px; }
.maint__state p { margin: 2px 0 0; }
.maint__dot { width: 12px; height: 12px; border-radius: 50%; background: #1db980; box-shadow: 0 0 0 5px rgba(29, 185, 128, 0.15); }
.maint__dot.-on { background: var(--c-danger); box-shadow: 0 0 0 5px var(--c-danger-soft); }
.maint__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.maint__preview { padding-top: 20px; border-top: 1px solid var(--c-line); }
.maint__preview p { margin: 0 0 8px; }
.maint__note { max-width: 720px; margin-top: 16px; font-size: 14px; }
