/* ==========================================================================
   Breefy · "Notte Elettrica"
   Indice (nell'ordine del file):
     1 Token · 2 Base · 3 Componenti · 4 Piattaforme · 5 Pagine admin · Lightbox · Marchio
     Shell (header, nav, tab bar) · Pagine elenco · Avatar cliente · Card post · Mockup nativo
     Metriche sotto la card · Modifica caption · Calendario · Dettaglio post · Cambia orario
     Analytics · Dettaglio analytics · Report mensile · Stampa · Impostazioni · Login
   Breakpoint unico 720px (max-width: 719px = mobile) + 1024px per le griglie a più colonne.

   Componenti (classi riusabili):
   .btn (+ -primary -dark -secondary -ghost -sm -icon)   bottoni
   .field                                                 etichetta + campo
   .badge (+ --accent --dark --error --warning --pending --signal-tint --signal)
   .chip / .chip.is-active                                filtro a pillola
   .segmented                                             selettore segmentato
   .tile (+ --hero --dark --insight --signal)             tessere dati
   .delta (+ --up --down --flat)                          variazioni
   .message (+ --success --info --error)                  avvisi
   .empty-state, .pagination, .post-card                  stati vuoti, pagine, card
   .pill-platform / .dot-platform + .platform-<nome>      colori piattaforma
   ========================================================================== */

/* ---------- 1. Token ---------- */

:root {
  /* superfici */
  --breefy-bg: #F4F1EC;
  --breefy-card: #FFFFFF;
  --breefy-surface: #EDE8E0;
  --breefy-border: #E4DDD3;
  --breefy-dark: #1B1714;
  --breefy-dark-2: #2A2420;
  --breefy-dark-3: #3A322C;
  /* testo */
  --breefy-text: #1B1714;
  --breefy-muted: #6B625A;
  --breefy-muted-2: #8A8176;
  --breefy-muted-dark: #BDB3A9;
  --breefy-on-dark: #F4F1EC;
  --breefy-on-dark-2: #D8D0C7;      /* testo corrente su espresso */
  --breefy-on-dark-3: #EDE6DE;      /* testo su immagine scura */
  --breefy-on-accent: #E4E1FF;      /* testo secondario su indaco */
  --breefy-eyebrow-dark: #C7C2FF;   /* etichetta su espresso */
  --breefy-text-2: #3D3631;         /* testo corrente su riquadri carta */
  --breefy-dashed: #D5CCC0;         /* bordo tratteggiato "nessun post" */
  --breefy-white: #FFFFFF;
  /* accenti */
  --breefy-accent: #5B4FF5;
  --breefy-accent-hover: #4436E0;
  --breefy-accent-tint: #EEEBFF;
  --breefy-accent-ink: #3F33D6;
  --breefy-accent-soft: #8A80FF;
  --breefy-lavender: #B9A8FF;
  --breefy-lavender-tint: #DCD6FF;
  --breefy-signal: #C6F432;
  --breefy-signal-tint: #F1FCCB;
  --breefy-signal-ink: #3A4710;
  /* stati */
  --breefy-error: #B4382B;
  --breefy-error-tint: #FBE4DF;
  --breefy-error-ink: #9F2F22;
  --breefy-success: #2F7D4F;
  --breefy-warning-tint: #FFEDD5;
  --breefy-warning-ink: #9A3412;
  --breefy-pending-tint: #EDE9FE;
  --breefy-pending-ink: #4C1D95;
  /* tipografia */
  --breefy-font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --breefy-font-ui: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* raggi */
  --breefy-radius-sm: 10px;
  --breefy-radius-md: 14px;
  --breefy-radius-lg: 20px;
  --breefy-radius-xl: 28px;
  --breefy-radius: 20px;
  --breefy-pill: 999px;
  /* ombre */
  --breefy-shadow-sm: 0 1px 2px rgba(27, 23, 20, 0.06);
  --breefy-shadow-md: 0 12px 32px rgba(27, 23, 20, 0.08);
  --breefy-shadow-lg: 0 24px 60px rgba(27, 23, 20, 0.14);
  --breefy-glow: 0 10px 28px rgba(91, 79, 245, 0.35);
  /* movimento */
  --breefy-ease: cubic-bezier(.2, .8, .2, 1);
  --breefy-fast: 160ms;
  --breefy-slow: 240ms;
  /* layout */
  --breefy-tabbar-h: 76px;
}

/* ---------- 2. Base ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--breefy-font-ui);
  font-size: 15px;
  line-height: 1.5;
  background: var(--breefy-bg);
  color: var(--breefy-text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  color: var(--breefy-accent-ink);
}

/* Numeri di metriche allineati in colonna. */
.num,
.tabular {
  font-variant-numeric: tabular-nums;
}

/* Focus visibile su tutti gli interattivi. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.btn:focus-visible,
.chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--breefy-bg), 0 0 0 5px var(--breefy-accent);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-property: color, background-color, border-color, opacity, box-shadow !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .post-card:hover,
  .tile:hover {
    transform: none !important;
  }
}







/* ---------- 3. Componenti ---------- */

/* Bottoni */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: var(--breefy-pill);
  font: 600 15px var(--breefy-font-ui);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--breefy-fast) ease, box-shadow var(--breefy-fast) ease, border-color var(--breefy-fast) ease, color var(--breefy-fast) ease;
}

.btn svg {
  flex: none;
}

.btn-primary {
  background: var(--breefy-accent);
  color: var(--breefy-white);
}

.btn-primary:hover {
  background: var(--breefy-accent-hover);
  box-shadow: var(--breefy-glow);
}

.btn-dark {
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
}

.btn-dark:hover {
  background: var(--breefy-dark-2);
}

.btn-dark .icon-signal {
  color: var(--breefy-signal);
}

.btn-secondary {
  background: var(--breefy-card);
  border: 1px solid var(--breefy-border);
  color: var(--breefy-text);
}

.btn-secondary:hover {
  border-color: var(--breefy-text);
}

.btn-ghost {
  background: transparent;
  color: var(--breefy-accent-ink);
  padding: 0 16px;
}

.btn-ghost:hover {
  background: var(--breefy-accent-tint);
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  gap: 6px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--breefy-card);
  border: 1px solid var(--breefy-border);
  color: var(--breefy-text);
}

.btn-icon:hover {
  border-color: var(--breefy-text);
}

.btn[disabled],
.btn.is-disabled {
  background: var(--breefy-surface);
  color: var(--breefy-muted);
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-block {
  width: 100%;
}

/* Campi */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--breefy-text);
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  height: 48px;
  padding: 0 18px;
  border: 1px solid var(--breefy-border);
  border-radius: var(--breefy-pill);
  background: var(--breefy-card);
  color: var(--breefy-text);
  font: 400 15px var(--breefy-font-ui);
  transition: border-color var(--breefy-fast) ease, box-shadow var(--breefy-fast) ease;
}

.field textarea {
  height: auto;
  padding: 16px 18px;
  border-radius: var(--breefy-radius-lg);
  line-height: 1.55;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  border-color: var(--breefy-accent);
  box-shadow: 0 0 0 4px var(--breefy-accent-tint);
}

.field.has-error > label {
  color: var(--breefy-error-ink);
}

.field.has-error input,
.field.has-error textarea,
.field textarea.is-over,
.field input.is-invalid {
  border-color: var(--breefy-error);
  box-shadow: 0 0 0 4px var(--breefy-error-tint);
}

.field-hint {
  font-size: 12px;
  color: var(--breefy-muted);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-accent-tint);
  color: var(--breefy-accent-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--accent { background: var(--breefy-accent-tint); color: var(--breefy-accent-ink); }
.badge--accent .dot { background: var(--breefy-accent); }
.badge--dark { background: var(--breefy-dark); color: var(--breefy-on-dark); }
.badge--dark .dot { background: var(--breefy-signal); }
.badge--error { background: var(--breefy-error-tint); color: var(--breefy-error-ink); }
.badge--error .dot { background: var(--breefy-error); }
.badge--warning { background: var(--breefy-warning-tint); color: var(--breefy-warning-ink); }
.badge--pending { background: var(--breefy-pending-tint); color: var(--breefy-pending-ink); }
.badge--signal-tint { background: var(--breefy-signal-tint); color: var(--breefy-signal-ink); }
.badge--signal { background: var(--breefy-signal); color: var(--breefy-dark); }
.badge--surface { background: var(--breefy-surface); color: var(--breefy-dark); }

/* Chip filtro */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--breefy-border);
  border-radius: var(--breefy-pill);
  background: var(--breefy-card);
  color: var(--breefy-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--breefy-fast) ease;
}

.chip:hover {
  border-color: var(--breefy-text);
}

.chip.is-active {
  background: var(--breefy-dark);
  border-color: var(--breefy-dark);
  color: var(--breefy-on-dark);
}

.chip .dot-platform {
  width: 8px;
  height: 8px;
}

/* Segmented */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-surface);
  max-width: 100%;
  overflow-x: auto;
}

.segmented a,
.segmented button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  margin: 0;
  border: none;
  border-radius: var(--breefy-pill);
  background: transparent;
  color: var(--breefy-muted);
  font: 600 14px var(--breefy-font-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.segmented a.is-active,
.segmented button.is-active,
.segmented [aria-current="true"] {
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
}

/* Tessere */
.tile {
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tile-label {
  font-size: 13px;
  color: var(--breefy-muted);
}

.tile-value {
  font: 800 36px/1 var(--breefy-font-display);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.tile--hero {
  background: var(--breefy-accent);
  color: var(--breefy-white);
  padding: 26px;
}

.tile--hero .tile-label { color: var(--breefy-on-accent); }
.tile--hero .tile-value { font-size: 60px; letter-spacing: -0.035em; }

.tile--dark {
  background: var(--breefy-dark-2);
  color: var(--breefy-on-dark);
}

.tile--dark .tile-label { color: var(--breefy-muted-dark); }

.tile--insight {
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
  padding: 26px;
  gap: 10px;
}

.tile--insight .tile-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--breefy-eyebrow-dark);
}

.tile--signal {
  background: var(--breefy-signal);
  color: var(--breefy-dark);
}

.tile--signal .tile-label { color: var(--breefy-signal-ink); font-weight: 700; }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--breefy-muted);
}

/* Delta */
.delta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: var(--breefy-pill);
  font-size: 12px;
  font-weight: 800;
  background: var(--breefy-surface);
  color: var(--breefy-muted);
  font-variant-numeric: tabular-nums;
}

.delta--up { background: var(--breefy-accent-tint); color: var(--breefy-accent-ink); }
.delta--down { background: var(--breefy-error-tint); color: var(--breefy-error-ink); }
.delta--flat { background: var(--breefy-surface); color: var(--breefy-muted); }
.tile--hero .delta--up { background: var(--breefy-signal); color: var(--breefy-dark); }
.tile--dark .delta { background: transparent; padding: 0; color: var(--breefy-lavender); font-size: 13px; font-weight: 600; }

/* Messaggi */
.message {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
  margin: 0 0 16px;
  border-radius: var(--breefy-radius-lg);
  font-size: 15px;
  background: var(--breefy-accent-tint);
  color: var(--breefy-accent-ink);
}

.message > svg {
  flex: none;
}

.message--success,
.message.success { background: var(--breefy-signal-tint); color: var(--breefy-signal-ink); }
.message--info { background: var(--breefy-accent-tint); color: var(--breefy-accent-ink); }
.message--error,
.message.error { background: var(--breefy-error-tint); color: var(--breefy-error-ink); }

/* Stato vuoto */
.empty-state {
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--breefy-muted);
  font-size: 15px;
}

.empty-state strong {
  font: 700 22px var(--breefy-font-display);
  letter-spacing: -0.015em;
  color: var(--breefy-text);
}

.empty-state p {
  margin: 0;
  max-width: 360px;
}

/* Paginazione */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 24px;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-card);
  border: 1px solid var(--breefy-border);
  color: var(--breefy-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.pagination a:hover:not(.active) {
  border-color: var(--breefy-text);
}

.pagination a.active {
  background: var(--breefy-dark);
  border-color: var(--breefy-dark);
  color: var(--breefy-on-dark);
  font-weight: 700;
}

/* Titoli */
.page-title,
h1.page-title {
  margin: 0;
  font: 800 44px/1 var(--breefy-font-display);
  letter-spacing: -0.03em;
}

.section-title {
  margin: 0;
  font: 700 24px/1.2 var(--breefy-font-display);
  letter-spacing: -0.015em;
}

/* ---------- 4. Colori per piattaforma ---------- */

.platform-instagram { --p-dot: #E1306C; --p-tint: #FCE7F3; --p-ink: #BE185D; }
.platform-facebook  { --p-dot: #1877F2; --p-tint: #DBEAFE; --p-ink: #1D4ED8; }
.platform-linkedin  { --p-dot: #0A66C2; --p-tint: #E0F2FE; --p-ink: #075985; }
.platform-pinterest { --p-dot: #E60023; --p-tint: #FEE2E2; --p-ink: #B91C1C; }
.platform-tiktok    { --p-dot: #1B1714; --p-tint: #1B1714; --p-ink: #F4F1EC; }
.platform-twitter,
.platform-threads,
.platform-bluesky   { --p-dot: #57534E; --p-tint: #EDE8E0; --p-ink: #1B1714; }
.platform-email     { --p-dot: #D97706; --p-tint: #FEF3C7; --p-ink: #92400E; }

.pill-platform {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--breefy-pill);
  background: var(--p-tint, var(--breefy-surface));
  color: var(--p-ink, var(--breefy-dark));
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: capitalize;
  white-space: nowrap;
}

.dot-platform {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--p-dot, #6B625A);
}

/* Compatibilità con il vecchio markup (badge con classe piattaforma) fino al restyle delle pagine. */
.badge[class*="platform-"] {
  background: var(--p-tint, var(--breefy-surface));
  color: var(--p-ink, var(--breefy-dark));
}

/* ---------- 5. Pagine admin (crea utente, genera chiave) ---------- */

.admin-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  position: relative;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  box-shadow: var(--breefy-shadow-md);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
}

.admin-page .card {
  max-width: 460px;
}

.card h1 {
  margin: 0 0 4px;
  font: 800 26px var(--breefy-font-display);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--breefy-muted);
  font-size: 14px;
}

.card form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 6px;
}

.card form input,
.card form select,
.card form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--breefy-border);
  border-radius: var(--breefy-radius-sm);
  font: 400 15px var(--breefy-font-ui);
  background: var(--breefy-white);
  color: var(--breefy-text);
}

.card form input:focus,
.card form select:focus,
.card form textarea:focus {
  border-color: var(--breefy-accent);
  box-shadow: 0 0 0 4px var(--breefy-accent-tint);
}

/* Il bottone a tutta larghezza vale solo per i form delle pagine admin. */
.card form button,
.admin-page button[type="submit"] {
  display: block;
  width: 100%;
  margin-top: 24px;
  height: 48px;
  border: none;
  border-radius: var(--breefy-pill);
  background: var(--breefy-accent);
  color: var(--breefy-white);
  font: 600 15px var(--breefy-font-ui);
  cursor: pointer;
}

.card form button:hover,
.admin-page button[type="submit"]:hover {
  background: var(--breefy-accent-hover);
}

code {
  font-size: 13px;
}

/* ---------- Lightbox ---------- */

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(27, 23, 20, 0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-overlay.open { display: flex; }

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-body img,
.lightbox-body video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--breefy-radius-md);
  display: block;
  background: var(--breefy-dark);
}

.lightbox-close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--breefy-white);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover { opacity: 0.7; }

/* ---------- Marchio ---------- */

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--breefy-text);
  text-decoration: none;
}

.brand-logo--dark { color: var(--breefy-on-dark); }

.brand-wordmark {
  font: 800 22px var(--breefy-font-display);
  letter-spacing: -0.04em;
}

/* ---------- Shell: header, navigazione, tab bar ---------- */

.app-page {
  min-height: 100vh;
}

.app-header {
  max-width: 1328px;
  margin: 0 auto;
  padding: 16px 24px 0;
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px 12px 20px;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  box-shadow: var(--breefy-shadow-md);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--breefy-text);
  text-decoration: none;
}

.app-tenant-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--breefy-muted);
  padding-left: 16px;
  border-left: 1px solid var(--breefy-border);
}

.app-nav {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-bg);
}

.app-nav a {
  padding: 9px 16px;
  border-radius: var(--breefy-pill);
  color: var(--breefy-muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--breefy-fast) ease, color var(--breefy-fast) ease;
}

.app-nav a:hover:not(.is-active) {
  color: var(--breefy-text);
}

.app-nav a.is-active {
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
}

.app-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tenant-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 6px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
}

.tenant-switcher svg {
  color: var(--breefy-muted-dark);
  pointer-events: none;
}

.tenant-switcher-avatar,
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--breefy-accent);
  color: var(--breefy-white);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
}

.tenant-switcher select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--breefy-on-dark);
  font: 600 14px var(--breefy-font-ui);
  padding: 0 2px 0 0;
  height: 40px;
  cursor: pointer;
}

.tenant-switcher select option {
  color: var(--breefy-text);
}

.tenant-switcher:focus-within {
  box-shadow: 0 0 0 3px var(--breefy-bg), 0 0 0 5px var(--breefy-accent);
}

/* Menu account */
.account-menu {
  position: relative;
}

.account-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.account-menu .avatar {
  width: 40px;
  height: 40px;
  background: var(--breefy-dark-2);
  font-size: 14px;
}

.account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 240px;
  padding: 8px;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-lg);
  box-shadow: var(--breefy-shadow-lg);
}

.account-panel .account-email {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--breefy-muted);
  overflow-wrap: anywhere;
}

.account-panel a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--breefy-radius-md);
  color: var(--breefy-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.account-panel a:hover {
  background: var(--breefy-bg);
}

.account-switcher {
  display: none;
  padding: 4px 4px 8px;
}

.app-main {
  max-width: 1328px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.tabbar {
  display: none;
}

@media (max-width: 719px) {
  .app-header {
    padding: 12px 16px 0;
  }

  .app-bar {
    padding: 8px 8px 8px 14px;
    border-radius: var(--breefy-radius-lg);
    gap: 10px;
  }

  .app-brand .brand-wordmark,
  .app-nav,
  .app-admin-badge,
  .tenant-switcher--bar {
    display: none;
  }

  .app-tenant-name {
    padding-left: 0;
    border-left: none;
    font-size: 15px;
    color: var(--breefy-text);
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-switcher {
    display: block;
  }

  .app-main {
    padding: 20px 16px calc(var(--breefy-tabbar-h) + 32px);
  }

  .tabbar {
    position: fixed;
    z-index: 40;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(var(--tab-count, 4), minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
    background: var(--breefy-dark);
    border-radius: 26px;
    box-shadow: var(--breefy-shadow-lg);
  }

  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 52px;
    border-radius: 18px;
    color: var(--breefy-muted-dark);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
  }

  .tabbar a.is-active {
    background: var(--breefy-accent);
    color: var(--breefy-white);
  }
}






@media (min-width: 720px) {
  .app-tenant-name.is-admin {
    display: none;
  }
}






/* ---------- Pagine elenco: testata, griglia, sezioni ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-sub {
  margin: 8px 0 0;
  color: var(--breefy-muted);
  font-size: 15px;
}

.list-section {
  margin-bottom: 32px;
}

.list-section .section-title {
  margin-bottom: 14px;
}

.section-title--signal {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ring-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--breefy-signal);
  box-shadow: 0 0 0 2px var(--breefy-dark);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 340px));
  gap: 16px;
  align-items: start;
}

/* ---------- Avatar cliente ---------- */

.avatar-initials,
.avatar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  font-weight: 700;
  overflow: hidden;
}

.avatar-initials--accent { background: var(--breefy-accent); color: var(--breefy-white); }
.avatar-initials--dark { background: var(--breefy-dark); color: var(--breefy-on-dark); }
.avatar-initials--light { background: var(--breefy-accent-tint); color: var(--breefy-accent-ink); }

.avatar-logo {
  object-fit: contain;
  background: var(--breefy-white);
  border: 1px solid var(--breefy-border);
}

/* ---------- Card post ---------- */

.post-card {
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--breefy-shadow-sm);
  min-width: 0;
  transition: transform var(--breefy-fast) ease, box-shadow var(--breefy-fast) ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--breefy-shadow-md);
}

.post-card--ring {
  box-shadow: 0 0 0 2px var(--breefy-signal);
}

.post-card--ring:hover {
  box-shadow: 0 0 0 2px var(--breefy-signal), var(--breefy-shadow-md);
}

.post-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 0;
}

.post-card-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--breefy-text);
  text-decoration: none;
}

a.post-card-date:hover {
  color: var(--breefy-accent-ink);
}

.post-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.post-card-badges .badge {
  font-size: 11px;
  padding: 4px 9px;
}

.post-card-actions {
  display: flex;
  gap: 8px;
}

.post-card-actions form {
  flex: 1;
}

.post-card-actions .btn {
  height: 44px;
  font-size: 14px;
  padding: 0 14px;
}

.post-card-actions > .btn {
  flex: 1;
}

.post-card-action {
  height: 44px;
  font-size: 14px;
}

.post-card-link {
  align-self: center;
  padding: 4px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--breefy-accent-ink);
  text-decoration: none;
}

.post-card-link:hover { text-decoration: underline; }

.post-card-note {
  margin: 0;
  padding: 0 6px 6px;
  font-size: 12px;
  color: var(--breefy-muted);
}

.post-card-failed {
  background: var(--breefy-bg);
  border-radius: var(--breefy-radius-lg);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  text-align: center;
  color: var(--breefy-error);
}

.post-card-failed strong { font-size: 15px; color: var(--breefy-text); }
.post-card-failed span { font-size: 13px; line-height: 1.45; color: var(--breefy-muted); }

/* Stati sotto la card: nuovo orario richiesto, modifica/cambio orario non riusciti */
.post-state {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--breefy-radius-lg);
  font-size: 13px;
  line-height: 1.45;
}

.post-state--warning { background: var(--breefy-warning-tint); color: var(--breefy-warning-ink); }
.post-state--error { background: var(--breefy-error-tint); color: var(--breefy-error-ink); }

.post-state-times {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.post-state-times .old { text-decoration: line-through; opacity: .75; }
.post-state blockquote { margin: 0; font-style: italic; }
.post-state .btn-ghost { color: inherit; padding: 0 12px; margin-left: -12px; text-decoration: underline; }
.post-state-form { margin: 0; }

/* ---------- Mockup nativo (restyle) ---------- */

.mockup-card {
  background: var(--breefy-white);
  border: 1px solid var(--breefy-surface);
  border-radius: var(--breefy-radius-lg);
  overflow: hidden;
}

.mockup-platform-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--p-ink, var(--breefy-muted));
  border-bottom: 1px solid var(--breefy-surface);
  text-transform: capitalize;
}

.mockup-platform-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.mockup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.mockup-avatar {
  display: flex;
  flex: none;
}

.mockup-identity {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.mockup-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mockup-meta {
  font-size: 12px;
  color: var(--breefy-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mockup-globe svg {
  width: 11px;
  height: 11px;
  display: block;
}

.mockup-caption {
  margin: 0 0 10px;
  padding: 0 14px;
  font-size: 13px;
  line-height: 1.5;
  height: 78px; /* esattamente 4 righe (13px * 1.5 * 4): mai taglia a metà */
  overflow: hidden;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.mockup-caption.expanded {
  height: auto;
  overflow: visible;
}

.mockup-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--breefy-bg);
}

.mockup-media a { display: block; height: 100%; }

.mockup-media-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--breefy-muted);
  font-size: 13px;
}

.mockup-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mockup-media-video {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--breefy-white);
  background: var(--breefy-dark);
}

.mockup-media-video svg { width: 44px; height: 44px; }

.mockup-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 14px;
  border-top: 1px solid var(--breefy-surface);
}

.mockup-actions svg { width: 20px; height: 20px; display: block; }
.mockup-actions-spacer { flex: 1; }

.mockup-actions-labeled {
  gap: 0;
  justify-content: space-between;
}

.mockup-actions-labeled span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--breefy-muted);
}

.mockup-actions-labeled svg { width: 17px; height: 17px; }

.mockup-linkedin .mockup-actions-labeled span:first-child,
.mockup-facebook .mockup-actions-labeled span:first-child { color: var(--p-ink); }

.mockup-pin-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--p-dot);
  color: var(--breefy-white);
  padding: 6px 14px;
  border-radius: var(--breefy-pill);
  font-size: 12px;
  font-weight: 700;
}

.mockup-pin-save svg { width: 14px; height: 14px; }

.thumb {
  display: block;
  width: 60px;
  height: 60px;
  border-radius: var(--breefy-radius-md);
  object-fit: cover;
  background: var(--breefy-surface);
  flex: none;
}

.count {
  color: var(--breefy-muted-2);
  font-weight: 700;
}

@media (max-width: 719px) {
  .page-title { font-size: 30px; }
  .section-title { font-size: 20px; }
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { margin-bottom: 16px; }
}




[hidden] { display: none !important; }

/* ---------- Modifica caption ---------- */

.back-link {
  margin-bottom: 18px;
  height: 44px;
  padding: 0 18px 0 12px;
  font-size: 14px;
}

.edit-head {
  margin-bottom: 22px;
}

.edit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 14px;
}

.editor {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 24px;
  align-items: start;
}

.editor-switch { grid-column: 1 / -1; justify-self: stretch; }
.editor-switch button { flex: 1; justify-content: center; }

.tile-panel {
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.editor .field > label {
  font-size: 14px;
  font-weight: 700;
}

.editor textarea {
  font-size: 16px;
  min-height: 260px;
  border-color: var(--breefy-accent);
  box-shadow: 0 0 0 4px var(--breefy-accent-tint);
}

.editor-counter {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--breefy-muted);
}

.editor-count strong { color: var(--breefy-text); font-variant-numeric: tabular-nums; }

.editor-bar {
  height: 6px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-bg);
  overflow: hidden;
}

.editor-bar span {
  display: block;
  width: 0;
  height: 6px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-accent);
  transition: width var(--breefy-fast) ease;
}

.editor-limit-msg { color: var(--breefy-error-ink); margin: 0; }

.editor-info {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--breefy-bg);
  font-size: 14px;
  line-height: 1.5;
  color: var(--breefy-text-2);
}

.editor-info svg { flex: none; margin-top: 1px; }

.editor-late { margin: 0; }

.editor-actions-note { display: none; }

.editor-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.editor-actions .btn { height: 50px; padding: 0 26px; }

.editor-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  min-width: 0;
}

.editor-preview-label { display: flex; align-items: center; gap: 8px; }

.editor-preview .mockup-card {
  border: none;
  border-radius: var(--breefy-radius-xl);
  background: var(--breefy-card);
}

.mockup-caption.is-preview {
  height: auto;
  overflow: visible;
  cursor: default;
  white-space: pre-line;
}

.preview-more { color: var(--breefy-muted); }

.editor-original {
  background: var(--breefy-card);
  border-radius: 22px;
  padding: 14px 18px;
  font-size: 14px;
}

.editor-original summary { cursor: pointer; font-weight: 600; }
.editor-original p { margin: 10px 0 0; color: var(--breefy-muted); line-height: 1.5; }

@media (max-width: 719px) {
  .editor { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-bottom: 150px; }
  .edit-head .page-title { font-size: 28px; }
  .tile-panel { padding: 0; background: transparent; }
  .editor textarea { min-height: 300px; border-radius: 22px; }
  .editor-info { display: none; }
  .editor-preview { max-width: none; }

  /* Con JS: una sola vista alla volta. */
  .editor[data-view="write"] .editor-preview { display: none; }
  .editor[data-view="preview"] .editor-write-fields { display: none; }

  /* Barra azioni fissa in basso (la tab bar qui si nasconde). */
  .editor-actions {
    position: fixed;
    z-index: 40;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--breefy-card);
    border-radius: var(--breefy-radius-xl);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--breefy-shadow-lg);
  }

  .editor-actions-note {
    display: block;
    margin: 0;
    padding: 0 8px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--breefy-muted);
    text-align: center;
  }

  .editor-actions-row { margin-top: 0; flex-wrap: nowrap; }
  .editor-actions-row .btn-primary { flex: 1; }
  .editor-actions-row .btn-secondary { display: none; }
}




@media (min-width: 720px) {
  .editor-switch { display: none !important; }
}




/* ---------- Calendario ---------- */

.cal-desktop { display: block; }
.cal-mobile { display: none; }

.cal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.cal-summary > a {
  text-decoration: none;
  color: var(--breefy-text);
}

.cal-summary-next {
  flex: 2 1 320px;
  background: var(--breefy-dark);
  color: var(--breefy-on-dark) !important;
  border-radius: 24px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cal-summary-next > span { display: flex; flex-direction: column; gap: 4px; }
.cal-summary-next strong { font-size: 16px; }

.thumb-lg { width: 52px; height: 52px; }

.eyebrow--dark { color: var(--breefy-eyebrow-dark); display: flex; align-items: center; gap: 8px; }

.dot-signal {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--breefy-signal);
  flex: none;
}

.cal-summary-tile {
  flex: 1 1 200px;
  background: var(--breefy-card);
  border-radius: 24px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.cal-summary-tile strong { font: 800 28px/1 var(--breefy-font-display); }
.cal-summary-tile span { font-size: 14px; color: var(--breefy-muted); }
.cal-summary-tile--signal { background: var(--breefy-signal-tint); }
.cal-summary-tile--signal span { color: var(--breefy-signal-ink); }
.cal-summary-tile--pending { background: var(--breefy-pending-tint); }
.cal-summary-tile--pending span { color: var(--breefy-pending-ink); }

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.cal-toolbar-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.cal-title { text-align: center; }
.cal-desktop .cal-title { min-width: 260px; font-size: 40px; }
.cal-year { color: var(--breefy-muted-2); font-weight: 700; }

.cal-scroll { overflow-x: auto; }

.cal-board {
  min-width: 900px;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-weekdays,
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.cal-weekdays {
  padding: 4px 8px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--breefy-muted);
}

.cal-cell {
  min-height: 140px;
  border-radius: var(--breefy-radius-lg);
  background: var(--breefy-bg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--breefy-text);
  min-width: 0;
  transition: box-shadow var(--breefy-fast) ease, background var(--breefy-fast) ease;
}

.cal-cell--blank { background: transparent; }

a.cal-cell:hover {
  background: var(--breefy-card);
  box-shadow: inset 0 0 0 1px var(--breefy-accent), var(--breefy-shadow-md);
}

.cal-cell.is-past { opacity: .5; }
.cal-cell.is-past:hover { opacity: 1; }

.cal-cell-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

.cal-cell.is-today {
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
}

.cal-cell.is-today:hover { background: var(--breefy-dark-2); box-shadow: var(--breefy-shadow-md); }

.cal-today-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-signal);
  color: var(--breefy-dark);
}

.cal-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--breefy-radius-sm);
  background: var(--breefy-card);
  white-space: nowrap;
  overflow: hidden;
}

.cal-entry-text { overflow: hidden; text-overflow: ellipsis; }

.cal-cell.is-today .cal-entry { background: var(--breefy-dark-2); }

.cal-more { font-size: 12px; font-weight: 700; color: var(--breefy-accent-ink); }
.cal-cell.is-today .cal-more { color: var(--breefy-lavender); }

/* Mobile */
.cal-m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cal-mobile .cal-title { font-size: 30px; text-align: left; letter-spacing: -0.025em; }
.cal-m-arrows { display: flex; gap: 6px; }

.cal-m-switch { display: flex; width: 100%; margin: 14px 0; }
.cal-m-switch a { flex: 1; justify-content: center; }

.cal-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  text-align: center;
  margin-bottom: 14px;
}

.cal-strip-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  min-height: 72px;
  border-radius: 16px;
  background: var(--breefy-card);
  font-size: 11px;
  font-weight: 600;
  color: var(--breefy-muted);
  text-decoration: none;
}

.cal-strip-day strong { font-size: 17px; color: var(--breefy-text); }
.cal-strip-count { font-size: 10px; font-weight: 700; color: var(--breefy-accent-ink); }
.cal-strip-day.is-past { opacity: .6; }
.cal-strip-day.is-today { box-shadow: inset 0 0 0 2px var(--breefy-accent); background: transparent; }
.cal-strip-day.is-selected { background: var(--breefy-dark); color: var(--breefy-muted-dark); opacity: 1; }
.cal-strip-day.is-selected strong { color: var(--breefy-white); }
.cal-strip-day.is-selected .cal-strip-count { color: var(--breefy-signal); font-weight: 800; }
.cal-strip-count:empty { visibility: hidden; }

.cal-m-summary {
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
  border-radius: 22px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.cal-m-next { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.cal-m-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-m-chips .badge { text-decoration: none; min-height: 28px; }
.cal-chip-dark { background: var(--breefy-dark-2); color: var(--breefy-on-dark); }

.cal-m-month {
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 12px 8px;
  margin-bottom: 14px;
}

.cal-m-weekdays,
.cal-m-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.cal-m-weekdays { font-size: 11px; font-weight: 700; color: var(--breefy-muted); padding-bottom: 6px; }

.cal-m-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 3px 0;
  text-decoration: none;
  color: var(--breefy-text);
}

.cal-m-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
}

.cal-m-day.is-past { opacity: .55; }
.cal-m-day.is-today .cal-m-num { box-shadow: inset 0 0 0 2px var(--breefy-accent); }
.cal-m-day.is-selected { opacity: 1; }
.cal-m-day.is-selected .cal-m-num { background: var(--breefy-dark); color: var(--breefy-white); }
.cal-m-dots { display: flex; gap: 3px; align-items: center; min-height: 8px; }
.cal-m-dots .dot-platform { width: 8px; height: 8px; }
.cal-m-plus { font-size: 10px; font-weight: 800; color: var(--breefy-muted); line-height: 1; }

.cal-m-dayhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 0 10px;
}

.cal-m-dayhead strong { font: 700 20px var(--breefy-font-display); letter-spacing: -0.01em; }
.cal-m-dayhead span { font-size: 13px; color: var(--breefy-muted); }

/* Agenda */
.agenda { display: flex; flex-direction: column; gap: 8px; }

.agenda-row {
  background: var(--breefy-card);
  border-radius: 22px;
  padding: 10px 12px 10px 10px;
  min-height: 72px;
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--breefy-text);
}

.agenda-row > svg { flex: none; color: var(--breefy-muted); }

.agenda-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.agenda-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.agenda-meta strong { font-size: 12px; }
.agenda-meta .pill-platform { font-size: 11px; padding: 3px 8px; }
.badge--sm { font-size: 11px; padding: 3px 8px; }
.agenda-text { font-size: 14px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--breefy-muted); }

@media (max-width: 719px) {
  .cal-desktop { display: none; }
  .cal-mobile { display: block; }
}


.cal-strip-count.is-zero { color: transparent !important; }

/* ---------- Dettaglio post ---------- */

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.detail-top .back-link { margin-bottom: 0; }
.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.detail-badges .badge { font-size: 12px; padding: 6px 12px; }
.detail-head { margin-bottom: 20px; }

.post-detail {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 360px);
  gap: 24px;
  align-items: start;
}

.post-detail-main .post-card:hover { transform: none; box-shadow: var(--breefy-shadow-sm); }
.detail-meta { margin: 10px 4px 0; font-size: 13px; color: var(--breefy-muted); }
.post-detail-side { display: flex; flex-direction: column; gap: 14px; }

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 14px;
}

.detail-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions-row > * { flex: 1; }
.detail-actions-row form { margin: 0; }
.detail-actions--static { background: transparent; padding: 0; }

@media (max-width: 719px) {
  .post-detail { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-bottom: 130px; }
  .detail-head .page-title { font-size: 28px; }
  .detail-actions {
    position: fixed;
    z-index: 40;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: var(--breefy-shadow-lg);
    gap: 4px;
  }
  .detail-actions .btn { height: 50px; }
  .detail-actions .btn-ghost { height: 44px; font-size: 14px; }
  .detail-actions--static { position: static; box-shadow: none; }
}



/* ---------- Cambia orario (dialogo su desktop, pannello dal basso su mobile) ---------- */

.chip--signal { background: var(--breefy-signal); border-color: var(--breefy-signal); color: var(--breefy-dark); font-weight: 700; }

.sheet-wrap { display: flex; justify-content: center; padding: 8px 0 32px; }
.sheet-backdrop { display: none; }

.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  box-shadow: var(--breefy-shadow-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-grip { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-title { margin: 0; font: 700 26px var(--breefy-font-display); letter-spacing: -0.015em; }
.sheet-close { background: var(--breefy-bg); border-color: transparent; }
.sheet-current { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--breefy-muted); }
.sheet-current strong { color: var(--breefy-text); }
.sheet-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sheet-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sheet-hint { margin: 0; font-size: 13px; line-height: 1.45; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.field-optional { font-weight: 400; color: var(--breefy-muted); }
.sheet .field textarea { border-radius: var(--breefy-radius-lg); padding: 12px 16px; }

@media (max-width: 719px) {
  .sheet-wrap { padding: 0; }
  .sheet-backdrop {
    display: block;
    height: 220px;
    border-radius: var(--breefy-radius-xl);
    overflow: hidden;
    position: relative;
  }
  .sheet-backdrop img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .sheet-backdrop::after { content: ''; position: absolute; inset: 0; background: rgba(27, 23, 20, 0.6); }
  .sheet-wrap { flex-direction: column; gap: 0; }
  .sheet {
    max-width: none;
    margin: -28px -16px 0;
    width: auto;
    position: relative;
    border-radius: 32px 32px 0 0;
    padding: 12px 20px 28px;
    box-shadow: 0 -12px 40px rgba(27, 23, 20, 0.12);
  }
  .sheet-grip { display: block; align-self: center; width: 44px; height: 5px; border-radius: var(--breefy-pill); background: var(--breefy-border); }
  .sheet-title { font-size: 24px; }
  .sheet-actions .btn-dark { flex: 1; height: 52px; }
  .sheet-actions .btn-secondary { display: none; }
  .sheet input[type="date"], .sheet input[type="time"] { height: 50px; font-size: 16px; }
}



/* ---------- Analytics ---------- */

.page-title--md { font-size: 40px; line-height: 1.05; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.custom-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}

.custom-range .field input { width: 170px; }

.bento {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.bento > * { min-width: 0; }
.bento--top > .tile--insight { flex: 2 1 560px; padding: 30px 32px; gap: 16px; }
.bento--top > .tile--hero { flex: 1 1 360px; padding: 28px; gap: 14px; }

.insight-lead {
  margin: 0;
  font: 600 29px/1.25 var(--breefy-font-display);
  letter-spacing: -0.01em;
}

.insight-figure { color: var(--breefy-signal); }

.insight-points {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--breefy-on-dark-2);
}

.insight-points li { display: flex; gap: 12px; align-items: flex-start; }
.insight-points strong { color: var(--breefy-on-dark); }

.insight-bullet {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--breefy-accent-soft);
}

.hero-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tile-sub { font-size: 13px; color: var(--breefy-on-accent); }
.hero-spark { margin-top: auto; padding-top: 6px; }
.hero-spark svg { display: block; width: 100%; height: 80px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.analytics-note { margin: 0 0 16px; font-size: 13px; color: var(--breefy-muted); }

.panel {
  flex: 1 1 380px;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 0;
}

.panel--wide { flex: 2 1 640px; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head--col { flex-direction: column; align-items: flex-start; gap: 4px; }
.section-title--sm { font-size: 20px; }

.analytics-chart-wrap { overflow-x: auto; }
.analytics-chart { width: 100%; min-width: 520px; height: auto; display: block; }
.analytics-chart-bar { fill: var(--breefy-accent); }
.analytics-chart-bar:hover { fill: var(--breefy-accent-hover); }
.analytics-chart-bar.is-best { fill: var(--breefy-signal); stroke: var(--breefy-dark); stroke-width: 2; }
.analytics-chart-none { fill: var(--breefy-surface); }
.analytics-chart-grid { stroke: var(--breefy-border); stroke-width: 1; }
.analytics-chart-axis { fill: var(--breefy-muted); font-size: 11px; font-family: inherit; }

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  font-size: 12px;
  color: var(--breefy-muted);
}

.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-sw { display: inline-block; width: 12px; height: 12px; border-radius: 4px; }
.legend-sw--bar { background: var(--breefy-accent); }
.legend-sw--best { background: var(--breefy-signal); box-shadow: inset 0 0 0 2px var(--breefy-dark); }
.legend-sw--none { border: 1px dashed var(--breefy-dashed); }

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: 76px repeat(7, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.heat-col { text-align: center; font-size: 12px; font-weight: 700; color: var(--breefy-muted); }
.heat-row { font-size: 12px; color: var(--breefy-muted); }

.heat-cell {
  display: block;
  height: 36px;
  border-radius: var(--breefy-radius-sm);
  border: 1px dashed var(--breefy-dashed);
}

.heat-1 { background: var(--breefy-accent-tint); border: none; }
.heat-2 { background: var(--breefy-lavender-tint); border: none; }
.heat-3 { background: var(--breefy-lavender); border: none; }
.heat-4 { background: var(--breefy-accent-soft); border: none; }
.heat-5 { background: var(--breefy-accent); border: none; }
.heat-cell.is-best { background: var(--breefy-signal); border: none; box-shadow: inset 0 0 0 2px var(--breefy-dark); }

.legend--heat .heat-cell { height: 14px; width: 22px; display: inline-block; border-radius: 4px; }
.heat-scale { display: inline-flex; gap: 2px; }

.best-slot {
  background: var(--breefy-signal);
  color: var(--breefy-dark);
  border-radius: var(--breefy-radius-lg);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.best-slot strong { font: 700 20px var(--breefy-font-display); }
.best-slot span { font-size: 13px; color: var(--breefy-signal-ink); }

/* Piattaforme */
.stack-wrap { display: flex; flex-direction: column; gap: 8px; }
.stack { display: flex; gap: 2px; height: 14px; border-radius: var(--breefy-pill); overflow: hidden; }
.stack-seg { display: block; background: var(--p-dot); min-width: 4px; }

.table-scroll { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--breefy-surface);
  vertical-align: middle;
}

.data-table thead th {
  font-size: 12px;
  font-weight: 700;
  color: var(--breefy-muted);
  white-space: nowrap;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody th { font-weight: 600; }
.muted-cell { color: var(--breefy-muted); font-size: 13px; }

.row-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--breefy-text);
  min-width: 260px;
}

.row-link:hover .row-link-text > span:first-child { text-decoration: underline; }
.row-link-text { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.row-link-text > span:first-child { font-weight: 600; }
.row-link .thumb { width: 44px; height: 44px; border-radius: var(--breefy-radius-sm); }

/* Top post */
.top-posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.top-post {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--breefy-text);
}

.top-post-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--breefy-radius-lg);
  overflow: hidden;
  background: var(--breefy-surface);
}

.top-post-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.top-post-rank {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: var(--breefy-pill);
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
  font-size: 12px;
  font-weight: 800;
}

.top-post-rank.is-first { background: var(--breefy-signal); color: var(--breefy-dark); }
.top-post-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--breefy-muted); }
.top-post-text { font-size: 14px; line-height: 1.4; }
.top-post-metric { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--breefy-muted); }
.top-post-metric strong { font: 800 24px var(--breefy-font-display); color: var(--breefy-text); letter-spacing: -0.02em; }
.top-post:hover .top-post-text { text-decoration: underline; }

.sparkline { display: block; }
.all-list { display: none; flex-direction: column; gap: 8px; }
.agenda-sub { font-size: 12px; color: var(--breefy-muted); }

@media (max-width: 1023px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


@media (max-width: 719px) {
  .page-title--md { font-size: 28px; }
  .insight-lead { font-size: 22px; }
  .bento--top > .tile--insight { padding: 22px 20px; flex-basis: 100%; }
  .bento--top > .tile--hero { flex-basis: 100%; padding: 22px 20px; }
  .tile--hero .tile-value { font-size: 52px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile-value { font-size: 30px; }
  .panel { padding: 20px 18px; flex-basis: 100%; }
  .top-posts { grid-template-columns: minmax(0, 1fr); }
  .top-post { flex-direction: row; flex-wrap: wrap; }
  .heatmap { grid-template-columns: 60px repeat(7, minmax(0, 1fr)); gap: 4px; }
  .all-table { display: none; }
  .all-list { display: flex; }
}


/* Dettaglio analytics di un post */
.post-detail--analytics { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
.post-detail--analytics .post-detail-main { display: flex; flex-direction: column; gap: 12px; }
.analytics-detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-title { display: flex; flex-direction: column; gap: 10px; }
.detail-title-pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.insight-lead--sm { font-size: 24px; }
.tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }
.tiles--4 .tile--hero .tile-value { font-size: 40px; }
.tiles--4 .tile--hero { padding: 22px; }

.part-bars { display: grid; grid-template-columns: auto 1fr auto; gap: 12px 14px; align-items: center; font-size: 14px; }
.part-bar { display: block; height: 10px; border-radius: var(--breefy-pill); background: var(--breefy-bg); overflow: hidden; }
.part-bar > span { display: block; height: 10px; border-radius: var(--breefy-pill); background: var(--breefy-accent); }

.compare { display: flex; flex-direction: column; gap: 14px; }
.compare-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.compare-head strong { font-weight: 700; }
.compare-track { position: relative; display: block; height: 10px; border-radius: var(--breefy-pill); background: var(--breefy-bg); }
.compare-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--breefy-pill); background: var(--breefy-accent); }
.compare-tick { position: absolute; top: -4px; width: 3px; height: 18px; margin-left: -1px; border-radius: 2px; background: var(--breefy-dark); }

.growth-chart { width: 100%; height: 200px; display: block; }
.growth-labels { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; font-size: 12px; color: var(--breefy-muted); font-variant-numeric: tabular-nums; }

.panel--details summary { cursor: pointer; font-weight: 600; }
.panel--details { gap: 12px; }

@media (max-width: 1023px) {
  .tiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


@media (max-width: 719px) {
  .post-detail--analytics { grid-template-columns: minmax(0, 1fr); }
  .post-detail--analytics .post-detail-main { order: 2; }
  .insight-lead--sm { font-size: 20px; }
}


/* ---------- Report mensile ---------- */

.report-page { background: var(--breefy-bg); padding: 16px 16px 48px; }

.report-bar {
  max-width: 900px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.report-bar-actions { margin-left: auto; display: inline-flex; gap: 8px; }

.report {
  max-width: 900px;
  margin: 0 auto;
  background: var(--breefy-card);
  border-radius: var(--breefy-radius-xl);
  overflow: hidden;
  box-shadow: var(--breefy-shadow-md);
}

.report-cover {
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
  padding: 32px 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.report-cover-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.report-client { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--breefy-muted-dark); }
.report-period { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--breefy-eyebrow-dark); }
.report-cover h1 { margin: 8px 0 0; font: 800 56px/0.98 var(--breefy-font-display); letter-spacing: -0.035em; }
.report-lead { margin: 0; max-width: 620px; font: 600 22px/1.3 var(--breefy-font-display); }

.report-body { padding: 28px 40px 8px; display: flex; flex-direction: column; gap: 22px; }
.report-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.report-tiles .tile { background: var(--breefy-bg); }
.report-tiles .tile--hero { background: var(--breefy-accent); }
.report-tiles .tile-value { font-size: 34px; }
.report-tiles .tile--hero .tile-value { font-size: 34px; }
.report-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.report-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.week-bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; }
.week-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; font-size: 12px; }
.week-bar-fill { display: block; width: 100%; border-radius: 8px 8px 4px 4px; background: var(--breefy-accent); }
.week-bar-fill.is-best { background: var(--breefy-signal); box-shadow: inset 0 0 0 2px var(--breefy-dark); }
.week-labels { display: flex; gap: 10px; font-size: 12px; color: var(--breefy-muted); }
.week-labels span { flex: 1; text-align: center; }

.report-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.report-top-item { display: flex; gap: 12px; align-items: center; min-width: 0; }
.report-top-item img, .report-top-noimg { width: 64px; height: 64px; flex: none; border-radius: var(--breefy-radius-md); object-fit: cover; background: var(--breefy-surface); }
.report-top-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.report-top-text strong { font-size: 14px; }

.report .best-slot-eyebrow { color: var(--breefy-signal-ink); }
.report .best-slot { margin: 0; }

.report-foot {
  margin-top: 22px;
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--breefy-muted);
  border-top: 1px solid var(--breefy-surface);
}

@media (max-width: 719px) {
  .report-cover { padding: 24px 20px 28px; }
  .report-cover h1 { font-size: 38px; }
  .report-lead { font-size: 18px; }
  .report-body { padding: 20px; }
  .report-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-cols, .report-top { grid-template-columns: minmax(0, 1fr); }
  .report-foot { padding: 14px 20px; }
}


/* ---------- Stampa ---------- */

@page { size: A4; margin: 12mm; }

@media print {
  .no-print,
  .app-header,
  .tabbar { display: none !important; }

  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; }
  body, .report-page { background: var(--breefy-white); padding: 0; }
  .report { max-width: none; border-radius: 0; }
  .report-cover { padding: 22px 26px 26px; gap: 14px; }
  .report-cover h1 { font-size: 40px; }
  .report-lead { font-size: 17px; }
  .report-body { padding: 18px 26px 4px; gap: 16px; }
  .report-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .report-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .report-top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-foot { padding: 10px 26px; margin-top: 12px; }
  .report-cover, .report-panel, .report-tiles { break-inside: avoid; }
  .week-bars { height: 120px; }
}


/* ---------- Login ---------- */

.auth-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--breefy-bg);
}

.auth-shell {
  width: 100%;
  max-width: 1160px;
  min-height: 680px;
  display: flex;
  flex-wrap: wrap;
  border-radius: 36px;
  overflow: hidden;
  background: var(--breefy-card);
  box-shadow: 0 30px 80px rgba(27, 23, 20, 0.16);
}

.auth-hero {
  position: relative;
  flex: 1 1 440px;
  min-height: 420px;
  background: var(--breefy-dark);
  color: var(--breefy-on-dark);
  overflow: hidden;
}

.auth-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 70%;
}

/* Velo scuro: il titolo deve leggersi bene sopra l'immagine. */
.auth-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 16, 13, .92) 0%, rgba(20, 16, 13, .78) 38%, rgba(20, 16, 13, .15) 62%, rgba(20, 16, 13, .55) 100%);
}

.auth-hero-content {
  position: relative;
  height: 100%;
  padding: 44px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-headline {
  margin: 12px 0 0;
  max-width: 420px;
  font: 800 52px/0.98 var(--breefy-font-display);
  letter-spacing: -0.035em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
}

.auth-lead {
  margin: 0;
  max-width: 360px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--breefy-on-dark-3);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}

.auth-pills {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-pills span {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--breefy-pill);
  background: rgba(27, 23, 20, 0.72);
  color: var(--breefy-on-dark);
}

.auth-pills .is-signal {
  background: var(--breefy-signal);
  color: var(--breefy-dark);
  font-weight: 700;
}

.auth-panel {
  flex: 1 1 440px;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
}

.auth-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  max-width: 380px;
}

.auth-title {
  margin: 0 0 12px;
  font: 800 36px var(--breefy-font-display);
  letter-spacing: -0.025em;
}

.auth-form .field input { height: 52px; padding: 0 20px; }
.auth-form .message { margin: 0; }
.auth-password-field { position: relative; display: block; }
.auth-password-field input { padding-right: 56px; }

.auth-password-toggle {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--breefy-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.auth-password-toggle:hover { color: var(--breefy-text); }

.auth-submit { margin-top: 8px; height: 54px; font-size: 16px; }
.auth-help { margin: 0; font-size: 13px; line-height: 1.5; color: var(--breefy-muted); }
.auth-foot { margin: 0; font-size: 12px; color: var(--breefy-muted); }

@media (max-width: 719px) {
  .auth-page { padding: 0; background: var(--breefy-dark); align-items: stretch; }
  .auth-shell { flex-direction: column; flex-wrap: nowrap; border-radius: 0; box-shadow: none; min-height: 100vh; background: transparent; }
  .auth-hero { flex: none; height: 360px; min-height: 0; }
  .auth-hero-bg { object-position: center 55%; }
  .auth-hero-scrim { background: linear-gradient(180deg, rgba(20, 16, 13, .9) 0%, rgba(20, 16, 13, .7) 45%, rgba(20, 16, 13, .2) 100%); }
  .auth-hero-content { padding: 28px 24px; gap: 14px; }
  .auth-headline { font-size: 34px; line-height: 1; max-width: 260px; margin-top: 6px; }
  .auth-lead, .auth-pills { display: none; }
  .auth-panel {
    flex: 1;
    margin-top: -32px;
    position: relative;
    background: var(--breefy-card);
    border-radius: 32px 32px 0 0;
    padding: 28px 22px 24px;
  }
  .auth-title { font-size: 28px; margin-bottom: 4px; }
  .auth-form { max-width: none; justify-content: flex-start; }
  .auth-form .field input { font-size: 16px; }
  .auth-help { text-align: center; }
  .auth-foot { text-align: center; margin-top: 12px; }
}

/* ---------- Impostazioni cliente (admin) ---------- */

.settings-form { max-width: 640px; }
.settings-preview { display: flex; align-items: center; gap: 12px; }

.check-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--breefy-bg);
  cursor: pointer;
  font-size: 15px;
}

.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--breefy-accent); flex: none; }

.app-tenant-name { display: inline-flex; align-items: center; gap: 8px; }

.app-brand { min-height: 44px; }

/* Bersagli touch >= 44px */
.app-brand { min-width: 44px; justify-content: center; }
a.post-card-date { display: inline-flex; align-items: center; min-height: 44px; }
.post-card-head { padding-top: 0; }
.post-card-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; }
.post-state .btn { height: 44px; }
.cal-m-chips .badge { min-height: 44px; padding: 0 16px; font-size: 13px; }

/* ---------- Eliminazione e rigenerazione ---------- */

.btn-danger { background: var(--breefy-error); color: var(--breefy-white); }
.btn-danger:hover { background: var(--breefy-error-ink); }

.sheet-sub { margin: 4px 0 0; font-size: 14px; color: var(--breefy-muted); }
.sheet-lead { margin: 0; font-size: 14px; color: var(--breefy-muted); }

.radio-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--breefy-border);
  border-radius: var(--breefy-radius-lg);
  background: var(--breefy-card);
  cursor: pointer;
  font-size: 15px;
}

.radio-card:has(input:checked) { border-color: var(--breefy-dark); box-shadow: 0 0 0 1px var(--breefy-dark); }
.radio-card input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--breefy-dark); flex: none; }
.radio-card > span, .radio-card-row > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.quota-pill { align-self: flex-start; margin-top: 4px; }

.radio-card--off { flex-direction: column; border-style: dashed; cursor: default; background: transparent; gap: 12px; }
.radio-card-row { display: flex; gap: 14px; align-items: flex-start; opacity: .7; }
.limit-box { font-size: 14px; line-height: 1.5; color: var(--breefy-text-2); padding: 12px 14px; border-radius: var(--breefy-radius-md); background: var(--breefy-bg); }

.sheet textarea { font-size: 16px; }
.sheet .editor-counter { margin-top: 4px; }

.post-card--placeholder { background: transparent; border: 2px dashed var(--breefy-lavender); box-shadow: none; }
.post-card--placeholder:hover { transform: none; box-shadow: none; }
.placeholder-body { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 16px 12px 20px; }
.placeholder-body blockquote { margin: 0; font-size: 14px; line-height: 1.45; font-style: italic; color: var(--breefy-text-2); }
.placeholder-meta { font-size: 12px; color: var(--breefy-muted); }

/* Eliminazione in corso: card attenuata */
.post-card--deleting .mockup-card { opacity: .5; filter: grayscale(1); }
.post-card--deleting .mockup-card + .post-state { margin-top: 0; }
.is-deleting-entry { text-decoration: line-through; opacity: .7; }
.post-card-delete { align-self: center; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--breefy-error); text-decoration: none; }
.post-card-delete:hover { text-decoration: underline; }
.cal-entry--placeholder { background: transparent !important; border: 1.5px dashed var(--breefy-lavender); }
.dot-empty { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--breefy-lavender); }
.agenda-row--placeholder { background: transparent; border: 2px dashed var(--breefy-lavender); }
.btn-danger-text { color: var(--breefy-error); } .btn-danger-text:hover { background: var(--breefy-error-tint); }

.settings-h2 { margin: 28px 0 14px; }
.regen-tile { flex: 1 1 360px; gap: 12px; }
.regen-tile .tile-sub { color: var(--breefy-muted-dark); }
.regen-blocks { display: flex; gap: 6px; flex-wrap: wrap; }
.regen-blocks span { width: 36px; height: 10px; border-radius: var(--breefy-pill); background: var(--breefy-signal); }
.regen-blocks span.is-used { background: var(--breefy-dark-3); }
.grant-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.grant-list li { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 14px; }
