/* Agorvy — base styles (SuperAdmin + tenant landing). Tenant skin overrides via CSS vars. */

:root {
  --bg: #fafafa;
  --bg-alt: #ffffff;
  --bg-soft: #f3f4f6;
  --fg: #1a1a1a;
  --fg-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2c6ee0;
  --primary-hover: #1a4faa;
  --primary-fg: #ffffff;
  --danger: #d32f2f;
  --danger-bg: #fdecea;
  --success: #2e7d32;
  --warning: #ed6c02;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

code {
  background: var(--bg-soft);
  padding: .12em .4em;
  border-radius: var(--radius-sm);
  font-size: .92em;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--fg-muted); }
.small { font-size: .85em; }

/* ----- buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  padding: .55rem 1.1rem;
  font: inherit;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-fg); }
.btn-ghost { background: transparent; color: var(--fg-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--fg); border-color: var(--fg-muted); }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: .35rem .8rem; font-size: .9em; }

/* ----- forms ----- */
.form .field { margin-bottom: 1rem; }
.form label {
  display: block;
  margin-bottom: .35rem;
  font-weight: 500;
  font-size: .92em;
  color: var(--fg);
}
.form input[type="email"],
.form input[type="text"],
.form input[type="password"] {
  display: block;
  width: 100%;
  padding: .6rem .8rem;
  font: inherit;
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
.form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 110, 224, .15);
}

/* ----- alerts ----- */
.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .92em;
}
.alert-danger { background: var(--danger-bg); color: var(--danger); }

/* ----- SuperAdmin layout ----- */
.sa-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.sa-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.sa-brand {
  display: inline-flex;
  align-items: baseline;
  gap: .55rem;
  text-decoration: none;
  color: var(--fg);
}
.sa-brand-mark {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.02em;
}
.sa-brand-tag {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 999px;
}
.sa-nav {
  display: flex;
  align-items: center;
  gap: .8rem;
  font-size: .92em;
}
.sa-nav-sep { color: var(--border); }
.sa-user { color: var(--fg-muted); }
.sa-logout { display: inline-block; margin: 0; }

.sa-main { padding: 2.5rem 0; min-height: calc(100vh - 132px); }
.sa-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  color: var(--fg-muted);
  background: var(--bg-alt);
}

.page-title {
  font-size: 1.9rem;
  margin: 0 0 .35rem;
  letter-spacing: -.02em;
  font-weight: 700;
  color: #4D4D4D;
}
.page-lead {
  color: var(--fg-muted);
  margin: 0 0 1.4rem;
  font-size: 1rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: #fff;
  border: none;
  border-top: 5px solid var(--tenant-primary, #1F3A8A);
  border-radius: 16px;
  padding: 1.3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 8%, transparent);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 14%, transparent);
}
.stat-label {
  font-size: .78em;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--fg, #4D4D4D);
}
.stat-sub {
  font-size: .8rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

.placeholder-block {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
}
.placeholder-block h2,
.placeholder-block h3 { margin-top: 0; }
.placeholder-block ul { margin: 0; padding-left: 1.2rem; }
.placeholder-block li { margin: .25rem 0; }

/* ----- SuperAdmin login ----- */
.login-page { background: var(--bg-soft); }
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.login-header {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .55rem;
  margin-bottom: 1.5rem;
}
.login-header .sa-brand-mark { font-size: 1.4rem; }
.login-hint {
  text-align: center;
  font-size: .85em;
  color: var(--fg-muted);
  margin: 1.2rem 0 0;
}

/* ----- Tenant landing placeholder ----- */
.tenant-landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  background: var(--tenant-secondary, var(--bg-soft));
}
.tenant-card {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}
.tenant-card h1 {
  margin: 0 0 .5rem;
  font-size: 1.8rem;
  letter-spacing: -.01em;
  color: var(--tenant-primary, var(--fg));
}
.tenant-tagline {
  margin: 0 0 1.5rem;
  color: var(--fg-muted);
  font-style: italic;
}

/* ----- Nav ----- */
.sa-nav a {
  text-decoration: none;
  color: var(--fg-muted);
  padding: .25rem .55rem;
  border-radius: var(--radius);
  transition: color .12s, background .12s;
}
.sa-nav a:hover { color: var(--fg); }
.sa-nav a.active {
  color: var(--primary);
  background: rgba(44, 110, 224, .08);
}

/* ----- Page header (title + actions) ----- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.page-header > div:first-child { flex: 1; min-width: 280px; }
.page-actions { display: flex; gap: .55rem; flex-wrap: wrap; }

/* ----- Tables ----- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table th, .table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  background: var(--bg-soft);
  font-size: .78em;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-muted);
  font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }
.table .actions { text-align: right; white-space: nowrap; }

/* ----- Badge ----- */
.badge {
  display: inline-block;
  padding: .12em .6em;
  font-size: .78em;
  font-weight: 500;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--fg-muted);
  white-space: nowrap;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: #d1ecf1; color: #0c5460; }

/* ----- Form extras ----- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-section-title {
  margin: 1.5rem 0 .8rem;
  font-size: 1.05em;
  letter-spacing: .02em;
  color: var(--fg-muted);
  text-transform: uppercase;
}
.form textarea,
.form select {
  display: block;
  width: 100%;
  padding: .6rem .8rem;
  font: inherit;
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
.form textarea {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9em;
  line-height: 1.45;
  resize: vertical;
}
.form textarea:focus,
.form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 110, 224, .15);
}
.form input:disabled,
.form textarea:disabled {
  background: var(--bg-soft);
  color: var(--fg-muted);
  cursor: not-allowed;
}
.form small { display: block; margin-top: .25rem; font-size: .82em; }
.checkbox-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
}
.checkbox input { margin: 0; }
.form-actions {
  display: flex;
  gap: .8rem;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.inline-form { display: inline; margin: 0; }

/* ----- Search bar ----- */
.search-form {
  display: flex;
  gap: .55rem;
  margin-bottom: 1.2rem;
}
.search-form input {
  flex: 1;
  padding: .55rem .8rem;
  font: inherit;
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ----- Detail (tenant) ----- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.detail-card {
  background: #fff;
  border: none;
  border-top: 5px solid var(--tenant-primary, #1F3A8A);
  border-radius: 16px;
  padding: 1.6rem 1.8rem;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 8%, transparent);
  margin-bottom: 1.2rem;
}
.detail-card h2 {
  margin: 0 0 1rem;
  font-size: 1.15em;
  letter-spacing: -.01em;
  color: var(--fg, #4D4D4D);
  font-weight: 700;
}
.kv {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: .5rem .8rem;
  margin: 0;
  font-size: .92em;
}
.kv dt {
  color: var(--fg-muted);
  font-weight: 500;
}
.kv dd { margin: 0; }
.color-chip {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  margin-right: .25rem;
  vertical-align: middle;
}

.actions-block {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
}
.actions-block h2 {
  margin: 0 0 1rem;
  font-size: 1.05em;
  letter-spacing: .02em;
  color: var(--fg-muted);
  text-transform: uppercase;
}
.action-row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ----- Pagination ----- */
.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.2rem;
}

/* ----- Code dump ----- */
.code-dump {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  font-size: .85em;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================ */
/* TENANT MNG - Layout sidebar laterale (replica PHP originale)   */
/* ============================================================ */
.tenant-mng {
  background: var(--tenant-secondary, var(--bg-soft));
  min-height: 100vh;
}
/* Su desktop: grid sidebar + main. Su mobile: column con hamburger drawer */
.mng-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.mng-shell > .mng-header { /* la sidebar */
  grid-row: 1 / 3;
  grid-column: 1;
}
.mng-shell > .mng-main {
  grid-column: 2;
  grid-row: 1;
}
.mng-shell > .mng-footer {
  grid-column: 2;
  grid-row: 2;
}

@media (max-width: 880px) {
  .mng-shell {
    display: flex;
    flex-direction: column;
  }
}

.mng-header {
  background: linear-gradient(180deg,
    var(--tenant-primary, #1F3A8A) 0%,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 80%, black) 100%);
  border: none;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.10);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.mng-header::-webkit-scrollbar { width: 6px; }
.mng-header::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }

@media (max-width: 880px) {
  .mng-header {
    position: relative;
    height: auto;
    background: var(--bg-alt);
    border-bottom: 3px solid var(--tenant-primary);
    box-shadow: none;
  }
}

.mng-header-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 1.4rem 1rem;
  width: 100%;
}
@media (max-width: 880px) {
  .mng-header-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
  }
}

.mng-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 0 .5rem 1.2rem;
  text-decoration: none;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  margin-bottom: .8rem;
}
@media (max-width: 880px) {
  .mng-brand {
    flex-direction: row;
    align-items: baseline;
    border-bottom: none;
    margin: 0;
    padding: 0;
    color: var(--fg);
  }
}
.mng-brand-mark {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -.02em;
  color: #fff;
}
@media (max-width: 880px) {
  .mng-brand-mark { color: var(--tenant-primary); }
}
.mng-brand-tag {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.15);
  padding: 2px 9px;
  border-radius: 999px;
  border: none;
}
@media (max-width: 880px) {
  .mng-brand-tag {
    color: var(--fg-muted);
    background: transparent;
    border: 1px solid var(--border);
  }
}

.mng-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  font-size: .9em;
  flex-wrap: nowrap;
  margin-top: 4px;
}

/* Hamburger button — mobile only */
.nav-hamburger {
  display: none;
  background: var(--tenant-primary, #1F3A8A);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 30%, transparent);
  transition: filter 0.15s, transform 0.15s;
}
.nav-hamburger:hover { filter: brightness(1.1); }
.nav-hamburger:active { transform: scale(0.96); }
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #fff;
  border-radius: 999px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-hamburger { display: inline-flex; }
  .mng-nav {
    /* Drop-down stile pannello sotto l'header */
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 12px;
    background: var(--bg-alt, #f9fafb);
    border-radius: 12px;
    padding: 12px;
    gap: 6px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
    order: 99;
  }
  .mng-nav.is-open {
    display: flex;
  }
  .mng-nav a {
    padding: 11px 14px;
    border-radius: 10px;
    font-weight: 600;
  }
  .mng-nav-sep {
    display: none;
  }
  .mng-user {
    padding: 8px 14px;
    color: var(--fg-muted, #64748b);
    font-size: 0.85rem;
    font-style: italic;
  }
  .mng-logout {
    margin-top: 4px;
  }
  .mng-logout button {
    width: 100%;
  }
}
/* Voci sidebar — desktop default (sfondo scuro brand) */
.mng-nav a {
  text-decoration: none;
  color: rgba(255,255,255,0.85);
  padding: 10px 14px;
  border-radius: 10px;
  transition: all 0.18s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mng-nav a:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  transform: translateX(4px);
  text-decoration: none;
}
.mng-nav a.active {
  background: #fff;
  color: var(--tenant-primary, #1F3A8A);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
@media (max-width: 880px) {
  .mng-nav a { color: var(--fg-muted, #64748b); }
  .mng-nav a:hover { background: var(--mist-light); color: var(--fg); transform: none; }
  .mng-nav a.active {
    color: var(--tenant-primary);
    background: color-mix(in srgb, var(--tenant-primary) 12%, transparent);
    font-weight: 600;
  }
}

.mng-nav-soon {
  color: rgba(255,255,255,0.5);
  opacity: .85;
  font-size: .85em;
  font-style: italic;
}
.mng-nav-sep {
  color: rgba(255,255,255,0.18);
  border-top: 1px solid rgba(255,255,255,0.18);
  margin: 8px 4px;
  height: 1px;
  display: block;
  text-indent: -9999px;
}
@media (max-width: 880px) {
  .mng-nav-sep { color: var(--border); border-color: var(--border); }
}
.mng-user {
  color: rgba(255,255,255,0.7);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-style: italic;
}
@media (max-width: 880px) {
  .mng-user { color: var(--fg-muted); }
}
.mng-logout { display: block; margin: 8px 0 0; }
.mng-logout button {
  width: 100%;
  background: rgba(255,255,255,0.12) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
}
.mng-logout button:hover {
  background: rgba(255,255,255,0.22) !important;
}
@media (max-width: 880px) {
  .mng-logout button {
    background: var(--surface) !important;
    color: var(--fg) !important;
    border: 1px solid var(--border) !important;
  }
}
.badge-counter {
  display: inline-block;
  margin-left: .35rem;
  min-width: 1.1rem;
  padding: 0 .35rem;
  font-size: .72rem;
  line-height: 1.1rem;
  text-align: center;
  background: var(--danger, #d62828);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
}

.mng-main {
  flex: 1;
  padding: 1.8rem 1.6rem;
  background: var(--bg-soft, #f3f5f8);
  min-width: 0;
}
.mng-main > .container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 880px) {
  .mng-main { padding: 1.2rem 1rem; }
}
.mng-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.6rem;
  color: var(--fg-muted);
  background: var(--bg-alt);
  font-size: 0.86rem;
}

/* Login card tenant-branded */
.mng-login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--tenant-secondary, var(--bg-soft));
}
.mng-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--tenant-primary);
}
.mng-login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.mng-login-mark {
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -.01em;
  color: var(--tenant-primary);
}
.mng-login-tag {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg-muted);
}
/* btn-tenant: bottone ricco con gradient + uppercase + shadow brand (replica PHP originale) */
.btn-tenant {
  background: linear-gradient(135deg,
    var(--tenant-primary, #1F3A8A) 0%,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 65%, black) 100%) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 11px 24px !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  font-size: 0.85rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 35%, transparent) !important;
  text-decoration: none !important;
}
.btn-tenant:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 50%, transparent) !important;
  color: #fff !important;
}
.btn-tenant.btn-sm {
  padding: 8px 16px !important;
  font-size: 0.78rem !important;
}

/* Form input ricco: border 2px + glow on focus (replica PHP originale) */
.form .field input[type="text"],
.form .field input[type="email"],
.form .field input[type="password"],
.form .field input[type="tel"],
.form .field input[type="url"],
.form .field input[type="number"],
.form .field input[type="date"],
.form .field input[type="datetime-local"],
.form .field input[type="search"],
.form .field input:not([type]),
.form .field textarea,
.form .field select {
  background: #fcfcfc;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.95rem;
  width: 100%;
  font: inherit;
  color: var(--fg, #495057);
  transition: all 0.3s ease;
  box-sizing: border-box;
}
.form .field input:focus,
.form .field textarea:focus,
.form .field select:focus {
  outline: none;
  background: #fff;
  border-color: var(--tenant-primary, #1F3A8A);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 14%, transparent);
}
.form .field label {
  display: block;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--fg-muted, #495057);
  margin-bottom: 0.4rem;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .55rem;
}
.feature-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .8rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
  font-size: .92em;
}
.feature-flag-name { color: var(--fg-muted); }

.stat-sub { display: block; margin-top: .25rem; }

.big-stat {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--tenant-primary, var(--primary));
  margin: .25rem 0 0;
}

/* SuperAdmin: manager-link readonly visible field */
.link-readonly {
  display: block;
  width: 100%;
  padding: .5rem .7rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .85em;
}

/* ----- Errors (tenant 404 / suspended) ----- */
.error-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg-soft);
}
.error-card {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}
.error-card h1 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  letter-spacing: -.01em;
}

/* ==========================================================================
   TENANT HOME — landing pubblica brandizzata del Comune (/<slug>/)
   ========================================================================== */
.th-shell { min-height: 100vh; background: #fff; color: var(--fg); }

.th-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.th-header-inner {
  max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.th-brand-mark {
  font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em;
  color: var(--tenant-primary, #1F3A8A);
}
.th-brand { text-decoration: none; }
.th-nav { display: flex; align-items: center; gap: 1.4rem; font-size: .95em; }
.th-nav a { color: var(--fg-muted); text-decoration: none; transition: color .12s; }
.th-nav a:hover { color: var(--fg); }
.th-nav-link { color: var(--fg) !important; font-weight: 500; }
@media (max-width: 720px) {
  .th-nav a:not(.th-btn):not(.th-nav-link) { display: none; }
}

.th-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .55rem 1.1rem;
  font: inherit; font-weight: 500;
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  transition: filter .12s, border-color .12s;
}
.th-btn:hover { text-decoration: none; }
.th-btn-primary { background: var(--tenant-primary, #1F3A8A); color: #fff; }
.th-btn-primary:hover { color: #fff; filter: brightness(1.08); }
.th-btn-ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.th-btn-ghost:hover { border-color: var(--tenant-primary, #1F3A8A); color: var(--tenant-primary, #1F3A8A); }
.th-btn-lg {
  padding: .9rem 1.5rem; font-size: 1.05rem;
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.th-btn-sub { font-size: .78em; font-weight: 400; opacity: .8; margin-top: .15rem; }

.th-hero {
  padding: 4rem 1.25rem 5rem;
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--tenant-secondary, #f5f5f5) 60%, white) 0%,
              #fff 100%);
}
.th-hero-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: center; }
@media (max-width: 880px) { .th-hero-inner { grid-template-columns: 1fr; } }
.th-eyebrow {
  display: inline-block;
  font-size: .78em; text-transform: uppercase; letter-spacing: .12em; font-weight: 600;
  color: var(--tenant-primary, #1F3A8A);
  background: color-mix(in srgb, var(--tenant-primary, #1F3A8A) 10%, transparent);
  padding: .35em .8em; border-radius: 999px;
  margin-bottom: 1.4rem;
}
.th-h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -.025em; line-height: 1.05;
  margin: 0 0 .7rem;
  color: var(--tenant-primary, #1F3A8A);
}
.th-tagline { font-size: 1.2rem; font-style: italic; color: var(--fg-muted); margin: 0 0 1.2rem; }
.th-lead { font-size: 1.08rem; line-height: 1.6; margin: 0 0 2rem; max-width: 36em; }
.th-hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; }

.th-hero-visual { display: flex; justify-content: center; }
.th-card-mockup {
  width: 320px; max-width: 100%;
  aspect-ratio: 1.586 / 1;
  border-radius: 18px;
  background: linear-gradient(135deg,
              var(--tenant-primary, #1F3A8A) 0%,
              color-mix(in srgb, var(--tenant-primary, #1F3A8A) 70%, var(--tenant-accent, #C4661F)) 100%);
  color: #fff; padding: 1.5rem;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 24px 48px rgba(31, 58, 138, .25);
  transform: rotate(-3deg);
  transition: transform .3s;
}
.th-card-mockup:hover { transform: rotate(0); }
.th-card-mockup-header { display: flex; justify-content: space-between; align-items: center; }
.th-card-mockup-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.th-card-mockup-chip {
  width: 36px; height: 28px; border-radius: 4px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.th-card-mockup-points { display: flex; flex-direction: column; margin-bottom: .5rem; }
.th-card-mockup-amount { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.th-card-mockup-label {
  font-size: .75em; opacity: .8;
  text-transform: uppercase; letter-spacing: .08em;
}
.th-card-mockup-name-bar { font-size: .9em; opacity: .9; letter-spacing: .15em; margin-top: .8rem; }
.th-card-mockup-serial { font-family: ui-monospace, monospace; font-size: .75em; opacity: .7; margin-top: .2rem; }

.th-stats { background: var(--tenant-primary, #1F3A8A); color: #fff; padding: 2.5rem 1.25rem; }
.th-stats-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; text-align: center; }
.th-stat { display: flex; flex-direction: column; gap: .35rem; }
.th-stat-num { font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.th-stat-lbl { font-size: .85em; opacity: .85; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 600px) { .th-stats-inner { grid-template-columns: 1fr; gap: 1.4rem; } }

.th-section { padding: 5rem 1.25rem; }
.th-section-alt { background: color-mix(in srgb, var(--tenant-secondary, #f5f5f5) 50%, white); }
.th-section-head { margin-bottom: 2.5rem; }
.th-h2 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  letter-spacing: -.02em; margin: 0 0 .6rem;
  color: var(--tenant-primary, #1F3A8A);
}
.th-section-lead { color: var(--fg-muted); font-size: 1.05rem; margin: 0; max-width: 44em; line-height: 1.6; }

.th-events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
}
.th-event {
  display: grid; grid-template-columns: 80px 1fr; gap: 1.2rem;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.th-event:hover {
  border-color: var(--tenant-primary, #1F3A8A);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .06);
}
.th-event-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--tenant-primary, #1F3A8A);
  color: #fff; border-radius: var(--radius); padding: .8rem; text-align: center; height: fit-content;
}
.th-event-date .day { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.th-event-date .month { font-size: .8em; text-transform: uppercase; opacity: .85; letter-spacing: .08em; }
.th-event-body h3 { margin: 0 0 .4rem; font-size: 1.1rem; letter-spacing: -.01em; }
.th-event-body p { margin: 0 0 .6rem; color: var(--fg-muted); font-size: .92rem; line-height: 1.5; }
.th-event-meta { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .85em; color: var(--fg-muted); }

.th-business-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; }
.th-business {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem;
  border-left: 3px solid var(--tenant-accent, #C4661F);
  transition: transform .12s, box-shadow .12s;
}
.th-business:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0, 0, 0, .06); }
.th-business-cat {
  font-size: .76em; text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
  color: var(--tenant-accent, #C4661F); margin-bottom: .5rem;
}
.th-business h3 { margin: 0 0 .4rem; font-size: 1.05rem; letter-spacing: -.01em; }
.th-business p { margin: 0 0 .6rem; color: var(--fg-muted); font-size: .92rem; line-height: 1.5; }
.th-business-addr { font-size: .85em; color: var(--fg-muted); }

.th-roles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.4rem; }
.th-role {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.8rem;
  border-top: 4px solid var(--tenant-primary, #1F3A8A);
  display: flex; flex-direction: column;
}
.th-role:nth-child(2) { border-top-color: var(--tenant-accent, #C4661F); }
.th-role:nth-child(3) { border-top-color: color-mix(in srgb, var(--tenant-primary, #1F3A8A) 50%, #5b8c5a); }
.th-role-tag {
  font-size: .76em; text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
  color: var(--fg-muted); margin-bottom: .8rem;
}
.th-role h3 { margin: 0 0 .8rem; font-size: 1.2rem; letter-spacing: -.01em; }
.th-role p { margin: 0 0 1.2rem; color: var(--fg-muted); line-height: 1.55; flex: 1; }
.th-link { font-weight: 500; color: var(--tenant-primary, #1F3A8A); text-decoration: none; }
.th-link:hover { text-decoration: underline; }

.th-sponsors {
  padding: 3rem 1.25rem;
  background: color-mix(in srgb, var(--tenant-secondary, #f5f5f5) 30%, white);
  border-top: 1px solid var(--border);
}
.th-sponsors-eyebrow {
  text-align: center;
  font-size: .78em; text-transform: uppercase; letter-spacing: .15em;
  color: var(--fg-muted); margin: 0 0 1.4rem;
}
.th-sponsors-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; align-items: center; }
.th-sponsor strong { color: var(--fg-muted); font-weight: 500; }
.th-sponsor a { color: inherit; text-decoration: none; }
.th-sponsor a:hover strong { color: var(--tenant-primary, #1F3A8A); }

.th-cta {
  padding: 5rem 1.25rem;
  background: var(--tenant-primary, #1F3A8A);
  color: #fff; text-align: center;
}
.th-cta h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.02em; margin: 0 0 .8rem; }
.th-cta p { font-size: 1.1rem; opacity: .9; margin: 0 0 2rem; }
.th-cta .th-btn-primary { background: var(--tenant-accent, #C4661F); }

.th-footer { background: #0f172a; color: #94a3b8; padding: 3rem 1.25rem 0; }
.th-footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 2rem; padding-bottom: 2rem;
}
.th-footer strong { color: #fff; font-size: 1.1rem; }
.th-footer-tagline { margin: .3rem 0 0; font-size: .9em; }
.th-footer-links { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.th-footer-links a { color: #94a3b8; text-decoration: none; font-size: .9em; }
.th-footer-links a:hover { color: #fff; }
.th-footer-bottom {
  border-top: 1px solid #1e293b; padding: 1.2rem 0; text-align: center; font-size: .85em;
}
.th-footer-bottom a { color: #cbd5e1; }

/* ==========================================================================
   QR SCAN — pagina /tourist/scan
   ========================================================================== */
.qr-scan-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem;
  margin-bottom: 2rem;
}
@media (max-width: 720px) { .qr-scan-grid { grid-template-columns: 1fr; } }
.qr-scan-camera, .qr-scan-manual {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.6rem;
}
.qr-scan-camera h2, .qr-scan-manual h2 { margin: 0 0 1rem; font-size: 1.05rem; letter-spacing: -.01em; }
.qr-reader {
  width: 100%; min-height: 280px;
  border-radius: var(--radius); background: #0f172a;
  margin-bottom: 1rem; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: .9em;
}
.qr-reader::before { content: "Fotocamera spenta"; }
.qr-reader.active::before { content: ""; }
.qr-reader video { width: 100% !important; height: auto !important; }
.qr-status { margin-bottom: .8rem; min-height: 1.4em; }
.qr-status[data-kind="ok"] { color: var(--success); }
.qr-status[data-kind="err"] { color: var(--danger); }
.qr-alert-ok { background: #d4edda; color: #155724; }

/* ==========================================================================
   MAP — pagina /tourist/map (MapLibre + sidebar)
   ========================================================================== */
.map-shell {
  display: grid; grid-template-columns: 320px 1fr; gap: 1rem;
  margin-bottom: 2rem; height: 540px;
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-alt);
}
@media (max-width: 880px) { .map-shell { grid-template-columns: 1fr; height: auto; } }
.map-sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--bg-soft); }
.map-tabs { display: flex; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.map-tab {
  flex: 1; padding: .7rem .5rem;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--fg-muted); font: inherit; font-size: .85em; font-weight: 500;
  cursor: pointer; transition: color .12s, border-color .12s;
}
.map-tab:hover { color: var(--fg); }
.map-tab.active { color: var(--tenant-primary, #1F3A8A); border-bottom-color: var(--tenant-primary, #1F3A8A); }
.map-list { overflow-y: auto; padding: .5rem; flex: 1; }
.map-item {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem 1rem;
  margin-bottom: .5rem; cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.map-item:hover { border-color: var(--tenant-primary, #1F3A8A); transform: translateX(2px); }
.map-item h4 { margin: .3rem 0 .2rem; font-size: .98rem; letter-spacing: -.01em; }
.map-item p { margin: 0; }
.map-item-cat {
  display: inline-block; font-size: .72em;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
  color: var(--tenant-primary, #1F3A8A);
}
.map-item-event .map-item-cat { color: var(--tenant-accent, #C4661F); }
.map-canvas { min-height: 540px; }
@media (max-width: 880px) { .map-canvas { min-height: 400px; } }
.map-sponsors-list { list-style: none; padding: 0; margin: 0; }
.map-sponsors-list li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.map-sponsors-list li:last-child { border-bottom: none; }

/* ==========================================================================
   QUICK ACCESS — sezione "Accessi rapidi demo" della dashboard SuperAdmin
   ========================================================================== */
.qa-section { margin-bottom: 2.5rem; }
.qa-title { font-size: 1.4rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
.qa-lead { margin: 0 0 1.4rem; }

.qa-tenant {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--qa-primary, #1F3A8A);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.qa-tenant-head {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.qa-tenant-head h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--qa-primary, #1F3A8A);
  letter-spacing: -.01em;
}

.qa-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .55rem;
}
.qa-btn {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg);
  transition: border-color .12s, transform .12s, background .12s;
}
.qa-btn:hover {
  border-color: var(--qa-primary, #1F3A8A);
  background: rgba(31, 58, 138, .03);
  text-decoration: none;
  transform: translateY(-1px);
}
.qa-btn-tag {
  font-size: .72em;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-muted);
  font-weight: 600;
}
.qa-btn-label { font-weight: 500; font-size: .98em; }
.qa-btn-public {
  background: var(--qa-primary, #1F3A8A);
  border-color: var(--qa-primary, #1F3A8A);
  color: #fff;
}
.qa-btn-public:hover {
  filter: brightness(1.1);
  color: #fff;
  background: var(--qa-primary, #1F3A8A);
}
.qa-btn-public .qa-btn-tag { color: rgba(255, 255, 255, .8); }
.qa-btn-soft { background: var(--bg-soft); }

.qa-creds {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.qa-creds summary {
  cursor: pointer;
  font-size: .9em;
  color: var(--fg-muted);
  user-select: none;
}
.qa-creds summary:hover { color: var(--fg); }
.qa-creds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .8rem;
  margin-top: .8rem;
}
.qa-creds-grid > div {
  background: var(--bg-soft);
  padding: .7rem .9rem;
  border-radius: var(--radius);
  font-size: .85em;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.qa-creds-grid strong {
  display: block;
  margin-bottom: .25rem;
  color: var(--fg);
}
.qa-creds-grid code {
  font-size: .85em;
  word-break: break-all;
}

/* ==========================================================================
   MARKETING SITE (home pubblica /)
   ========================================================================== */

body.marketing { background: #ffffff; }

.btn-lg { padding: .85rem 1.6rem; font-size: 1.05rem; }

/* Header marketing */
.mk-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.mk-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: .9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.mk-brand-logo { height: 32px; width: auto; display: block; }
.mk-nav { display: flex; align-items: center; gap: 1.4rem; font-size: .95em; }
.mk-nav a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color .12s;
}
.mk-nav a:hover { color: var(--fg); }
.mk-nav .btn { font-size: .9em; }
@media (max-width: 720px) {
  .mk-nav a:not(.btn) { display: none; }
}

/* Hero */
.mk-hero {
  padding: 5rem 1.25rem 4rem;
  background: linear-gradient(180deg, #fafbff 0%, #ffffff 100%);
}
.mk-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 880px) {
  .mk-hero-inner { grid-template-columns: 1fr; gap: 2rem; }
}
.mk-eyebrow {
  display: inline-block;
  font-size: .78em;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 600;
  color: #1F3A8A;
  background: rgba(31, 58, 138, .08);
  padding: .35em .8em;
  border-radius: 999px;
  margin-bottom: 1.4rem;
}
.mk-h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -.025em;
  margin: 0 0 1.4rem;
  font-weight: 700;
}
.mk-h1 .accent { color: #C4661F; }
.mk-lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--fg-muted);
  margin: 0 0 2rem;
  max-width: 36em;
}
.mk-hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 2rem; }
.mk-hero-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
  font-size: .92em;
  color: var(--fg-muted);
}
.mk-hero-bullets li {
  position: relative;
  padding-left: 1.4rem;
}
.mk-hero-bullets li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: #1F3A8A;
  font-weight: 700;
}
.mk-hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}
.mk-hero-icon {
  width: 100%;
  max-width: 360px;
  height: auto;
  filter: drop-shadow(0 24px 48px rgba(31, 58, 138, .15));
}

/* Sezioni */
.mk-section { padding: 5rem 1.25rem; }
.mk-section-alt { background: #fafbff; }
.mk-h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  letter-spacing: -.02em;
  margin: 0 0 .8rem;
  font-weight: 700;
}
.mk-section-lead {
  font-size: 1.08rem;
  color: var(--fg-muted);
  max-width: 44em;
  margin: 0 0 3rem;
  line-height: 1.6;
}

/* Target grid (per chi è) */
.mk-target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}
.mk-target-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color .15s, transform .15s;
}
.mk-target-card:hover { border-color: #1F3A8A; transform: translateY(-2px); }
.mk-target-card h3 {
  font-size: 1.2rem;
  margin: 0 0 .8rem;
  color: #1F3A8A;
}
.mk-target-card p { margin: 0; color: var(--fg-muted); line-height: 1.6; }

/* Features grid */
.mk-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}
.mk-feature {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.mk-feature:hover {
  border-color: #1F3A8A;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(31, 58, 138, .08);
}
.mk-feature-icon {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  line-height: 1;
}
.mk-feature h3 {
  font-size: 1.1rem;
  margin: 0 0 .5rem;
  letter-spacing: -.01em;
}
.mk-feature p {
  margin: 0;
  color: var(--fg-muted);
  font-size: .95rem;
  line-height: 1.55;
}

/* Roles grid */
.mk-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
}
.mk-role {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border-top: 4px solid #1F3A8A;
}
.mk-role:nth-child(2) { border-top-color: #C4661F; }
.mk-role:nth-child(3) { border-top-color: #5b8c5a; }
.mk-role-tag {
  display: inline-block;
  font-size: .76em;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}
.mk-role h3 {
  font-size: 1.3rem;
  margin: 0 0 1rem;
  letter-spacing: -.01em;
}
.mk-role ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mk-role li {
  padding: .55rem 0 .55rem 1.5rem;
  position: relative;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-size: .95rem;
}
.mk-role li:last-child { border-bottom: none; }
.mk-role li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #1F3A8A;
  font-weight: 700;
}

/* Pricing */
.mk-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem;
  margin-bottom: 2rem;
}
.mk-plan {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.8rem;
  display: flex;
  flex-direction: column;
  position: relative;
}
.mk-plan-featured {
  border: 2px solid #1F3A8A;
  box-shadow: 0 18px 48px rgba(31, 58, 138, .12);
  transform: translateY(-8px);
}
.mk-plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F3A8A;
  color: #fff;
  font-size: .75em;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  padding: .35em .9em;
  border-radius: 999px;
}
.mk-plan h3 {
  font-size: 1.3rem;
  margin: 0 0 .3rem;
  color: #1F3A8A;
  letter-spacing: -.01em;
}
.mk-plan-tag {
  font-size: .85em;
  color: var(--fg-muted);
  margin: 0 0 1.4rem;
  min-height: 2.5em;
}
.mk-plan-price {
  margin: 0 0 1.4rem;
  display: flex;
  align-items: baseline;
  gap: .15rem;
}
.mk-plan-price .cur { font-size: 1.4rem; font-weight: 600; color: #1F3A8A; }
.mk-plan-price .amt { font-size: 3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.mk-plan-price .per { font-size: 1rem; color: var(--fg-muted); margin-left: .2rem; }
.mk-plan-price-custom {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1F3A8A;
}
.mk-plan ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.6rem;
  flex: 1;
}
.mk-plan li {
  padding: .5rem 0 .5rem 1.4rem;
  position: relative;
  font-size: .92rem;
  color: var(--fg);
}
.mk-plan li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #1F3A8A;
  font-weight: 700;
}
.mk-pricing-note {
  text-align: center;
  max-width: 44em;
  margin: 0 auto;
}

/* Demo section */
.mk-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 880px) { .mk-demo { grid-template-columns: 1fr; } }
.mk-demo-actions { margin: 1.6rem 0 .8rem; }
.mk-demo-cred { font-size: .85em; }
.mk-demo-fake-window {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(31, 58, 138, .15);
  border: 1px solid var(--border);
  overflow: hidden;
}
.mk-demo-fake-bar {
  background: #f3f4f6;
  padding: .6rem .9rem;
  display: flex;
  gap: .4rem;
  border-bottom: 1px solid var(--border);
}
.mk-demo-fake-bar span {
  width: 12px; height: 12px; border-radius: 50%; background: #d1d5db;
}
.mk-demo-fake-bar span:first-child { background: #fb7185; }
.mk-demo-fake-bar span:nth-child(2) { background: #fbbf24; }
.mk-demo-fake-bar span:last-child { background: #34d399; }
.mk-demo-fake-body {
  padding: 3rem 2rem;
  text-align: center;
  background: linear-gradient(180deg, #f3e9d7 0%, #ffffff 100%);
}
.mk-demo-brand {
  font-size: 1.6rem;
  font-weight: 700;
  color: #5b8c5a;
  letter-spacing: -.01em;
  margin-bottom: .4rem;
}
.mk-demo-fake-body p { color: var(--fg-muted); font-style: italic; margin: 0 0 1.6rem; }
.mk-demo-buttons { display: flex; gap: .6rem; justify-content: center; }
.mk-demo-buttons span {
  padding: .55rem 1.2rem;
  background: #5b8c5a;
  color: #fff;
  border-radius: var(--radius);
  font-size: .9em;
}
.mk-demo-buttons span:last-child {
  background: #fff;
  color: #5b8c5a;
  border: 1px solid #5b8c5a;
}

/* Final CTA strip */
.mk-cta {
  padding: 5rem 1.25rem;
  background: linear-gradient(135deg, #1F3A8A 0%, #2c4eb6 100%);
  color: #fff;
  text-align: center;
}
.mk-cta-inner h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 .8rem;
  letter-spacing: -.02em;
}
.mk-cta-inner p {
  font-size: 1.1rem;
  opacity: .9;
  margin: 0 0 2rem;
}
.mk-cta .btn-primary {
  background: #C4661F;
  color: #fff;
}
.mk-cta .btn-primary:hover { background: #a04f12; color: #fff; }

/* Footer */
.mk-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 4rem 1.25rem 0;
}
.mk-footer-inner {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 3rem;
  padding-bottom: 3rem;
}
@media (max-width: 720px) { .mk-footer-inner { grid-template-columns: 1fr; gap: 2rem; } }
.mk-footer-logo { height: 32px; filter: brightness(0) invert(1); margin-bottom: .8rem; }
.mk-footer-brand p { color: #94a3b8; }
.mk-footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.mk-footer-cols h4 {
  font-size: .82em;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #fff;
  margin: 0 0 1rem;
}
.mk-footer-cols a {
  display: block;
  color: #94a3b8;
  text-decoration: none;
  padding: .35rem 0;
  font-size: .92em;
}
.mk-footer-cols a:hover { color: #fff; }
.mk-footer-bottom {
  border-top: 1px solid #1e293b;
  padding: 1.4rem 0;
  text-align: center;
  color: #64748b;
}

/* ============================================================ */
/* TT — Tourist Tile (home cittadino, replica fedele del PHP)     */
/* ============================================================ */

.tt-discovery {
  margin: 1.8rem 0 2rem;
}
.tt-discovery-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.tt-discovery-head h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #4D4D4D;
}
.tt-filters {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.tt-filter-label {
  font-size: 0.82rem;
  color: var(--fg-muted, #64748b);
  font-weight: 600;
}
.tt-select {
  padding: 10px 14px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  background: #fcfcfc;
  outline: none;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 220px;
}
.tt-select:hover { border-color: var(--tenant-primary, #1F3A8A); }
.tt-select:focus {
  background: #fff;
  border-color: var(--tenant-primary, #1F3A8A);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 15%, transparent);
}

/* Grid responsiva — 3 colonne desktop, 2 tablet, 1 mobile */
.tt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
@media (max-width: 1100px) { .tt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .tt-grid { grid-template-columns: 1fr; gap: 16px; } }

/* CARD — replica fedele del PHP: border-radius 15px, hover shadow, no border laterale */
.tt-card {
  background: #ffffff;
  border: none;
  border-radius: 15px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.3s, transform 0.3s;
  position: relative;
}
.tt-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
}

/* Tile evento e sponsor con sfondo colorato (come PHP originale) */
.tt-card-event {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 90%, white) 0%,
    var(--tenant-primary, #1F3A8A) 100%);
  color: #ffffff;
}
.tt-card-event .tt-card-title,
.tt-card-event .tt-card-desc { color: #ffffff; }
.tt-card-event .tt-card-desc { color: rgba(255,255,255,0.92); }
.tt-card-event .tt-card-meta { color: rgba(255,255,255,0.85); }
.tt-card-event .tt-points {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.tt-card-sponsor {
  background: linear-gradient(180deg, #eaf2f8 0%, #cfe0ec 100%);
  color: #1a2a3a;
}
.tt-card-sponsor .tt-card-title { color: #0f1f2e; }
.tt-card-sponsor .tt-card-desc { color: #2c3e50; }

.tt-card-featured {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

/* COVER — 1:1 quadrata come PHP, immagine cresce su hover */
.tt-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 100%);
  overflow: hidden;
  border-radius: 15px 15px 0 0;
}
.tt-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.tt-card:hover .tt-card-cover img {
  transform: scale(1.06);
}
.tt-card-cover-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  opacity: 0.55;
}

/* RIBBONS TRIANGOLARI — replica esatta border-style trick del PHP */
.tt-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 70px 70px 0;
  z-index: 2;
  pointer-events: none;
}
.tt-ribbon-red {
  border-color: transparent #dc3545 transparent transparent;
}
.tt-ribbon-blue {
  border-color: transparent #0d6efd transparent transparent;
}
/* Etichetta del ribbon dentro al triangolo */
.tt-ribbon::after {
  content: attr(data-label);
  position: absolute;
  top: 12px;
  right: -64px;
  width: 70px;
  text-align: center;
  transform: rotate(45deg);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Categoria badge — sopra l'immagine in basso a sinistra */
.tt-cat-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
  z-index: 1;
}

/* BODY — padding generoso, tipografia ricca */
.tt-card-body {
  padding: 18px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.tt-card-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #4D4D4D;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.tt-card-desc {
  margin: 0;
  color: var(--fg-muted, #6c757d);
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}
.tt-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--fg-muted, #6c757d);
}
.tt-points {
  background: color-mix(in srgb, var(--tenant-primary, #1F3A8A) 14%, transparent);
  color: var(--tenant-primary, #1F3A8A);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
}

/* FEEDBACK BAR — bottoni 👍/👎 grandi e colorati come PHP */
.tt-fb-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.tt-fb-form {
  display: flex;
  gap: 10px;
  width: 100%;
  margin: 0;
}
.tt-fb-btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 12px;
  font-size: 1.4rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  letter-spacing: 0;
}
.tt-fb-pos {
  background: linear-gradient(135deg, #198754 0%, #157347 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(25, 135, 84, 0.40);
}
.tt-fb-neg {
  background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.40);
}
.tt-fb-pos:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(25, 135, 84, 0.55);
}
.tt-fb-neg:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(220, 53, 69, 0.55);
}
.tt-fb-given {
  margin-top: 6px;
  text-align: center;
}
.tt-fb-tag {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
}
.tt-fb-tag-pos { background: #d1f4dd; color: #0f5132; }
.tt-fb-tag-neg { background: #f8d7da; color: #842029; }

/* CARD ACTIONS — bottoni gradient uppercase come PHP originale */
.tt-card-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tt-card-actions .btn,
.tt-card-actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.82rem;
  text-decoration: none;
  border: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  background: linear-gradient(135deg,
    var(--tenant-primary, #1F3A8A) 0%,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 65%, black) 100%);
  color: #fff !important;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 35%, transparent);
}
.tt-card-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 50%, transparent);
  text-decoration: none;
}

/* CARD su sfondo colorato (event/sponsor): action bottone bianco invertito */
.tt-card-event .tt-card-actions .btn,
.tt-card-sponsor .tt-card-actions .btn {
  background: rgba(255,255,255,0.95);
  color: var(--tenant-primary, #1F3A8A) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.18);
}
.tt-card-event .tt-card-actions .btn:hover,
.tt-card-sponsor .tt-card-actions .btn:hover {
  background: #fff;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}
.tt-card-sponsor .tt-card-actions .btn {
  color: #0d6efd !important;
}

/* STAT CARD PRIMARY — gradient ricco brand */
.stat-card-primary {
  background: linear-gradient(135deg,
    var(--tenant-primary, #1F3A8A) 0%,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 70%, var(--tenant-accent, #C4661F)) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 30%, transparent);
}
.stat-card-primary .stat-label { color: rgba(255,255,255,0.88); }
.stat-card-primary .stat-value { color: #fff; }
.stat-card-primary .stat-sub { color: rgba(255,255,255,0.78); }

/* ============================================================ */
/* Business detail page (pagina pubblica esercente)              */
/* ============================================================ */

.biz-hero {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: 28px;
  margin-bottom: 1.8rem;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
@media (max-width: 800px) {
  .biz-hero { grid-template-columns: 1fr; }
}
.biz-hero-cover {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 100%);
  overflow: hidden;
}
.biz-hero-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.biz-hero-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 7rem; opacity: 0.5;
}
.biz-hero-meta {
  padding: 2rem 2rem 2rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  justify-content: center;
}
@media (max-width: 800px) {
  .biz-hero-meta { padding: 1.4rem; }
}
.btn-ghost-back {
  display: inline-block;
  width: fit-content;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--mist, #f1f5f9);
  color: var(--fg-muted, #64748b);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 0.4rem;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost-back:hover {
  background: var(--tenant-primary, #1F3A8A);
  color: #fff;
  text-decoration: none;
}
.biz-hero-cat {
  display: inline-block;
  width: fit-content;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--tenant-primary, #1F3A8A) 14%, transparent);
  color: var(--tenant-primary, #1F3A8A);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
}
.biz-hero-title {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #4D4D4D;
  line-height: 1.15;
}
.biz-hero-desc {
  margin: 0.4rem 0 0;
  color: var(--fg-muted, #6c757d);
  font-size: 1.02rem;
  line-height: 1.55;
}
.biz-hero-addr {
  margin: 0.4rem 0 0;
  color: var(--fg-muted, #6c757d);
  font-size: 0.95rem;
}

/* Vantaggi grid */
.biz-vantaggi {
  margin: 1.8rem 0;
}
.biz-vantaggi h2 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  color: #4D4D4D;
}
.biz-vantaggi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 800px) {
  .biz-vantaggi-grid { grid-template-columns: 1fr; }
}
.biz-vantaggio-card {
  background: #fff;
  border-radius: 15px;
  padding: 22px 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  text-align: center;
  border-top: 5px solid var(--tenant-primary, #1F3A8A);
  transition: transform 0.2s, box-shadow 0.2s;
}
.biz-vantaggio-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}
.biz-vantaggio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: color-mix(in srgb, var(--tenant-primary, #1F3A8A) 12%, transparent);
  border-radius: 50%;
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}
.biz-vantaggio-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #4D4D4D;
}
.biz-vantaggio-card p {
  margin: 0;
  color: var(--fg-muted, #6c757d);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Two col layout per detail card */
.biz-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 1.4rem;
}
@media (max-width: 800px) {
  .biz-twocol { grid-template-columns: 1fr; }
}
.biz-info-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.biz-info-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft, #eef0f4);
}
.biz-info-row:last-child { border-bottom: none; }
.biz-info-row dt {
  font-weight: 600;
  color: var(--fg-muted, #6c757d);
  font-size: 0.86rem;
  margin: 0;
}
.biz-info-row dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--fg, #4D4D4D);
}
.biz-info-row a {
  color: var(--tenant-primary, #1F3A8A);
  text-decoration: none;
}
.biz-info-row a:hover { text-decoration: underline; }

/* Alert success */
.alert-success {
  background: #d1f4dd;
  color: #0f5132;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 500;
  margin-bottom: 1rem;
}

/* ============================================================ */
/* Offerte esercente - vista pubblica cittadino                  */
/* ============================================================ */

.biz-offers {
  margin: 1.5rem 0;
}
.biz-offers h2 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  color: #4D4D4D;
  font-weight: 700;
}
.biz-offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.biz-offer-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 8%, white) 0%,
    color-mix(in srgb, var(--tenant-accent, #C4661F) 8%, white) 100%);
  border: none;
  border-left: 5px solid var(--tenant-accent, #C4661F);
  border-radius: 14px;
  align-items: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s, box-shadow 0.18s;
}
.biz-offer-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}
.biz-offer-value {
  background: var(--tenant-accent, #C4661F);
  color: #fff;
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--tenant-accent, #C4661F) 35%, transparent);
}
.biz-offer-num {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: block;
  line-height: 1.1;
  word-break: break-word;
}
.biz-offer-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.biz-offer-body h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: #4D4D4D;
}
.biz-offer-body p {
  margin: 0;
  color: var(--fg-muted, #6c757d);
  font-size: 0.86rem;
  line-height: 1.45;
}
.biz-offer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.78rem;
}

/* ============================================================ */
/* Mini-bars (grafico mensile dashboard esercente/admin)         */
/* ============================================================ */
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 160px;
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--line, #e2e8f0);
  margin-top: 0.5rem;
}
.mini-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.mini-bar {
  width: 100%;
  max-width: 48px;
  min-height: 4px;
  background: linear-gradient(180deg,
    var(--tenant-primary, #1F3A8A) 0%,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 70%, var(--tenant-accent, #C4661F)) 100%);
  border-radius: 6px 6px 2px 2px;
  transition: filter 0.15s, transform 0.15s;
  cursor: help;
}
.mini-bar:hover { filter: brightness(1.1); transform: scaleY(1.04); }
.mini-bar-label {
  font-size: 0.72rem;
  color: var(--fg-muted, #64748b);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.mini-bar-value {
  font-size: 0.74rem;
  color: var(--fg, #0f172a);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ============================================================ */
/* Quick actions (dashboard esercente)                            */
/* ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 1.4rem 0;
}
.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  text-decoration: none;
  color: var(--fg, #0f172a);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, background 0.15s;
}
.quick-action:hover {
  border-color: var(--tenant-primary, #1F3A8A);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 14%, transparent);
  transform: translateY(-2px);
  text-decoration: none;
}
.qa-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--tenant-primary, #1F3A8A) 10%, transparent);
  border-radius: 10px;
  flex-shrink: 0;
}
.qa-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.qa-text strong {
  font-size: 0.95rem;
  color: var(--fg, #0f172a);
  letter-spacing: -0.01em;
}
.qa-text small {
  font-size: 0.78rem;
  color: var(--fg-muted, #64748b);
}

/* ============================================================ */
/* Dashboard manager — 2 colonne, ranking, feedback, activity     */
/* ============================================================ */
.dashboard-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 900px) {
  .dashboard-2col { grid-template-columns: 1fr; }
}

.page-header-actions {
  display: flex;
  gap: 8px;
}

.stat-card-warn {
  background: #fff7ed;
  border-color: #fdba74;
}
.stat-card-warn .stat-value { color: #c2410c; }

/* Ranked list (top businesses) */
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.rank-item:hover { background: var(--mist, #f5f7fa); }
.rank-num {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--tenant-primary, #1F3A8A) 12%, transparent);
  color: var(--tenant-primary, #1F3A8A);
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.rank-name {
  flex: 1;
  font-weight: 600;
  color: var(--fg, #0f172a);
  text-decoration: none;
  font-size: 0.92rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-name:hover { color: var(--tenant-primary, #1F3A8A); }
.rank-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--fg-muted, #64748b);
  font-size: 0.86rem;
}

/* Event list mini */
.event-list-mini {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event-list-item {
  padding: 8px 10px;
  border-left: 3px solid var(--tenant-primary, #1F3A8A);
  background: var(--mist, #f5f7fa);
  border-radius: 4px 8px 8px 4px;
}

/* Feedback overview */
.feedback-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 0.8rem;
}
.fb-overview-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
}
.fb-overview-stat.fb-pos { background: #ecfdf5; }
.fb-overview-stat.fb-neg { background: #fef2f2; }
.fb-overview-stat .fb-icon { font-size: 1.6rem; }
.fb-overview-stat .fb-count {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.fb-pos .fb-count { color: #15803d; }
.fb-neg .fb-count { color: #b91c1c; }
.fb-overview-stat .fb-label {
  font-size: 0.74rem;
  color: var(--fg-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.fb-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line-soft, #eef0f4);
}
.fb-bar-pos { background: linear-gradient(90deg, #22c55e, #16a34a); }
.fb-bar-neg { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* Activity stream */
.activity-stream {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.activity-item {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft, #eef0f4);
  font-size: 0.86rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { white-space: nowrap; }
.activity-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
  min-width: 50px;
}
.activity-reason {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================ */
/* Storico cittadino — mini-bars per sorgente (orizzontali)       */
/* ============================================================ */
.mini-bars .mini-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}
.mini-bars .mini-bar-row .mini-bar-label {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg, #0f172a);
}
.mini-bars .mini-bar-track {
  height: 10px;
  background: var(--line-soft, #eef0f4);
  border-radius: 999px;
  overflow: hidden;
}
.mini-bars .mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,
    var(--tenant-primary, #1F3A8A),
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 60%, var(--tenant-accent, #C4661F)));
  border-radius: 999px;
}
.mini-bars .mini-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--tenant-primary, #1F3A8A);
}
/* Overrride flex height per mini-bars usate in modalità righe (storico cittadino) */
.detail-card .mini-bars:has(.mini-bar-row) {
  display: block;
  height: auto;
  border-bottom: none;
  padding-top: 0.6rem;
}

/* ============================================================ */
/* Marker mappa Agorvy (Leaflet) — pin pieno con anello           */
/* ============================================================ */
.agorvy-pin {
  background: transparent !important;
  border: none !important;
}
.agorvy-pin-inner {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
  margin: 2px;
  transition: transform 0.15s;
}
.agorvy-pin:hover .agorvy-pin-inner { transform: scale(1.18); }
.agorvy-pin-event .agorvy-pin-inner { border-radius: 4px; }

/* Map item action link */
.map-item-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--tenant-primary, #1F3A8A);
  text-decoration: none;
}
.map-item-link:hover { text-decoration: underline; }

/* ============================================================ */
/* Stat card footer (note sotto valore principale)                */
/* ============================================================ */
.stat-card .stat-foot {
  display: block;
  margin-top: 6px;
  font-size: 0.74rem;
}

/* ============================================================ */
/* Sponsor banner rotation (cittadino home + mappa)               */
/* ============================================================ */
.sponsor-banner-rot {
  position: relative;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  margin: 1.4rem 0;
  box-shadow: 0 2px 12px rgba(15,23,42,.06);
  border: 1px solid var(--line, #e2e8f0);
}
.sponsor-banner-label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--fg-muted, #64748b);
  font-weight: 700;
  padding: 8px 14px 0;
}
.sponsor-banner-track {
  position: relative;
  aspect-ratio: 4.5 / 1;
  min-height: 90px;
}
.sponsor-banner-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .5s;
  pointer-events: none;
  text-decoration: none;
}
.sponsor-banner-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}
.sponsor-banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  background: #fff;
}
.sponsor-banner-placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 10%, transparent),
    color-mix(in srgb, var(--tenant-accent, #C4661F) 10%, transparent));
  padding: 1.4rem;
  text-align: center;
  color: var(--fg, #0f172a);
}
.sponsor-banner-placeholder strong { font-size: 1.3rem; }
.sponsor-banner-dots {
  position: absolute;
  bottom: 8px; left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}
.sponsor-banner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(15,23,42,.25);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.sponsor-banner-dot:hover { background: rgba(15,23,42,.5); }
.sponsor-banner-dot.is-active {
  background: var(--tenant-primary, #1F3A8A);
  transform: scale(1.25);
}

/* ============================================================ */
/* Business gallery slider (scheda cittadino)                     */
/* ============================================================ */
.biz-slider {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  margin-bottom: 1.4rem;
  aspect-ratio: 16 / 9;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}
.biz-slider-track {
  display: flex;
  height: 100%;
  transition: transform .45s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.biz-slide {
  flex: 0 0 100%;
  margin: 0;
  position: relative;
  overflow: hidden;
}
.biz-slide img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.biz-slide figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.75) 0%, rgba(0,0,0,0) 100%);
  color: #fff;
  padding: 2.4rem 1.2rem 1rem;
  font-size: .95rem;
  font-weight: 500;
}
.biz-slider-arrow {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  background: rgba(15,23,42,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
  z-index: 2;
}
.biz-slider-arrow:hover { background: rgba(15,23,42,.8); transform: translateY(-50%) scale(1.08); }
.biz-slider-prev { left: 12px; }
.biz-slider-next { right: 12px; }
.biz-slider-dots {
  position: absolute;
  left: 0; right: 0; bottom: 14px;
  display: flex; justify-content: center; gap: 8px;
  z-index: 2;
}
.biz-slider-dot {
  width: 10px; height: 10px;
  background: rgba(255,255,255,.45);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.biz-slider-dot:hover { background: rgba(255,255,255,.7); }
.biz-slider-dot.is-active { background: #fff; transform: scale(1.25); }

/* ============================================================ */
/* Logo Agorvy — footer, header, login                            */
/* ============================================================ */
.agorvy-footer {
  background: #fafbfc;
  border-top: 1px solid var(--line-soft, #eef0f4);
  padding: 1rem 0;
  margin-top: 2rem;
}
.agorvy-footer-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.agorvy-footer-brand { display: inline-flex; align-items: center; text-decoration: none; }
.agorvy-footer-logo { height: 28px; width: auto; display: block; }
.agorvy-footer-text {
  font-size: .86rem;
  color: var(--fg-muted, #64748b);
  text-align: right;
}
.agorvy-footer-text a { color: var(--fg, #0f172a); text-decoration: none; }
.agorvy-footer-text a:hover { text-decoration: underline; }

/* Header brand logo (cittadino / esercente / manager) */
.mng-brand-logo {
  height: 28px;
  width: auto;
  border-radius: 4px;
  flex-shrink: 0;
  margin-right: 8px;
}

/* SuperAdmin header icona */
.sa-brand-logo {
  height: 28px;
  width: auto;
  margin-right: 8px;
  vertical-align: middle;
}

/* Login: logo dell'ente */
.mng-login-logo {
  display: block;
  max-height: 64px;
  max-width: 180px;
  margin: 0 auto .8rem;
}
.login-agorvy-logo {
  display: block;
  max-height: 56px;
  width: auto;
  margin: 0 auto .6rem;
}
.login-foot {
  text-align: center;
  margin-top: 1rem;
  padding: 0 1rem;
}

/* ============================================================ */
/* SuperAdmin boost — KPI grid, tenant cards, plans, system       */
/* ============================================================ */

/* KPI grid hero (4 card grandi con icona + valore + label + foot) */
.sa-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 1.4rem;
}
.sa-kpi-grid-hero {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 1rem;
}
.sa-kpi-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.2rem 1.3rem;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border-top: 5px solid var(--tenant-primary, #1F3A8A);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transition: transform .18s, box-shadow .18s;
}
.sa-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 14%, transparent);
}
.sa-kpi-card-primary {
  background: linear-gradient(135deg, var(--tenant-primary, #1F3A8A) 0%, color-mix(in srgb, var(--tenant-primary, #1F3A8A) 60%, var(--tenant-accent, #C4661F)) 100%);
  color: #fff;
  border-top-color: rgba(255,255,255,.35);
}
.sa-kpi-card-primary .sa-kpi-label,
.sa-kpi-card-primary .sa-kpi-foot { color: rgba(255,255,255,.92); }
.sa-kpi-card-primary .sa-kpi-value { color: #fff; }
.sa-kpi-icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.sa-kpi-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.sa-kpi-label {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--fg-muted, #64748b);
}
.sa-kpi-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--fg, #0f172a);
  font-variant-numeric: tabular-nums;
}
.sa-kpi-foot {
  font-size: .78rem;
  color: var(--fg-muted, #64748b);
  margin-top: 2px;
}

/* KPI mini (compact card per row 2 della dashboard) */
.sa-kpi-card-mini {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line, #e2e8f0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  align-items: flex-start;
}
.sa-kpi-mini-icon { font-size: 1.4rem; line-height: 1; }
.sa-kpi-mini-val {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg, #0f172a);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.sa-kpi-mini-lbl { font-size: .78rem; color: var(--fg-muted, #64748b); }

/* Pie/breakdown bar (orizzontale a 3 segmenti) */
.sa-pie {
  display: flex;
  height: 28px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--line-soft, #eef0f4);
  margin-bottom: 1rem;
}
.sa-pie-segment { height: 100%; }
.sa-pie-segment.sa-pie-active { background: #22c55e; }
.sa-pie-segment.sa-pie-prov { background: #f59e0b; }
.sa-pie-segment.sa-pie-susp { background: #ef4444; }
.sa-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: .9rem;
}
.sa-pie-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}
.sa-pie-dot.sa-pie-active { background: #22c55e; }
.sa-pie-dot.sa-pie-prov { background: #f59e0b; }
.sa-pie-dot.sa-pie-susp { background: #ef4444; }

/* Trial list */
.sa-trial-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sa-trial-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft, #eef0f4);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .92rem;
}
.sa-trial-list li:last-child { border-bottom: none; }

/* Audit list compact */
.sa-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sa-audit-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft, #eef0f4);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: .88rem;
}
.sa-audit-list li:last-child { border-bottom: none; }
.sa-audit-time { white-space: nowrap; min-width: 100px; }
.sa-audit-by { font-weight: 600; min-width: 140px; }
.sa-audit-action {
  background: var(--line-soft, #eef0f4);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .82rem;
}

/* Grid a 2 colonne per sezioni affiancate */
.sa-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin: 0 0 1.4rem;
}

/* Tenant card grid (lista enti) */
.sa-tenant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin: 1rem 0;
}
.sa-tenant-card {
  background: #fff;
  border-radius: 14px;
  padding: 1rem 1.2rem 1.2rem;
  border: 1px solid var(--line, #e2e8f0);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: transform .18s, box-shadow .18s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sa-tenant-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--ten-primary, #1F3A8A) 16%, transparent);
}
.sa-tenant-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.sa-tenant-card-color {
  width: 6px;
  align-self: stretch;
  background: var(--ten-primary, #1F3A8A);
  border-radius: 3px;
}
.sa-tenant-card-name { flex: 1; min-width: 0; }
.sa-tenant-card-name h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.sa-tenant-card-kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: .9rem;
}
.sa-tenant-card-kpi div { display: flex; gap: 4px; align-items: center; }
.sa-tenant-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft, #eef0f4);
}
.sa-tenant-card-actions { display: flex; gap: 4px; }

/* Tenant hero (detail) */
.sa-tenant-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.4rem;
  padding: 0;
  isolation: isolate;
}
.sa-tenant-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--ten-primary, #1F3A8A) 0%, var(--ten-accent, #C4661F) 100%);
  opacity: 0.92;
  z-index: -1;
}
.sa-tenant-hero-content {
  padding: 2rem 2.2rem;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.sa-tenant-hero-tag {
  display: inline-block;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  background: rgba(255,255,255,.18);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: .6rem;
}
.sa-tenant-hero-content h1 {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.sa-tenant-hero-sub {
  margin: .4rem 0 0;
  font-size: 1.05rem;
  opacity: 0.92;
}
.sa-tenant-hero-meta {
  margin: .8rem 0 0;
  font-size: .9rem;
  opacity: 0.92;
}
.sa-tenant-hero-meta code {
  background: rgba(255,255,255,.18);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
}
.sa-tenant-hero-meta .badge { background: rgba(255,255,255,.22); color: #fff; }
.sa-tenant-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sa-tenant-hero-actions .btn { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.3); }
.sa-tenant-hero-actions .btn:hover { background: rgba(255,255,255,.28); }
.sa-tenant-hero-actions .btn-primary { background: #fff; color: var(--ten-primary, #1F3A8A); }
.sa-tenant-hero-actions .btn-primary:hover { background: #f1f5f9; }

/* Usage vs limits bars */
.sa-usage-list { display: flex; flex-direction: column; gap: 10px; margin-top: .6rem; }
.sa-usage-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  gap: 10px;
  align-items: center;
  font-size: .9rem;
}
.sa-usage-label { display: flex; flex-direction: column; gap: 2px; }
.sa-usage-bar {
  height: 12px;
  background: var(--line-soft, #eef0f4);
  border-radius: 999px;
  overflow: hidden;
}
.sa-usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 999px;
  transition: width .3s;
}
.sa-usage-warn .sa-usage-bar-fill { background: linear-gradient(90deg, #f59e0b, #d97706); }
.sa-usage-danger .sa-usage-bar-fill { background: linear-gradient(90deg, #ef4444, #dc2626); }
.sa-usage-unlimited {
  background: linear-gradient(90deg,
    var(--line-soft, #eef0f4) 0%, var(--line-soft, #eef0f4) 50%,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 20%, transparent) 50%,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 20%, transparent) 100%);
  background-size: 12px 12px;
}
.sa-usage-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: .88rem;
}

/* Plans grid */
.sa-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin: 1rem 0;
}
.sa-plan-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.3rem;
  border: 1px solid var(--line, #e2e8f0);
  border-top: 5px solid var(--tenant-primary, #1F3A8A);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform .18s, box-shadow .18s;
}
.sa-plan-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--tenant-primary, #1F3A8A) 14%, transparent);
}
.sa-plan-card-inactive { opacity: .65; border-top-color: var(--line, #cbd5e1); }
.sa-plan-card-internal { border-top-color: #8b5cf6; }
.sa-plan-card-head h3 { margin: 0 0 .2rem; font-size: 1.2rem; font-weight: 800; color: var(--fg, #0f172a); }
.sa-plan-card-badges { margin-top: .6rem; display: flex; gap: 4px; flex-wrap: wrap; }
.sa-plan-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 10px 12px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--tenant-primary, #1F3A8A) 8%, transparent) 0%,
    color-mix(in srgb, var(--tenant-accent, #C4661F) 8%, transparent) 100%);
  border-radius: 10px;
}
.sa-plan-price-currency { font-size: 1.1rem; color: var(--fg-muted, #64748b); font-weight: 600; }
.sa-plan-price-amount {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg, #0f172a);
  font-variant-numeric: tabular-nums;
}
.sa-plan-price-period { font-size: .9rem; color: var(--fg-muted, #64748b); }
.sa-plan-desc { font-size: .9rem; color: var(--fg-muted, #6c757d); margin: 0; line-height: 1.45; }
.sa-plan-section-title {
  display: block;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted, #64748b);
  margin-bottom: 6px;
}
.sa-plan-feature-list,
.sa-plan-limit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .88rem;
}
.sa-plan-feature-list li, .sa-plan-limit-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sa-plan-limit-list li { justify-content: space-between; }
.sa-plan-check { color: #22c55e; font-weight: 700; }
.sa-plan-x { color: #ef4444; }
.sa-plan-stats {
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft, #eef0f4);
  border-bottom: 1px solid var(--line-soft, #eef0f4);
}
.sa-plan-stat { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.sa-plan-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--fg, #0f172a);
  line-height: 1;
}
.sa-plan-hf { padding: 6px 8px; background: #f8fafc; border-radius: 6px; font-size: .82rem; }
.sa-plan-card-foot {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

/* Table counts grid (system page) */
.sa-table-counts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: .8rem;
}
.sa-table-count {
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 3px solid var(--tenant-primary, #1F3A8A);
}
.sa-table-count-empty { opacity: .55; border-left-color: var(--line, #cbd5e1); }
.sa-table-count-error { border-left-color: #ef4444; }
.sa-table-count-num {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--fg, #0f172a);
  line-height: 1.1;
}

/* ============================================================ */
/* Payment methods grid (esercente: lista metodi di pagamento)    */
/* ============================================================ */
.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 0.8rem;
}
.payment-mini-card {
  background: #f8fafc;
  border: 1px solid var(--line-soft, #eef0f4);
  border-left: 4px solid var(--tenant-primary, #1F3A8A);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.payment-mini-head {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--fg, #0f172a);
  margin-bottom: 6px;
}
.payment-mini-card code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.84rem;
  border: 1px solid var(--line-soft, #eef0f4);
}
