/* ══════════════════════════════════════════════════════
   GTQ Company Area — CSS
   Estende /admin/gtq-admin-v2.css (già incluso)
   ══════════════════════════════════════════════════════ */

/* Assicura che l'attributo hidden funzioni anche con display espliciti */
[hidden] { display: none !important; }

/* Tema verde — distingue l'area azienda dall'admin */
:root {
  --orange: #16a34a;
  --orange-lt: #f0fdf4;
  --orange-dk: #15803d;
  --orange2: #15803d;
  --orange-glow: rgba(22,163,74,0.12);
}

/* Override colori arancio hardcoded nel CSS admin */
input:focus, textarea:focus, select:focus {
  box-shadow: 0 0 0 3px rgba(22,163,74,.08) !important;
}
button.primary:focus, button.primary:active {
  box-shadow: 0 4px 12px rgba(22,163,74,.25) !important;
}

/* Override box-shadow arancio hardcoded in admin CSS su tutti i button hover */
button:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(22,163,74,.25);
}
button.secondary:hover:not(:disabled),
#gtqSidebar .sb-item:hover:not(:disabled) {
  box-shadow: none;
  transform: none;
}

.sb-item.active {
  background: #16a34a !important;
}
input[type="checkbox"] { accent-color: #16a34a; }
input[type="radio"] { accent-color: #16a34a; }

/* LOGIN ─────────────────────────────────────────────── */
#loginOverlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.co-login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(380px, 94vw);
  overflow: hidden;
}

.co-login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border2);
}

.co-login-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.co-login-brand-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--text2);
  text-transform: uppercase;
}

.co-login-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.co-login-status {
  min-height: 18px;
  font-size: 12px;
}

/* SIDEBAR override — sottolinea brand come "AZIENDA" ── */
#gtqSidebar .sb-brand-sub {
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--text2);
}

/* OVERVIEW — stat grid ────────────────────────────────── */
.co-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.co-stat-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 16px;
}

.co-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  margin-bottom: 6px;
}

.co-stat-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--orange);
  line-height: 1;
}

.co-stat-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}

/* PIANO ─────────────────────────────────────────────── */
.co-plan-current {
  background: var(--orange-lt, #fff4ed);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.co-plan-current-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

.co-plan-current-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.co-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.co-plan-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 16px;
}

.co-plan-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.co-plan-card-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--orange);
}

.co-plan-card-desc {
  font-size: 12px;
  color: var(--text2);
  margin-top: 8px;
}

/* OPERATORI — sezione ancorata, scroll solo nella lista */
/* Blocca scrollbar esterna quando la sezione è visibile */
#gtqMain:has(#operatoriSection:not(.hidden)) {
  overflow: hidden;
}

#operatoriSection {
  height: calc(100vh - var(--topbar-h) - 28px);
  display: flex;
  flex-direction: column;
}

/* #operatoriContent è il div diretto → va nella catena flex */
#operatoriSection > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#operatoriSection .co-card-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#operatoriSection .co-card-section-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* DOWNLOAD — sezione ancorata, scroll solo nella lista */
#gtqMain:has(#downloadSection:not(.hidden)) {
  overflow: hidden;
}

#downloadSection {
  height: calc(100vh - var(--topbar-h) - 28px);
  display: flex;
  flex-direction: column;
}

#downloadSection > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#downloadSection .co-card-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#downloadSection .co-card-section-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* TAG — sezione ancorata, scroll solo nella lista */
#gtqMain:has(#tagSection:not(.hidden)) {
  overflow: hidden;
}

#tagSection {
  height: calc(100vh - var(--topbar-h) - 28px);
  display: flex;
  flex-direction: column;
}

#tagSection > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#tagSection .co-card-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#tagSection .co-card-section-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0;
}

/* FOTO — sezione ancorata, scroll solo nella griglia foto */
#gtqMain:has(#fotoSection:not(.hidden)) { overflow: hidden; }

#fotoSection {
  height: calc(100vh - var(--topbar-h) - 28px);
  display: flex;
  flex-direction: column;
}

#fotoSection > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.co-foto-grid-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow: hidden;
}

.co-foto-grid-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-top: 4px;
}

/* TAG — flat grid unico: header sticky + righe dati allineate */
.co-tag-list-grid {
  display: grid;
  grid-template-columns: 44px max-content minmax(80px, 1fr) 66px;
  column-gap: 8px;
  padding: 0 14px;
  align-content: start;
}

.co-tag-header-wrap {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.co-tag-grid-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  padding: 5px 0;
}

.co-tag-header-sep {
  grid-column: 1 / -1;
  border-bottom: 2px solid var(--border2);
}

.co-tag-grid-cell {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border2);
  min-width: 0;
}

/* OPERATORI ─────────────────────────────────────────── */
.co-operator-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
}

.co-operator-row:last-child { border-bottom: none; }

.co-operator-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange-lt, #fff4ed);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.co-operator-info { flex: 1; min-width: 0; }

.co-operator-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.co-operator-meta {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

.co-operator-key {
  font-family: monospace;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text2);
}

.co-connected-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.co-connected-dot.off { background: var(--border2); }

/* TAG ───────────────────────────────────────────────── */
.co-tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border2);
}

.co-tag-row:last-child { border-bottom: none; }

.co-tag-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--orange-lt, #fff4ed);
  color: var(--orange);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: monospace;
  letter-spacing: .04em;
}

/* CONDIVISIONE ──────────────────────────────────────── */
.co-pin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
}

.co-pin-row:last-child { border-bottom: none; }

.co-pin-code {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--orange);
  background: var(--orange-lt, #fff4ed);
  border-radius: 6px;
  padding: 4px 10px;
  flex-shrink: 0;
}

/* FOTO ──────────────────────────────────────────────── */

/* Filter cards row */
.co-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.co-filter-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.co-filter-card-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--orange);
  text-transform: uppercase;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border2);
}

.co-filter-col-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--text2);
  text-transform: uppercase;
  margin-bottom: 5px;
}


.co-filter-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 3px;
  white-space: nowrap;
}

.co-grid-cols-ctrl { display: flex; align-items: center; gap: 6px; }

.co-cols-step {
  width: auto !important; height: auto;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--orange);
  font-size: 15px; line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color .12s;
}
.co-cols-step:hover:not(:disabled) {
  background: none !important;
  color: var(--orange) !important;
  border-color: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

.co-cols-value { font-size: 13px; font-weight: 700; min-width: 22px; text-align: center; }


/* Filter dropdown */
.co-filter-reset-btn {
  width: auto !important;
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid var(--border2);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  margin-bottom: 6px;
  display: inline-block;
}
.co-filter-reset-btn:hover:not(:disabled) {
  background: var(--surface) !important;
  border-color: var(--orange) !important;
  color: var(--orange) !important;
  transform: none !important;
  box-shadow: none !important;
}

.co-filter-dropdown-wrap { position: relative; width: 110px; }

.co-filter-dropdown-trigger {
  width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
.co-filter-dropdown-trigger:hover:not(:disabled) {
  border-color: var(--orange) !important;
  background: var(--orange-lt) !important;
  color: var(--orange) !important;
  transform: none !important;
  box-shadow: none !important;
}
.co-filter-dropdown-trigger.has-selection {
  border-color: var(--orange);
  background: var(--orange-lt);
  color: var(--orange);
}

.co-filter-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 3px); left: 0;
  min-width: 100%; width: max-content;
  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;
}
.co-filter-dropdown-panel.open { display: block; }

.co-filter-checklist-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border2);
  cursor: pointer;
}
.co-filter-checklist-item:last-child { border-bottom: none; }
.co-filter-checklist-item.is-checked { background: var(--orange-lt); color: var(--orange); }


.co-export-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
}
.co-export-cols > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}
.co-export-cols > div:first-child { padding-left: 0; }
.co-export-cols > div + div { border-left: 1px solid var(--border2); }


/* Photo grid */
.co-photo-grid { display: grid; gap: 8px; margin-top: 10px; }

.co-photo-tile {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border2);
  cursor: pointer;
  aspect-ratio: 1;
  transition: outline .1s;
}
.co-photo-tile.selected { outline: 2px solid var(--orange); outline-offset: -2px; }

.co-photo-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .15s;
}
.co-photo-tile:hover img { transform: scale(1.03); }

.co-photo-tile-meta {
  padding: 6px 6px 4px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.co-photo-tile-date {
  font-size: 10px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.co-photo-tile-comune {
  font-size: 10px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Skeleton shimmer while tile image loads */
.co-tile-loading {
  background: var(--border2);
  overflow: hidden;
}
.co-tile-loading::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,.07) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: co-tile-shimmer .9s infinite linear;
}
@keyframes co-tile-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* IMPOSTAZIONI ──────────────────────────────────────── */
.co-settings-section {
  margin-bottom: 20px;
}

.co-settings-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--orange);
  margin-bottom: 10px;
}

.co-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
}

.co-check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
}

.co-check-item input[type="checkbox"] {
  accent-color: var(--orange);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

/* FORM helpers ──────────────────────────────────────── */
.co-card-section {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.co-card-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border2);
}

.co-card-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--orange);
}

.co-card-section-body {
  padding: 14px;
}

/* Export rows (sezione Download) ────────────────────── */
.co-export-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
}

.co-export-row:last-child { border-bottom: none; }

.co-export-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  flex-shrink: 0;
  margin-top: 1px;
}

.co-export-info { flex: 1; min-width: 0; }

.co-export-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.co-export-meta {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

.co-export-progress {
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.co-export-progress-bar {
  height: 4px;
  background: var(--orange);
  border-radius: 2px;
  transition: width 0.4s;
}

.co-export-status-pending  { color: var(--text2); font-size: 11px; }
.co-export-status-process  { color: var(--orange); font-size: 11px; }
.co-export-status-ready    { color: #16a34a;       font-size: 11px; }
.co-export-status-error    { color: #dc2626;       font-size: 11px; }

/* Utility ───────────────────────────────────────────── */
.co-empty {
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  padding: 32px 0;
}

.co-load-more {
  text-align: center;
  padding: 12px 0;
}

.co-photo-chip {
  font-size: 9px;
  font-weight: 600;
  background: rgba(0,0,0,.55);
  color: #fff;
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Form inline label+input ───────────────────────────── */
.co-form-inline {
  display: flex;
  align-items: stretch;
  margin-bottom: 8px;
  gap: 0;
}

.co-form-lbl {
  flex-shrink: 0;
  width: 10em;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px 0 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--orange);
  background: transparent;
  border: 1px solid var(--border2);
  border-right: none;
  border-radius: var(--radius-sm, 6px) 0 0 var(--radius-sm, 6px);
  white-space: nowrap;
}

.co-form-inline input[type="text"],
.co-form-inline input[type="tel"],
.co-form-inline input[type="email"],
.co-form-inline input[type="password"] {
  flex: 1;
  border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0 !important;
  margin: 0 !important;
}

/* Bottoni icona outline ─────────────────────────────── */
.co-icon-btn {
  background: transparent !important;
  border: 1px solid var(--border2) !important;
  box-shadow: none !important;
  padding: 6px 8px !important;
  width: auto !important;
  min-width: 0 !important;
  color: var(--orange) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.co-icon-btn:hover:not(:disabled) {
  background: var(--orange-lt) !important;
  box-shadow: none !important;
  transform: none !important;
}
.co-icon-btn.danger {
  color: var(--red, #ef4444) !important;
}
.co-icon-btn.danger:hover:not(:disabled) {
  background: #fef2f2 !important;
}

.admin-photo-delete-btn:hover { background: rgba(220,38,38,.85) !important; color: #fff !important; border-color: transparent !important; transform: none !important; box-shadow: none !important; }

button.ghost { opacity: .35 !important; pointer-events: none !important; }

#fotoSection .admin-photo-tile.selected { border-color: #16a34a; }
#fotoSection .admin-photo-tile.co-tile-excluded { border-color: #ef4444 !important; opacity: .55; }

/* Omit button — center of tile */
.co-omit-btn {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  background: rgba(0,0,0,.45); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0;
  transition: opacity .15s, background .15s;
  z-index: 3;
}
.co-omit-btn svg { width: 20px; height: 20px; }
.admin-photo-tile:hover .co-omit-btn { opacity: 1; }
.co-omit-btn.active { opacity: 1 !important; background: #ef4444; }

/* Count split: active + omitted */
.co-excl-count { color: #ef4444; margin-left: 3px; }
.co-date-header .co-excl-count,
.co-tag-header  .co-excl-count { color: rgba(255,255,255,.85); }

#fotoSection .admin-photo-tile { border: 2px solid #9ca3af; }
#fotoSection .admin-photo-tile:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,.22); }
#fotoSection .admin-photo-delete-btn { top: -2px !important; right: -2px !important; width: 24px !important; height: 24px !important; border-radius: 0 0 0 5px !important; }
#fotoSection .admin-photo-overlay-left .admin-photo-chip {
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(248, 250, 252, .82);
  border-color: rgba(148, 163, 184, .55);
}
#fotoSection .admin-photo-overlay-left .admin-photo-chip.admin-photo-chip-danger {
  background: rgba(254, 226, 226, .82);
  border-color: rgba(252, 165, 165, .75);
}


/* ═══════════════════════════════════════════════════
   VIEW CHECKBOX CSS TOGGLES
   Avoiding full renderPhotoGrid() on checkbox change
═══════════════════════════════════════════════════ */
#coPhotoGrid.co-hide-tag      .admin-photo-overlay-left  { display: none; }
#coPhotoGrid.co-hide-operator .admin-photo-overlay-right { display: none; }
#coPhotoGrid.co-hide-date     .co-tile-date              { display: none; }
#coPhotoGrid.co-hide-time     .co-tile-time              { display: none; }
#coPhotoGrid.co-hide-comune   .admin-photo-line          { display: none; }
#coPhotoGrid.co-hide-elimina  .admin-photo-delete-btn    { display: none; }
#coPhotoGrid.co-hide-ometti   .co-omit-btn               { display: none !important; }
/* Separator between date and time spans */
.co-tile-time::before { content: " · "; }
#coPhotoGrid.co-hide-date .co-tile-time::before { content: ""; }
/* Hide empty stamp and meta when all sub-elements are hidden */
#coPhotoGrid.co-hide-date.co-hide-time                          .admin-photo-stamp { display: none; }
#coPhotoGrid.co-hide-date.co-hide-time.co-hide-comune           .admin-photo-meta  { display: none; }

/* ═══════════════════════════════════════════════════
   PHOTO GROUPS (Data → Tag)
═══════════════════════════════════════════════════ */
.co-photo-groups { display: flex; flex-direction: column; }

/* ── Date group ─────────────────────────────────── */
.co-date-group { margin-bottom: 4px; }

.co-date-header {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: 6px;
  background: #374151; color: #f9fafb;
  border: none; text-align: left; cursor: pointer; user-select: none;
  min-height: 26px;
  transition: background .12s;
}
.co-date-header:hover { background: #4b5563 !important; transform: none !important; box-shadow: none !important; }

.co-date-arrow {
  display: inline-block; font-size: 18px; color: #d1d5db; flex-shrink: 0;
  transition: transform .18s;
}
.co-date-group.collapsed .co-date-arrow { transform: rotate(-90deg); }

.co-date-label { font-size: 12px; font-weight: 700; }
.co-date-count {
  font-size: 10px; font-weight: 600; color: #9ca3af;
  background: rgba(0,0,0,.2); padding: 1px 7px; border-radius: 20px;
  flex-shrink: 0;
}
.co-group-spacer { flex: 1; }
.co-group-msg {
  font-size: 11px; font-style: italic; opacity: .85;
  white-space: nowrap; flex-shrink: 0;
  padding-right: 12px; margin-right: 12px;
  border-right: 1px solid var(--border2);
  color: var(--text2);
}
.co-group-msg:empty { padding-right: 0; margin-right: 0; border-right: none; }
.co-date-header .co-group-msg,
.co-tag-header  .co-group-msg { color: rgba(255,255,255,.85); border-right-color: rgba(255,255,255,.25); }
.co-group-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.co-action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
  background: transparent; border: none; border-radius: 4px;
  cursor: pointer; color: inherit; opacity: 0.65; flex-shrink: 0;
  transition: opacity .15s, background .15s;
}
.co-action-btn:hover { opacity: 1 !important; transform: none !important; box-shadow: none !important; }
.co-action-btn svg { width: 15px; height: 15px; display: block; }

/* hover bg per sfondi scuri (data, tag) */
.co-date-header .co-action-btn:hover { background: rgba(255,255,255,.15) !important; }
.co-tag-header  .co-action-btn:hover { background: rgba(255,255,255,.15) !important; }
/* hover bg per sfondi chiari (comune, foto header) */
.co-comune-header .co-action-btn:hover { background: rgba(0,0,0,.1) !important; }
#coFotoHeaderActions .co-action-btn { color: var(--text2); }
#coFotoHeaderActions .co-action-btn:hover { background: rgba(0,0,0,.07) !important; }

.co-date-body { margin-top: 3px; padding-left: 8px; display: flex; flex-direction: column; gap: 3px; }
.co-date-group.collapsed .co-date-body { display: none; }

/* ── Tag group ──────────────────────────────────── */
.co-tag-group { }

.co-tag-header {
  width: 100%; display: flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 5px;
  background: rgba(255,83,8,.75); color: #fff;
  border: none; text-align: left; cursor: pointer; user-select: none;
  min-height: 24px;
  transition: background .12s;
}
.co-tag-header:hover { background: rgba(255,83,8,.9) !important; transform: none !important; box-shadow: none !important; }

.co-tag-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.co-tag-count {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.9);
  background: rgba(0,0,0,.2); padding: 1px 7px; border-radius: 20px;
  flex-shrink: 0;
}
.co-tag-arrow {
  display: inline-block; font-size: 18px; color: rgba(255,255,255,.85); flex-shrink: 0;
  transition: transform .18s;
}
.co-tag-group.collapsed .co-tag-arrow { transform: rotate(-90deg); }

.co-tag-body { margin-top: 3px; padding-left: 8px; display: flex; flex-direction: column; gap: 3px; }
.co-tag-group.collapsed .co-tag-body { display: none; }

/* ── Comune group ───────────────────────────────── */
.co-comune-header {
  width: 100%; display: flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 4px;
  background: #d1d5db; color: #374151;
  border: none; text-align: left; cursor: pointer; user-select: none;
  min-height: 22px;
  transition: background .12s;
}
.co-comune-header:hover { background: #b8bec7 !important; transform: none !important; box-shadow: none !important; }

.co-comune-arrow {
  display: inline-block; font-size: 18px; color: #6b7280; flex-shrink: 0;
  transition: transform .18s;
}
.co-comune-group.collapsed .co-comune-arrow { transform: rotate(-90deg); }

.co-comune-name { font-size: 11px; font-weight: 600; }
.co-comune-count {
  font-size: 10px; font-weight: 600; color: #374151;
  background: rgba(0,0,0,.12); padding: 1px 7px; border-radius: 20px;
  flex-shrink: 0;
}

.co-comune-grid {
  display: grid;
  grid-template-columns: repeat(var(--co-grid-cols, 10), minmax(0,1fr));
  gap: 4px; padding: 6px 0 4px;
}
.co-comune-group.collapsed .co-comune-grid { display: none; }

/* ═══════════════════════════════════════════════════
   LIGHTBOX FOTO (company)
═══════════════════════════════════════════════════ */
.co-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(2,6,23,.9);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: co-lb-fade .18s ease both;
}
@keyframes co-lb-fade { from { opacity:0 } to { opacity:1 } }
.co-lightbox[hidden] { display: none !important; }

.co-lightbox-panel {
  position: relative;
  width: min(880px, 100%);
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: #0d1b35;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.07);
  animation: co-lb-pop .22s cubic-bezier(.22,1,.36,1) both;
}
@keyframes co-lb-pop { from { transform: scale(.96) translateY(10px); opacity:0 } to { transform:none; opacity:1 } }

.co-lightbox-image-area {
  position: relative; flex: 1; min-height: 0;
  background: #060d1e;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.co-lightbox-media {
  position: relative; display: inline-block;
  max-width: 100%; max-height: calc(100vh - 120px);
  line-height: 0;
}
.co-lightbox-img {
  max-width: 100%; max-height: calc(100vh - 120px);
  display: block; object-fit: contain;
}

/* overlay banda alta (tag) */
.co-lightbox-top-bar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 10px 14px;
  background: rgba(15,23,42,.5);
  pointer-events: none;
}
.co-lightbox-tag-label {
  color: #f59e0b; font-weight: 800; font-size: 14px;
  letter-spacing: .5px; text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}

/* overlay banda bassa (brand + lines) */
.co-lightbox-bottom-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 14px;
  background: rgba(15,23,42,.42);
  display: flex; align-items: center; gap: 10px;
  pointer-events: none;
}
.co-lightbox-pin-wrap { flex-shrink: 0; width: 44px; display: flex; align-items: center; justify-content: center; }
.co-lightbox-pin { width: 40px; height: 40px; }
.co-lightbox-lines {
  flex: 1; min-width: 0; color: #fff;
  font-size: 13px; line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.co-lightbox-lines .co-lb-line { display: block; font-weight: 600; }
.co-lightbox-lines .co-lb-line:first-child { font-weight: 700; }
.co-lightbox-wordmark {
  position: absolute; bottom: 10px; right: 14px;
  width: 64px; opacity: .85; flex-shrink: 0;
}

/* Loading spinner */
.co-lightbox-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,13,30,.55);
}
.co-lightbox-loading.hidden { display: none; }
.co-lightbox-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,.12);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: co-spin .65s linear infinite;
}
@keyframes co-spin { to { transform: rotate(360deg); } }

/* Frecce navigazione */
.co-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0;
  border-radius: 50%;
  background: rgba(15,23,42,.6);
  border: 1px solid rgba(255,255,255,.13);
  color: #e2e8f0; font-size: 30px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, transform .15s;
  z-index: 4;
}
.co-lightbox-prev { left: 10px; }
.co-lightbox-next { right: 10px; }
.co-lightbox-nav:hover:not(:disabled) {
  background: rgba(15,23,42,.9) !important;
  border-color: rgba(255,255,255,.3) !important;
  transform: translateY(-50%) scale(1.1) !important;
  box-shadow: none !important;
}

/* Footer */
.co-lightbox-footer {
  padding: 9px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #0d1b35;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.co-lightbox-meta { flex: 1; color: #94a3b8; font-size: 12px; font-weight: 500; }
.co-lightbox-counter {
  color: #64748b; font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.06);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}

/* Pulsante chiudi */
.co-lightbox-close {
  position: absolute; top: 10px; right: 10px; z-index: 10;
  width: 32px; height: 32px; padding: 0;
  border-radius: 50%;
  background: rgba(15,23,42,.65);
  border: 1px solid rgba(255,255,255,.13);
  color: #94a3b8; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.co-lightbox-close:hover { background: rgba(239,68,68,.8); color: #fff; border-color: transparent; }
