/* ============================================================
   Traqr — Design System ispirato a Stripe
   Palette: #0A2540 navy, #635BFF indigo, #F6F9FC bg
   ============================================================ */

/* ---- Variables ---- */
:root {
  --stripe-navy:    #0A2540;
  --stripe-navy-2:  #122D4E;
  --stripe-purple:  #635BFF;
  --stripe-purple-h:#4F46E5;
  --stripe-bg:      #F6F9FC;
  --stripe-border:  #E3E8EE;
  --stripe-shadow:  0 2px 5px 0 rgba(60,66,87,.08), 0 0 0 1px rgba(60,66,87,.08);
  --stripe-shadow-lg: 0 6px 15px 0 rgba(60,66,87,.12), 0 0 0 1px rgba(60,66,87,.08);

  --text-primary:   #1A1F36;
  --text-secondary: #697386;
  --text-muted:     #8792A2;
  --text-white:     #FFFFFF;

  --success-bg:   #CBEDDA; --success-fg:   #0B7A43;
  --warning-bg:   #FCEFC7; --warning-fg:   #8C5E00;
  --danger-bg:    #FDE8EE; --danger-fg:    #A41C4E;
  --info-bg:      #D7E9FA; --info-fg:      #0D4A8A;

  --sidebar-w:    200px;
  --topbar-h:     60px;
  --radius-sm:    4px;
  --radius:       6px;
  --radius-lg:    10px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--text-primary); background: var(--stripe-bg); line-height: 1.5; }
a { color: var(--stripe-purple); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--stripe-shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--stripe-border);
  margin-bottom: 0;
}

.card-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.card-header h2 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.card > h2, .card > h3 { padding: 1.25rem 1.5rem 0; font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

.form-card { padding: 1.5rem; }
.form-card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; padding: 0; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.02em;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }

.stats-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--stripe-shadow);
  padding: 1.25rem 1.5rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.03em;
  line-height: 1.2;
}

.stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .3rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.4;
  transition: background .15s, box-shadow .15s, border-color .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--stripe-purple);
  color: #fff;
  border-color: var(--stripe-purple);
}
.btn-primary:hover { background: var(--stripe-purple-h); border-color: var(--stripe-purple-h); color: #fff; }

.btn-ghost {
  background: #fff;
  color: var(--text-secondary);
  border-color: var(--stripe-border);
}
.btn-ghost:hover { background: var(--stripe-bg); color: var(--text-primary); border-color: #C8D0DC; }

.btn-danger {
  background: #DF1B41;
  color: #fff;
  border-color: #DF1B41;
}
.btn-danger:hover { background: #B80E2F; border-color: #B80E2F; color: #fff; }

.btn-upgrade {
  background: linear-gradient(135deg, #635BFF, #8B5CF6);
  color: #fff;
  border: none;
}
.btn-upgrade:hover { background: linear-gradient(135deg, #4F46E5, #7C3AED); color: #fff; }

.btn-sm {
  padding: .3rem .7rem;
  font-size: .8rem;
}

.btn-lg {
  padding: .7rem 1.5rem;
  font-size: .95rem;
}

.btn-full { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; cursor: pointer; color: var(--stripe-purple); padding: 0; font-size: inherit; font-family: inherit; }

/* ============================================================
   OTP INPUT
   ============================================================ */
.otp-inputs {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin: 1.5rem 0 .75rem;
}
.otp-digit {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 1.5px solid var(--stripe-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}
.otp-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.otp-timer {
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.otp-resend {
  text-align: center;
  margin-top: 1rem;
  font-size: .875rem;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem; }
.required { color: #DF1B41; }

/* Password visibility toggle */
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input[type=password],
.pw-wrap input[type=text] {
  padding-right: 2.5rem;
}
.pw-toggle {
  position: absolute;
  right: .55rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  line-height: 1;
  transition: color .15s;
}
.pw-toggle:hover,
.pw-toggle--on { color: var(--primary); }

input[type=text],
input[type=email],
input[type=tel],
input[type=password],
input[type=url],
input[type=number],
input[type=search],
input[type=date],
input[type=datetime-local],
textarea,
select {
  width: 100%;
  padding: .5rem 2.25rem .5rem .75rem;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right .75rem center;
  background-size: 12px;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--stripe-purple);
  box-shadow: 0 0 0 3px rgba(99,91,255,.15);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

.input-lg { font-size: .95rem; padding: .6rem .875rem; }
.input-search { width: auto; min-width: 220px; }
.static-value { display: inline-block; background: var(--stripe-bg); border: 1px solid var(--stripe-border); border-radius: var(--radius-sm); padding: .4rem .75rem; font-family: monospace; font-size: .875rem; color: var(--text-secondary); }
.form-help { display: block; font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.25rem; }

.form-check-group { display: flex; align-items: center; gap: .5rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--text-secondary); cursor: pointer; font-weight: 400; }
.checkbox-label input[type=checkbox] { width: auto; cursor: pointer; }

select.select-sm { width: auto; padding: .3rem 2rem .3rem .6rem; font-size: .8rem; }
select.select-full { width: 100%; }

.input-prefix-group { display: flex; align-items: center; }
.input-prefix { background: var(--stripe-bg); border: 1px solid var(--stripe-border); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: .5rem .75rem; font-size: .875rem; color: var(--text-muted); white-space: nowrap; }
.input-prefix-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* UTM preview */
.utm-preview-wrap {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  background: var(--stripe-bg);
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius-sm);
  padding: .6rem .875rem;
  margin-bottom: 1rem;
}
.utm-preview-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.utm-preview-url { font-size: .75rem; color: var(--text-secondary); word-break: break-all; }

/* Form section divider */
.form-section-divider {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-top: 1px solid var(--stripe-border);
  padding-top: 1.25rem;
  margin-top: .25rem;
  margin-bottom: .75rem;
}

/* UTM grid 2 colonne */
.utm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

/* Label hint inline (es. "utm_source") */
.form-hint-inline {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'SFMono-Regular', Consolas, monospace;
  margin-left: .25rem;
}

@media (max-width: 580px) {
  .utm-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: .6rem 1rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--stripe-border);
  background: #fff;
  white-space: nowrap;
}

.table td {
  padding: .8rem 1rem;
  font-size: .875rem;
  border-bottom: 1px solid #F0F3F7;
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #FAFBFC; }
.table tbody tr.row-inactive { opacity: .6; }

/* Compact table for analytics */
.table-compact { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table-compact th { padding: .4rem .5rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--stripe-border); }
.table-compact td { padding: .5rem .5rem; border-bottom: 1px solid #F0F3F7; color: var(--text-primary); }
.table-compact tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge-active   { background: var(--success-bg); color: var(--success-fg); }
.badge-inactive { background: var(--stripe-bg);  color: var(--text-muted); border: 1px solid var(--stripe-border); }
.badge-expired  { background: var(--danger-bg);  color: var(--danger-fg); }
.badge-warning  { background: var(--warning-bg); color: var(--warning-fg); }
.badge-pro      { background: rgba(99,91,255,.12); color: var(--stripe-purple); }
.badge-pending  { background: var(--warning-bg); color: var(--warning-fg); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; gap: .3rem; justify-content: center; margin-top: 1.5rem; }
.page-link { padding: .35rem .7rem; border-radius: var(--radius-sm); font-size: .8rem; border: 1px solid var(--stripe-border); color: var(--text-secondary); background: #fff; text-decoration: none; }
.page-link.active { background: var(--stripe-purple); color: #fff; border-color: var(--stripe-purple); }
.page-link:hover:not(.active) { background: var(--stripe-bg); color: var(--text-primary); text-decoration: none; }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  background: #fff;
  padding: .875rem 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--stripe-shadow);
}

/* ── Barra di ricerca link (semplice, compare solo con ≥20 link) ── */
.link-search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.link-search-bar input[type="search"] {
  flex: 1;
  padding: .6rem 1rem;
  border: 1.5px solid var(--stripe-border);
  border-radius: var(--radius);
  font-size: .9rem;
  background: #fff;
  outline: none;
  transition: border-color .15s;
  min-width: 0;
  width: 100%;
}
.link-search-bar input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

/* ============================================================
   LINK LIST
   ============================================================ */
.link-slug-cell { display: flex; flex-direction: column; gap: .15rem; }
.short-url { color: var(--stripe-purple); font-weight: 600; font-size: .875rem; }
.short-url:hover { text-decoration: underline; }
.link-title { font-size: .75rem; color: var(--text-muted); }
.folder-tag { display: inline-flex; align-items: center; padding: .1rem .45rem; background: #EEF2FF; color: #4338CA; border-radius: 3px; font-size: .7rem; font-weight: 600; }

.btn-copy {
  background: none;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .75rem;
  padding: .15rem .4rem;
  color: var(--text-muted);
  line-height: 1;
  transition: all .15s;
}
.btn-copy:hover { background: var(--stripe-bg); color: var(--text-primary); }

.actions-cell { white-space: nowrap; display: flex; gap: .4rem; align-items: center; }

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .65rem;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--stripe-border);
  background: #fff;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background .13s, color .13s, border-color .13s;
  white-space: nowrap;
  line-height: 1;
}
.btn-action svg { flex-shrink: 0; }
.btn-action:hover { background: var(--stripe-bg); color: var(--text-primary); border-color: #c8d0da; text-decoration: none; }

.btn-action-copy.btn-action-copied {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
}

/* ============================================================
   BULK ACTIONS
   ============================================================ */
.bulk-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  margin-bottom: .75rem;
  font-size: .875rem;
  color: #4338CA;
}

/* ============================================================
   ADVANCED SECTION (details/summary)
   ============================================================ */
.advanced-section {
  margin-top: 1rem;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
}
.advanced-section summary {
  padding: .65rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .8rem;
  color: var(--text-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.advanced-section summary::before { content: '›'; font-size: 1rem; transition: transform .2s; }
.advanced-section[open] summary::before { transform: rotate(90deg); }
.advanced-section > *:not(summary) { padding: 1rem; border-top: 1px solid var(--stripe-border); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 3rem 2rem; }
.empty-state p { color: var(--text-muted); font-size: .9rem; }
.empty-state a { color: var(--stripe-purple); }

/* ============================================================
   HOME / LANDING
   ============================================================ */
.hero { text-align: center; padding: 3rem 1rem 2rem; }
.hero h1 { font-size: 2.5rem; font-weight: 800; color: var(--text-primary); letter-spacing: -.04em; line-height: 1.15; margin-bottom: .75rem; }
.hero p { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 2rem; }

.hero-box { max-width: 600px; margin: 0 auto; }
.anon-link-form { display: flex; gap: .75rem; }
.anon-link-form input { flex: 1; }

.anon-result { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; background: var(--stripe-bg); border: 1px solid var(--stripe-border); border-radius: var(--radius); padding: .75rem 1rem; font-size: .9rem; flex-wrap: wrap; }
.anon-result a { font-weight: 700; color: var(--stripe-purple); }

.features-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin: 2rem auto; max-width: 1000px; padding: 0 1rem; }
.feature-item { text-align: center; }
.feature-icon { font-size: 2rem; margin-bottom: .5rem; }
.feature-item h3 { font-size: .95rem; font-weight: 700; margin-bottom: .35rem; }
.feature-item p { font-size: .85rem; color: var(--text-secondary); }

.cta-center { display: flex; justify-content: center; gap: 1rem; margin: 2rem 0; padding: 0 1rem; }
.form-error { background: var(--danger-bg); color: var(--danger-fg); padding: .5rem .75rem; border-radius: var(--radius-sm); font-size: .8rem; border: 1px solid #F7B4C7; margin-top: .4rem; }

/* ============================================================
   PRICING
   ============================================================ */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; max-width: 900px; margin: 2rem auto; }
.pricing-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--stripe-shadow); padding: 2rem; position: relative; }
.pricing-card-highlight { box-shadow: var(--stripe-shadow-lg); border: 2px solid var(--stripe-purple); }
.pricing-badge { display: inline-block; background: var(--stripe-purple); color: #fff; font-size: .7rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; margin-bottom: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.pricing-badge-green { background: var(--success-fg); }
.price { font-size: 2.5rem; font-weight: 800; margin: .75rem 0; letter-spacing: -.04em; }
.price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.price-sub { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; }
.features-list { list-style: none; margin: 1.25rem 0; display: flex; flex-direction: column; gap: .4rem; }
.features-list li { font-size: .875rem; color: var(--text-secondary); }

.faq-section { max-width: 650px; margin: 2rem auto; padding: 0 1rem 2rem; }
.faq-section h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }
.faq-item { margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--stripe-border); }
.faq-item:last-child { border-bottom: none; }
.faq-item strong { display: block; margin-bottom: .4rem; font-size: .9rem; }
.faq-item p { font-size: .875rem; color: var(--text-secondary); }

/* ============================================================
   UPGRADE CARD
   ============================================================ */
.upgrade-card {
  background: linear-gradient(135deg, var(--stripe-navy) 0%, var(--stripe-navy-2) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.upgrade-card p { font-size: .875rem; opacity: .8; margin-top: .25rem; }

/* ============================================================
   ALERT
   ============================================================ */
.alert { padding: .875rem 1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1rem; }
.alert-info    { background: var(--info-bg);    color: var(--info-fg);    border: 1px solid #93C5FD; }
.alert-warning { background: var(--warning-bg); color: var(--warning-fg); border: 1px solid #FCD34D; }
.alert-success { background: var(--success-bg); color: var(--success-fg); border: 1px solid #6EE7B7; }
.alert-error   { background: var(--danger-bg);  color: var(--danger-fg);  border: 1px solid #FCA5A5; }
.form-error-list { margin: 0; padding: 0; list-style: none; }
.form-error-list li + li { margin-top: .2rem; }

/* ============================================================
   TOKEN DISPLAY
   ============================================================ */
.token-display { font-family: monospace; font-size: .85rem; word-break: break-all; }

/* ============================================================
   TRUNCATE / UTILITY
   ============================================================ */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--danger-fg); }
.link-header-meta { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; }

/* ============================================================
   PHONE INPUT WIDGET
   ============================================================ */
.phone-input-wrap { display: flex; gap: .5rem; align-items: stretch; width: 100%; }
.phone-prefix-select {
  flex: 0 0 auto;
  width: 100px;
  min-width: 0;
  padding: .5rem .4rem;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  background: #fff;
  color: var(--text-primary);
  cursor: pointer;
}
.phone-prefix-select:focus {
  outline: none;
  border-color: var(--stripe-purple);
  box-shadow: 0 0 0 3px rgba(99,91,255,.1);
}
.phone-input-wrap [data-phone-number] { flex: 1; min-width: 0; }

/* ============================================================
   FIELD VALIDATION — stati inline
   ============================================================ */
.field-error-js {
  display: block;
  color: #ef4444;
  font-size: .78rem;
  margin-top: .2rem;
}
.js-valid {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34,197,94,.08) !important;
}

/* ============================================================
   FORM HINT (testo di aiuto sotto il campo)
   ============================================================ */
.form-hint {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* ============================================================
   HONEYPOT — non visibile ad utenti umani
   ============================================================ */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  overflow: hidden;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   BILLING — plans grid
   ============================================================ */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 980px;
  margin: 0 auto 2rem;
}

.plan-card {
  background: #fff;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
  box-shadow: var(--stripe-shadow);
  display: flex;
  flex-direction: column;
}

.plan-card.highlighted {
  border: 2px solid var(--stripe-purple);
  box-shadow: 0 0 0 4px rgba(99,91,255,.08), var(--stripe-shadow-lg);
}

.plan-card .plan-badge {
  display: inline-block;
  background: var(--stripe-purple);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}

.plan-header { margin-bottom: 1.25rem; }
.plan-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-bottom: .25rem; }
.plan-header p { font-size: .875rem; color: var(--text-secondary); margin: 0; }

.plan-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: .5rem 0;
  line-height: 1;
}
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--text-secondary); }
.plan-price small { display: block; font-size: .8rem; font-weight: 400; color: var(--text-muted); margin-top: .25rem; }

.plan-features {
  list-style: none;
  padding: 1rem 0 0;
  margin: 0 0 1.5rem;
  flex: 1;
  border-top: 1px solid var(--stripe-border);
}
.plan-features li { padding: .3rem 0; font-size: .875rem; color: var(--text-primary); }
.plan-features li.disabled { color: var(--text-muted); }

.btn-current {
  display: block;
  width: 100%;
  text-align: center;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  background: var(--stripe-bg);
  color: var(--text-secondary);
  border: 1px solid var(--stripe-border);
  cursor: default;
}

/* ============================================================
   PUBLIC LAYOUT — header, footer, landing
   ============================================================ */
.pub-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Header ---- */
.pub-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stripe-border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
}
.pub-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.pub-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--stripe-navy);
  text-decoration: none;
  letter-spacing: -.025em;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.pub-logo-icon {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--stripe-purple), #4F46E5);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: #fff;
  font-weight: 900;
}
.pub-logo:hover { text-decoration: none; color: var(--stripe-navy); }
.pub-nav {
  display: flex;
  gap: .15rem;
  align-items: center;
  flex: 1;
  justify-content: center;
}
.pub-nav-link {
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.pub-nav-link:hover { color: var(--text-primary); background: var(--stripe-bg); text-decoration: none; }
.pub-nav-link.active { color: var(--stripe-purple); font-weight: 600; }
.pub-header-actions { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }

/* ---- Nav dropdown ---- */
.pub-nav-dropdown { position: relative; }
.pub-nav-dropdown-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3rem;
  font-family: inherit;
  line-height: inherit;
}
.pub-nav-chevron { transition: transform .2s; flex-shrink: 0; }
.pub-nav-dropdown:hover .pub-nav-chevron,
.pub-nav-dropdown.open  .pub-nav-chevron { transform: rotate(180deg); }
.pub-nav-dropdown-menu {
  position: absolute;
  top: calc(100% + .5rem);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 168px;
  background: #fff;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.1);
  padding: .35rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, transform .15s, visibility .15s;
  z-index: 300;
}
.pub-nav-dropdown:hover .pub-nav-dropdown-menu,
.pub-nav-dropdown.open  .pub-nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.pub-nav-dropdown-item {
  display: block;
  padding: .5rem .85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .12s, background .12s;
  white-space: nowrap;
}
.pub-nav-dropdown-item:hover { color: var(--stripe-purple); background: var(--stripe-bg); text-decoration: none; }
.pub-nav-dropdown-item.active { color: var(--stripe-purple); font-weight: 600; }

/* ---- Hamburger button ---- */
.pub-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: .45rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  margin-left: auto;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.pub-hamburger:hover { background: var(--stripe-bg); color: var(--text-primary); }
.pub-hamburger .hb-close { display: none; }
.pub-hamburger.open .hb-open  { display: none; }
.pub-hamburger.open .hb-close { display: block; }

/* ---- Mobile menu panel ---- */
.pub-mobile-menu {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid var(--stripe-border);
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
  padding: .5rem 1.25rem 1.25rem;
  z-index: 199;
}
.pub-mobile-menu.open { display: block; }
.pub-mobile-link {
  display: block;
  padding: .7rem .25rem;
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--stripe-border);
  transition: color .12s;
}
.pub-mobile-link:hover,
.pub-mobile-link.active { color: var(--stripe-purple); text-decoration: none; }
.pub-mobile-link.active { font-weight: 600; }
.pub-mobile-link-sub { padding-left: 1rem; font-size: .85rem; color: var(--text-muted, #94a3b8); }
.pub-mobile-link-sub.active { color: var(--stripe-purple); }
.pub-mobile-group-label {
  padding: .8rem .25rem .3rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #94a3b8;
}
.pub-mobile-actions {
  display: flex;
  gap: .6rem;
  padding-top: 1rem;
}
.pub-mobile-actions .btn { flex: 1; justify-content: center; text-align: center; }

/* ---- Footer ---- */
/* ============================================================
   Footer pubblico — redesign multi-colonna
   ============================================================ */
/* Public breadcrumb */
.pub-breadcrumb {
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
  padding: .45rem 2rem;
}
.pub-breadcrumb-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
}
.pub-breadcrumb a {
  color: #6b7280;
  text-decoration: none;
}
.pub-breadcrumb a:hover { color: #374151; }
.pub-breadcrumb-sep { color: #d1d5db; }
.pub-breadcrumb-current { color: #374151; font-weight: 500; }

.pub-footer {
  background: var(--stripe-navy);
  margin-top: auto;
  padding: 4rem 2rem 0;
}
.pub-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

/* Brand column */
.pub-footer-brand { display: flex; flex-direction: column; gap: .75rem; }
.pub-footer-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -.025em;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.pub-footer-logo:hover { text-decoration: none; color: #fff; }
.pub-footer-tagline {
  font-size: .85rem;
  color: rgba(255,255,255,.5);
  margin: 0;
  line-height: 1.5;
}
.pub-footer-address {
  font-style: normal;
  font-size: .78rem;
  color: rgba(255,255,255,.35);
  line-height: 1.8;
  margin: .25rem 0 0;
}

/* Link columns */
.pub-footer-col {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.pub-footer-col-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  margin: 0 0 .25rem;
}
.pub-footer-link {
  font-size: .84rem;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  transition: color .15s;
}
.pub-footer-link:hover { color: #fff; text-decoration: none; }

/* Bottom bar */
.pub-footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0 1.5rem;
  font-size: .75rem;
  color: rgba(255,255,255,.25);
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---- Page wrapper ---- */
.pub-page { flex: 1; }

/* ============================================================
   Pagine legali (Privacy Policy, Termini di Servizio)
   ============================================================ */
.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}
.legal-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.legal-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .4rem;
}
.legal-meta {
  font-size: .82rem;
  color: var(--text-muted);
  margin: 0;
}
.legal-body h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2.25rem 0 .65rem;
  color: var(--text-primary);
}
.legal-body h3 {
  font-size: .95rem;
  font-weight: 600;
  margin: 1.5rem 0 .5rem;
  color: var(--text-primary);
}
.legal-body p,
.legal-body li {
  font-size: .92rem;
  line-height: 1.75;
  color: var(--text-secondary);
}
.legal-body ul {
  padding-left: 1.4rem;
  margin: .5rem 0 1rem;
}
.legal-body li { margin-bottom: .35rem; }
.legal-body address {
  font-style: normal;
  background: var(--stripe-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-size: .9rem;
  line-height: 1.7;
  margin: .75rem 0 1rem;
}
.legal-body a { color: var(--primary); }
.legal-body a:hover { text-decoration: underline; }
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin: .75rem 0 1.5rem;
}
.legal-table th {
  background: var(--stripe-bg);
  padding: .6rem .85rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.legal-table td {
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .legal-page { padding: 1.5rem 1rem 4rem; }
  .legal-header h1 { font-size: 1.5rem; }
  .legal-table { display: block; overflow-x: auto; }
}

/* ---- Hero ---- */
.pub-hero {
  background: linear-gradient(160deg, #F5F3FF 0%, #EEF2FF 55%, #F0FDF4 100%);
  padding: 5.5rem 2rem 4.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.pub-hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99,91,255,.07) 0%, transparent 70%);
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.pub-hero-inner { max-width: 760px; margin: 0 auto; position: relative; }
.pub-hero h1 {
  font-size: 3.25rem;
  font-weight: 800;
  color: var(--stripe-navy);
  letter-spacing: -.045em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}
.pub-hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, #635BFF, #7C3AED);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pub-hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0 auto 2.5rem;
  line-height: 1.65;
  max-width: 520px;
}
.pub-hero-form {
  display: flex;
  max-width: 520px;
  margin: 0 auto .5rem;
  background: #fff;
  border-radius: var(--radius);
  border: 1.5px solid rgba(99,91,255,.2);
  box-shadow: 0 6px 24px rgba(99,91,255,.12);
  overflow: hidden;
}
.pub-hero-form input {
  flex: 1;
  border: none;
  background: none;
  font-size: .925rem;
  outline: none;
  color: var(--text-primary);
  padding: .85rem 1rem;
  font-family: inherit;
  min-width: 0;
}
.pub-hero-form input::placeholder { color: var(--text-muted); }
.pub-hero-form input:focus { box-shadow: none; border: none; }
.pub-hero-form .btn { border-radius: 0; padding: .75rem 1.25rem; border: none; flex-shrink: 0; font-size: .875rem; }
.pub-hero-result {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  max-width: 520px;
  margin: .5rem auto 0;
  background: #fff;
  border: 1px solid #C7D2FE;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .875rem;
  text-align: left;
}
.pub-hero-result.visible { display: flex; }
.pub-hero-result a { font-weight: 700; color: var(--stripe-purple); }
.pub-hero-note { margin-top: 1.25rem; font-size: .78rem; color: var(--text-muted); }
.pub-hero-note a { color: var(--stripe-purple); font-weight: 600; }

/* ---- Section base ---- */
.pub-section { padding: 5rem 2rem; }
.pub-section-alt { background: #FAFAFF; }
.pub-section-inner { max-width: 1100px; margin: 0 auto; }
.pub-section-label {
  display: inline-block;
  background: rgba(99,91,255,.08);
  border: 1px solid rgba(99,91,255,.15);
  color: var(--stripe-purple);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .3rem .75rem;
  border-radius: 99px;
  margin-bottom: .875rem;
}
.pub-section-header { text-align: center; margin-bottom: 3.5rem; }
.pub-section-header h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--stripe-navy);
  letter-spacing: -.035em;
  margin-bottom: .6rem;
}
.pub-section-header p { color: var(--text-secondary); font-size: 1rem; line-height: 1.6; max-width: 520px; margin: 0 auto; }

/* ---- Steps ---- */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr 48px 1fr 48px 1fr;
  align-items: start;
  max-width: 860px;
  margin: 0 auto;
}
.step-arrow {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 1.5rem;
  color: rgba(99,91,255,.25);
  font-size: 1.75rem;
  line-height: 1;
}
.step-card { text-align: center; padding: 0 .5rem; }
.step-number {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--stripe-purple), #4F46E5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 1.25rem;
  box-shadow: 0 4px 18px rgba(99,91,255,.35);
}
.step-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; color: var(--stripe-navy); }
.step-card p { font-size: .85rem; color: var(--text-secondary); line-height: 1.6; }

/* ---- Benefits ---- */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.benefit-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--stripe-shadow);
  border: 1px solid var(--stripe-border);
  text-align: center;
  transition: transform .2s, box-shadow .2s;
}
.benefit-card:hover { transform: translateY(-3px); box-shadow: var(--stripe-shadow-lg); }
.benefit-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(99,91,255,.1), rgba(79,70,229,.05));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.1rem;
  font-size: 1.5rem;
}
.benefit-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .4rem; color: var(--stripe-navy); }
.benefit-card p { font-size: .8rem; color: var(--text-secondary); line-height: 1.55; }

/* ---- Social proof ---- */
.social-proof {
  text-align: center;
  padding: 4.5rem 2rem;
  background: linear-gradient(135deg, #F5F3FF, #EEF2FF);
}
.social-proof-inner { max-width: 520px; margin: 0 auto; }
.social-proof-avatars { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.social-proof-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(135deg, var(--stripe-purple), #4F46E5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  color: #fff;
  font-weight: 700;
  margin-left: -10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.social-proof-avatars .social-proof-avatar:first-child { margin-left: 0; }
.social-proof h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--stripe-navy);
  letter-spacing: -.03em;
  margin-bottom: .6rem;
}
.social-proof p { color: var(--text-secondary); line-height: 1.65; font-size: .95rem; }

/* ---- CTA Banner ---- */
.pub-cta-banner {
  background: linear-gradient(135deg, #635BFF 0%, #4F46E5 50%, #4338CA 100%);
  padding: 5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.pub-cta-banner::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  top: -200px;
  right: -100px;
  pointer-events: none;
}
.pub-cta-banner-inner { position: relative; max-width: 600px; margin: 0 auto; }
.pub-cta-banner h2 {
  font-size: 2.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.04em;
  margin-bottom: .75rem;
  line-height: 1.15;
}
.pub-cta-banner p { color: rgba(255,255,255,.8); font-size: 1rem; margin-bottom: 2rem; line-height: 1.6; }
.btn-white { background: #fff; color: var(--stripe-purple); border-color: #fff; font-weight: 700; }
.btn-white:hover { background: #F0EDFF; border-color: #F0EDFF; color: #4F46E5; text-decoration: none; }

/* ============================================================
   Feature landing pages (link-brevi, qr-code, bio-page, ecc.)
   ============================================================ */
.feat-hero {
  padding: 5.5rem 2rem 5rem;
  background: linear-gradient(160deg, #F5F3FF 0%, #EEF2FF 55%, #F0FDF4 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.feat-hero::before {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(99,91,255,.08) 0%, transparent 70%);
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.feat-hero-inner { position: relative; max-width: 720px; margin: 0 auto; }
.feat-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(99,91,255,.08);
  border: 1px solid rgba(99,91,255,.18);
  color: var(--stripe-purple);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .3rem .85rem;
  border-radius: 99px;
  margin-bottom: 1.5rem;
}
.feat-hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.1;
  color: var(--stripe-navy);
  margin-bottom: 1.1rem;
}
.feat-hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--stripe-purple), #4F46E5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.feat-hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto 2rem;
}
.feat-hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}
.feat-hero-trust {
  font-size: .75rem;
  color: var(--text-muted);
  letter-spacing: .01em;
}
.feat-hero-trust span { margin: 0 .35rem; opacity: .4; }

/* ---- Feature list (2-col, benefit-first) ---- */
.feat-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  max-width: 860px;
  margin: 0 auto;
}
.feat-list-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.feat-list-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(99,91,255,.1), rgba(79,70,229,.05));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}
.feat-list-item h3 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--stripe-navy);
  margin: 0 0 .2rem;
}
.feat-list-item p {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

/* ---- FAQ ---- */
.feat-faq { max-width: 680px; margin: 0 auto; }
.feat-faq-item {
  border-bottom: 1px solid var(--border);
}
.feat-faq-item:first-child { border-top: 1px solid var(--border); }
.feat-faq-item summary {
  font-size: .95rem;
  font-weight: 600;
  color: var(--stripe-navy);
  padding: 1.1rem 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  user-select: none;
}
.feat-faq-item summary::-webkit-details-marker { display: none; }
.feat-faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}
.feat-faq-item[open] summary::after { content: '−'; }
.feat-faq-item p {
  font-size: .875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 0 0 1.1rem;
  margin: 0;
}

/* ---- Final CTA stripe ---- */
.feat-cta {
  background: linear-gradient(135deg, #635BFF 0%, #4F46E5 60%, #4338CA 100%);
  padding: 5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.feat-cta::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  top: -200px; right: -100px;
  pointer-events: none;
}
.feat-cta-inner { position: relative; max-width: 560px; margin: 0 auto; }
.feat-cta h2 {
  font-size: 2.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.04em;
  line-height: 1.15;
  margin-bottom: .75rem;
}
.feat-cta p {
  color: rgba(255,255,255,.8);
  font-size: .95rem;
  line-height: 1.65;
  margin-bottom: 2rem;
}
.feat-cta-trust {
  margin-top: .85rem;
  font-size: .73rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .01em;
}
.feat-cta-trust span { margin: 0 .35rem; opacity: .5; }

@media (max-width: 900px) {
  .feat-hero h1 { font-size: 2.25rem; }
  .feat-list { grid-template-columns: 1fr; max-width: 520px; }
}
@media (max-width: 640px) {
  .feat-hero { padding: 3.5rem 1.25rem 3rem; }
  .feat-hero h1 { font-size: 1.9rem; }
  .feat-hero-sub { font-size: .95rem; }
  .feat-cta h2 { font-size: 1.75rem; }
  .feat-cta { padding: 3.5rem 1.25rem; }
}

/* ---- Pricing toggle ---- */
.pricing-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  margin-bottom: 2.75rem;
}
.pricing-toggle-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
.pricing-toggle-label.on { color: var(--stripe-navy); }
.pricing-toggle-track {
  width: 52px;
  height: 28px;
  background: var(--stripe-border);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background .25s;
  flex-shrink: 0;
}
.pricing-toggle-track.annual { background: var(--stripe-purple); }
.pricing-toggle-thumb {
  position: absolute;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.pricing-toggle-track.annual .pricing-toggle-thumb { transform: translateX(24px); }
.pricing-save-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(11,122,67,.1);
  color: var(--success-fg);
  font-size: .72rem;
  font-weight: 700;
  padding: .25rem .6rem;
  border-radius: 99px;
  border: 1px solid rgba(11,122,67,.18);
  white-space: nowrap;
}


/* ============================================================
   QR LOGO SECTION
   ============================================================ */
.qr-logo-section {
  background: var(--stripe-bg);
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
  padding: .75rem;
  margin-bottom: .875rem;
}
.qr-logo-header {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  margin-bottom: .5rem;
}
.qr-logo-current {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
}
.qr-logo-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stripe-border);
  background: #fff;
}
.qr-logo-upload-btn {
  display: inline-block;
  cursor: pointer;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}
.qr-logo-hint {
  font-size: .72rem;
  color: var(--text-muted);
  margin: .3rem 0 0;
}
.qr-logo-remove { white-space: nowrap; }

/* ============================================================
   QR SHAPE PICKER
   ============================================================ */
.qr-shape-picker {
  display: flex;
  gap: .375rem;
}
.qr-shape-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .5rem .25rem;
  border: 1.5px solid var(--stripe-border);
  border-radius: var(--radius-sm);
  background: var(--stripe-bg);
  color: var(--text-secondary);
  font-size: .72rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.qr-shape-btn:hover {
  border-color: var(--primary);
  background: var(--primary-faint);
}
.qr-shape-btn.active {
  border-color: var(--primary);
  background: var(--primary-faint);
  color: var(--primary);
  font-weight: 600;
}
/* Mini preview icons representing each shape */
.qr-shape-icon {
  display: block;
  width: 22px;
  height: 22px;
  position: relative;
}
/* Square: solid square */
.qr-shape-square {
  background: currentColor;
  border-radius: 2px;
}
/* Dot: circle */
.qr-shape-dot {
  background: currentColor;
  border-radius: 50%;
}
/* Rounded: rounded rect */
.qr-shape-rounded {
  background: currentColor;
  border-radius: 6px;
}

/* ============================================================
   PERIOD SELECTOR (link detail analytics)
   ============================================================ */
.period-selector-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.period-btns {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
}
.period-btn {
  padding: .3rem .75rem;
  border: 1px solid var(--stripe-border);
  border-radius: 99px;
  background: #fff;
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
}
.period-btn:hover { border-color: var(--stripe-purple); color: var(--stripe-purple); }
.period-btn.active {
  background: var(--stripe-purple);
  border-color: var(--stripe-purple);
  color: #fff;
}
.custom-range-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.custom-range-wrap input[type="date"] {
  padding: .3rem .6rem;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: var(--text-primary);
  background: #fff;
}
.period-label-txt {
  font-size: .8rem;
  color: var(--text-muted);
  margin-left: .25rem;
}

/* ============================================================
   CHARTS ROW (line + device side-by-side)
   ============================================================ */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
.charts-row-line  { padding: 1.25rem; }
.charts-row-device { padding: 1.25rem; }

/* Device legend */
.device-legend-list { margin-top: .875rem; display: flex; flex-direction: column; gap: .375rem; }
.device-legend-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
}
.device-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.device-legend-label { flex: 1; color: var(--text-primary); }
.device-legend-pct { color: var(--text-muted); min-width: 2.5rem; text-align: right; }
.device-legend-num { color: var(--text-secondary); min-width: 2.5rem; text-align: right; font-weight: 600; }

/* ============================================================
   ANALYTICS 2-COL (paesi + referrer)
   ============================================================ */
.analytics-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ============================================================
   SORGENTE CLICK (QR vs Link bars)
   ============================================================ */
.source-bar-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin-bottom: .875rem;
}
.source-icon { font-size: 1.1rem; flex-shrink: 0; }
.source-label {
  font-size: .82rem;
  color: var(--text-primary);
  width: 90px;
  flex-shrink: 0;
}
.source-bar-track {
  flex: 1;
  height: 8px;
  background: var(--stripe-border);
  border-radius: 99px;
  overflow: hidden;
}
.source-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.source-bar-link { background: #6366f1; }
.source-bar-qr   { background: #10b981; }
.source-count {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 2.5rem;
  text-align: right;
}
.source-pct {
  font-size: .78rem;
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: right;
}

/* ============================================================
   RECLICK STATS
   ============================================================ */
.reclick-kpi-row {
  display: flex;
  gap: 1rem;
  margin-bottom: .25rem;
}
.reclick-kpi {
  flex: 1;
  background: var(--stripe-bg);
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
  padding: .625rem .875rem;
  text-align: center;
}
.reclick-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.02em;
  line-height: 1.2;
}
.reclick-kpi-label {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .125rem;
}

/* ============================================================
   IFRAME PREVIEW
   ============================================================ */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--stripe-border);
}
.preview-browser-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--stripe-bg);
  padding: .5rem .875rem;
  border-bottom: 1px solid var(--stripe-border);
}
.preview-dots { display: flex; gap: 5px; flex-shrink: 0; }
.preview-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--stripe-border);
}
.preview-dots span:nth-child(1) { background: #fc5f57; }
.preview-dots span:nth-child(2) { background: #fdbe2b; }
.preview-dots span:nth-child(3) { background: #28c840; }
.preview-url-bar {
  flex: 1;
  font-size: .75rem;
  color: var(--text-secondary);
  background: #fff;
  border: 1px solid var(--stripe-border);
  border-radius: 99px;
  padding: .2rem .75rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.preview-viewport {
  position: relative;
  overflow: hidden;
  background: #f8f9fb;
  height: 290px;
}
.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--text-muted);
  font-size: .8rem;
  z-index: 2;
  background: #f8f9fb;
}
.preview-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--stripe-border);
  border-top-color: var(--stripe-purple);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preview-fallback {
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  background: #f8f9fb;
  z-index: 1;
}
.preview-fallback-host { font-weight: 600; color: var(--text-primary); margin-bottom: .25rem; }
.preview-fallback-msg { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.preview-dest-url-mobile {
  display: none;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .625rem 1.25rem;
  border-top: 1px solid var(--stripe-border);
  font-size: .8rem;
  color: var(--text-secondary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .stats-grid, .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .benefits-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .analytics-2col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .pub-nav { display: none; }
  .pub-header-actions { display: none; }
  .pub-hamburger { display: flex; }
  .pub-hero h1 { font-size: 2.1rem; }
  .steps-grid { grid-template-columns: 1fr; gap: 2rem; }
  .step-arrow { display: none; }
  .benefits-grid { grid-template-columns: repeat(2, 1fr); }
  .pub-cta-banner h2 { font-size: 1.75rem; }
  .pub-hero-form { flex-direction: column; }
  .pub-hero-form .btn { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
}

@media (max-width: 640px) {
  .pub-hero h1 { font-size: 1.8rem; }
  .benefits-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .plans-grid { grid-template-columns: 1fr; }
  .stats-grid, .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .pub-footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  .pub-footer-brand {
    grid-column: 1 / -1;
  }
  .pub-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: .35rem;
  }
  .period-selector-wrap { flex-direction: column; align-items: flex-start; }
  .custom-range-wrap { width: 100%; }
  .agency-client-row { flex-direction: column; align-items: flex-start; gap: .75rem; }
}

/* ====================================================================
   MOBILE APP — Bottom nav + responsive overrides (≤640px)
   Usa .app-body .xxx per battere layout.css (caricato dopo app.css)
==================================================================== */

/* ── Mobile nav: nascosta su desktop ── */
.mobile-nav         { display: none; }
.mobile-more-panel  { display: none; }
.mobile-more-backdrop { display: none; }

/* ── Scroll wrapper tabelle ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {

  /* ── Override layout.css: sidebar nascosta, contenuto full-width ── */
  .app-body .sidebar   { display: none !important; }
  .app-body .app-main  { margin-left: 0 !important; }
  .app-body .container { padding: 1rem .875rem 76px !important; }
  .app-body .topbar    { padding: 0 .875rem !important; }
  .app-body .flash-wrapper { padding: 0 .875rem; }

  /* ── Topbar ── */
  .topbar-workspace {
    font-size: .8rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Bottom nav ── */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 300;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid var(--stripe-border);
    box-shadow: 0 -2px 16px rgba(0,0,0,.07);
    align-items: stretch;
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: .62rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s;
  }
  .mobile-nav-item svg {
    width: 22px; height: 22px;
    fill: none; stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .mobile-nav-item.active { color: var(--stripe-purple); }
  .mobile-nav-item:active  { color: var(--stripe-purple); }

  /* ── CTA centrale (+ Nuovo link) ── */
  .mobile-nav-cta {
    flex: 0 0 52px;
    height: 44px;
    margin: 8px 4px;
    background: var(--stripe-purple);
    color: #fff !important;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(99,91,255,.4);
  }
  .mobile-nav-cta svg { width: 24px; height: 24px; stroke-width: 2.2; }
  .mobile-nav-cta span { display: none; }

  /* ── Backdrop ── */
  .mobile-more-backdrop {
    display: block;
    position: fixed; inset: 0;
    z-index: 298;
    background: rgba(0,0,0,.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }
  .mobile-more-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* ── Panel "Altro" slide-up ── */
  .mobile-more-panel {
    display: block;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 299;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 32px rgba(0,0,0,.14);
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-more-panel.open { transform: translateY(0); }

  .mobile-more-handle {
    width: 36px; height: 4px;
    background: var(--stripe-border);
    border-radius: 2px;
    margin: .75rem auto .25rem;
  }

  .mobile-more-inner { padding: .25rem 0 .75rem; }

  .mobile-more-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.25rem;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
  }
  .mobile-more-link:active  { background: var(--surface); }
  .mobile-more-link.active  { color: var(--stripe-purple); }
  .mobile-more-link svg     { flex-shrink: 0; opacity: .6; }
  .mobile-more-upgrade      { color: var(--stripe-purple); font-weight: 600; }
  .mobile-more-upgrade svg  { opacity: 1; stroke: var(--stripe-purple); }
  .mobile-more-logout       { color: #ef4444; }
  .mobile-more-logout svg   { opacity: 1; stroke: #ef4444; }

  .mobile-more-divider {
    height: 1px;
    background: var(--stripe-border);
    margin: .35rem 1.25rem;
  }

  /* ── Page header ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: 1rem;
  }
  .page-header h1 { font-size: 1.15rem; }
  .page-header > div { display: flex; gap: .4rem; flex-wrap: wrap; }

  /* ── Filters bar ── */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
    padding: .75rem 1rem;
  }
  .filters-bar .input-search,
  .filters-bar .select-sm { width: 100%; box-sizing: border-box; }
  .filters-bar .btn        { align-self: flex-start; }

  /* ── Campaign strips ── */
  .campaign-strip { padding: .7rem 1rem; }
  .campaign-strip-desc { display: none; }

  /* ── Links section header ── */
  .links-section-header { flex-wrap: wrap; gap: .4rem; }

  /* ── Stat cards ── */
  .stats-grid, .stats-grid-4 { grid-template-columns: repeat(2, 1fr); gap: .65rem; }
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; }

  /* ── Conversion UI ── */
  .conv-channels-grid    { grid-template-columns: 1fr; gap: 1rem; }
  .conv-pixel-cta        { order: -1; }
  .conv-channels-grid .conv-channel-box:not(.conv-pixel-cta) { order: 1; }
  .conv-kpi-grid         { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .conv-kpi-card         { padding: .6rem .35rem; min-width: 0; }
  .conv-kpi-val          { font-size: 1.05rem; }
  .conv-kpi-icon         { font-size: 1.05rem; }
  .conv-objective-grid   { grid-template-columns: repeat(2, 1fr); }
  .conv-config-form      { margin-top: 1rem; }

  /* ── Bulk actions ── */
  .bulk-actions { flex-wrap: wrap; gap: .4rem; }

  /* ── Analytics ── */
  .analytics-countries-list { grid-template-columns: 1fr; }
  .charts-row      { grid-template-columns: 1fr; }
  .analytics-2col  { grid-template-columns: 1fr; }

  /* ── Preview iframe: su mobile nascondi chrome + iframe, mostra URL compatto ── */
  .link-live-preview .preview-browser-bar { display: none; }
  .link-live-preview .preview-viewport    { display: none; }
  .preview-dest-url-mobile                { display: block; }

  /* ── QR: immagine centrata, non allarga la card ── */
  .qr-preview-box img { max-width: 100%; height: auto; }

  /* ── Form color pickers affiancati: va in colonna ── */
  .qr-color-pickers .form-row { grid-template-columns: 1fr; }

  /* ── Topbar: workspace name più corto ── */
  .topbar-workspace { max-width: 120px; }
  .ws-switcher-btn { max-width: 130px; font-size: .8rem; }
  .ws-switcher-dropdown { min-width: 180px; }

  /* ── Settings ── */
  .app-body .settings-layout { flex-direction: column; }

  /* ── Agency banner ── */
  .agency-banner { padding: .6rem .875rem; font-size: .8rem; }

  /* ── Cards ── */
  .card { border-radius: var(--radius); }
  .card-body { padding: 1rem; }
}

/* ── Telefoni molto piccoli (≤375px) ── */
@media (max-width: 375px) {
  .app-body .container { padding: .75rem .75rem 76px !important; }
  .stats-grid, .stats-grid-4, .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .page-header h1 { font-size: 1.05rem; }
  .mobile-nav-item { font-size: .58rem; }
}

/* ============================================================
   AGENCY PLAN — banner impersonation + lista clienti
   ============================================================ */
.agency-banner {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #7c3aed;
  color: #fff;
  padding: .6rem 1.5rem;
  font-size: .875rem;
  font-weight: 500;
}
.agency-banner-icon { font-size: 1rem; }
.agency-banner-back {
  margin-left: auto;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .8rem;
  border: 1px solid rgba(255,255,255,.35);
  padding: .25rem .75rem;
  border-radius: 99px;
  transition: background .15s;
}
.agency-banner-back:hover { background: rgba(255,255,255,.15); color: #fff; }

.agency-client-list { display: flex; flex-direction: column; gap: 0; }
.agency-client-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 0;
  border-bottom: 1px solid var(--stripe-border);
}
.agency-client-row:last-child { border-bottom: none; }
.agency-client-info { flex: 1; min-width: 0; }
.agency-client-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
  margin-bottom: .15rem;
}
.agency-client-meta {
  font-size: .78rem;
  color: var(--text-muted);
}
.agency-client-actions { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }
.badge-pending {
  background: rgba(245,158,11,.12);
  color: #92400e;
  border: 1px solid rgba(245,158,11,.25);
  font-size: .72rem;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-weight: 600;
}

/* Modal agency */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  line-height: 1;
}

/* ============================================================
   Sezione Conversioni — /links/:id
   ============================================================ */
.conv-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--stripe-border);
}
.conv-section-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.conv-config-form {
  margin-bottom: 1.5rem;
}
.conv-config-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  align-items: end;
  margin-bottom: 1.25rem;
}
.conv-config-row .form-group {
  margin-bottom: 0;
}
.conv-config-row label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}

/* Objective card picker */
.conv-objective-picker {
  margin-bottom: 1.5rem;
}
.conv-objective-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .75rem;
}
.conv-objective-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
}
.conv-objective-card {
  cursor: pointer;
  border: 2px solid var(--stripe-border);
  border-radius: var(--radius);
  padding: .875rem .625rem .75rem;
  text-align: center;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  user-select: none;
}
.conv-objective-card:hover {
  border-color: var(--stripe-purple);
  background: rgba(99,91,255,.04);
}
.conv-objective-card.selected {
  border-color: var(--stripe-purple);
  background: rgba(99,91,255,.07);
  box-shadow: 0 0 0 3px rgba(99,91,255,.12);
}
.conv-objective-icon {
  display: block;
  font-size: 1.375rem;
  line-height: 1;
  margin-bottom: .375rem;
}
.conv-objective-title {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .2rem;
}
.conv-objective-desc {
  display: block;
  font-size: .68rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.conv-channels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 1.5rem;
}
.conv-channel-box {
  background: var(--stripe-bg);
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.conv-channel-box h3 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 .5rem;
}
.conv-channel-box p {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}
.conv-channel-box label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}

.conv-snippet-wrap {
  position: relative;
  margin-bottom: .5rem;
}
.conv-snippet-wrap pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  font-size: .75rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.conv-snippet-wrap .btn-copy {
  position: absolute;
  top: .5rem;
  right: .5rem;
}

@media (max-width: 1200px) {
  /* Bottone copia snippet: sotto il codice fino a iPad landscape */
  .conv-snippet-wrap {
    display: flex;
    flex-direction: column;
    gap: .5rem;
  }
  .conv-snippet-wrap pre { padding-bottom: .875rem; }
  .conv-snippet-wrap .btn-copy {
    position: static;
    align-self: flex-end;
  }
}

.conv-confirm-url {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.conv-confirm-url input {
  flex: 1;
  font-size: .8rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  background: #fff;
}

.conv-help {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .4rem;
  line-height: 1.5;
}
.conv-help code {
  background: rgba(99,91,255,.08);
  color: var(--stripe-purple);
  padding: .1em .35em;
  border-radius: 3px;
  font-size: .85em;
}

.conv-recent {
  border-top: 1px solid var(--stripe-border);
  padding-top: 1.25rem;
}
.conv-recent h3 {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Descrizione link sotto il titolo */
.link-show-description {
  font-size: .875rem;
  color: var(--text-muted);
  margin: .2rem 0 0;
  line-height: 1.5;
  max-width: 60ch;
}

/* Conv KPI mini-grid */
.conv-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.conv-kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--stripe-bg);
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  min-width: 90px;
  text-align: center;
}
.conv-kpi-icon {
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: .25rem;
}
.conv-kpi-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.conv-kpi-label {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .15rem;
}
.conv-kpi-sub {
  font-size: .75rem;
  font-weight: 600;
  color: var(--stripe-purple);
  margin-top: .2rem;
}

/* CTA box pixel dentro conv-channels-grid */
.conv-pixel-cta {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.conv-pixel-cta p {
  flex: 1;
}

/* Settings pixel page */
.pixel-events-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: .5rem;
}
.pixel-event-box {
  background: var(--stripe-bg);
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
  padding: 1rem;
}
.pixel-event-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .625rem;
}
.pixel-event-icon {
  font-size: 1.2rem;
  line-height: 1;
}
.pixel-event-name {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'SFMono-Regular', Consolas, monospace;
}

@media (max-width: 640px) {
  .conv-channels-grid { grid-template-columns: 1fr; }
  .conv-config-row { grid-template-columns: 1fr; }
  .conv-objective-grid { grid-template-columns: repeat(2, 1fr); }
  .pixel-events-grid { grid-template-columns: 1fr; }

  /* Blocchi codice: mai più larghi del contenitore */
  pre, code {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
    max-width: 100%;
  }

  /* Input URL confirm: non forza larghezza */
  .conv-confirm-url { flex-wrap: wrap; }
  .conv-confirm-url input { min-width: 0; flex: 1 1 100%; }
  .conv-confirm-url .btn { flex-shrink: 0; }

}

/* ============================================================
   Dashboard redesign
   ============================================================ */

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.dash-header h1 { margin-bottom: .15rem; }
.dash-subtitle { color: var(--text-muted); font-size: .85rem; }

/* KPI grid */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dash-kpi-card {
  background: #fff;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: var(--stripe-shadow);
}
.dash-kpi-card--highlight {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.dash-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
  gap: .5rem;
}
.dash-kpi-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.dash-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.dash-kpi-limit {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}
.dash-kpi-sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .3rem;
}
.dash-kpi-link { color: var(--stripe-purple); font-weight: 500; }

/* Trend badge */
.dash-trend {
  font-size: .72rem;
  font-weight: 700;
  padding: .15em .45em;
  border-radius: 99px;
  white-space: nowrap;
}
.dash-trend-up      { background: #dcfce7; color: #15803d; }
.dash-trend-down    { background: #fee2e2; color: #b91c1c; }
.dash-trend-neutral { background: var(--stripe-border); color: var(--text-muted); }

/* Progress bar dentro KPI */
.dash-progress {
  height: 4px;
  background: var(--stripe-border);
  border-radius: 99px;
  margin-top: .5rem;
  overflow: hidden;
}
.dash-progress-fill {
  height: 100%;
  background: var(--stripe-purple);
  border-radius: 99px;
  transition: width .4s ease;
}
.dash-progress-warn { background: #f59e0b; }
.dash-progress-full { background: #ef4444; }

/* Alert bar */
.dash-alerts {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
}
.dash-alerts-title {
  font-size: .8rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.dash-alerts-list { display: flex; flex-direction: column; gap: .4rem; }
.dash-alert-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.dash-alert-slug {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-primary);
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.dash-alert-title { font-size: .8rem; color: var(--text-muted); }
.dash-alert-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .15em .5em;
  border-radius: 99px;
}
.dash-alert-expired { background: #fee2e2; color: #b91c1c; }
.dash-alert-limit   { background: #fef3c7; color: #92400e; }

/* Two columns */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

/* Top links */
.dash-top-links {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem 1.25rem;
  gap: 0;
}
.dash-top-link-row {
  display: grid;
  grid-template-columns: 1fr 90px 44px;
  align-items: center;
  gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--stripe-border);
}
.dash-top-link-row:last-child { border-bottom: none; }
.dash-top-link-info { min-width: 0; }
.dash-top-link-slug {
  display: block;
  font-weight: 600;
  font-size: .875rem;
  color: var(--stripe-purple);
  font-family: 'SFMono-Regular', Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-top-link-slug:hover { text-decoration: underline; }
.dash-top-link-title {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: .1rem;
}
.dash-top-link-bar-wrap {
  height: 6px;
  background: var(--stripe-border);
  border-radius: 99px;
  overflow: hidden;
}
.dash-top-link-bar {
  height: 100%;
  background: var(--stripe-purple);
  border-radius: 99px;
  min-width: 4px;
  transition: width .5s ease;
}
.dash-top-link-count {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
}

/* Recent conversions */
.dash-activity {
  display: flex;
  flex-direction: column;
  padding: .75rem 1.5rem 1rem;
  gap: 0;
}
.dash-activity-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--stripe-border);
  transition: background .15s;
}
.dash-activity-row:last-child { border-bottom: none; }
.dash-conv-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.dash-activity-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.dash-activity-type { font-weight: 600; font-size: .83rem; color: var(--text-primary); }
.dash-activity-value { font-size: .8rem; color: #15803d; font-weight: 700; }
.dash-activity-link { font-size: .78rem; color: var(--text-muted); font-family: 'SFMono-Regular', Consolas, monospace; }
.dash-activity-time { font-size: .75rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* Responsive */
@media (max-width: 900px) {
  .dash-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-kpi-value { font-size: 1.4rem; }
  .dash-top-link-bar-wrap { display: none; }
  .dash-top-link-row { grid-template-columns: 1fr 44px; }
  .dash-top-links { padding: .75rem 1rem 1rem; }
  .dash-activity { padding: .5rem 1rem .75rem; }
}

/* ================================================================
   PIXEL DOCUMENTATION PAGE
================================================================ */
.pixel-doc-step {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.pixel-doc-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .15rem;
}
.pixel-doc-step-body { flex: 1; min-width: 0; }
.pixel-doc-step-body h3 {
  margin: 0 0 .5rem;
  font-size: .95rem;
}
.pixel-doc-step-body p {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: .75rem;
}
.pixel-doc-alert {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .82rem;
  color: #92400e;
  line-height: 1.5;
}


/* ================================================================
   LINKS PAGE — SEZIONI E CAMPAGNE STRIPS
================================================================ */
.links-section { }
.links-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.links-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.campaigns-list { display: flex; flex-direction: column; gap: .5rem; }

/* Campaign strip (cliccabile) */
.campaign-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--c, #6366f1);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .1s;
}
.campaign-strip:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transform: translateY(-1px);
}
.campaign-strip-body { flex: 1; min-width: 0; }
.campaign-strip-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
}
.campaign-strip-desc {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-strip-dates {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .1rem;
}
.campaign-strip-right {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.campaign-strip-count {
  font-size: .8rem;
  font-weight: 600;
  color: var(--c, #6366f1);
}
.campaign-strip-arrow { color: var(--text-muted); }

/* Breadcrumb per vista campagna */
.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
  margin-bottom: .25rem;
}
.breadcrumb-link { color: var(--text-muted); text-decoration: none; }
.breadcrumb-link:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-primary);
  font-weight: 600;
}
.campaign-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.page-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin: .2rem 0 0;
}
.campaign-detail-meta {
  display: flex;
  gap: 1.5rem;
  font-size: .83rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* Campaign badge in link row / show header */
.campaign-badge {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 600;
  padding: .1rem .5rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--c, #6366f1) 12%, transparent);
  color: var(--c, #6366f1);
  border: 1px solid color-mix(in srgb, var(--c, #6366f1) 25%, transparent);
}

/* ================================================================
   TAG COLORED BADGES (in table cells / show header)
================================================================ */
.tag-badge-colored {
  display: inline-flex;
  align-items: center;
  padding: .1rem .45rem;
  border-radius: 100px;
  font-size: .7rem;
  font-weight: 500;
  background: color-mix(in srgb, var(--tag-color, #6366f1) 12%, transparent);
  color: var(--tag-color, #6366f1);
  border: 1px solid color-mix(in srgb, var(--tag-color, #6366f1) 25%, transparent);
  white-space: nowrap;
}
.link-tags-cell {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-width: 80px;
  max-width: 180px;
}

/* ================================================================
   TAG PICKER (in forms)
================================================================ */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.tag-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .65rem;
  border-radius: 100px;
  font-size: .8rem;
  cursor: pointer;
  /* sempre colorato come un badge, ma più opaco (non selezionato) */
  background: color-mix(in srgb, var(--chip-color, #6366f1) 8%, white);
  border: 1px solid color-mix(in srgb, var(--chip-color, #6366f1) 25%, transparent);
  color: color-mix(in srgb, var(--chip-color, #6366f1) 55%, #697386);
  transition: all .15s;
  user-select: none;
  font-family: inherit;
}
.tag-picker-chip:hover {
  background: color-mix(in srgb, var(--chip-color, #6366f1) 15%, white);
  border-color: color-mix(in srgb, var(--chip-color, #6366f1) 50%, transparent);
  color: var(--chip-color, #6366f1);
}
.tag-picker-chip.selected {
  background: color-mix(in srgb, var(--chip-color, #6366f1) 16%, white);
  border-color: var(--chip-color, #6366f1);
  color: var(--chip-color, #6366f1);
  font-weight: 600;
}
.tag-picker-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Spunta visibile solo quando selezionato */
.tag-check {
  font-size: .65rem;
  line-height: 1;
  display: none;
  flex-shrink: 0;
}
.tag-picker-chip.selected .tag-check { display: inline; }

/* X di rimozione: visibile solo su chip selezionati */
.tag-remove-x {
  display: none;
  margin-left: .15rem;
  font-size: .85rem;
  line-height: 1;
  opacity: .6;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0 .1rem;
}
.tag-remove-x:hover { opacity: 1; }
.tag-picker-chip.selected .tag-remove-x { display: inline; }

/* ================================================================
   TAG MANAGEMENT PAGE
================================================================ */
.tag-create-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.tag-desc-input { flex: 1; min-width: 180px; }
.tag-color-pick { display: flex; align-items: center; gap: .4rem; }
.input-color {
  width: 36px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 3px;
  cursor: pointer;
  background: var(--surface);
}
.tags-grid { display: grid; gap: .6rem; }
.tag-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.tag-card:hover { border-color: var(--primary); }
.tag-card-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}
.tag-card-info { flex: 1; min-width: 0; }
.tag-card-name { font-weight: 600; font-size: .9rem; }
.tag-card-desc { font-size: .8rem; color: var(--text-muted); margin-top: .1rem; }
.tag-card-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ── Email typo suggestion ── */
.email-typo-suggestion {
  margin-top: .35rem;
  padding: .45rem .75rem;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  font-size: .8rem;
  color: #78350f;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.email-typo-fix {
  background: none;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  padding: .1rem .55rem;
  font-size: .78rem;
  font-weight: 600;
  color: #92400e;
  cursor: pointer;
  transition: background .15s;
}
.email-typo-fix:hover { background: #fef3c7; }

/* ── Confirm email page ── */
.confirm-email-box {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
}
.confirm-email-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-all;
  margin-bottom: .25rem;
}
.confirm-email-edit-wrap {
  margin-top: 1rem;
  display: none;
}
.confirm-email-edit-wrap.open { display: block; }
.confirm-email-edit-wrap input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: .75rem;
}

/* ── Link type tabs (URL / File) ── */
.link-type-tabs {
  display: flex;
  gap: .5rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: -.1rem;
  margin-bottom: .25rem;
}
.link-type-tab {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
}
.link-type-tab:hover { color: var(--text-primary); }
.link-type-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── File drop area ── */
.file-drop-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.file-drop-area:hover,
.file-drop-area.drag-over {
  border-color: var(--primary);
  background: rgba(99,102,241,.04);
}
.file-drop-icon {
  color: var(--text-muted);
  margin-bottom: .75rem;
  display: flex;
  justify-content: center;
}
.file-drop-text {
  font-size: .9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── File link info badge (show page + index) ── */
.file-link-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: .2rem .6rem;
  font-size: .75rem;
  font-weight: 600;
}
.file-link-info-card {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.file-link-info-card .file-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  margin-bottom: .25rem;
}
.file-link-info-card .file-meta {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════
   BIO PAGE EDITOR
══════════════════════════════════════════════════════════════ */

/* Stats row */
.bio-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.bio-stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--stripe-shadow);
  padding: 1.1rem 1.25rem;
  text-align: center;
}
.bio-stat-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.bio-stat-lbl {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* Link search picker */
.bio-link-results {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  margin-top: .4rem;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.bio-link-result {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .65rem .875rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  position: relative;
}
.bio-link-result:last-child { border-bottom: none; }
.bio-link-result:hover { background: var(--surface); }
.bio-link-result--attached { opacity: .55; cursor: default; }
.bio-link-result--attached:hover { background: transparent; }
.bio-link-result-main {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.bio-link-result-title { font-weight: 600; font-size: .845rem; }
.bio-link-result-slug {
  font-size: .72rem;
  background: var(--surface);
  padding: .1rem .35rem;
  border-radius: 4px;
  color: var(--text-muted);
}
.bio-link-result-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.bio-link-result-dest {
  font-size: .72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bio-link-tag {
  font-size: .68rem;
  font-weight: 600;
  padding: .1rem .4rem;
  border-radius: 99px;
  border: 1px solid;
}
.bio-link-campaign {
  font-size: .7rem;
  color: var(--text-secondary);
  padding-left: .4rem;
  font-style: italic;
}
.bio-link-result-add {
  position: absolute;
  right: .875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary);
}
.bio-link-result-badge {
  position: absolute;
  right: .875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: .15rem .45rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}
.bio-link-result-empty {
  padding: .875rem;
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
}
.bio-link-result-empty a { color: var(--primary); }

/* Link stats table */
.bio-links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .845rem;
}
.bio-links-table th {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: .4rem .5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.bio-links-table td { padding: .5rem .5rem; border-bottom: 1px solid var(--border); }
.bio-links-table tr:last-child td { border-bottom: none; }

/* Template grid */
.bio-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .75rem;
}
.bio-tpl-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: .4rem;
  cursor: pointer;
  transition: border-color .15s;
  position: relative;
}
.bio-tpl-swatch:hover  { border-color: var(--primary); }
.bio-tpl-swatch.active { border-color: var(--primary); }
.bio-tpl-preview {
  display: block;
  width: 100%;
  height: 52px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.bio-tpl-name {
  font-size: .72rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
}
.bio-tpl-check {
  position: absolute;
  top: .3rem;
  right: .4rem;
  font-size: .7rem;
  color: var(--primary);
  font-weight: 700;
}

.bio-edit-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.bio-settings-col { position: sticky; top: calc(var(--topbar-h) + 1rem); }

/* Block items */
.bio-block-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  background: var(--bg);
  transition: box-shadow .15s;
}
.bio-block-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.bio-block-handle {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex-shrink: 0;
}
.bio-btn-move {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 24px;
  height: 22px;
  cursor: pointer;
  font-size: .7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
}
.bio-btn-move:hover { background: var(--surface); color: var(--text-primary); }
.bio-block-body { flex: 1; min-width: 0; }
.bio-block-view { display: flex; align-items: flex-start; gap: .5rem; }
.bio-block-icon { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }
.bio-block-title { font-weight: 600; font-size: .875rem; }
.bio-block-url {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bio-block-edit-wrap { margin-top: .6rem; }
.bio-block-actions {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
}
.bio-btn-toggle, .bio-btn-edit, .bio-btn-del {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
}
.bio-btn-toggle:hover, .bio-btn-edit:hover { background: var(--surface); }
.bio-btn-del:hover  { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.bio-toggle-on  { color: #16a34a; border-color: #86efac; }
.bio-toggle-off { color: var(--text-muted); }

/* Inline add/edit form */
.bio-inline-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

/* Theme option selector */
.bio-theme-opt {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  transition: border-color .15s;
}
.bio-theme-opt input[type="radio"] { display: none; }
.bio-theme-opt.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }

@media (max-width: 900px) {
  .bio-edit-grid { grid-template-columns: 1fr; }
  .bio-settings-col { position: static; }
  .bio-stats-row { grid-template-columns: repeat(2, 1fr); }
  .bio-template-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
@media (max-width: 480px) {
  .bio-stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ================================================================
   SIDEBAR UPGRADE BUTTON
================================================================ */
.sidebar-upgrade {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm, 6px);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: .4rem;
  transition: opacity .15s, transform .1s;
}
.sidebar-upgrade:hover { opacity: .9; transform: translateY(-1px); color: #fff; }
.sidebar-upgrade .sidebar-icon { color: #fff; opacity: .9; }

/* ================================================================
   TOPBAR UPGRADE AD AGENCY BUTTON
================================================================ */
.topbar-upgrade-agency {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff !important;
  border: none;
  font-weight: 600;
}
.topbar-upgrade-agency:hover { opacity: .88; color: #fff !important; }

/* ================================================================
   WORKSPACE SWITCHER (topbar dropdown)
================================================================ */
.ws-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ws-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: .25rem .5rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.4;
  transition: background .15s, border-color .15s;
  max-width: 220px;
}
.ws-switcher-btn:hover {
  background: var(--stripe-bg);
  border-color: var(--stripe-border);
}
.ws-switcher-btn .ws-switcher-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-switcher-chevron {
  flex-shrink: 0;
  transition: transform .2s;
  color: var(--text-muted);
}
.ws-switcher--open .ws-switcher-chevron { transform: rotate(180deg); }

.ws-switcher-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 500;
  min-width: 220px;
  max-width: 300px;
  background: #fff;
  border: 1px solid var(--stripe-border);
  border-radius: var(--radius);
  box-shadow: var(--stripe-shadow-lg);
  padding: .35rem;
}
.ws-switcher-dropdown[hidden] { display: none; }

.ws-switcher-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem .6rem;
  background: none;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  font-size: .84rem;
  transition: background .12s;
}
.ws-switcher-item:hover { background: var(--stripe-bg); }
.ws-switcher-item--active { background: rgba(99,91,255,.07); }
.ws-switcher-item--active:hover { background: rgba(99,91,255,.11); }

.ws-switcher-item-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.ws-switcher-item-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-switcher-item-role {
  font-size: .75rem;
  color: var(--text-muted);
}

/* Pallino colorato tipo */
.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ws-dot--own    { background: #635BFF; }   /* indigo — account proprio */
.ws-dot--member { background: #0EA5E9; }   /* sky — workspace a cui si è stati invitati */

/* Etichetta ruolo colorata */
.ws-role--own    { color: #635BFF; font-weight: 600; }
.ws-role--member { color: #0EA5E9; font-weight: 500; }

/* Bordo sinistro colorato per tipo */
.ws-switcher-item--own   { border-left: 3px solid #635BFF; }
.ws-switcher-item--member { border-left: 3px solid #0EA5E9; }

/* Mobile ws list in hamburger panel */
.mobile-ws-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .5rem .75rem .2rem;
  margin: 0;
}
.mobile-ws-list { padding-bottom: .25rem; }

/* ================================================================
   MOBILE: hamburger menu button (topbar, visibile solo ≤640px)
================================================================ */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: .5rem;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn:hover { background: var(--surface); color: var(--text); }

@media (max-width: 640px) {
  .mobile-menu-btn { display: flex; }

  /* Nascondi upgrade button topbar su mobile (c'è nel menu hamburger) */
  .topbar-right .btn { display: none; }
  .topbar-right .badge { display: none; }

  /* ── Contenimento overflow orizzontale ──
     Blocca a livello di app-shell + app-main;
     width: 100% impedisce che si allarghi per contenuto interno */
  .app-body .app-shell { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .app-body .app-main  { overflow-x: hidden; width: 100%; }

  /* ── Tabelle: scrollabili dentro il loro spazio ── */
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* ── Input search: niente min-width fissa ── */
  .input-search { min-width: 0; width: 100%; }

  /* ── Tag description input ── */
  .tag-desc-input { min-width: 0; }

  /* ── Iframe preview: non allarga la pagina ── */
  .preview-viewport { max-width: 100%; overflow: hidden; }
  .preview-viewport iframe { max-width: 100%; }

  /* ── Period selector ── */
  .period-selector-wrap { flex-wrap: wrap; gap: .5rem; }
  .period-btns { flex-wrap: wrap; }

  /* ── Link show: truncate più stretto ── */
  .truncate { max-width: 140px; }

  /* ── Plans grid: 1 colonna ── */
  .plans-grid { grid-template-columns: 1fr !important; }

  /* ── Bio template grid ── */
  .bio-template-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   MOBILE OVERFLOW — fix elementi tagliati a destra
   ============================================================ */

/* Slug display: non espandere oltre il card */
.slug-display code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Table-compact: stessa gestione di .table su mobile */
.table-scroll .table-compact,
.table-compact-scroll {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

@media (max-width: 768px) {
  /* Previeni overflow orizzontale globale nell'app */
  .app-body { overflow-x: hidden; }

  /* QR shape picker: vai a capo se non c'è spazio */
  .qr-shape-picker { flex-wrap: wrap; }

  /* Slug display */
  .slug-display { overflow: hidden; }

  /* Form row: già a 1fr a ≤640px, qui assicuriamo i campi non abbiano min-width fissa */
  .form-group input,
  .form-group select,
  .form-group textarea { max-width: 100%; box-sizing: border-box; }

  /* Conv channels grid: collassa prima */
  .conv-channels-grid { grid-template-columns: 1fr; }

  /* Reclick kpi row: va a capo */
  .reclick-kpi-row { flex-wrap: wrap; }

  /* Custom range wrap: impila gli input */
  .custom-range-wrap { flex-wrap: wrap; }
  .custom-range-wrap input[type="date"] { flex: 1 1 120px; }
}

/* ============================================================
   BIO PAGE EDITOR — fix mobile overflow
   ============================================================ */

/* Tabella statistiche link bio */
.bio-links-table {
  width: 100%;
  border-collapse: collapse;
}

/* Grid children: permettono di shrinkare sotto il contenuto */
.bio-settings-col,
.bio-blocks-col { min-width: 0; }

@media (max-width: 768px) {
  /* Scroll orizzontale per la tabella link bio */
  .bio-links-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Stats row: 2 colonne invece di 4 */
  .bio-stats-row { grid-template-columns: repeat(2, 1fr); }

  /* Color picker rows: va a capo se necessario */
  .bio-color-row { flex-wrap: wrap; }

  /* Grid children: contenimento overflow */
  .bio-settings-col,
  .bio-blocks-col { overflow: hidden; }

  /* Tutta la griglia editor: non più larga della viewport */
  .bio-edit-grid { overflow: hidden; }

  /* Guida: testo e code vanno a capo */
  .bio-guide-card { overflow: hidden; word-break: break-word; overflow-wrap: anywhere; }
  .bio-guide-card code { white-space: normal; word-break: break-all; }
  .bio-guide-card p,
  .bio-guide-card div,
  .bio-guide-card strong { max-width: 100%; }

  /* Bio block item: non espandere oltre il container */
  .bio-block-item { overflow: hidden; }
  .bio-block-body { overflow: hidden; }
  .bio-block-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Edit form dentro i blocchi: collassa a 1 col */
  .bio-block-edit-wrap .form-row { grid-template-columns: 1fr; }

  /* Input hex colore: non più wide del necessario */
  input[id$="_hex"] { max-width: 100px; }

  /* Input prefix group: input cresce fino al container */
  .input-prefix-group { overflow: hidden; }
  .input-prefix-group input { flex: 1; min-width: 0; }
}
