/* ═══════════════════════════════════
   RESET & ROOT
═══════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

:root {
  /* palette GTQ */
  --bg:        #f4f3ef;
  --surface:   #ffffff;
  --surface2:  #f9f8f5;
  --surface3:  #f0efe9;
  --border:    rgba(0,0,0,0.07);
  --border2:   rgba(0,0,0,0.13);
  --orange:    #e8501a;
  --orange2:   #f06030;
  --orange-lt: #fff1ec;
  --orange-glow: rgba(232,80,26,0.12);
  --text:      #18170f;
  --mid:       #4a4840;
  --muted:     #888078;
  --dim:       #c0bdb8;
  --green:     #16a34a;
  --green-lt:  #f0fdf4;
  --red:       #dc2626;
  --red-lt:    #fef2f2;
  --blue:      #2563eb;
  --blue-lt:   #eff6ff;
  --yellow:    #d97706;
  --yellow-lt: #fffbeb;
  /* layout */
  --sidebar-w: 220px;
  --topbar-h:  56px;
  --shadow:    0 1px 6px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.10);
  --radius:    10px;
  --radius-sm: 6px;
}

/* ═══════════════════════════════════
   GLOBAL
═══════════════════════════════════ */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  /* no flex on body — layout gestito da #appCard */
}

/* appCard è l'app shell post-login — occupa tutto lo schermo.
   NON usiamo flex qui: la sidebar è position:fixed e non partecipa
   al flusso. gtqMain usa margin-left per evitare la sidebar. */
#appCard {
  display: block;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}
#appCard.hidden { display: none !important; }

.hidden { display: none !important; }

/* ═══════════════════════════════════
   SIDEBAR
═══════════════════════════════════ */
#gtqSidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--text);   /* quasi-nero caldo */
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
}

/* logo */
.sb-logo {
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 16px; gap: 9px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-logo-mark {
  width: 30px; height: 30px;
  background: var(--orange);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sb-logo-mark svg { width: 16px; height: 16px; fill: #fff; }
.sb-logo-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px; font-weight: 800; letter-spacing: .04em;
  color: #fff; line-height: 1;
}
.sb-logo-sub {
  font-size: 9px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
}

/* navigation */
.sb-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}

.sb-group-label {
  font-size: 9px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.25);
  padding: 12px 10px 5px;
}
.sb-group-label:first-child { padding-top: 4px; }

.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,.55);
  font-size: 13px; font-weight: 400;
  transition: color .15s, background .15s;
  border: none; background: transparent; width: 100%; text-align: left;
  position: relative;
}
/* hover: solo evidenzia testo, nessuno sfondo */
.sb-item:hover { color: rgba(255,255,255,.9); background: transparent; }
/* active: sfondo arancio pieno, come nel new-backoffice originale */
.sb-item.active {
  background: var(--orange);
  color: #fff;
  font-weight: 500;
}
.sb-item.active .sb-icon { color: #fff; }
.sb-item.disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* badge numerici nelle voci sidebar */
.sb-badge {
  margin-left: auto;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 100px;
  min-width: 20px; text-align: center;
}
.sb-item.active .sb-badge { background: rgba(255,255,255,.28); color: #fff; }

.sb-icon {
  width: 15px; height: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,.45);
}
.sb-item.active .sb-icon { color: #fff; }

/* voce azienda selezionata nella sidebar */
.sb-company-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(232,80,26,.12);
  border: 1px solid rgba(232,80,26,.25);
  cursor: pointer; transition: all .18s;
  width: 100%;
}
.sb-company-chip:hover { background: rgba(232,80,26,.2); }
.sb-company-back {
  font-size: 11px; color: var(--orange); flex-shrink: 0;
}
.sb-company-name {
  font-size: 12px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
.sb-company-code {
  font-size: 10px; color: rgba(255,255,255,.4);
  letter-spacing: .06em;
}

/* footer sidebar: avatar utente */
.sb-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer; transition: background .18s;
  width: 100%; border: none; background: transparent;
}
.sb-user-btn:hover { background: rgba(255,255,255,.07); }
.sb-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange2));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sb-user-info { text-align: left; overflow: hidden; }
.sb-user-name {
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-role {
  font-size: 10px; color: rgba(255,255,255,.35);
  letter-spacing: .05em; text-transform: uppercase;
}

/* ═══════════════════════════════════
   MAIN CONTENT AREA
═══════════════════════════════════ */
#gtqMain {
  margin-left: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  /* width esplicita: occupa tutto lo spazio dopo la sidebar fixed */
  width: calc(100% - var(--sidebar-w));
  background: var(--bg);
}

/* topbar */
#gtqTopbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 12px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px; font-weight: 700; letter-spacing: .03em;
  color: var(--text); flex: 1;
}
.topbar-status { font-size: 12px; color: var(--muted); }

/* page container */
#gtqPages { flex: 1; padding: 20px 24px; min-width: 0; }

/* ogni "page" è nascosta di default */
.gtq-page { display: none; }
.gtq-page.active { display: block; }

/* ═══════════════════════════════════
   LOGIN SCREEN  (centrato, no sidebar)
═══════════════════════════════════ */
#loginCard {
  /* quando attivo, occupa tutto lo schermo ignorando sidebar e topbar */
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
#loginCard.hidden { display: none !important; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 360px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.login-logo-mark {
  width: 36px; height: 36px; background: var(--orange);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.login-logo-mark svg { width: 18px; height: 18px; fill: #fff; }
.login-logo-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px; font-weight: 800; letter-spacing: .04em; color: var(--text);
}
.login-logo-sub { font-size: 10px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.login-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: var(--text); }

/* ═══════════════════════════════════
   FORM ELEMENTS (globali)
═══════════════════════════════════ */
input, select, textarea {
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,80,26,.08);
}
input.field-error, select.field-error, textarea.field-error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(220,38,38,.12);
}
input[readonly] { background: var(--surface3); color: var(--muted); }
input[disabled], select[disabled] { opacity: .6; cursor: not-allowed; }

/* ═══════════════════════════════════
   BUTTONS
═══════════════════════════════════ */
button {
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  border: 1px solid var(--orange);
  background: var(--orange);
  color: #fff;
  cursor: pointer;
  transition: all .18s;
  width: 100%;
}
button:hover:not(:disabled) {
  background: var(--orange2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232,80,26,.25);
}
button:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border2);
}
button.secondary:hover:not(:disabled) {
  background: var(--surface3);
  box-shadow: none; transform: none;
}
button.danger {
  background: var(--surface);
  color: var(--red);
  border-color: #fecaca;
}
button.danger:hover:not(:disabled) { background: var(--red-lt); box-shadow: none; transform: none; }
button.tiny { padding: 4px 10px; font-size: 12px; width: auto; }
button.btn-wide { width: 120px; min-width: 120px; }
button.collapse-btn { width: auto; padding: 3px 9px; font-size: 12px; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; }
button.collapse-btn:hover:not(:disabled) { background: rgba(255,255,255,.2); transform: none; box-shadow: none; }

/* ═══════════════════════════════════
   CARD
═══════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }

/* card header (mantenuto .head per compatibilità JS) */
/* ── CARD-HEADER: fondo scuro, usato su tutte le card ── */
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; gap: 10px;
  background: var(--text);
  color: #f9fafb;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.card-header h1, .card-header h2 {
  margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; color: #f9fafb;
}
.card-header .actions { margin: 0; align-items: center; }
/* collapse support */
.card.collapsed > :not(.card-header) { display: none !important; }
/* alias .head → .card-header per compatibilità JS (initCardCollapsers usa .head) */
.head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; gap: 10px;
  background: var(--text); color: #f9fafb;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.head h1, .head h2 { margin: 0; font-size: 15px; font-weight: 600; color: #f9fafb; }
.head .actions { margin: 0; align-items: center; }
.card.collapsed > :not(.head) { display: none !important; }

.card-body { padding: 16px; }

/* ═══════════════════════════════════
   TABELLE
═══════════════════════════════════ */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; table-layout: auto; }

/* Tabella aziende: colonne fisse, no wrap */
#companiesCard table {
  table-layout: fixed;
  min-width: 700px;
}
#companiesCard table th:nth-child(1) { width: 80px; }   /* Code */
#companiesCard table th:nth-child(2) { width: 60px; }   /* Attiva */
#companiesCard table th:nth-child(3) { width: auto; }   /* Nome */
#companiesCard table th:nth-child(4) { width: 180px; }  /* Email */
#companiesCard table th:nth-child(5) { width: 80px; }   /* Sub */
#companiesCard table th:nth-child(6) { width: 130px; }  /* Updated */
#companiesCard table th:nth-child(7) { width: 80px; }   /* Azioni */
#companiesCard table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#companiesCard table td:nth-child(3) { white-space: normal; }  /* Nome: può wrappare */
th {
  background: var(--surface2);
  padding: 9px 10px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 9px 10px;
  font-size: 13px;
  color: var(--mid);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow-wrap: anywhere;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fff7f2; }
tr.selected td { background: #ffede4; }

/* ═══════════════════════════════════
   PIANI — card griglia pubblica
═══════════════════════════════════ */
/* Piano card visiva (sezione sotto tabella) */
.plan-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 16px;
}
.plan-pub-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  transition: box-shadow .25s, border-color .25s;
  overflow: hidden;
}
.plan-pub-card:hover { box-shadow: var(--shadow-md); border-color: rgba(232,80,26,.2); }
.plan-pub-card.is-most-sold {
  border-top: 3px solid var(--orange);
  background: linear-gradient(160deg, #fff8f5 0%, var(--surface) 60%);
}

/* badge "PIÙ VENDUTO" corner ribbon */
.plan-pub-card .plan-ribbon {
  position: absolute; top: 0; right: 0;
  background: var(--orange); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 10px 3px 6px;
  border-bottom-left-radius: var(--radius-sm);
  display: none;
}
.plan-pub-card.is-most-sold .plan-ribbon { display: block; }

/* header card: intervallo pill + toggle pubblica */
.plan-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.plan-interval-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  padding: 3px 10px; border-radius: 100px;
  border: 1px solid var(--border2);
  color: var(--mid);
}
.plan-interval-pill::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--orange);
}

/* ── TOGGLE SWITCH — standard unico per tutti i checkbox ──
   Uso:
     <label class="toggle-switch">
       <input type="checkbox" id="myId" />
       <span class="toggle-slider"></span>
     </label>
   Il JS legge/scrive .checked sull'<input> come sempre.
   Per riga con label testo usa .toggle-row:
     <div class="toggle-row">
       <span class="toggle-row-label">Testo</span>
       <label class="toggle-switch">...</label>
     </div>
── */
.toggle-switch {
  position: relative; display: inline-block;
  width: 36px; height: 20px; flex-shrink: 0; cursor: pointer;
}
.toggle-switch input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--dim); border-radius: 100px;
  transition: background .2s ease; cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }
.toggle-switch input:disabled + .toggle-slider { opacity: .45; cursor: not-allowed; }
.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(232,80,26,.2);
}
/* riga toggle con label */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row-label { font-size: 13px; color: var(--mid); }
/* wrapper inline con testo a sinistra */
.toggle-wrap { display: inline-flex; align-items: center; gap: 8px; }


/* prezzo e nome */
.plan-pub-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 800; letter-spacing: .02em;
  color: var(--text); margin-bottom: 4px;
}
.plan-pub-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px; font-weight: 800;
  color: var(--orange); line-height: 1; margin-bottom: 14px;
}
.plan-pub-price span { font-size: 14px; font-weight: 400; color: var(--muted); }

/* feature list */
.plan-pub-features { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.plan-pub-features li {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--mid);
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.plan-pub-features li:last-child { border-bottom: none; }
.plan-pub-features li::before { content: '✓'; color: var(--green); font-weight: 700; margin-right: 6px; flex-shrink: 0; }
.plan-pub-features strong { color: var(--text); font-weight: 500; }

/* footer card: checkbox più venduto + btn dettaglio */
.plan-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.plan-most-sold-wrap {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.plan-most-sold-wrap input[type="checkbox"] {
  width: 15px; height: 15px; cursor: pointer; accent-color: var(--orange);
}

/* ═══════════════════════════════════
   PIANI — tabella inline inputs
═══════════════════════════════════ */
#plansCard th, #plansCard td {
  white-space: nowrap; font-size: 12px; padding: 5px 6px;
}
#plansCard .plan-table-input {
  width: auto; min-width: 46px; padding: 3px 5px;
  border-radius: var(--radius-sm); font-size: 11px;
}
#plansCard .plan-table-input.narrow { min-width: 44px; max-width: 54px; }
#plansCard .plan-table-input.narrow-mid { min-width: 52px; max-width: 64px; }
#plansCard .plan-cell-inline { display: inline-flex; align-items: center; gap: 4px; }
#plansCard th:last-child, #plansCard td:last-child { min-width: 138px; width: 138px; }
#plansCard .plan-row-actions { display: inline-flex; gap: 4px; min-width: 128px; }
#plansCard .plan-row-actions .tiny { padding: 4px 6px; font-size: 11px; }
#plansCard .plan-name-cell { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
#plansCard tr.plan-dirty td { background: #fff7f2; }
#plansCard .plan-order-cell {
  width: 24px;
  padding: 0;
  text-align: center;
}
#plansCard .plan-move-up,
#plansCard .plan-move-down {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: 7px;
  color: var(--muted);
  cursor: pointer;
}
#plansCard .plan-move-up:hover,
#plansCard .plan-move-down:hover { color: var(--orange); }

/* ═══════════════════════════════════
   OVERVIEW — page header
═══════════════════════════════════ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header-left h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px; font-weight: 700; letter-spacing: .01em; margin-bottom: 2px;
}
.page-header-left p { font-size: 13px; color: var(--muted); font-weight: 300; }

/* btn stile flat (usato nel page-header) */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .18s; font-family: 'Inter', sans-serif; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--bg); box-shadow: none; transform: none; }
.btn-sm { padding: 5px 11px; font-size: 12px; width: auto; }
.btn svg { width: 13px; height: 13px; }

/* ═══════════════════════════════════
   OVERVIEW — stat cards
═══════════════════════════════════ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 7px;
}
.stat-label-dot { width: 6px; height: 6px; border-radius: 50%; }
.stat-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 6px;
}
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 100px; margin-top: 6px;
}
.trend-up { background: var(--green-lt); color: var(--green); }
.trend-dn { background: var(--red-lt);   color: var(--red); }

/* ═══════════════════════════════════
   OVERVIEW — card header generico
═══════════════════════════════════ */
.card-header {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); gap: 12px;
}
.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px; font-weight: 700; letter-spacing: .02em;
}
.card-body { padding: 16px 20px; }

/* ═══════════════════════════════════
   OVERVIEW — 2 col grid
═══════════════════════════════════ */
.overview-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ═══════════════════════════════════
   OVERVIEW — activity feed
═══════════════════════════════════ */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--surface2); }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.ad-green  { background: var(--green); }
.ad-orange { background: var(--orange); }
.ad-blue   { background: var(--blue); }
.ad-red    { background: var(--red); }
.activity-text { flex: 1; }
.activity-main { font-size: 13px; color: var(--text); margin-bottom: 2px; }
.activity-main strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--muted); }

/* ═══════════════════════════════════
   OVERVIEW — azioni rapide
═══════════════════════════════════ */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; }
.qa-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; transition: all .2s; color: var(--text);
}
.qa-btn:hover { border-color: var(--orange); background: var(--orange-lt); }
.qa-btn:hover .qa-icon { background: var(--orange); color: #fff; }
.qa-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; transition: all .2s;
}
.qa-label { font-size: 12px; font-weight: 500; }
.qa-sub { font-size: 11px; color: var(--muted); }

/* ═══════════════════════════════════
   OVERVIEW — mini bar chart
═══════════════════════════════════ */
.mini-chart { display: flex; align-items: flex-end; gap: 4px; height: 48px; padding: 0 2px; }
.mc-bar { flex: 1; background: var(--orange-lt); border-radius: 3px 3px 0 0; transition: background .2s; cursor: pointer; }
.mc-bar:hover { background: var(--orange); }
.mc-bar.active { background: var(--orange); }

/* ═══════════════════════════════════
   AZIENDE — dettaglio inline
═══════════════════════════════════ */
.company-detail-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
#detailCard { width: 100%; }
#companyMainCard { width: 100%; }
.company-detail-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--text);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.company-detail-header h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px; font-weight: 700; letter-spacing: .03em;
  color: #fff; flex: 1; margin: 0;
}
.company-anag-layout {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 0;
  width: 100%;
  overflow-x: auto;  /* scroll orizzontale se schermo stretto */
}
.company-anag-col {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  min-width: 180px;
}
.company-anag-col:last-child { border-right: none; }
.col-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--orange);
  margin-bottom: 10px; padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

/* field-row compact: label + input affiancati orizzontalmente */
.field-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}
.field-row:last-child { margin-bottom: 0; }
.field-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.field-row input, .field-row select {
  font-size: 12px; padding: 4px 7px;
}

/* field row (label sopra, input sotto) */
.field-row { margin-bottom: 9px; }
.field-row:last-child { margin-bottom: 0; }
.field-label {
  font-size: 10px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  display: block; margin-bottom: 3px;
}
.field-row input, .field-row select { font-size: 12px; padding: 5px 8px; }

/* meta box */
.meta-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface2);
  margin-bottom: 8px;
}
.meta-box .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.meta-box .v { font-size: 13px; margin-top: 2px; word-break: break-word; font-weight: 500; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* status badges subscription */
.sub-status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 100px;
}
.sub-status-trial  { background: var(--yellow-lt); color: var(--yellow); border: 1px solid rgba(217,119,6,.2); }
.sub-status-active { background: var(--green-lt);  color: var(--green);  border: 1px solid rgba(22,163,74,.2); }
.sub-status-past_due   { background: var(--red-lt); color: var(--red); border: 1px solid rgba(220,38,38,.2); }
.sub-status-suspended  { background: var(--surface3); color: var(--muted); border: 1px solid var(--border2); }

/* ═══════════════════════════════════
   OPERATORI TABELLA
═══════════════════════════════════ */
/* ── Checkbox nelle tabelle dinamiche (generati da JS — non modificabili)
   Li rendiamo coerenti con il design system via accent-color ── */
.plan-row-active, .plan-row-published,
input.tag-active, input.operator-active, input.operator-debug,
input.shared-company-active,
input[data-company-active] {
  width: 16px !important; height: 16px !important;
  accent-color: var(--orange);
  cursor: pointer;
}
input.plan-row-published { accent-color: var(--green); }
input.operator-active    { accent-color: var(--green); }
input.tag-active         { accent-color: var(--orange); }

/* ─── TABELLA OPERATORI (9 colonne — allineata a renderOperatorsTable())
   Col 1: dot connessione + btn copia + input nome
   Col 2: ruolo  3: magazzino  4: code  5: mobile
   Col 6: del.foto  7: attivo  8: debug  9: azioni ─── */
.operator-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex: 0 0 8px;
  border: 1px solid transparent;
}
.operator-status-dot.on  { background: var(--green);  border-color: #15803d; }
.operator-status-dot.off { background: var(--red);    border-color: #b91c1c; }
tr.operator-row-connected td { background: #f0fdf4; }

.operator-name-cell {
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.operator-name-cell input { flex: 1; min-width: 60px; }
.operator-copy-login-btn {
  width: auto; min-width: 72px; font-size: 11px; padding: 3px 7px; flex-shrink: 0;
}

/* table-layout:fixed + min-width per scroll orizzontale */
#operatorsTable { table-layout: fixed; min-width: 860px; }
#operatorsTable th, #operatorsTable td {
  font-size: 12px; padding: 5px 7px; white-space: nowrap; overflow: hidden;
}
/* col 1: nome (dot + btn + input) */
#operatorsTable th:nth-child(1), #operatorsTable td:nth-child(1) { width: 260px; }
/* col 2: ruolo */
#operatorsTable th:nth-child(2), #operatorsTable td:nth-child(2) { width: 100px; }
/* col 3: magazzino */
#operatorsTable th:nth-child(3), #operatorsTable td:nth-child(3) { width: 100px; }
/* col 4: code */
#operatorsTable th:nth-child(4), #operatorsTable td:nth-child(4) { width: 68px; }
/* col 5: mobile */
#operatorsTable th:nth-child(5), #operatorsTable td:nth-child(5) { width: 120px; }
/* col 6: del.foto */
#operatorsTable th:nth-child(6), #operatorsTable td:nth-child(6) { width: 78px; }
/* col 7: attivo */
#operatorsTable th:nth-child(7), #operatorsTable td:nth-child(7) { width: 52px; text-align: center; }
/* col 8: debug */
#operatorsTable th:nth-child(8), #operatorsTable td:nth-child(8) { width: 52px; text-align: center; }
/* col 9: azioni */
#operatorsTable th:nth-child(9), #operatorsTable td:nth-child(9) { width: auto; min-width: 120px; }

/* input nella tabella: minimal, si espandono nella cella */
#operatorsTable input:not([type=checkbox]) {
  width: 100%; padding: 3px 6px; font-size: 12px;
  background: transparent; border-color: var(--border);
}
#operatorsTable input:not([type=checkbox]):focus {
  background: var(--surface); border-color: var(--orange);
}
#operatorsTable input[type=checkbox] {
  width: 15px; height: 15px; accent-color: var(--orange); cursor: pointer;
}
.stack-actions { display: flex; gap: 5px; align-items: center; }

/* ═══════════════════════════════════
   FOTO — griglia
═══════════════════════════════════ */
.photo-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.photo-config-col {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface2);
}
.photo-config-col h3 { font-size: 12px; color: var(--mid); margin-bottom: 8px; font-weight: 600; }
.photo-toggle-row { margin: 5px 0; }
.photo-toggle-row label, .photo-filter-row label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--mid);
}
.photo-filter-row { margin: 6px 0; }
.photo-filter-row select, .photo-filter-row input { margin-top: 4px; }
.photo-date-preset-row {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 8px;
}
.photo-date-preset-btn {
  border: 1px solid var(--border2); background: var(--surface);
  color: var(--mid); border-radius: 100px;
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  cursor: pointer; width: auto; flex-shrink: 0;
}
.photo-date-preset-btn:hover:not(:disabled) { background: var(--orange-lt); border-color: rgba(232,80,26,.3); color: var(--orange); transform: none; box-shadow: none; }
.photo-date-preset-btn.active { border-color: var(--orange); background: var(--orange-lt); color: var(--orange); }
.photo-view-card { grid-column: span 2; }
#photoPreviewFilterGrid { grid-template-columns: 1fr 1fr 1.8fr 0.8fr 1fr 0.8fr; }
@media (max-width: 900px) { .photo-view-card { grid-column: span 1; } #photoPreviewFilterGrid { grid-template-columns: 1fr 1fr; } }
.photo-view-cols { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 14px; margin-top: 6px; align-items: start; }
.photo-view-col { display: flex; flex-direction: column; gap: 5px; }
.photo-view-col-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.photo-grid-cols-ctrl { display: flex; align-items: center; gap: 6px; }
.photo-grid-cols-ctrl span { font-size: 13px; font-weight: 700; color: var(--text); min-width: 18px; text-align: center; }
.photo-grid-cols-btn { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border2); background: var(--surface); color: var(--mid); font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.photo-grid-cols-btn:hover { background: var(--orange-lt); border-color: rgba(232,80,26,.3); color: var(--orange); transform: none; box-shadow: none; }
.photo-date-custom-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.photo-date-range-inline { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.photo-date-range-inline input[type="date"] { flex: 1; min-width: 0; font-size: 11px; padding: 3px 6px; }
/* ── Card Esporta ── */
.photo-export-row { display: flex; gap: 12px; margin-top: 12px; align-items: stretch; flex-wrap: wrap; }
.photo-export-card { flex: 1; min-width: 0; }
.photo-selection-card { flex-shrink: 0; width: 400px; }
.photo-export-overlay-cols {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  flex: 1;
}
@media (max-width: 900px) { .photo-export-overlay-cols { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .photo-export-overlay-cols { grid-template-columns: repeat(2, 1fr); } }
.photo-export-overlay-col { display: flex; flex-direction: column; gap: 2px; }
.photo-export-col-title {
  font-size: 10px; font-weight: 700; color: var(--mid);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 5px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.photo-export-check-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text);
  cursor: pointer; padding: 3px 0;
  user-select: none;
}
.photo-export-check-item input[type="checkbox"] {
  margin: 0; flex-shrink: 0;
  width: 13px; height: 13px;
  accent-color: var(--orange);
}
.photo-export-actions {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 200px;
}
.photo-export-actions-header { display: flex; align-items: center; gap: 8px; }
.photo-export-actions-header .photo-export-col-title { margin: 0; }
.photo-export-actions-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.photo-export-actions-col { display: flex; flex-direction: column; gap: 6px; }
.photo-date-range-row {
  display: flex; gap: 8px; margin-bottom: 2px;
}
.photo-date-range-row.hidden { display: none; }
.photo-date-range-field {
  flex: 1; display: flex; flex-direction: column; gap: 3px;
}
.photo-date-range-field label {
  font-size: 11px; color: var(--mid); font-weight: 500;
}
.photo-date-range-field input { margin: 0; }
.photo-filter-checklist-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.photo-filter-checklist-label {
  font-size: 12px; color: var(--mid); font-weight: 500;
}
.photo-filter-reset-btn {
  font-size: 10px; font-weight: 600; color: var(--mid);
  background: none; border: 1px solid var(--border2);
  border-radius: 100px; padding: 2px 8px; cursor: pointer;
  line-height: 1.4; width: auto;
}
.photo-filter-reset-btn:hover { color: var(--orange); border-color: rgba(232,80,26,.4); background: var(--orange-lt); }
.photo-filter-dropdown-wrap {
  position: relative;
}
.photo-filter-dropdown-trigger {
  width: 100%; text-align: left;
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px; font-size: 12px;
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  cursor: pointer; width: auto; min-width: 100%;
  transition: border-color .15s;
}
.photo-filter-dropdown-trigger:hover { border-color: var(--orange); }
.photo-filter-dropdown-trigger.has-selection { border-color: var(--orange); color: var(--orange); background: var(--orange-lt); }
.photo-filter-dropdown-trigger .dropdown-arrow { font-size: 10px; margin-left: 4px; opacity: .6; }
.photo-filter-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 3px); left: 0; right: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(0,0,0,.13);
  max-height: 220px; overflow-y: auto;
}
.photo-filter-dropdown-panel.open { display: block; }
.photo-filter-checklist-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px;
  font-size: 12px; color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
  transition: background .1s;
}
.photo-filter-checklist-item:last-child { border-bottom: none; }
.photo-filter-checklist-item:hover { background: var(--surface2); }
.photo-filter-checklist-item input[type="checkbox"] {
  margin: 0; flex-shrink: 0;
  width: 13px; height: 13px;
  accent-color: var(--orange);
}
.photo-filter-checklist-item.is-checked {
  background: var(--orange-lt);
  color: var(--orange);
}
.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; margin-top: 12px;
}
.admin-photo-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface2);
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .15s ease;
}
.admin-photo-tile.select-mode { cursor: pointer; }
.admin-photo-tile.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(22,163,74,.2); }
.admin-photo-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.admin-photo-frame { position: relative; aspect-ratio: 4/3; background: var(--surface3); }
.admin-photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.admin-photo-tile:hover .admin-photo-frame img { transform: scale(1.03); }
.admin-photo-delete-btn {
  position: absolute; top: -2px; right: -2px; z-index: 3;
  width: 20px; height: 20px; border-radius: 4px;
  border: 1px solid rgba(203,213,225,.6);
  background: rgba(255,255,255,.92); color: var(--mid);
  font-size: 12px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.admin-photo-select-btn {
  position: absolute; top: 6px; right: 34px; z-index: 3;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid rgba(203,213,225,.6);
  background: rgba(255,255,255,.92); color: var(--mid);
  font-weight: 700; line-height: 1; padding: 0; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.admin-photo-select-btn.on { background: var(--green); border-color: var(--green); color: #fff; }
.admin-photo-overlay-left { position: absolute; top: 6px; left: 6px; z-index: 2; }
.admin-photo-overlay-right { position: absolute; right: 6px; bottom: 6px; z-index: 2; display: inline-flex; align-items: center; max-width: calc(100% - 12px); }
.admin-proof-overlay-top, .admin-proof-overlay-bottom { position: absolute; left: 0; right: 0; padding: 6px 8px; color: #f8fafc; }
.admin-proof-overlay-top { top: 0; background: linear-gradient(to bottom, rgba(2,6,23,.6), rgba(2,6,23,0)); }
.admin-proof-overlay-bottom { bottom: 0; background: linear-gradient(to top, rgba(2,6,23,.68), rgba(2,6,23,0)); }
.admin-proof-tag { color: #f59e0b; font-weight: 800; font-size: 18px; letter-spacing: .2px; text-transform: uppercase; }
.admin-proof-lines { white-space: pre-line; text-align: center; font-size: 11px; line-height: 1.25; font-weight: 600; text-shadow: 0 1px 1px rgba(2,6,23,.35); }
.admin-photo-meta { padding: 7px; display: grid; gap: 4px; }
.admin-photo-stamp { font-size: 10px; font-weight: 700; color: var(--mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-photo-comune { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-photo-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.admin-photo-tag-badge { display: inline-flex; align-items: center; border-radius: 100px; border: 1px solid var(--border2); background: var(--surface3); color: var(--mid); font-size: 11px; font-weight: 600; padding: 2px 7px; }
.admin-photo-line { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.admin-photo-chip { display: inline-flex; align-items: center; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: var(--surface3); color: var(--mid); font-size: 11px; font-weight: 600; padding: 2px 7px; }
.admin-photo-chip-danger { border-color: #fecaca; background: var(--red-lt); color: var(--red); }
.admin-photo-chip-operator { background: rgba(15,23,42,.8); color: #f8fafc; border-color: rgba(148,163,184,.5); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-photo-name { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════
   LIGHTBOX
═══════════════════════════════════ */
.admin-lightbox { position: fixed; inset: 0; z-index: 1100; background: rgba(2,6,23,.85); display: grid; place-items: center; }
.admin-lightbox[hidden] { display: none !important; }
.admin-lightbox-content { width: min(1200px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: #0b1a3a; border: 1px solid #1e3a8a; border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; box-shadow: 0 24px 48px rgba(2,6,23,.45); animation: lb-pop .22s ease both; }
@keyframes lb-pop { from { opacity:0; transform:translateY(8px) scale(.985); } to { opacity:1; transform:none; } }
.admin-lightbox-image-wrap { position: relative; min-height: 320px; max-height: calc(100vh - 160px); display: flex; justify-content: center; align-items: center; background: #071126; border-radius: 8px; overflow: hidden; }
.admin-lightbox-media { position: relative; display: inline-block; max-width: 100%; max-height: calc(100vh - 170px); }
.admin-lightbox-image { max-width: 100%; max-height: calc(100vh - 170px); display: block; }
.admin-lightbox-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 1px solid #334155; background: rgba(15,23,42,.6); color: #fff; font-size: 22px; line-height: 1; padding: 0; width: auto; }
.admin-lightbox-prev { left: 10px; } .admin-lightbox-next { right: 10px; }
.admin-lightbox-close { position: absolute; top: 8px; right: 8px; width: auto; min-width: 34px; height: 34px; border-radius: 8px; border: 1px solid #334155; background: rgba(15,23,42,.7); color: #fff; font-size: 14px; line-height: 1; padding: 0 9px; }
.admin-lightbox-close:hover:not(:disabled), .admin-lightbox-btn:hover:not(:disabled) { border-color: #60a5fa; background: rgba(15,23,42,.84); box-shadow: none; transform: translateY(-50%); }
.admin-lightbox-close:hover:not(:disabled) { transform: none; }
.admin-lightbox-proof-top, .admin-lightbox-proof-bottom { position: absolute; left: 0; right: 0; padding: 8px 10px; pointer-events: none; }
.admin-lightbox-proof-top { top: 0; background: rgba(15,23,42,.5); }
.admin-lightbox-proof-bottom { bottom: 0; background: rgba(15,23,42,.5); display: grid; grid-template-columns: 54px 1fr; gap: 8px; align-items: center; }
.admin-lightbox-proof-bottom.icon-only { grid-template-columns: 54px; justify-content: start; background: transparent; padding: 8px 10px; }
.admin-lightbox-proof-brand { display: grid; justify-items: center; align-content: center; gap: 2px; }
.admin-lightbox-proof-brand img { width: 34px; height: 34px; object-fit: contain; }
.admin-lightbox-proof-brand span { font-size: 9px; line-height: 1; color: rgba(241,245,249,.9); font-weight: 800; letter-spacing: .5px; }
.admin-lightbox-proof-bottom .admin-proof-lines { text-align: left; font-size: 12px; line-height: 1.25; white-space: pre-line; color: #fff; text-shadow: 0 1px 2px rgba(2,6,23,.55); }
.admin-lightbox-proof-bottom.icon-only .admin-proof-lines { display: none; }
.admin-lightbox-proof-bottom.icon-only .admin-lightbox-proof-brand { background: rgba(15,23,42,.5); border-radius: 8px; padding: 6px 8px; }
.admin-lightbox-meta { color: #cbd5e1; font-size: 13px; text-align: center; font-weight: 600; }

/* ═══════════════════════════════════
   MODALI
═══════════════════════════════════ */
.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; }
.modal.hidden { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-dialog { position: relative; z-index: 1; width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-dialog-lg { position: relative; z-index: 1; width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-dialog .card, .modal-dialog-lg .card { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.modal-actions { justify-content: center; gap: 14px; }

/* layout interno modale piano */
.plan-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
.plan-modal-col {
  padding: 18px 20px;
  border-right: 1px solid var(--border);
}
.plan-modal-col:last-child { border-right: none; }
.plan-modal-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--orange);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.pm-field { margin-bottom: 9px; }
.pm-field:last-child { margin-bottom: 0; }
.pm-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 3px; }
.pm-field input, .pm-field select { font-size: 12px; padding: 5px 8px; }
.pm-check-row { display: flex; align-items: center; gap: 7px; padding: 4px 0; font-size: 12px; color: var(--mid); border-bottom: 1px solid var(--border); }
.pm-check-row:last-child { border-bottom: none; }
.pm-check-row input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--orange); flex-shrink: 0; }

/* ═══════════════════════════════════
   FORM ROW (label + input affiancati)
═══════════════════════════════════ */
.row {
  display: grid; grid-template-columns: 130px 1fr;
  align-items: center; gap: 4px; margin: 4px 0;
}
.label { font-size: 11px; color: var(--muted); text-align: right; }

/* ═══════════════════════════════════
   STATUS / PILLS / MISC
═══════════════════════════════════ */
.status { font-size: 12px; margin-top: 6px; }
.status.ok { color: var(--green); }
.status.err { color: var(--red); }
.status.info { color: var(--blue); }
.pill { display: inline-block; border: 1px solid #fed7aa; color: #9a3412; background: #fff7ed; border-radius: 100px; padding: 2px 8px; font-size: 12px; }
.count-pill { display: inline-block; border: 1px solid var(--border2); color: var(--mid); background: var(--surface2); border-radius: 100px; padding: 2px 8px; font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; margin: 0; }
.tiny { padding: 4px 10px; font-size: 12px; width: auto; }
.inline-inputs { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }

/* ═══════════════════════════════════
   IMPOSTAZIONI — layout
═══════════════════════════════════ */
.set-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.set-todo-badge {
  font-size: 10px; font-weight: 500; letter-spacing: 0;
  text-transform: none; color: var(--yellow);
  background: var(--yellow-lt); border: 1px solid rgba(217,119,6,.2);
  padding: 2px 8px; border-radius: 100px;
}
.set-row {
  display: grid; grid-template-columns: 160px 1fr;
  align-items: center; gap: 12px; margin-bottom: 12px;
}
.set-row:last-of-type { margin-bottom: 0; }
.set-label {
  font-size: 13px; color: var(--mid);
}
.set-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.set-toggle-label { font-size: 13px; color: var(--mid); }
.set-info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.set-info-key { font-size: 13px; color: var(--muted); }
.set-info-val { font-size: 13px; color: var(--mid); font-weight: 500; }
.set-online { color: var(--green); font-weight: 600; }

/* ═══════════════════════════════════
   SECTION HEAD (mantenuto per compatibilità)
═══════════════════════════════════ */
.section-head {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 0 6px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* defaults-config-grid, plans-bottom-grid etc (mantenuti per compatibilità JS) */
.defaults-config-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.defaults-col { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--surface2); }
.defaults-col .section-head { margin: 0 0 8px; padding: 0 0 6px; }
.defaults-photo-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.defaults-photo-head input { max-width: 96px; }
.plans-bottom-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(580px, 1.8fr); gap: 12px; align-items: start; }
.plans-left-col, .plans-right-col { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--surface2); }
.plans-right-grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(240px, .9fr); gap: 10px; }
.plans-sub-col { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--surface2); }
.company-bottom-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.company-bottom-col { min-width: 0; }

/* ═══════════════════════════════════
   PLACEHOLDER "SELEZIONA AZIENDA"
═══════════════════════════════════ */
.select-company-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
  color: var(--muted);
}
.select-company-placeholder-icon { font-size: 40px; margin-bottom: 14px; opacity: .5; }
.select-company-placeholder h3 { font-size: 16px; font-weight: 600; color: var(--mid); margin-bottom: 8px; }
.select-company-placeholder p { font-size: 13px; }

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 900px) {
  #gtqSidebar { transform: translateX(-100%); transition: transform .25s; }
  #gtqMain { margin-left: 0; }
  .company-anag-layout { grid-template-columns: 1fr 1fr; }
  .defaults-config-grid { grid-template-columns: 1fr; }
  .plans-bottom-grid { grid-template-columns: 1fr; }
  .plans-right-grid { grid-template-columns: 1fr; }
  .photo-config-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 981px) and (max-width: 1360px) {
  #plansCard th, #plansCard td { font-size: 11px; padding: 4px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
