/* ==========================================================================
   TweakIT — stile del pannello admin del sito (/admin e /admin-shop.html)
   Stessi colori, caratteri e forme del pannello dell'app (/app).
   ========================================================================== */

:root {
  --bg:        #07080c;
  --bg-side:   #0a0c11;
  --surface:   #0f1117;
  --surface2:  #161922;
  --surface3:  #20242f;
  --line:      rgba(255,255,255,.065);
  --line2:     rgba(255,255,255,.11);
  --border:    var(--line);
  --border2:   var(--line2);
  --primary:   #fff600;
  --primary-d: #e6dd00;
  --primary-soft: rgba(255,246,0,.11);
  --primary-ink:  #0d0e05;
  --text:      #f3f4f8;
  --text2:     #c3c6d3;
  --muted:     #868ba1;
  --red:       #f87171;
  --green:     #34d399;
  --blue:      #818cf8;
  --sky:       #38bdf8;
  --orange:    #fbbf24;
  --discord:   #5865f2;
  --sidebar-w: 256px;
  --radius:    16px;
  --transition: .16s ease;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Orbitron', 'DM Sans', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.admin-ui {
  font-family: var(--font);
  background:
    radial-gradient(70% 40% at 20% 0%, rgba(255,246,0,.05), transparent 60%),
    radial-gradient(60% 40% at 100% 0%, rgba(88,101,242,.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  /* niente flex sul body: qualsiasi elemento aggiunto in fondo (es. il banner
     dei cookie) finirebbe in riga col contenuto e lo schiaccerebbe a zero */
  display: block;
  -webkit-font-smoothing: antialiased;
}
.admin-ui a { text-decoration: none; color: inherit; }
.admin-ui button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.admin-ui code { font-family: var(--mono); font-size: .85em; }
.admin-ui svg { flex-shrink: 0; }
/* l'attributo hidden deve vincere su qualsiasi display dei componenti (es. i tasti di pulizia) */
.admin-ui [hidden] { display: none !important; }

.admin-ui ::-webkit-scrollbar { width: 8px; height: 8px; }
.admin-ui ::-webkit-scrollbar-track { background: transparent; }
.admin-ui ::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; border: 2px solid var(--bg); }

@keyframes blink  { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin   { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s cubic-bezier(.32,1,.56,1);
}
.sidebar-logo {
  padding: 20px 18px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-ink);
  display: grid; place-items: center;
  box-shadow: 0 6px 22px rgba(255,246,0,.28);
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: .08em; line-height: 1; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 5px; font-weight: 600; }
.sidebar-logo img { display: none; }
.sidebar-logo-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,246,0,.22);
  text-transform: uppercase;
  margin-left: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 6px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 10px 6px;
  opacity: .8;
}
.admin-tab {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 12px;
  border-radius: 11px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  position: relative;
}
.admin-tab svg { width: 17px; height: 17px; opacity: .75; }
.admin-tab:hover { background: rgba(255,255,255,.045); color: var(--text); }
.admin-tab.active {
  background: var(--primary-soft);
  border-color: rgba(255,246,0,.2);
  color: var(--text);
}
.admin-tab.active svg { opacity: 1; color: var(--primary); }
.admin-tab .nav-count {
  margin-left: auto;
  min-width: 22px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid; place-items: center;
}
.admin-tab .nav-count:empty { display: none; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.discord-status {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(52,211,153,.08);
  border: 1px solid rgba(52,211,153,.2);
  color: var(--green);
}
.discord-status.offline { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.22); color: var(--red); }
.discord-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
  animation: blink 2s ease-in-out infinite;
}
.sidebar-link,
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 600;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.sidebar-link svg, .sidebar-logout svg { width: 16px; height: 16px; opacity: .75; }
.sidebar-link:hover { background: rgba(255,255,255,.045); color: var(--text); }
.sidebar-logout:hover { background: rgba(248,113,113,.08); color: var(--red); }

.sidebar-scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  z-index: 99;
}

/* ══════════════════════════════════════════
   MAIN
══════════════════════════════════════════ */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7,8,12,.78);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.admin-topbar-title {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.1;
  color: var(--text);
}
.topbar-sub { font-size: 13px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.topbar-sub strong { color: var(--text2); font-weight: 700; }
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; }
.menu-btn {
  display: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line2) !important;
  color: var(--text2);
  place-items: center;
}
.menu-btn svg { width: 19px; height: 19px; }

.admin-content {
  padding: 28px 32px 48px;
  flex: 1;
  width: 100%;
  max-width: 1480px;
}
.admin-section { display: none; }
.admin-section.visible { display: block; animation: fadeUp .25s ease; }

/* ── Incasso + statistiche ── */
.stats-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.hero-card {
  padding: 20px 22px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255,246,0,.16), rgba(255,246,0,.025) 60%),
    var(--surface);
  border: 1px solid rgba(255,246,0,.2);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-card::after {
  content: '';
  position: absolute;
  right: -50px; top: -60px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,246,0,.2), transparent 70%);
  pointer-events: none;
}
.hero-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text2);
}
.hero-label svg { width: 15px; height: 15px; color: var(--primary); }
.hero-value {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 800;
  color: var(--primary);
  margin-top: 10px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(255,246,0,.25);
}
.hero-sub { margin-top: 10px; font-size: 13px; color: var(--text2); }
.hero-sub strong { color: var(--text); font-weight: 700; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--line2); transform: translateY(-1px); }
.stat-icon {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.yellow { background: rgba(255,255,255,.05); border-color: var(--line2); color: var(--text2); }
.stat-icon.red    { background: rgba(251,191,36,.12);  border-color: rgba(251,191,36,.25);  color: var(--orange); }
.stat-icon.blue   { background: rgba(129,140,248,.13); border-color: rgba(129,140,248,.28); color: var(--blue); }
.stat-icon.green  { background: rgba(52,211,153,.12);  border-color: rgba(52,211,153,.26);  color: var(--green); }
.stat-info { min-width: 0; }
.stat-number { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 6px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Barra filtri e campi ── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.search-field { position: relative; flex: 1 1 320px; max-width: 460px; }
.search-field svg {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search-field input { width: 100%; padding-left: 38px !important; }

.filter-bar input,
.filter-bar select,
.modal-form-group input,
.modal-form-group select,
.modal-form-group textarea {
  height: 42px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line2);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 0 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  color-scheme: dark;
}
.modal-form-group textarea { height: auto; padding: 11px 14px; line-height: 1.5; }
.filter-bar select, .modal-form-group select { cursor: pointer; }
.filter-bar input:focus,
.filter-bar select:focus,
.modal-form-group input:focus,
.modal-form-group select:focus,
.modal-form-group textarea:focus {
  border-color: rgba(255,246,0,.5);
  background: rgba(255,246,0,.03);
  box-shadow: 0 0 0 3px rgba(255,246,0,.08);
}
.filter-bar input::placeholder, .modal-form-group input::placeholder, .modal-form-group textarea::placeholder { color: var(--muted); }
.admin-ui select option { background: var(--surface2); color: var(--text); }

/* ── Tabelle ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead tr { background: rgba(255,255,255,.02); }
.data-table th {
  position: sticky; top: 0;
  background: #12141b;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(255,255,255,.025); }

.cell-id { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.cell-client { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.cell-client .avatar {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  text-transform: uppercase;
  color: hsl(var(--h, 50) 95% 76%);
  background: hsl(var(--h, 50) 70% 50% / .15);
  border: 1px solid hsl(var(--h, 50) 80% 60% / .25);
  flex-shrink: 0;
}
.cell-client .name { font-weight: 700; }
.cell-client .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cell-service { max-width: 320px; color: var(--text2); }
.cell-price { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-price s { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.cell-date { white-space: nowrap; color: var(--text2); font-size: 13px; }
.cell-date small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.cell-muted { color: var(--muted); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Stati ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pending    { background: rgba(251,191,36,.12);  color: var(--orange); }
.status-processing { background: rgba(129,140,248,.14); color: var(--blue); }
.status-shipped    { background: rgba(56,189,248,.13);  color: var(--sky); }
.status-completed  { background: rgba(52,211,153,.12);  color: var(--green); }
.status-cancelled  { background: rgba(248,113,113,.12); color: var(--red); }

/* ── Pulsanti ── */
.action-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  border: 1px solid transparent !important;
  transition: all var(--transition);
}
.action-btn svg { width: 14px; height: 14px; }
.action-btn.icon { width: 32px; padding: 0; justify-content: center; }
.action-btn.edit   { background: rgba(255,255,255,.05) !important; border-color: var(--line2) !important; color: var(--text2); }
.action-btn.edit:hover { background: var(--primary-soft) !important; border-color: rgba(255,246,0,.3) !important; color: var(--primary); }
.action-btn.delete { background: rgba(248,113,113,.08) !important; border-color: rgba(248,113,113,.2) !important; color: var(--red); }
.action-btn.delete:hover { background: rgba(248,113,113,.16) !important; border-color: rgba(248,113,113,.35) !important; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  background: var(--primary) !important;
  color: var(--primary-ink) !important;
  font-weight: 800;
  font-size: 14px;
  padding: 0 18px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(255,246,0,.18);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-d) !important; box-shadow: 0 8px 26px rgba(255,246,0,.28); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px;
  background: rgba(255,255,255,.05) !important;
  color: var(--text) !important;
  border: 1px solid var(--line2) !important;
  font-weight: 700;
  font-size: 14px;
  padding: 0 16px;
  border-radius: 12px;
  transition: background var(--transition);
  white-space: nowrap;
}
.btn-secondary svg { width: 15px; height: 15px; }
.btn-secondary:hover { background: rgba(255,255,255,.09) !important; }
.btn-secondary.spinning svg { animation: spin .7s linear infinite; }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px;
  background: rgba(248,113,113,.09) !important;
  color: var(--red) !important;
  border: 1px solid rgba(248,113,113,.22) !important;
  font-weight: 700;
  font-size: 14px;
  padding: 0 16px;
  border-radius: 12px;
  transition: background var(--transition);
  white-space: nowrap;
}
.btn-danger:hover { background: rgba(248,113,113,.17) !important; }
.btn-danger:disabled, .btn-primary:disabled, .btn-secondary:disabled { opacity: .5; pointer-events: none; }
/* nei footer delle finestre "Annulla"/"Chiudi" sono neutri, non rossi */
.modal-footer .btn-danger { background: rgba(255,255,255,.05) !important; color: var(--text2) !important; border-color: var(--line2) !important; }
.modal-footer .btn-danger:hover { background: rgba(255,255,255,.09) !important; }

/* ── Intestazione di sezione ── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--text); margin-right: auto; }
/* nel pannello principale il titolo della sezione è già nella barra in alto */
body[data-page="main"] .admin-section .section-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body[data-page="main"] .admin-section .section-head { justify-content: flex-end; }
.section-hint { font-size: 13.5px; line-height: 1.55; color: var(--muted); margin-bottom: 18px; max-width: 900px; }
.section-hint strong { color: var(--text2); }

/* ── Vuoto ── */
.empty-state { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty-state-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 24px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line2);
  font-size: 30px;
  color: var(--muted);
}
.empty-state-icon svg { width: 30px; height: 30px; }
.empty-state h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; }

.ticket-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: 9px;
  background: rgba(88,101,242,.14);
  color: #a5acff;
  font-size: 12.5px; font-weight: 700;
}
.ticket-link svg { width: 13px; height: 13px; }
.ticket-link:hover { background: rgba(88,101,242,.24); color: #c7cbff; }

/* ══════════════════════════════════════════
   FINESTRE
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.active { display: flex; animation: fadeUp .2s ease; }
#serviceModal.modal-overlay { align-items: flex-start; padding: max(1rem, 4vh) 1rem; overflow-y: auto; }
.modal-content {
  background: #10121a;
  border: 1px solid var(--line2);
  border-radius: 22px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#serviceModal .modal-content { max-width: min(560px, 100vw - 2rem); max-height: min(92vh, 900px); margin: 0 auto; }
#serviceModal .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.modal-close {
  width: 34px !important; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.07) !important;
  color: var(--text2);
  font-size: 18px;
  line-height: 1;
  display: grid; place-items: center;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,.12) !important; color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-form-group { margin-bottom: 16px; }
.modal-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.modal-form-group input,
.modal-form-group select,
.modal-form-group textarea { width: 100%; }
.modal-form-group textarea { resize: vertical; }
.modal-form-group input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); margin-right: 8px; vertical-align: -3px; }
.modal-form-group label:has(input[type=checkbox]) { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text2); cursor: pointer; }

/* ── Modulo in linea (licenze, sconti) ── */
.lic-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.lic-form .modal-form-group { margin: 0; flex: 1 1 170px; }
.lic-tier-select {
  height: 34px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 0 .6rem;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color-scheme: dark;
}
.lic-tier-select:disabled { opacity: .5; cursor: default; }

/* ── Chat supporto ── */
.admin-support-chat__messages {
  flex: 1;
  overflow-y: auto;
  background: rgba(0,0,0,.25);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  max-height: 360px;
  font-size: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.admin-support-chat__msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 16px;
  background: var(--surface2);
  border: 1px solid var(--line);
  line-height: 1.45;
}
.admin-support-chat__msg--user  { align-self: flex-start; border-bottom-left-radius: 5px; }
.admin-support-chat__msg--staff { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-color: transparent; border-bottom-right-radius: 5px; }
.admin-support-chat__msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.admin-support-chat__msg--staff .admin-support-chat__msg-meta { color: rgba(13,14,5,.6); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
  z-index: 999;
  max-width: 360px;
  border: 1px solid var(--line2);
  background: rgba(24,27,37,.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--text);
  box-shadow: 0 12px 36px rgba(0,0,0,.45);
}
.toast.active { opacity: 1; transform: none; }
.toast.success { border-color: rgba(52,211,153,.35); color: var(--green); }
.toast.error   { border-color: rgba(248,113,113,.35); color: var(--red); }
.toast.info    { border-color: rgba(255,246,0,.3);    color: var(--primary); }

/* ══════════════════════════════════════════
   PAGINA SHOP (admin-shop.html): componenti dello shop riallineati
══════════════════════════════════════════ */
body.admin-ui.shop { display: block; background-color: var(--bg); }
.admin-ui .sh-loading { color: var(--muted); padding: 48px 0; text-align: center; }
.admin-ui .ad-nav {
  display: inline-flex; gap: 4px;
  padding: 4px;
  margin: 0 0 20px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  flex-wrap: wrap;
}
.admin-ui .ad-nav button {
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  color: var(--muted);
  font-size: 13.5px; font-weight: 700;
  transition: background .2s, color .2s;
}
.admin-ui .ad-nav button:hover { color: var(--text); }
.admin-ui .ad-nav button.is-active { background: var(--surface3); color: var(--text); box-shadow: 0 2px 12px rgba(0,0,0,.35); }
.admin-ui .ad-bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.admin-ui .ad-bar > strong { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.admin-ui .ad-bar select {
  height: 40px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--text);
  color-scheme: dark;
}
.admin-ui .ad-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.admin-ui table.ad { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.admin-ui table.ad th, .admin-ui table.ad td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-ui table.ad tbody tr:last-child td { border-bottom: none; }
.admin-ui table.ad tbody tr:hover { background: rgba(255,255,255,.025); }
.admin-ui table.ad th {
  background: #12141b;
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  position: sticky; top: 0;
}
.admin-ui table.ad tr.is-off td { opacity: .5; }
.admin-ui table.ad pre { white-space: pre-wrap; font-size: 12.5px; color: var(--text2); margin-top: 8px; font-family: var(--mono); background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.admin-ui table.ad select {
  height: 34px;
  background: rgba(255,255,255,.045);
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 0 8px;
  color: var(--text);
  font-weight: 600;
  color-scheme: dark;
}
.admin-ui table.ad details summary { margin-top: 6px; cursor: pointer; font-size: 13px; }
.admin-ui .ad-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-ui .ad-actions button {
  height: 30px; padding: 0 10px;
  border-radius: 9px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line2);
  color: var(--text2);
  font-size: 12.5px; font-weight: 700;
}
.admin-ui .ad-actions button:hover { color: var(--primary); border-color: rgba(255,246,0,.3); }
.admin-ui .ad-actions button.danger { color: var(--red); border-color: rgba(248,113,113,.22); background: rgba(248,113,113,.07); }
.admin-ui .sh-btn { height: 40px; padding: 0 16px; border-radius: 12px; font-size: 14px; }
.admin-ui .sh-btn--primary { box-shadow: 0 6px 20px rgba(255,246,0,.18); }
.admin-ui .sh-btn--ghost { background: rgba(255,255,255,.05); border: 1px solid var(--line2); }
.admin-ui .sh-btn--ghost:hover { background: rgba(255,255,255,.09); color: var(--text); border-color: var(--line2); }
.admin-ui dialog {
  margin: auto;
  background: #10121a;
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: 22px;
  padding: 24px;
  width: min(780px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
.admin-ui dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(6px); }
.admin-ui dialog h2 { font-family: var(--font); font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px; }
.admin-ui .sh-form label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; gap: 7px; }
.admin-ui .sh-form label:has(input[type=checkbox]) { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text2); }
.admin-ui .sh-form input, .admin-ui .sh-form textarea, .admin-ui .sh-form select {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
  text-transform: none; letter-spacing: 0; font-weight: 500;
  color-scheme: dark;
}
.admin-ui .sh-form input:focus, .admin-ui .sh-form textarea:focus, .admin-ui .sh-form select:focus { outline: none; border-color: rgba(255,246,0,.5); box-shadow: 0 0 0 3px rgba(255,246,0,.08); }
.admin-ui .ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-ui .ad-grid .full { grid-column: 1 / -1; }
.admin-ui .ad-chat { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.25); }
.admin-ui .ad-chat__msg { max-width: 80%; padding: 9px 13px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-ui .ad-chat__msg--user { align-self: flex-start; background: var(--surface2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.admin-ui .ad-chat__msg--staff { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-bottom-right-radius: 5px; }

/* ── Banner dei cookie (le pagine admin non caricano style.css del sito) ── */
.admin-ui .cookie-banner {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 2500;
  width: min(46rem, calc(100vw - 2.5rem));
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(16,18,26,.95);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line2);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  font-size: 14px;
}
.admin-ui .cookie-banner[hidden] { display: none; }
.admin-ui .cookie-banner__inner { display: flex; flex-direction: column; gap: 12px; }
.admin-ui .cookie-banner__title { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.admin-ui .cookie-banner__text { font-size: 13.5px; color: var(--text2); line-height: 1.55; }
.admin-ui .cookie-banner__links { display: flex; gap: 16px; flex-wrap: wrap; }
.admin-ui .cookie-banner__links a { font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.admin-ui .cookie-banner__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.admin-ui .cookie-banner__actions .btn {
  height: 40px; padding: 0 16px;
  border-radius: 12px;
  font-size: 13.5px; font-weight: 700;
}
.admin-ui .btn-cookie-primary { background: var(--primary); color: var(--primary-ink); }
.admin-ui .btn-cookie-secondary { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--line2) !important; }

/* ══════════════════════════════════════════
   SCHERMI PICCOLI: la barra laterale si apre col pulsante menu
══════════════════════════════════════════ */
@media (max-width: 1240px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-grid .hero-card { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim { display: block; }
  .admin-main { margin-left: 0; }
  .menu-btn { display: grid; }
  .admin-topbar { padding: 12px 16px; }
  .admin-topbar-title { font-size: 20px; }
  .admin-content { padding: 18px 16px 40px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .search-field { max-width: none; }
  .admin-ui .ad-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar-sub { display: none; }
  .admin-topbar-actions .btn-label { display: none; }
}

/* campi in carattere a larghezza fissa (specifiche JSON dei componenti) */
.admin-ui .sh-form textarea.mono { font-family: var(--mono); font-size: 13px; line-height: 1.5; }
