/* Social Planner – Calendario Post styles
   Aligned with IamCarla design system (emerald, Inter, radius-12, shadows). */

:root {
  --sp-primary: var(--brand-green);
  --sp-primary-hover: var(--brand-green-hover);
  --sp-primary-light: var(--brand-green-100);
  --sp-primary-glow: 0 4px 14px 0 rgba(var(--brand-green-rgb), 0.15);
  --sp-orange: var(--color-warning);
  --sp-orange-light: var(--color-warning-tint);
  --sp-red: var(--color-danger);
  --sp-red-light: var(--color-danger-tint);
  --sp-blue: var(--color-info);
  --sp-blue-light: var(--color-info-tint);
  --sp-gray: var(--color-text-muted);
  --sp-gray-light: var(--neutral-100);
  --sp-text: var(--color-text);
  --sp-text-secondary: var(--color-text-secondary);
  --sp-text-muted: var(--color-text-faint);
  --sp-border: var(--color-border);
  --sp-border-light: var(--neutral-100);
  --sp-surface: var(--neutral-0);
  --sp-surface-alt: var(--color-surface-2);
  --sp-radius: 12px;
  --sp-radius-lg: 16px;
  --sp-radius-pill: 999px;
  --sp-shadow-sm: 0 1px 2px 0 rgba(var(--rgb-black), 0.05);
  --sp-shadow-md: 0 4px 6px -1px rgba(var(--rgb-black), 0.1);
  --sp-shadow-lg: 0 10px 15px -3px rgba(var(--rgb-black), 0.1);
  --sp-transition: 0.2s ease;

  /* Post STATO — pipeline pre-approvazione (bozza/da_approvare/programmato/…) arancio; approvato verde brand; pubblicato blu */
  --sp-post-bozza-bg: #ffedd5;
  --sp-post-bozza-ink: var(--color-warning-ink);
  --sp-post-bozza-dot: var(--color-orange-accent);
  --sp-post-da-approvare-bg: var(--color-ai-border);
  --sp-post-da-approvare-ink: var(--color-ai-ink);
  --sp-post-da-approvare-dot: var(--color-ai);
  --sp-post-approvato-bg: var(--sp-primary-light);
  --sp-post-approvato-ink: var(--brand-green-ink);
  --sp-post-approvato-dot: var(--sp-primary);
  --sp-post-pubblicato-bg: var(--color-info-tint);
  --sp-post-pubblicato-ink: var(--color-info-ink);
  --sp-post-pubblicato-dot: var(--color-info);
}

/* ── Page header ─────────────────────────────────────────── */

.social-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.social-page-header h1 {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--sp-text);
  margin: 0;
  letter-spacing: -0.025em;
}

.social-page-header .subtitle {
  color: var(--sp-text-secondary);
  font-size: var(--font-size-md);
  margin: 0.25rem 0 0;
  line-height: 1.5;
}

.social-page-header-left {
  flex: 1;
  min-width: 0;
}

/* Title + stats only; toolbar is React island #social-planner-header-root */
.social-page-header--title-only {
  margin-bottom: 0.5rem;
}

#social-planner-header-root {
  margin-bottom: 1.25rem;
}

.social-cal-stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.55rem;
  font-size: var(--font-size-caption);
  font-weight: 600;
}

.social-cal-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.social-cal-stat--approved {
  color: var(--sp-post-approvato-ink);
}

.social-cal-stat--bozze {
  color: var(--sp-post-bozza-ink);
}

.social-cal-stat-sep {
  color: var(--sp-border);
  font-weight: 500;
  font-size: var(--font-size-xs);
  user-select: none;
  padding: 0 0.1rem;
}

.social-cal-stat__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: var(--radius-round);
  flex-shrink: 0;
}

.social-cal-stat__dot--approved {
  background: var(--sp-post-approvato-dot);
}

.social-cal-stat__dot--draft {
  background: var(--sp-post-bozza-dot);
}

/* ── Primary CTA button (gradient emerald) ───────────────── */

.btn-social-green {
  background: linear-gradient(135deg, var(--sp-primary), var(--sp-primary-hover));
  color: var(--neutral-0);
  border: none;
  border-radius: var(--sp-radius);
  padding: 0.625rem 1.5rem;
  font-weight: 600;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: transform var(--sp-transition), box-shadow var(--sp-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--sp-primary-glow);
}

.btn-social-green:hover {
  transform: translateY(-1px);
  box-shadow: var(--sp-shadow-lg);
  color: var(--neutral-0);
}

/* ── Outline button ──────────────────────────────────────── */

.btn-social-outline {
  background: var(--sp-surface);
  color: var(--sp-primary);
  border: 2px solid var(--sp-primary);
  border-radius: var(--sp-radius);
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--sp-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.btn-social-outline:hover {
  background: var(--sp-primary);
  color: var(--neutral-0);
  border-color: var(--sp-primary);
  transform: translateY(-1px);
  box-shadow: var(--sp-shadow-md);
}

.btn-social-outline--sm {
  padding: 0.35rem 0.85rem;
  font-size: var(--font-size-caption);
}

/* ── Status dots ─────────────────────────────────────────── */

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-round);
  flex-shrink: 0;
  display: inline-block;
}

.status-dot.bozza,
.status-dot.da_approvare,
.status-dot.programmato,
.status-dot.generazione,
.status-dot.pubblicazione { background: var(--sp-post-bozza-dot); }
.status-dot.approvato    { background: var(--sp-post-approvato-dot); }
.status-dot.rifiutato    { background: var(--sp-red); }
.status-dot.pubblicato   { background: var(--sp-post-pubblicato-dot); }
.status-dot.errore       { background: var(--sp-red); }

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--sp-radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.status-label.bozza,
.status-label.da_approvare,
.status-label.programmato,
.status-label.generazione,
.status-label.pubblicazione { background: var(--sp-post-bozza-bg); color: var(--sp-post-bozza-ink); }
.status-label.approvato    { background: var(--sp-post-approvato-bg); color: var(--sp-post-approvato-ink); }
.status-label.rifiutato    { background: var(--sp-red-light); color: var(--color-danger-ink-bright); }
.status-label.pubblicato   { background: var(--sp-post-pubblicato-bg); color: var(--sp-post-pubblicato-ink); }

/* ═════════════════════════════════════════════════════════════════════════════
   SITO-STYLE POST EDITOR LAYOUT
   ═════════════════════════════════════════════════════════════════════════════ */

/* ── Editor Container ──────────────────────────────────────────────────────── */
.post-editor-container {
  background: var(--neutral-0);
  border-radius: var(--sp-radius-lg);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-sm);
  overflow: hidden;
  margin-bottom: 2rem;
  position: relative; /* needed for absolute loading overlay */
  z-index: 25; /* above planner chrome when both were visible; chrome is now hidden while open */
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: min(920px, calc(100vh - 110px));
}

/* Same workspace box as the SITO Pro studio (.sito-studio in sito_pro.css). */
@media (min-width: 1201px) {
  .post-editor-container {
    min-height: calc(100vh - 9.5rem);
    max-height: calc(100vh - 9.5rem);
    height: calc(100vh - 9.5rem);
    margin-bottom: 0;
  }
}

/* ── Editor Header ────────────────────────────────────────────────────────── */
.post-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem 0.55rem;
  border-bottom: 1px solid var(--sp-border);
  background: linear-gradient(180deg, var(--color-surface-empty) 0%, var(--neutral-0) 100%);
  flex-shrink: 0;
}

.post-editor-header h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--sp-text);
  display: flex;
  align-items: center;
}

/* Step rail — same visual language as the SITO wizard's ".sito-rail": a row
   of small pill buttons, each with a dashed-circle icon that fills in solid
   green once reached/complete, rather than plain flat-color text pills. */
.editor-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
  font-size: var(--font-size-caption);
  color: var(--color-gray-400);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  color: var(--color-text-subtle);
  font-weight: 500;
  font-size: inherit;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.step-badge:hover:not(.active) {
  background: rgba(var(--brand-green-rgb), 0.08);
  color: var(--sp-text);
}

.step-badge-icon {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: var(--radius-round);
  border: 1.5px dashed var(--color-gray-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  background: transparent;
  font-size: var(--font-size-2xs);
  line-height: 1;
}

.step-badge-icon i {
  display: block;
}

.step-badge.is-complete .step-badge-icon {
  border-style: solid;
  border-color: var(--sp-primary);
  background: var(--sp-primary);
  color: var(--neutral-0);
}

.step-badge.active {
  background: rgba(var(--brand-green-rgb), 0.14);
  color: var(--sp-text);
  font-weight: 700;
  cursor: default;
}

.step-badge.active .step-badge-icon {
  border-style: solid;
  border-color: var(--sp-primary);
  background: var(--sp-primary);
  box-shadow: 0 0 0 2.5px rgba(var(--brand-green-rgb), 0.22);
}

.step-badge.active:not(.is-complete) .step-badge-icon {
  color: transparent;
}

.editor-header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.editor-header-steps-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.editor-header-status {
  display: none;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-caption);
  font-weight: 600;
  color: var(--sp-text-muted);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--color-gray-100);
}

.editor-header-status__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  flex-shrink: 0;
}

.editor-header-status__dot--bozza {
  background: var(--sp-post-bozza-dot);
}

.editor-header-status__dot--approvato {
  background: var(--sp-post-approvato-dot);
}

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

/* Mini month modal (Programma step, calendario editor) */
.programma-month-modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 120;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.programma-month-modal.is-open {
  display: flex;
}

.programma-month-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--rgb-ink), 0.45);
  cursor: pointer;
}

.programma-month-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--neutral-0);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 1rem 1rem 0.75rem;
}

.programma-month-modal__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.programma-month-modal__title {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--sp-text);
}

.programma-month-modal__nav {
  border: none;
  background: var(--color-gray-100);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.programma-month-modal__nav:hover {
  background: var(--color-border-alt);
}

.programma-month-modal__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
  margin-bottom: 0.35rem;
  font-size: var(--font-size-2xs);
  font-weight: 600;
  color: var(--color-gray-400);
  text-align: center;
}

.programma-month-modal__dow-wknd {
  color: var(--neutral-300);
}

.programma-month-modal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.programma-month-modal__cell {
  border: 1px solid var(--color-border-alt);
  border-radius: var(--radius-sm);
  background: var(--neutral-50);
  padding: 0.2rem 0.1rem 0.35rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 3rem;
  transition: background 0.15s, border-color 0.15s;
}

.programma-month-modal__cell:hover:not(:disabled) {
  background: var(--neutral-100);
  border-color: var(--sp-primary);
}

.programma-month-modal__cell--other {
  opacity: 0.35;
  cursor: default;
}

.programma-month-modal__cell--today {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 1px rgba(var(--brand-green-rgb), 0.35);
}

.programma-month-modal__daynum {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-gray-700);
}

.programma-month-modal__dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
  min-height: 10px;
}

.programma-month-modal__minidot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-round);
  flex-shrink: 0;
}

.programma-month-modal__minidot--more {
  width: auto;
  height: auto;
  border-radius: 0;
  font-size: var(--font-size-3xs);
  font-weight: 700;
  color: var(--color-gray-400);
  background: transparent !important;
}

.programma-month-modal__footer {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-gray-100);
  display: flex;
  justify-content: flex-end;
}

.btn-close-editor {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--sp-text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-close-editor:hover {
  background: var(--sp-gray-light);
  color: var(--sp-text);
}

/* ── Split Layout ─────────────────────────────────────────────────────────── */
.editor-split-layout {
  display: grid;
  /* Same 50/50 workspace as SITO Pro (.sito-studio-main). */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  /* Force the single implicit row to fill 100% of this grid's own height
     instead of the default `auto` track, which sizes to content and only
     "happens" to look right when one column's content is tall enough to
     drive it — exactly what step 2's media grid (a flex:1/min-height:0
     chain with no intrinsic content size of its own) doesn't provide,
     collapsing .editor-form-panel (and everything in it) to ~1px even
     though align-items:stretch is meant to fill it. minmax(0,1fr) sidesteps
     the auto-track content measurement entirely. */
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 0;
  min-height: 0;
}

/* ── Left: Form Panel ─────────────────────────────────────────────────────── */
.editor-form-panel {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--neutral-0);
  border-right: 1px solid var(--sp-border);
  overflow: hidden; /* children control their own scroll */
  min-height: 0;
}

/* Scrollable sections wrapper (everything except the footer) */
.editor-form-panel .editor-sections-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Alias for the hidden-input outside sections ── */
.editor-form-panel > input[type="hidden"] {
  display: none;
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--sp-text);
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--sp-border);
}

.section-header i {
  color: var(--sp-primary);
  font-size: var(--font-size-lg);
}

.editor-form-panel .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.editor-form-panel .form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--sp-text);
  margin-bottom: 0;
}

.editor-form-panel .form-hint {
  font-size: var(--font-size-caption);
  color: var(--sp-text-muted);
  margin: 0;
}

.editor-form-panel .form-control,
.editor-form-panel .form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--font-size-md);
  color: var(--sp-text);
  background: var(--neutral-0);
  border: 1.5px solid var(--sp-border);
  border-radius: var(--sp-radius);
  transition: border-color var(--sp-transition), box-shadow var(--sp-transition);
  font-family: inherit;
  line-height: 1.5;
}

.editor-form-panel .form-control:focus,
.editor-form-panel .form-select:focus {
  outline: none;
  border-color: var(--sp-primary);
  box-shadow: var(--focus-ring);
}

.editor-form-panel .form-control::placeholder {
  color: var(--sp-text-muted);
}

.editor-form-panel textarea.form-control {
  resize: vertical;
}

/* ── Media Upload Zone ─────────────────────────────────────────────────────── */
.media-upload-zone {
  border: 2px dashed var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--sp-transition);
  background: var(--sp-surface-alt);
}

.media-upload-zone:hover,
.media-upload-zone.dragover {
  border-color: var(--sp-primary);
  background: var(--sp-primary-light);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-content i {
  font-size: var(--font-size-3xl);
  color: var(--sp-primary);
}

.upload-text {
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--sp-text);
}

.upload-hint {
  font-size: var(--font-size-xs);
  color: var(--sp-text-muted);
}

.media-preview-box {
  border-radius: var(--sp-radius);
  overflow: hidden;
  border: 1px solid var(--sp-border);
  max-height: 300px;
}

.media-preview-box img,
.media-preview-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.btn-remove-media {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: var(--sp-red-light);
  color: var(--sp-red);
  border: 1px solid var(--sp-red);
  border-radius: var(--sp-radius);
  font-size: var(--font-size-caption);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-remove-media:hover {
  background: var(--sp-red);
  color: var(--neutral-0);
}

/* ── Media Library Grid ───────────────────────────────────────────────────── */
.media-library-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.media-library-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.media-library-item:hover {
  border-color: var(--sp-primary);
  transform: scale(1.02);
}

.media-library-item.selected {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px rgba(var(--brand-green-rgb), 0.3);
}

.media-library-item img,
.media-library-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-type-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  top: auto;
  right: auto;
  background: rgba(var(--rgb-black), 0.6);
  color: var(--neutral-0);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-2xs);
  z-index: 2;
}

/* Corner delete on library tiles (Media Library, calendario step 2, wizard) */
.social-media-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 6;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-round);
  background: rgba(var(--rgb-ink), 0.82);
  color: var(--neutral-0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-3xs);
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s ease, transform 0.1s ease;
}

.social-media-delete-btn:hover {
  background: var(--color-danger-bright);
  transform: scale(1.08);
}

.social-media-delete-btn:focus-visible {
  outline: 2px solid var(--sp-primary);
  outline-offset: 2px;
}

.media-library-item-wrap,
.ai-media-tile-wrap {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: var(--radius-md);
}

.media-library-item-wrap > .media-library-item {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.media-card .social-media-delete-btn {
  opacity: 0;
  pointer-events: none;
}

.media-card:hover .social-media-delete-btn,
.media-card.selected .social-media-delete-btn,
.media-card:focus-within .social-media-delete-btn {
  opacity: 1;
  pointer-events: auto;
}

.media-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--sp-text-muted);
}

/* ── Caption Stats ─────────────────────────────────────────────────────────── */
.caption-stats {
  display: flex;
  gap: 1rem;
  font-size: var(--font-size-xs);
  color: var(--sp-text-muted);
}

/* ── Platform Selector ─────────────────────────────────────────────────────── */
.platform-selector {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.platform-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--sp-surface);
  border: 2px solid var(--sp-border);
  border-radius: var(--sp-radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.platform-chip:hover {
  border-color: var(--sp-primary);
}

.platform-chip input {
  display: none;
}

.platform-chip:has(input:checked) {
  border-color: var(--sp-primary);
  background: var(--sp-primary-light);
}

.platform-chip i {
  font-size: var(--font-size-lg);
}

.platform-chip[data-platform="instagram"] i { color: var(--color-instagram); }
.platform-chip[data-platform="facebook"] i { color: var(--color-facebook); }
.platform-chip[data-platform="tiktok"] i { color: var(--color-black); }

/* ── Secondary Actions ───────────────────────────────────────────────────── */
.secondary-actions {
  padding: 1rem;
  background: var(--sp-surface-alt);
  border-radius: var(--sp-radius);
  border: 1px solid var(--sp-border);
}

.secondary-actions-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Editor Footer / toolbar ─────────────────────────────────────────────── */
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--sp-border);
  background: var(--neutral-0);
  flex-shrink: 0;
  gap: 0.75rem;
}

/* Toolbar pinned to the left column (SITO .sito-wizard-nav / .sito-builder-foot). */
.editor-form-panel > .editor-toolbar.editor-footer {
  border-top: 1px solid var(--sp-border);
  border-bottom: none;
  background: linear-gradient(180deg, var(--color-surface-empty) 0%, var(--neutral-0) 100%);
  flex-shrink: 0;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--sp-surface);
  color: var(--sp-text-secondary);
  border: 2px solid var(--sp-border);
  border-radius: var(--sp-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: var(--sp-gray-light);
  border-color: var(--sp-text-muted);
}

.btn-green {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  background: linear-gradient(135deg, var(--sp-primary), var(--sp-primary-hover));
  color: var(--neutral-0);
  border: none;
  border-radius: var(--sp-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--sp-primary-glow);
}

.btn-green:hover {
  transform: translateY(-1px);
  box-shadow: var(--sp-shadow-md);
}

/* ── Secondary green action button (outline variant) ─────────────────────── */
.btn-green-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--sp-surface);
  color: var(--sp-primary);
  border: 2px solid var(--sp-primary);
  border-radius: var(--sp-radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-green-secondary:hover {
  background: var(--sp-primary);
  color: var(--neutral-0);
  transform: translateY(-1px);
  box-shadow: var(--sp-shadow-md);
}

/* ── Delete button (red) ────────────────────────────────────────────────────── */

.btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--sp-red);
  background: var(--sp-surface);
  border: 2px solid var(--sp-red);
  border-radius: var(--sp-radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete:hover {
  background: var(--sp-red);
  color: var(--neutral-0);
  border-color: var(--sp-red);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--rgb-danger), 0.25);
}

/* ── Right: Preview Panel ─────────────────────────────────────────────────── */
.editor-preview-panel {
  background: var(--color-surface-ios);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

/* Preview device caption (calendar editor — single mobile target) */
.preview-device-caption {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--sp-text-muted);
  letter-spacing: 0.02em;
}

.preview-device-caption i {
  font-size: var(--font-size-base);
  opacity: 0.85;
}

/* iPhone Mockup Container */
.iphone-mockup-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

/* iPhone Frame — same true-to-device-proportions system as the SITO wizard
   preview (web/assets/css/sito.css: ".sito-page .iphone-frame"). Everything
   below is expressed in device points (440 x 956 logical) via --phone-pt, so
   the frame, dynamic island and status bar all stay in proportion at any
   --phone-frame-w instead of the mismatched fixed-px numbers this used to
   have. Kept as its own unscoped copy (not a shared selector with sito.css)
   because this page doesn't load sito.css and the two screens' content model
   differs — sito's is a fixed-aspect-ratio iframe, this one is a scrollable
   post-detail view. */
.iphone-frame {
  --phone-frame-w: 320px;
  --phone-bezel: calc(var(--phone-frame-w) * 0.0375);
  --phone-ring: max(1px, calc(var(--phone-frame-w) * 0.00625));
  --phone-screen-w: calc(var(--phone-frame-w) - 2 * var(--phone-bezel));
  --phone-pt: calc(var(--phone-screen-w) / 440); /* 1 device point, in px */
  --phone-screen-radius: calc(58 * var(--phone-pt));

  width: var(--phone-frame-w);
  max-width: 100%;
  background: var(--color-ink-ios);
  border-radius: calc(var(--phone-screen-radius) + var(--phone-bezel));
  padding: var(--phone-bezel);
  box-shadow:
    0 0 0 var(--phone-ring) var(--color-charcoal),
    0 25px 50px -12px rgba(var(--rgb-black), 0.5),
    inset 0 0 0 1px rgba(var(--rgb-white), 0.1);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
  box-sizing: border-box;
}

.iphone-frame::after {
  content: '';
  position: absolute;
  inset: var(--phone-bezel);
  border-radius: var(--phone-screen-radius);
  box-shadow: 0 0 0 var(--phone-bezel) var(--color-ink-ios);
  pointer-events: none;
  z-index: 10;
}

.iphone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  z-index: 10;
}

.notch-bar {
  width: 100%;
  height: 100%;
  background: var(--color-ink-ios);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.iphone-screen {
  background: var(--neutral-0);
  border-radius: var(--phone-screen-radius, 40px); /* stylelint-disable-line declaration-property-value-disallowed-list -- device mockup screen corner */
  overflow-y: auto; /* scroll but hidden — content stays navigable in mockup */
  overflow-x: hidden;
  aspect-ratio: 440 / 956; /* same logical display as SITO .sito-iphone-screen */
  height: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  position: relative;
}

.iphone-screen::-webkit-scrollbar {
  display: none; /* Chrome / Safari — hide native scrollbar inside phone mockup */
}

/* iPhone 17–style screen: Dynamic Island + status bar + post detail */
.iphone-screen-post-detail {
  position: relative;
  padding-bottom: calc(22 * var(--phone-pt));
}

/* Dynamic Island: 125 x 36.7 pt, 11 pt below the top of the display — same
   device-point formula as sito.css's ".sito-page .iphone-dynamic-island". */
.iphone-dynamic-island {
  position: absolute;
  top: calc(11 * var(--phone-pt));
  left: 50%;
  transform: translateX(-50%);
  width: calc(125 * var(--phone-pt));
  height: calc(36.7 * var(--phone-pt));
  background: var(--color-black);
  border-radius: var(--radius-pill);
  z-index: 5;
  box-shadow: inset 0 1px 2px rgba(var(--rgb-white), 0.06);
}

/* In-flow (not overlaid) status bar — this screen has real scrollable content
   below it rather than sito's full-bleed iframe, so it takes real layout
   space instead of absolutely overlaying; the column widths and sizes still
   follow the same device-point formula so the row reads correctly centered
   around the island at any --phone-frame-w. */
.iphone-status-bar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr calc(133 * var(--phone-pt)) 1fr;
  align-items: center;
  height: calc(62 * var(--phone-pt));
  padding-bottom: calc(3.3 * var(--phone-pt));
  font-size: calc(17 * var(--phone-pt));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--color-black);
}

.iphone-status-time {
  grid-column: 1;
  justify-self: center;
  padding-left: calc(6 * var(--phone-pt));
}

.iphone-status-icons {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: calc(5 * var(--phone-pt));
  padding-right: calc(20 * var(--phone-pt));
  font-size: calc(13 * var(--phone-pt));
}

.iphone-status-icons svg {
  display: block;
  height: auto;
}

.iphone-status-icons .ios-signal {
  width: calc(17 * var(--phone-pt));
}

.iphone-status-icons .ios-wifi {
  width: calc(16 * var(--phone-pt));
}

.iphone-status-icons .ios-battery {
  width: calc(27 * var(--phone-pt));
}

.post-detail-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem 0.5rem 0.5rem;
  border-bottom: 1px solid var(--neutral-100);
}

.post-detail-header .pdh-icon-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--neutral-900);
  font-size: var(--font-size-xl);
  line-height: 1;
  cursor: default;
}

.post-detail-header .pdh-follow {
  flex-shrink: 0;
  padding: 0.28rem 0.65rem;
  font-size: var(--font-size-2xs);
  font-weight: 600;
  color: var(--neutral-0);
  background: var(--color-messenger);
  border: none;
  border-radius: var(--radius-xs);
  cursor: default;
}

.post-detail-header .pdh-profile {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.25rem;
}

.post-detail-header .pdh-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-round);
  object-fit: cover;
  border: 1.5px solid var(--color-instagram);
  flex-shrink: 0;
}

.post-detail-header .pdh-names {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.app-header {
  padding: 1rem;
  border-bottom: 1px solid var(--neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  color: var(--color-ink-ios);
}

/* Instagram Post Preview */
.insta-post {
  font-size: var(--font-size-sm);
}

.insta-post-detail .insta-caption {
  padding-top: 0.35rem;
}

.insta-post-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.insta-header-names {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.insta-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-round);
  object-fit: cover;
  border: 2px solid var(--color-instagram);
}

.insta-username {
  font-weight: 600;
  color: var(--color-ink-ios);
  font-size: var(--font-size-caption);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insta-verified-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  color: var(--color-messenger);
  font-size: var(--font-size-xs);
  line-height: 1;
}

.insta-verified-badge[hidden] {
  display: none !important;
}

.insta-menu {
  color: var(--color-gray-400);
}

.insta-media {
  aspect-ratio: 1;
  background: var(--color-gray-100);
  overflow: hidden;
}

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

.insta-media-placeholder,
.preview-media-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--color-gray-300);
}

.insta-media-placeholder i,
.preview-media-placeholder i {
  font-size: var(--font-size-6xl);
}

.insta-action-block {
  border-bottom: 1px solid var(--color-gray-100);
}

.insta-action-block .insta-actions {
  padding-bottom: 0.35rem;
}

.insta-carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  padding: 0 1rem 0.65rem;
}

.insta-carousel-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-round);
  background: var(--color-gray-300);
}

.preview-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neutral-900);
}

.preview-carousel-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-carousel-stage .preview-media-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: var(--radius-round);
  background: rgba(var(--rgb-ink), 0.55);
  color: var(--neutral-0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.preview-carousel-nav--prev { left: 6px; }
.preview-carousel-nav--next { right: 6px; }

.preview-carousel-nav:hover {
  background: rgba(var(--rgb-ink), 0.82);
}

.media-upload-zone-v2--busy {
  pointer-events: none;
  opacity: 0.85;
}

.insta-carousel-dots .dot.active {
  background: var(--color-messenger);
}

.insta-likes-line {
  padding: 0.4rem 1rem 0.25rem;
  font-size: var(--font-size-caption);
  font-weight: 600;
  color: var(--color-ink-ios);
}

.insta-comments-teaser {
  padding: 0 1rem 0.45rem;
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
}

.insta-comment-count {
  color: var(--color-gray-400);
}

.iphone-home-indicator {
  position: absolute;
  left: 50%;
  bottom: calc(8 * var(--phone-pt));
  transform: translateX(-50%);
  width: calc(140 * var(--phone-pt));
  height: calc(5 * var(--phone-pt));
  margin: 0;
  background: rgba(var(--rgb-black), 0.55);
  border-radius: var(--radius-pill);
  opacity: 1;
  z-index: 6;
  pointer-events: none;
}

.insta-actions {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: var(--font-size-xl);
  color: var(--color-ink-ios);
}

.insta-actions-left {
  display: flex;
  gap: 1rem;
}

.insta-save {
  color: var(--color-ink-ios);
}

.insta-caption {
  padding: 0 1rem 0.5rem;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--color-gray-700);
}

.insta-caption-user {
  font-weight: 700;
  color: var(--color-ink-ios);
  margin-right: 0.25rem;
}

.insta-timestamp {
  padding: 0 1rem 1rem;
  font-size: var(--font-size-2xs);
  color: var(--color-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Preview Caption */
.preview-caption {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-caption);
  color: var(--sp-text-muted);
  font-weight: 500;
}

/* ═════════════════════════════════════════════════════════════════════════════
   WEEK CALENDAR VIEW
   ═════════════════════════════════════════════════════════════════════════════ */

.week-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.weekday-header {
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--sp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem;
  border-radius: var(--sp-radius);
}

.weekday-header.weekend {
  color: var(--sp-primary);
  background: var(--sp-primary-light);
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.75rem;
}

.week-day-cell {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  min-height: 380px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--sp-transition);
}

.week-day-cell:hover {
  border-color: var(--sp-primary);
  box-shadow: var(--sp-shadow-md);
}

.week-day-cell.today {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 2px rgba(var(--brand-green-rgb), 0.2);
}

.week-day-cell.weekend {
  background: var(--neutral-100);
  border-color: var(--color-success-border);
}

.week-day-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--sp-border-light);
  background: var(--sp-surface-alt);
}

.week-day-header .day-number {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--sp-text);
}

.week-day-header .day-month {
  font-size: var(--font-size-2xs);
  color: var(--sp-text-muted);
  text-transform: uppercase;
}

.week-day-cell.today .week-day-header {
  background: var(--sp-primary-light);
}

.week-day-cell.today .day-number {
  color: var(--sp-primary);
}

.week-day-posts {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Week day post card (Instagram-style) ─── */

.week-day-post {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border-light);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  transition: all var(--sp-transition);
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--sp-shadow-sm);
}

.week-day-post:hover {
  border-color: var(--sp-primary);
  box-shadow: var(--shadow-brand);
  transform: translateY(-1px);
}

/* Header: avatar + username + delete */
.ig-card-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--sp-border-light);
}

.ig-card-avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-round);
  object-fit: cover;
  border: 1.5px solid var(--sp-border);
  flex-shrink: 0;
}

.ig-card-username {
  font-weight: 700;
  font-size: var(--font-size-2xs);
  color: var(--sp-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ig-card-header .insta-verified-badge.ig-card-verified {
  font-size: var(--font-size-2xs);
  margin-left: -0.125rem;
}

.post-card-delete {
  background: none;
  border: none;
  padding: 0.125rem 0.25rem;
  cursor: pointer;
  color: var(--sp-text-muted);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-xs);
  transition: color var(--sp-transition), background var(--sp-transition);
  line-height: 1;
}

.post-card-delete:hover {
  color: var(--sp-red);
  background: var(--sp-red-light);
}

.post-card-delete:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Media area */
.ig-card-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--sp-gray-light);
  overflow: hidden;
  position: relative;
}

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

.ig-card-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ig-card-no-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sp-text-muted);
  font-size: var(--font-size-2xl);
  background: var(--sp-surface-alt);
}

/* Action icons */
.ig-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.5rem 0.15rem;
}

.ig-card-icons {
  display: flex;
  gap: 0.4rem;
}

.ig-card-actions i {
  font-size: var(--font-size-sm);
  color: var(--sp-text);
}

/* Caption */
.ig-card-caption {
  padding: 0 0.5rem 0.2rem;
  font-size: var(--font-size-2xs);
  color: var(--sp-text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ig-card-caption-user {
  font-weight: 700;
  color: var(--sp-text);
}

.ig-card-caption-text {
  font-weight: 400;
}

/* Footer: time + status */
.ig-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.5rem 0.4rem;
  border-top: 1px solid var(--sp-border-light);
  margin-top: 0.1rem;
}

.ig-card-time {
  font-size: var(--font-size-3xs);
  color: var(--sp-text-muted);
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.ig-card-time i {
  font-size: var(--font-size-3xs);
}

.status-badge-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: var(--font-size-3xs);
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--sp-gray-light);
  color: var(--sp-text-secondary);
}

.status-badge-sm.bozza,
.status-badge-sm.da_approvare,
.status-badge-sm.programmato,
.status-badge-sm.generazione,
.status-badge-sm.pubblicazione { background: var(--sp-post-bozza-bg); color: var(--sp-post-bozza-ink); }
.status-badge-sm.approvato    { background: var(--sp-post-approvato-bg); color: var(--sp-post-approvato-ink); }
.status-badge-sm.pubblicato   { background: var(--sp-post-pubblicato-bg); color: var(--sp-post-pubblicato-ink); }
.status-badge-sm.rifiutato    { background: var(--sp-red-light); color: var(--sp-red); }
.status-badge-sm.errore       { background: var(--sp-red-light); color: var(--sp-red); }

/* Legacy classes – kept for backward compat */
.week-day-post .post-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex-shrink: 0;
}

.week-day-post .post-thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--sp-gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sp-text-muted);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.week-day-post .post-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.week-day-post .post-time {
  font-weight: 600;
  color: var(--sp-text-secondary);
  font-size: var(--font-size-2xs);
}

.week-day-post .post-platforms {
  display: flex;
  gap: 0.25rem;
}

.week-day-post .post-platforms i {
  font-size: var(--font-size-2xs);
  color: var(--sp-text-muted);
}

/* ── Month overview (compact pills under week grid) ─────── */

.month-calendar-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sp-border);
}

.month-calendar-head {
  margin-bottom: 0.75rem;
}

.month-calendar-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  margin: 0;
  color: var(--sp-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.month-calendar-title i {
  color: var(--sp-primary);
  font-size: var(--font-size-lg);
}

.month-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.375rem;
}

.month-cal-dow {
  font-size: var(--font-size-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sp-text-muted);
  text-align: center;
  padding: 0.25rem 0;
}

.month-cal-dow-weekend {
  color: var(--sp-text-secondary);
}

.month-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.month-cal-cell {
  border: 1px solid var(--sp-border-light);
  border-radius: var(--sp-radius);
  background: var(--sp-surface);
  min-height: 5.5rem;
  padding: 0.35rem 0.3rem 0.4rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.month-cal-cell-other {
  opacity: 0.48;
  background: var(--sp-surface-alt);
}

.month-cal-cell-today {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 1px rgba(var(--brand-green-rgb), 0.22);
}

.month-cal-daynum {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--sp-text-secondary);
  margin-bottom: 0.2rem;
  flex-shrink: 0;
}

.month-cal-cell-today .month-cal-daynum {
  color: var(--sp-primary);
}

.month-cal-posts {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.month-cal-pill {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: var(--radius-xs);
  padding: 0.15rem 0.25rem;
  background: rgba(var(--rgb-ink), 0.04);
  cursor: pointer;
  font-size: var(--font-size-2xs);
  line-height: 1.25;
  color: var(--sp-text);
  transition: background var(--sp-transition);
  min-width: 0;
}

.month-cal-pill:hover {
  background: rgba(var(--rgb-ink), 0.09);
}

.month-cal-pill .status-dot {
  margin-top: 0.15rem;
}

.month-cal-pill-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.month-calendar-empty {
  margin-top: 1rem;
  padding: 1rem;
}

@media (max-width: 768px) {
  .month-cal-cell {
    min-height: 4.25rem;
  }

  .month-cal-pill {
    font-size: var(--font-size-3xs);
  }

  .month-cal-pill-text {
    -webkit-line-clamp: 2;
  }
}

/* ── Empty state ─────────────────────────────────────────── */

.social-empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--sp-text-muted);
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  box-shadow: var(--sp-shadow-sm);
}

.social-empty-state i {
  font-size: var(--font-size-6xl);
  margin-bottom: 1.25rem;
  color: var(--sp-primary);
  opacity: 0.5;
}

.social-empty-state p {
  margin: 0;
  line-height: 1.6;
}

.social-empty-state p:first-of-type {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--sp-text);
  margin-bottom: 0.375rem;
}

.social-empty-state p:last-of-type {
  font-size: var(--font-size-caption);
}

.social-empty-state .btn-social-green {
  margin-top: 1.25rem;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1200px) {
  .editor-split-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    flex: none;
    min-height: auto;
    max-height: none;
  }

  /* Media step: anteprima iPhone sopra, controlli sotto */
  .editor-split-layout .editor-preview-panel {
    order: 1;
  }

  .editor-split-layout .editor-form-panel {
    order: 2;
  }
  
  .editor-form-panel {
    border-right: none;
    border-bottom: 1px solid var(--sp-border);
    max-height: none;
    min-height: 0;
  }
  
  .editor-preview-panel {
    /* Let the 440/956 mockup size the pane — don't force a 480px box that
       clips or dwarfs the SITO-sized phone on stacked / phone viewports. */
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .editor-preview-panel .iphone-mockup-container {
    flex: 0 0 auto;
    container-type: inline-size;
    min-height: 0;
  }

  .editor-preview-panel .iphone-frame {
    --phone-frame-w: min(320px, 100cqi, 100%);
  }
  
  .week-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .week-grid-header {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .weekday-header:nth-child(5),
  .weekday-header:nth-child(6),
  .weekday-header:nth-child(7) {
    display: none;
  }
  
  .week-day-cell:nth-child(5),
  .week-day-cell:nth-child(6),
  .week-day-cell:nth-child(7) {
    display: none;
  }
}

@media (max-width: 768px) {
  .social-page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .social-page-header h1 {
    font-size: var(--font-size-2xl);
  }
  
  .editor-header-left {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  
  .editor-steps {
    display: flex;
  }
  
  .week-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .week-grid-header {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .weekday-header:nth-child(4) {
    display: none;
  }
  
  .week-day-cell:nth-child(4) {
    display: none;
  }
  
  .week-day-cell {
    min-height: 240px;
  }

  .ig-card-media {
    aspect-ratio: 4 / 3;
  }

}

@media (max-width: 576px) {
  .editor-form-panel .editor-sections-scroll {
    padding: 1rem;
  }
  
  .media-library-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .platform-selector {
    flex-direction: column;
  }
  
  .platform-chip {
    width: 100%;
    justify-content: center;
  }
  
  .editor-footer {
    flex-direction: column;
    gap: 0.75rem;
  }

  .editor-footer-actions {
    flex-direction: column;
    width: 100%;
  }

  .editor-footer button,
  .editor-footer-actions button {
    width: 100%;
    justify-content: center;
  }

  .week-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .week-grid-header {
    display: none;
  }
  
  .week-day-cell {
    min-height: auto;
  }
  
  .week-day-cell:nth-child(2),
  .week-day-cell:nth-child(3),
  .week-day-cell:nth-child(4),
  .week-day-cell:nth-child(5),
  .week-day-cell:nth-child(6),
  .week-day-cell:nth-child(7) {
    display: none;
  }
  
}

/* ── Brand Kit (tuo_brand.html) ────────────────────────────────────────── */
.brand-section {
  background: var(--neutral-0);
  border: 1px solid rgba(var(--rgb-ink), 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.brand-section-title {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--neutral-900);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-section-title i {
  color: var(--sp-primary);
}

.brand-section-help {
  font-size: var(--font-size-sm);
  color: var(--sp-text-muted);
  margin: 0 0 1rem;
  max-width: 48rem;
}

.brand-category-pill {
  display: inline-block;
  background: var(--sp-primary-light);
  color: var(--sp-text-strong, var(--brand-green-ink));
  font-size: var(--font-size-caption);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  margin: 0 0.35rem 0.35rem 0;
}

/* Logo dropzone: fixed viewport so huge uploads do not blow the flex row */
label.brand-logo-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 10rem;
  height: 10rem;
  min-width: 10rem;
  border-radius: var(--radius-md);
  border: 2px dashed rgba(var(--rgb-ink), 0.14);
  background: var(--color-surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
}

label.brand-logo-upload:hover {
  border-color: rgba(var(--brand-green-rgb), 0.45);
  background: var(--neutral-100);
}

.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--sp-text-muted);
  font-size: var(--font-size-caption);
  text-align: center;
  padding: 0.75rem;
}

.logo-placeholder .bi {
  font-size: var(--font-size-3xl);
  opacity: 0.7;
}

.brand-logo-upload .brand-logo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 992px) {
  .brand-visual-grid {
    grid-template-columns: 1fr;
  }
}

.brand-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand-color-card {
  border: 1px solid rgba(var(--rgb-ink), 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  background: var(--neutral-50);
}

.brand-color-card p {
  margin: 0 0 0.75rem;
  font-size: var(--font-size-caption);
  color: var(--sp-text-muted);
}

.brand-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.brand-color-picker input[type='color'] {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.brand-style-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 576px) {
  .brand-style-options {
    grid-template-columns: 1fr;
  }
}

.brand-style-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.875rem;
  border-radius: var(--radius-md);
  border: 2px solid rgba(var(--rgb-ink), 0.1);
  background: linear-gradient(
    135deg,
    var(--brand-preview-bg, var(--brand-green-50)) 0%,
    color-mix(in srgb, var(--brand-preview-bg, var(--brand-green-50)) 88%, white) 100%
  );
  color: var(--neutral-900);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.brand-style-option input[type='radio'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.brand-style-option.active,
.brand-style-option:has(input:focus-visible) {
  border-color: var(--sp-primary);
  box-shadow: var(--focus-ring);
}

.brand-style-option strong {
  font-size: var(--font-size-md);
}

.brand-style-option small {
  font-size: var(--font-size-xs);
  opacity: 0.9;
}

.style-badge {
  font-size: var(--font-size-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.brand-field-hint {
  color: var(--sp-text-muted);
  font-size: var(--font-size-xs);
  margin-top: 0.25rem;
  display: block;
}

.brand-kit-form {
  margin-top: 1.5rem;
}

.brand-kit-form__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Brand Kit wizard (tuo_brand.html) */
.brand-wizard-form .brand-wizard {
  margin-top: 0.5rem;
}

.brand-wizard__progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.brand-wizard__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 2px solid rgba(var(--rgb-ink), 0.12);
  border-radius: var(--radius-round);
  background: var(--neutral-0);
  color: var(--sp-text-muted);
  font-size: var(--font-size-caption);
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.brand-wizard__dot.is-active {
  border-color: var(--sp-primary);
  background: var(--sp-primary-light);
  color: var(--sp-text-strong, var(--brand-green-ink));
}

.brand-wizard__line {
  width: 1.25rem;
  height: 2px;
  background: rgba(var(--rgb-ink), 0.1);
  margin: 0 0.15rem;
}

.brand-wizard__step-label {
  text-align: center;
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--neutral-900);
  margin: 0 0 1rem;
}

.brand-wizard__panel.is-active {
  animation: brandWizardFadeIn 0.2s ease;
}

@keyframes brandWizardFadeIn {
  from {
    opacity: 0.85;
  }
  to {
    opacity: 1;
  }
}

.brand-wizard__nav {
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.brand-wizard__nav-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.brand-wizard__advanced {
  margin-top: 1rem;
  border: 1px solid rgba(var(--rgb-ink), 0.08);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  background: var(--neutral-50);
}

.brand-wizard__advanced summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--neutral-700);
  padding: 0.35rem 0;
}

.brand-wizard__advanced-body {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(var(--rgb-ink), 0.06);
  margin-top: 0.5rem;
}

.brand-ai-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.brand-ai-fields-grid__full {
  grid-column: 1 / -1;
}

@media (max-width: 576px) {
  .brand-ai-fields-grid {
    grid-template-columns: 1fr;
  }
}

.brand-autocompila-banner {
  display: none;
  align-items: center;
  gap: 0.75rem;
  background: var(--neutral-100);
  border: 1px solid var(--color-success-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.brand-autocompila-banner__icon {
  color: var(--brand-green);
  font-size: var(--font-size-xl);
  flex-shrink: 0;
}

.brand-autocompila-banner__text {
  font-size: var(--font-size-sm);
  color: var(--brand-green-ink);
  flex: 1;
}

.brand-autocompila-banner__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-subtle);
  padding: 0.25rem;
  flex-shrink: 0;
}

/* ── Media Library ───────────────────────────────────────────────────── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spin-icon,
.media-upload-area .bi-arrow-repeat {
  display: inline-block;
  animation: spin 0.9s linear infinite;
}

.media-upload-area {
  border: 2px dashed rgba(var(--rgb-ink), 0.12);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  background: linear-gradient(180deg, var(--color-surface-2) 0%, var(--neutral-0) 100%);
  cursor: pointer;
  margin-bottom: 1.25rem;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.media-upload-area:hover {
  border-color: rgba(var(--brand-green-rgb), 0.45);
  background: var(--neutral-100);
  box-shadow: var(--shadow-popover);
}

.media-upload-area.dragover {
  border-color: var(--sp-primary);
  background: var(--brand-green-50);
  box-shadow: 0 0 0 3px rgba(var(--brand-green-rgb), 0.2);
}

.media-upload-icon {
  font-size: var(--font-size-4xl);
  color: var(--sp-primary);
  margin-bottom: 0.5rem;
}

.media-upload-title {
  font-weight: 600;
  color: var(--neutral-900);
  margin-bottom: 0.35rem;
}

.media-upload-hint {
  font-size: var(--font-size-caption);
  color: var(--sp-text-muted);
}

.media-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--neutral-0);
  border: 1px solid rgba(var(--rgb-ink), 0.08);
  border-radius: var(--radius-md);
}

.media-toolbar .selected-count {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--neutral-900);
}

.media-toolbar__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.media-toolbar__selection {
  font-size: var(--font-size-caption);
  color: var(--sp-text-muted);
  display: none;
}

.media-toolbar__selection.media-toolbar__selection--visible {
  display: inline;
}

.media-library-header-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.media-toolbar__deselect {
  color: var(--sp-primary);
  text-decoration: none;
  font-weight: 600;
}

.media-toolbar__btn {
  padding: 0.375rem 0.875rem;
  font-size: var(--font-size-caption);
}

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

@media (min-width: 993px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

.media-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--neutral-100);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.media-card:hover {
  box-shadow: var(--shadow-popover);
}

.media-card.selected {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px rgba(var(--brand-green-rgb), 0.25);
}

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

.media-card .video-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  top: auto;
  right: auto;
  background: rgba(var(--rgb-black), 0.72);
  color: var(--neutral-0);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-xs);
  z-index: 2;
}

.media-card.video::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(to top, rgba(var(--rgb-black), 0.5), transparent);
  pointer-events: none;
}

.media-card-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem;
  background: linear-gradient(to top, rgba(var(--rgb-ink), 0.88) 0%, rgba(var(--rgb-ink), 0.2) 55%, transparent 100%);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.media-card:hover .media-card-actions {
  opacity: 1;
  pointer-events: auto;
}

.media-card-actions button {
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.55rem;
  font-size: var(--font-size-2xs);
  font-weight: 600;
  cursor: pointer;
  background: rgba(var(--rgb-white), 0.95);
  color: var(--neutral-900);
}

.media-card-actions a {
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.55rem;
  font-size: var(--font-size-2xs);
  font-weight: 600;
  background: var(--sp-primary);
  color: var(--neutral-0);
  text-decoration: none;
}

.media-missing-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 1rem;
  text-align: center;
  color: var(--sp-text-muted);
  font-size: var(--font-size-caption);
}

.media-missing-state .bi {
  font-size: var(--font-size-3xl);
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.media-missing-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-faint);
}

.check-overlay {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-round);
  background: var(--sp-primary);
  color: var(--neutral-0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-base);
  opacity: 0;
  transform: scale(0.85);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
  z-index: 4;
  pointer-events: none;
  box-shadow: var(--shadow-card);
}

.media-card.selected .check-overlay {
  opacity: 1;
  transform: scale(1);
}

/* ── Social connections (connessioni) ─────────────────────────────────── */
.social-connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.social-connection-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  background: var(--neutral-0);
  border: 1px solid rgba(var(--rgb-ink), 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}

.social-connection-card:hover {
  border-color: rgba(var(--brand-green-rgb), 0.25);
  box-shadow: var(--shadow-popover);
}

.social-connection-card .platform-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  flex-shrink: 0;
}

.social-connection-card .platform-icon.instagram {
  background: linear-gradient(135deg, var(--color-instagram-orange) 0%, var(--color-instagram-warm) 25%, var(--color-instagram-mid) 50%, var(--color-instagram-deep) 75%, var(--color-instagram-ink) 100%);
  color: var(--neutral-0);
}

.social-connection-card .platform-icon.facebook {
  background: var(--color-facebook);
  color: var(--neutral-0);
}

.social-connection-card .platform-icon.tiktok {
  background: linear-gradient(135deg, var(--color-black) 0%, var(--color-tiktok-cyan) 50%, var(--color-tiktok) 100%);
  color: var(--neutral-0);
}

.social-connection-card .platform-icon.whatsapp {
  background: var(--color-whatsapp);
  color: var(--neutral-0);
}

.social-connection-info {
  flex: 1;
  min-width: 0;
}

.social-connection-name {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--neutral-900);
}

.social-connection-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--font-size-sm);
  margin-top: 0.25rem;
}

.social-connection-status.connected {
  color: var(--brand-green-ink);
}

.social-connection-status.disconnected {
  color: var(--sp-text-muted);
}

.social-connection-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-round);
  margin-right: 0.25rem;
  object-fit: cover;
}

.btn-social-connection-compact {
  padding: 0.375rem 1rem;
  font-size: var(--font-size-caption);
}

/* ============================================================
   NUOVO: Rifacimento Step 3 Programmazione - Drawer Post
   ============================================================ */

/* Variabili colore viola AI */
:root {
  --sp-ai-purple: var(--color-ai);
  --sp-ai-purple-hover: var(--color-ai-ink);
  --sp-ai-purple-light: var(--color-ai-soft);
  --sp-ai-purple-glow: 0 4px 14px 0 rgba(var(--rgb-ai), 0.25);
}

/* Layout a due colonne per lo step 3 */
.scheduling-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  padding: 0 1.5rem 1.5rem;
}

@media (max-width: 992px) {
  .scheduling-layout {
    grid-template-columns: 1fr;
  }
  .scheduling-preview {
    order: -1;
  }
}

/* Card form sinistra */
.scheduling-form {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 1.5rem;
}

.scheduling-form .sp-form-group {
  margin-bottom: 1.25rem;
}

.scheduling-form .sp-form-group:last-child {
  margin-bottom: 0;
}

/* Label dei campi */
.scheduling-form .sp-form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--sp-text);
  margin-bottom: 0.5rem;
}

/* Input datetime con icona calendario */
.datetime-input-wrapper {
  position: relative;
}

.datetime-input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sp-text-muted);
  font-size: var(--font-size-base);
  pointer-events: none;
}

.datetime-input-wrapper input[type="datetime-local"] {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1.5px solid var(--sp-border);
  border-radius: var(--sp-radius);
  font-size: var(--font-size-md);
  color: var(--sp-text);
  background: var(--sp-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.datetime-input-wrapper input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--sp-ai-purple);
  box-shadow: 0 0 0 3px rgba(var(--rgb-ai), 0.15);
}

/* Status badge interattivo */
.status-badge-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--sp-radius);
  font-weight: 600;
  font-size: var(--font-size-sm);
  transition: all 0.2s ease;
}

.status-badge.draft {
  background: var(--sp-gray-light);
  color: var(--sp-gray);
  border: 1.5px solid var(--sp-border);
}

/* Large editor STATO badge — same palette as .status-badge-sm */
.status-badge.status-bozza,
.status-badge.status-da_approvare,
.status-badge.status-programmato,
.status-badge.status-generazione,
.status-badge.status-pubblicazione {
  background: var(--sp-post-bozza-bg);
  color: var(--sp-post-bozza-ink);
  border: 1.5px solid rgba(251, 146, 60, 0.35);
}

.status-badge.status-approvato {
  background: var(--sp-post-approvato-bg);
  color: var(--sp-post-approvato-ink);
  border: 1.5px solid rgba(var(--brand-green-rgb), 0.28);
}

.status-badge.status-pubblicato {
  background: var(--sp-post-pubblicato-bg);
  color: var(--sp-post-pubblicato-ink);
  border: 1.5px solid rgba(var(--rgb-info), 0.3);
}

.status-badge.status-rifiutato,
.status-badge.status-errore {
  background: var(--sp-red-light);
  color: var(--color-danger-ink-bright);
  border: 1.5px solid rgba(var(--rgb-danger), 0.25);
}

/* datetime-input-wrapper in the calendar inline editor (editor-form-panel context) */
.editor-form-panel .datetime-input-wrapper {
  position: relative;
}

.editor-form-panel .datetime-input-wrapper > i {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sp-text-muted);
  font-size: var(--font-size-base);
  pointer-events: none;
  z-index: 1;
}

.editor-form-panel .datetime-input-wrapper input[type="datetime-local"] {
  padding-left: 2.5rem;
}

/* Visually separate Elimina from primary action buttons */
#editorToolbarActions #btnDeletePost {
  margin-left: auto;
}

/* Input titolo interno */
.scheduling-form input[type="text"].sp-form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--sp-border);
  border-radius: var(--sp-radius);
  font-size: var(--font-size-md);
  color: var(--sp-text);
  background: var(--sp-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.scheduling-form input[type="text"].sp-form-control:focus {
  outline: none;
  border-color: var(--sp-ai-purple);
  box-shadow: 0 0 0 3px rgba(var(--rgb-ai), 0.15);
}

.scheduling-form input[type="text"].sp-form-control::placeholder {
  color: var(--sp-text-muted);
}

/* Preview destra (iPhone mockup) */
.scheduling-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.scheduling-preview .preview-device-caption {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--sp-text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.scheduling-preview .iphone-mockup-container {
  transform: scale(0.85);
  transform-origin: top center;
  /* transform doesn't shrink layout box — pull subsequent content up to compensate */
  margin-bottom: -94px;
}

.scheduling-preview .drawer-preview-label {
  font-size: var(--font-size-caption);
  color: var(--sp-text-muted);
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Bottoni azione (3 principali) */
.scheduling-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1.5rem 1.5rem;
  max-width: 400px;
  margin-top: 0.5rem;
}

/* Bottone principale: Programma post (green – non AI) */
.btn-schedule-primary {
  background: linear-gradient(135deg, var(--sp-primary), var(--sp-primary-hover));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-weight: 600;
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--sp-primary-glow);
  width: 100%;
}

.btn-schedule-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--sp-shadow-md);
}

.btn-schedule-primary:active {
  transform: translateY(0);
}

/* Bottone secondario: Salva come bozza (outline) */
.btn-schedule-secondary {
  background: transparent;
  color: var(--sp-text-secondary);
  border: 1.5px solid var(--sp-border);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-weight: 500;
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-schedule-secondary:hover {
  background: var(--sp-gray-light);
  border-color: var(--sp-gray);
  color: var(--sp-text);
}

/* Bottone pericolo: Elimina (text link rosso) */
.btn-schedule-danger {
  background: transparent;
  color: var(--sp-red);
  border: none;
  padding: 12px 24px;
  font-weight: 500;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  margin-top: 0.5rem;
  border-radius: var(--radius-pill);
}

.btn-schedule-danger:hover {
  background: var(--sp-red-light);
}

/* ============================================================
   NUOVO: AI Generation Overlay (dopo wizard)
   ============================================================ */

.ai-generation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--rgb-white), 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: overlayFadeIn 0.3s ease;
}

.ai-generation-overlay.hidden {
  display: none !important;
}

.ai-generation-content {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: var(--sp-radius-lg);
  box-shadow: var(--sp-shadow-lg);
  min-width: 280px;
}

.ai-generation-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--color-border-alt);
  border-top-color: var(--sp-ai-purple);
  border-radius: var(--radius-round);
  animation: spinnerRotate 1s linear infinite;
  margin: 0 auto 1.5rem;
}

.ai-generation-text {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--sp-text);
  margin: 0 0 0.5rem;
}

.ai-generation-subtext {
  font-size: var(--font-size-sm);
  color: var(--sp-text-muted);
  margin: 0;
}

@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Stili specifici per il drawer step 3 - override vecchi */
#step3Section.scheduling-step {
  padding: 0;
}

#step3Section .drawer-preview-inner {
  padding: 0;
}

/* Versione compatta del form per drawer */
.drawer-split-layout .scheduling-layout {
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  padding: 1.25rem;
}

@media (max-width: 992px) {
  .drawer-split-layout .scheduling-layout {
    grid-template-columns: 1fr;
  }
}

:root {
  --ai-purple: var(--color-ai);
  --ai-purple-light: var(--color-ai-soft);
  --ai-purple-bg: var(--color-ai-tint);
}

/* AI Loading Spinner Animation */
@keyframes aiSpinnerRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ai-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--ai-purple-bg);
  border-top-color: var(--ai-purple);
  border-radius: var(--radius-round);
  animation: aiSpinnerRotate 1s linear infinite;
}

/* Full-page AI wizard: purple Carla "C" (#page-loader-overlay from base.html) */
#page-loader-overlay.page-loader--ai-gen {
  flex-direction: column;
  gap: 1rem;
}

#page-loader-overlay.page-loader--ai-gen .carla-spinner {
  color: var(--sp-ai-purple);
  filter: drop-shadow(0 4px 18px rgba(var(--rgb-ai), 0.35));
}

#page-loader-overlay .page-loader-ai-caption {
  margin: 0;
  padding: 0 1.5rem;
  max-width: 22rem;
  text-align: center;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--sp-text);
}

#page-loader-overlay .page-loader-ai-caption:empty {
  display: none !important;
}

/* ── Media step v2 (wizard post) – upload, aspect ratio, live preview ─────── */
:root {
  --media-step-violet: var(--sp-primary);
  --media-step-violet-hover: var(--sp-primary-hover);
  --media-step-violet-soft: var(--neutral-100);
  --media-step-violet-border: var(--brand-green-300);
}

.media-step-v2 .media-step-inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Upload zone */
.media-upload-zone-v2 {
  position: relative;
  border: 2px dashed var(--media-step-violet);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  background: var(--media-step-violet-soft);
  overflow: hidden;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-upload-zone-v2:hover,
.media-upload-zone-v2.media-upload-zone-v2--dragover {
  border-color: var(--media-step-violet-hover);
  background: var(--neutral-100);
  box-shadow: var(--shadow-brand);
  transform: translateY(-1px);
}

.media-upload-zone-v2[hidden],
.upload-preview-v2[hidden] {
  display: none !important;
}

.upload-zone-content-v2 i {
  font-size: var(--font-size-5xl);
  color: var(--media-step-violet);
  margin-bottom: 0.75rem;
  display: block;
}

.upload-title-v2 {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--sp-text);
  margin: 0 0 0.35rem 0;
  font-family: 'Inter', system-ui, sans-serif;
}

.upload-hint-v2 {
  font-size: var(--font-size-caption);
  color: var(--sp-text-secondary);
  margin: 0;
  line-height: 1.4;
}

.upload-progress-v2 {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
}

.upload-progress-v2[hidden] {
  display: none !important;
}

.upload-progress-v2:has(.progress-track) {
  flex-direction: column;
  gap: 0.5rem;
}

.upload-progress-v2 .progress-track {
  width: min(12rem, 80%);
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
}

.upload-progress-v2 .progress-fill {
  height: 100%;
  width: var(--pct, 0%);
  background: var(--brand-green);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

.upload-progress-v2 .progress-text {
  font-size: var(--font-size-caption);
  color: var(--sp-text-muted);
}

.media-picker-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1rem;
  color: var(--sp-text-muted);
}

.media-upload-zone-v2--loading {
  pointer-events: none;
  cursor: wait;
}

.media-upload-zone-v2--loading .upload-zone-content-v2 {
  visibility: hidden;
}

.media-upload-zone-v2 .carla-spinner--upload-zone {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 800;
  color: var(--brand-green);
  font-size: var(--font-size-5xl);
  line-height: 1;
  letter-spacing: -0.02em;
  filter: drop-shadow(0 4px 14px rgba(var(--brand-green-rgb), 0.25));
  animation: carla-rotate 1.1s linear infinite;
}

@keyframes carla-rotate {
  to {
    transform: rotate(360deg);
  }
}

/* Thumbnail after upload */
.upload-preview-v2 {
  padding: 0.75rem;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}

.upload-preview-thumb-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-ink-near);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 168px;
  flex-shrink: 0;
  min-height: 0;
}

.upload-preview-thumb-wrap--portrait {
  aspect-ratio: 9 / 16;
  max-height: 150px;
  max-width: 108px;
  width: 100%;
  margin-inline: auto;
}

.upload-preview-thumb-wrap--landscape {
  aspect-ratio: 16 / 9;
  max-height: 140px;
}

.upload-preview-thumb-wrap img,
.upload-preview-thumb-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-height: 100%;
}

.upload-preview-thumb-wrap video {
  object-fit: contain;
  background: var(--color-black);
}

.upload-file-type-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(var(--rgb-ai), 0.95);
  color: var(--neutral-0);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-2xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(4px);
}

.upload-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-media-replace,
.btn-media-remove {
  flex: 1;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  border: 1px solid transparent;
  font-family: 'Inter', system-ui, sans-serif;
}

.btn-media-replace {
  background: var(--neutral-100);
  color: var(--color-success-deep);
  border-color: var(--brand-green-300);
}

.btn-media-replace:hover {
  background: var(--color-success-surface);
  transform: translateY(-1px);
}

.btn-media-remove {
  background: var(--color-danger-surface);
  color: var(--color-danger-bright);
  border-color: var(--color-danger-border);
}

.btn-media-remove:hover {
  background: var(--color-danger-tint);
  transform: translateY(-1px);
}

/* Aspect ratio chips */
.aspect-ratio-section-v2 .aspect-section-label {
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--sp-text);
  margin: 0 0 0.5rem 0;
}

.aspect-ratio-chips-v2 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.ratio-chip-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.4rem;
  background: var(--sp-surface);
  border: 2px solid var(--sp-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  font-family: 'Inter', system-ui, sans-serif;
}

.ratio-chip-v2 i {
  font-size: var(--font-size-xl);
  color: var(--sp-gray);
}

.ratio-chip-v2 .ratio-chip-title {
  font-size: var(--font-size-2xs);
  font-weight: 600;
  color: var(--sp-text-secondary);
  text-align: center;
  line-height: 1.25;
}

.ratio-chip-v2 .ratio-chip-sub {
  font-size: var(--font-size-3xs);
  color: var(--sp-text-muted);
}

.ratio-chip-v2:hover {
  border-color: var(--media-step-violet-border);
  background: var(--media-step-violet-soft);
}

.ratio-chip-v2.ratio-chip-v2--active {
  border-color: var(--media-step-violet);
  background: var(--neutral-100);
  box-shadow: 0 0 0 3px rgba(var(--brand-green-rgb), 0.2);
}

.ratio-chip-v2.ratio-chip-v2--active i,
.ratio-chip-v2.ratio-chip-v2--active .ratio-chip-title {
  color: var(--media-step-violet);
}

.ratio-chip-v2.ratio-chip-v2--recommended:not(.ratio-chip-v2--active) {
  border-color: var(--color-warning-soft);
}

.ratio-chip-v2 .ratio-chip-pill {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-warning);
  color: var(--neutral-0);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-3xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ratio-hint-v2 {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem 0.85rem;
  background: var(--sp-surface-alt);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-caption);
  color: var(--sp-text-secondary);
  line-height: 1.4;
}

.ratio-hint-v2 i {
  color: var(--color-info);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.aspect-format-badge-v2 {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--media-step-violet);
  color: var(--neutral-0);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-top: 0.35rem;
}

.pd-video-options-v2 {
  margin-top: 0.5rem;
}

.pd-video-format-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.pd-format-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.55rem 0.4rem;
  border: 2px solid var(--sp-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  text-align: center;
  position: relative;
}

.pd-format-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pd-format-option:has(input:checked) {
  border-color: var(--media-step-violet);
  background: var(--neutral-100);
}

.pd-format-option__title {
  font-size: var(--font-size-caption);
  font-weight: 700;
  color: var(--sp-text);
}

.pd-format-option__sub {
  font-size: var(--font-size-2xs);
  color: var(--sp-text-muted);
}

.pd-video-format-hint {
  margin: 0.5rem 0 0;
}

.pd-video-duration-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  background: var(--color-warning-tint);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-caption);
  color: var(--color-warning-deep);
}

.pd-video-duration-warning i {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Media library collapsible */
.media-library-collapsible-v2 {
  margin-top: 0.5rem;
  padding: 0;
  border: none;
  background: transparent;
}

.btn-toggle-media-library {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--sp-text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-family: 'Inter', system-ui, sans-serif;
}

.btn-toggle-media-library:hover {
  background: var(--sp-surface-alt);
  border-color: var(--neutral-300);
}

.btn-toggle-media-library i:first-of-type {
  color: var(--media-step-violet);
}

.media-library-panel-v2 {
  margin-top: 0.65rem;
  padding: 1rem;
  background: var(--sp-surface-alt);
  border: 1px solid var(--sp-border);
  border-radius: var(--radius-md);
}

.media-library-panel-v2 .media-library-grid {
  max-height: 220px;
}

/* Quality warning under preview */
.editor-preview-quality-warning,
.drawer-preview-quality-warning {
  width: 100%;
  max-width: 320px;
  margin: 0.75rem auto 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-warning);
  background: linear-gradient(135deg, var(--color-warning-tint) 0%, var(--color-warning-soft-alt) 100%);
  color: var(--color-warning-deep);
  font-size: var(--font-size-caption);
  line-height: 1.45;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
}

.editor-preview-quality-warning.is-visible,
.drawer-preview-quality-warning.is-visible {
  display: flex;
}

.editor-preview-quality-warning i,
.drawer-preview-quality-warning i {
  color: var(--color-warning);
  flex-shrink: 0;
  font-size: var(--font-size-lg);
}

.preview-caption-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.preview-ratio-badge-v2 {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  background: var(--media-step-violet);
  color: var(--neutral-0);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 700;
}

@keyframes livePreviewShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Live preview: dynamic aspect ratio (fixes stretched / broken crop) */
.insta-media.live-preview-media {
  background: var(--color-black);
  transition: aspect-ratio 0.3s ease, min-height 0.3s ease, max-height 0.3s ease;
  position: relative;
  overflow: hidden;
}

.insta-media.live-preview-media.loading::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, var(--neutral-900) 25%, var(--color-charcoal-mid) 50%, var(--neutral-900) 75%);
  background-size: 200% 100%;
  animation: livePreviewShimmer 1.5s infinite;
  pointer-events: none;
}

.editor-preview-panel .insta-media.live-preview-media,
.drawer-preview .insta-media.live-preview-media {
  /* override global .insta-media { aspect-ratio: 1 } */
  aspect-ratio: unset;
}

.insta-media.live-preview-media.preview-ar-1-1 {
  aspect-ratio: 1 / 1;
}

.insta-media.live-preview-media.preview-ar-4-5 {
  aspect-ratio: 4 / 5;
}

.insta-media.live-preview-media.preview-ar-16-9 {
  aspect-ratio: 16 / 9;
}

.insta-media.live-preview-media.preview-ar-9-16 {
  aspect-ratio: 9 / 16;
}

.insta-media.live-preview-media.preview-ar-original {
  aspect-ratio: auto;
  min-height: 160px;
  max-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.insta-media.live-preview-media img.preview-media-el,
.insta-media.live-preview-media video.preview-media-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.insta-media.live-preview-media video.preview-media-el {
  position: relative;
  z-index: 2;
  min-height: 0;
}

.insta-media.live-preview-media.preview-ar-original img.preview-media-el,
.insta-media.live-preview-media.preview-ar-original video.preview-media-el {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.insta-media.live-preview-media .preview-media-placeholder {
  width: 100%;
  height: 100%;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Editor: Avanti (step 1) — styled consistently with media upload zone */
#btnNextStep.btn-next-media-step {
  background: var(--media-step-violet) !important;
  border-color: var(--media-step-violet) !important;
  color: var(--neutral-0) !important;
  border-radius: var(--radius-pill);
  padding: 12px 24px;
  font-weight: 600;
}

#btnNextStep.btn-next-media-step:hover:not(:disabled) {
  background: var(--media-step-violet-hover) !important;
  border-color: var(--media-step-violet-hover) !important;
}

#btnNextStep.btn-next-media-step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Post drawer — wizard step pills */
.post-drawer .post-drawer-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-caption);
  color: var(--color-gray-400);
  margin-top: 0.5rem;
}

.post-drawer .post-drawer-steps .step-indicator {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xl);
  background: var(--color-gray-100);
  color: var(--color-text-subtle);
  font-weight: 500;
  transition: all 0.2s ease;
}

.post-drawer .post-drawer-steps .step-indicator.active {
  background: var(--sp-primary);
  color: var(--neutral-0);
  font-weight: 500;
}

/* Post drawer: Programma (step 1) — full width form; Media (step 2) — preview column like before Upload step */
.post-drawer.post-drawer--step1 .drawer-preview {
  display: none;
}

.post-drawer.post-drawer--step2 .drawer-split-layout {
  flex-direction: row-reverse;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.post-drawer.post-drawer--step3 .drawer-split-layout {
  flex-direction: row-reverse;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.post-drawer.post-drawer--step3 .drawer-fields {
  overflow-y: auto;
  min-height: 0;
}

.post-drawer.post-drawer--step2 .drawer-fields {
  min-height: 0;
  overflow: hidden;
}

.post-drawer.post-drawer--step2 #step2.post-drawer-step {
  min-height: 0;
}

.post-drawer.post-drawer--step2 #step2 .post-drawer-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem 1.15rem;
}

.post-drawer.post-drawer--step2 .upload-section.media-step-v2 {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.post-drawer.post-drawer--step2 .media-step-inner {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.post-drawer.post-drawer--step2 .media-step-inner > :not(.media-library-collapsible-v2),
.post-editor-container.post-editor-container--step2 #step2Section .media-step-inner > :not(.media-library-collapsible-v2) {
  flex: 0 0 auto;
}

.post-drawer.post-drawer--step2 .media-library-collapsible-v2,
.post-editor-container.post-editor-container--step2 .media-library-collapsible-v2 {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.post-drawer.post-drawer--step2 .media-library-panel-v2 {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-top: 0.35rem;
}

.post-drawer.post-drawer--step2 .media-library-grid {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.media-library-static-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.media-library-static-header .section-label {
  margin: 0;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--sp-text);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Post drawer + calendar editor: fixed handset size (consistent step 2–3 and Feed/Reel) */
.post-drawer.post-drawer--step2 .drawer-preview,
.post-drawer.post-drawer--step3 .drawer-preview {
  width: 46%;
  min-width: 280px;
  padding: 0.5rem 0.65rem 0.65rem;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.post-drawer.post-drawer--step2 .drawer-preview-inner,
.post-drawer.post-drawer--step3 .drawer-preview-inner {
  max-width: 100%;
  width: 100%;
  padding-top: 0.15rem;
  gap: 0.35rem;
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.post-drawer.post-drawer--step2 .drawer-preview-inner .iphone-mockup-container,
.post-drawer.post-drawer--step3 .drawer-preview-inner .iphone-mockup-container,
.editor-preview-panel .iphone-mockup-container {
  /* Size the phone off leftover space in this pane, same as SITO Pro
     (.sito-preview-mockup-area { container-type: size }). */
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}

.post-drawer.post-drawer--step2 .drawer-preview-inner .iphone-frame,
.post-drawer.post-drawer--step3 .drawer-preview-inner .iphone-frame,
.editor-preview-panel .iphone-frame {
  /* Identical formula to sito_pro.css:
     --phone-frame-w: min(340px, 100cqw, calc(100cqh / 2.0848))
     (bezel 3.75%/side → frame_h = frame_w * 2.0848). Aspect-ratio 440/956
     on .iphone-screen then gives the true device height — no independent
     300×640 stretch. */
  --phone-frame-w: min(340px, 100cqw, calc(100cqh / 2.0848));
  width: var(--phone-frame-w);
  height: auto;
  max-height: none;
  flex: 0 0 auto;
}

.post-drawer.post-drawer--step2 .iphone-screen,
.post-drawer.post-drawer--step3 .iphone-screen,
.editor-preview-panel .iphone-screen {
  aspect-ratio: 440 / 956;
  flex: none;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

.post-drawer.post-drawer--step2 .preview-device-caption,
.post-drawer.post-drawer--step3 .preview-device-caption {
  font-size: var(--font-size-2xs);
}

.post-drawer.post-drawer--step2 .drawer-preview-label,
.post-drawer.post-drawer--step3 .drawer-preview-label {
  font-size: var(--font-size-2xs);
  margin: 0;
}

.post-drawer.post-drawer--step2 .post-drawer-header {
  padding: 0.85rem 1.15rem;
}

.post-drawer.post-drawer--step2 .post-drawer-header h2 {
  margin-bottom: 0.35rem;
  font-size: var(--font-size-lg);
}

.post-drawer.post-drawer--step2 .post-drawer-footer {
  padding: 0.75rem 1.15rem;
}

.post-drawer.post-drawer--step2 .post-drawer-content h3 {
  margin-bottom: 0.5rem;
  font-size: var(--font-size-base);
}

.post-drawer.post-drawer--step2 .upload-section > .text-muted {
  margin-bottom: 0.65rem !important;
}

.editor-form-panel .editor-sections-scroll:has(.media-step-v2) {
  padding: 1.1rem 1.25rem;
  gap: 1rem;
}

/* Inline calendar editor: step 2 — same grid as drawer, no outer scroll.
   Parent .post-editor-container now has a definite height (SITO studio box),
   so min-height: 0 is safe: the media library flex:1 chain fills leftover
   space instead of collapsing. */
.post-editor-container.post-editor-container--step2 .editor-split-layout {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.post-editor-container.post-editor-container--step2 .editor-form-panel .editor-sections-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.post-editor-container.post-editor-container--step2 #step2Section.media-step-v2 {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.post-editor-container.post-editor-container--step2 #step2Section .section-header {
  flex-shrink: 0;
}

.post-editor-container.post-editor-container--step2 #step2Section .media-step-inner {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.post-editor-container.post-editor-container--step2 .media-library-panel-v2 {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 160px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.post-editor-container.post-editor-container--step2 .media-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.65rem;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 0.15rem 0.35rem 0.35rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--rgb-ink), 0.28) transparent;
}

.post-editor-container.post-editor-container--step2 .media-library-grid::-webkit-scrollbar {
  width: 8px;
}

.post-editor-container.post-editor-container--step2 .media-library-grid::-webkit-scrollbar-thumb {
  background: rgba(var(--rgb-ink), 0.22);
  border-radius: var(--radius-pill);
}

.post-editor-container.post-editor-container--step2 .media-library-item {
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid transparent;
  padding: 0;
  margin: 0;
  background: var(--neutral-100);
  font: inherit;
  border-radius: var(--radius-md);
  text-align: left;
  box-sizing: border-box;
}

.post-editor-container.post-editor-container--step2 .media-library-item:focus-visible {
  outline: 2px solid var(--sp-primary);
  outline-offset: 2px;
}

.post-editor-container.post-editor-container--step2 .media-library-item:hover:not(:disabled) {
  border-color: var(--sp-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-popover);
}

.post-editor-container.post-editor-container--step2 .media-library-item__check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-round);
  background: var(--sp-primary);
  color: var(--neutral-0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  opacity: 0;
  transform: scale(0.85);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
  box-shadow: var(--shadow-card);
  pointer-events: none;
  z-index: 3;
}

.post-editor-container.post-editor-container--step2 .media-library-item.selected .media-library-item__check {
  opacity: 1;
  transform: scale(1);
}

.post-editor-container.post-editor-container--step2 .media-library-item--missing {
  cursor: not-allowed;
  opacity: 0.9;
  background: var(--color-border);
  transform: none;
  box-shadow: none;
}

.post-editor-container.post-editor-container--step2 .media-library-item--missing:hover {
  border-color: transparent;
  transform: none;
  box-shadow: none;
}

.post-editor-container.post-editor-container--step2 .media-library-item-missing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 4.5rem;
  padding: 0.35rem;
  font-size: var(--font-size-2xs);
  line-height: 1.25;
  color: var(--sp-text-muted);
  text-align: center;
  gap: 0.3rem;
}

.post-editor-container.post-editor-container--step2 .media-library-item-missing-inner .bi {
  font-size: var(--font-size-xl);
  opacity: 0.5;
}

.post-editor-container.post-editor-container--step2 .media-library-loading,
.post-editor-container.post-editor-container--step2 .media-library-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--sp-text-muted);
  font-size: var(--font-size-sm);
}

.post-editor-container.post-editor-container--step2 .media-library-empty__title {
  margin: 0 0 0.4rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--sp-text);
}

.post-editor-container.post-editor-container--step2 .media-library-empty__hint {
  margin: 0 0 0.85rem;
  font-size: var(--font-size-caption);
  line-height: 1.45;
}

.post-editor-container.post-editor-container--step2 .media-library-empty__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.post-editor-container.post-editor-container--step2 .media-library-static-header--editor {
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem 1rem;
  width: 100%;
}

.post-editor-container.post-editor-container--step2 .media-library-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.85rem;
  margin-left: auto;
}

.post-editor-container.post-editor-container--step2 .media-library-count {
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.post-editor-container.post-editor-container--step2 .media-library-manage-link {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--sp-primary);
  text-decoration: none;
  white-space: nowrap;
}

.post-editor-container.post-editor-container--step2 .media-library-manage-link:hover {
  text-decoration: underline;
}

.post-editor-container.post-editor-container--step2 .editor-preview-panel {
  overflow: hidden;
}

@media (max-width: 576px) {
  .post-editor-container.post-editor-container--step2 .media-library-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 0.5rem;
  }

  .post-editor-container.post-editor-container--step2 .media-library-static-header--editor {
    flex-direction: column;
    align-items: stretch;
  }

  .post-editor-container.post-editor-container--step2 .media-library-header-meta {
    justify-content: space-between;
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .aspect-ratio-chips-v2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-drawer.post-drawer--step2 .drawer-split-layout,
  .post-drawer.post-drawer--step3 .drawer-split-layout {
    flex-direction: column;
  }

  .post-drawer.post-drawer--step2 .drawer-preview,
  .post-drawer.post-drawer--step3 .drawer-preview {
    order: -1;
  }
}

/* ── AI Wizard — Strategia step (pillars read / edit) ─────────────────── */

.ai-wizard-modal .ai-strategy-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ai-wizard-modal .ai-strategy-regenerate-jump-btn {
  border: 1px solid rgba(var(--rgb-ai), 0.35);
  color: var(--sp-secondary, var(--color-ai));
}

.ai-wizard-modal .ai-strategy-regenerate-jump-btn:hover:not(:disabled) {
  background: rgba(var(--rgb-ai), 0.08);
  border-color: var(--sp-secondary, var(--color-ai));
  color: var(--sp-secondary, var(--color-ai));
}

.ai-wizard-modal .ai-strategy-generation-form--flash {
  animation: aiStrategyGenerationFormFlash 1.25s ease;
  border-radius: var(--sp-radius);
}

@keyframes aiStrategyGenerationFormFlash {
  0%,
  100% {
    box-shadow: none;
  }
  20% {
    box-shadow: 0 0 0 3px rgba(var(--rgb-ai), 0.4);
  }
}

.ai-wizard-modal .ai-strategy-block-label {
  display: block;
  font-size: var(--font-size-caption);
  font-weight: 700;
  color: var(--sp-text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.ai-wizard-modal .ai-strategy-overview-wrap {
  margin-bottom: 1.15rem;
}

.ai-wizard-modal .ai-strategy-overview {
  max-height: min(320px, 42vh);
}

.ai-wizard-modal .ai-strategy-overview-input {
  display: block;
  width: 100%;
  max-height: min(360px, 48vh);
  min-height: 9rem;
  resize: vertical;
  font-size: var(--font-size-sm);
  line-height: 1.55;
  margin-top: 0.25rem;
}

.ai-wizard-modal .ai-strategy-pillars-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.ai-wizard-modal .ai-strategy-pillars-head .ai-strategy-block-label {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.ai-wizard-modal .ai-strategy-pillars-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.ai-wizard-modal .ai-strategy-pillars-edit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.ai-wizard-modal .ai-strategy-status-badge.ai-strategy-status-user {
  background: linear-gradient(135deg, var(--brand-green-hover) 0%, var(--brand-green) 100%);
  color: var(--neutral-0);
}

.ai-wizard-modal .ai-pillar-card {
  padding: 0.75rem 0.9rem;
  background: var(--sp-surface);
  border-radius: var(--sp-radius);
  border: 1px solid var(--sp-border);
  font-size: var(--font-size-sm);
}

.ai-wizard-modal .ai-pillar-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
}

.ai-wizard-modal .ai-pillar-card-title {
  color: var(--sp-secondary, var(--color-ai));
  font-weight: 700;
}

.ai-wizard-modal .ai-pillar-card .ai-pillar-pct {
  font-size: var(--font-size-xs);
  color: var(--sp-gray);
  font-weight: 600;
  white-space: nowrap;
}

.ai-wizard-modal .ai-pillar-card-desc {
  font-size: var(--font-size-caption);
  color: var(--sp-text-secondary);
  margin-top: 0.35rem;
  line-height: 1.45;
}

.ai-wizard-modal .ai-pillar-topics {
  margin: 0.35rem 0 0 1rem;
  padding: 0;
}

.ai-wizard-modal .ai-pillars-pct-warning {
  font-size: var(--font-size-caption);
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.65rem;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface-alt);
  color: var(--sp-text-secondary);
}

.ai-wizard-modal .ai-pillars-pct-warning.is-error {
  border-color: var(--color-danger-border);
  background: var(--color-danger-surface);
  color: var(--color-danger-ink-deep);
}

.ai-wizard-modal .ai-pillars-pct-warning.is-ok {
  border-color: var(--brand-green-200);
  background: var(--brand-green-50);
  color: var(--brand-green-strong);
}

.ai-wizard-modal .ai-strategy-pillars-edit-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-wizard-modal .ai-pillar-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  align-items: flex-start;
}

.ai-wizard-modal .ai-pillar-edit-row-main {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ai-wizard-modal .ai-pillar-edit-row-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 4.5rem;
}

.ai-wizard-modal .ai-pillar-edit-label {
  font-size: var(--font-size-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sp-text-muted);
  margin: 0;
}

.ai-wizard-modal .ai-pillar-edit-row-side .ai-pillar-pct-input {
  text-align: center;
}

.ai-wizard-modal .ai-pillar-remove-btn {
  align-self: stretch;
}

/* ── Instagram Reels preview mockup (feed vs reel chrome on calendar + drawer phones) ── */

.iphone-preview-media-mount {
  display: block;
  width: 100%;
}

/* Reels: full-bleed video — black screen, overlays above media, no reserved white strip under Dynamic Island */
.iphone-screen--reels {
  background: var(--color-black);
  position: relative;
  overflow: hidden;
}

.iphone-screen--reels.iphone-screen-post-detail {
  padding-bottom: 0;
}

.iphone-screen--reels .iphone-dynamic-island {
  z-index: 12;
}

.iphone-screen--reels .iphone-status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  color: var(--neutral-0);
  background: transparent;
  pointer-events: none;
}

.iphone-screen--reels .iphone-status-icons {
  color: var(--neutral-0);
}

/* Cover entire handset viewport; sibling feed chrome stays display:none via [hidden] */
.iphone-screen--reels .preview-chrome-reels:not([hidden]) {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.reels-video-stack {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: var(--color-black);
}

.reels-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--color-black);
}

.iphone-screen--reels .reels-stage .insta-media.live-preview-media {
  aspect-ratio: unset !important;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  border-radius: 0;
}

.iphone-screen--reels .reels-stage .insta-media.live-preview-media img.preview-media-el,
.iphone-screen--reels .reels-stage .insta-media.live-preview-media video.preview-media-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reels-overlay-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.reels-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(var(--rgb-black), 0.45) 0%,
    rgba(var(--rgb-black), 0) 28%,
    rgba(var(--rgb-black), 0) 55%,
    rgba(var(--rgb-black), 0.55) 100%
  );
}

.reels-top-bar {
  position: absolute;
  top: 3rem;
  left: 0.65rem;
  right: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  color: var(--neutral-0);
  font-weight: 600;
  font-size: var(--font-size-base);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px rgba(var(--rgb-black), 0.45);
}

.reels-top-bar .bi-camera {
  position: absolute;
  right: 0;
  font-size: var(--font-size-lg);
  opacity: 0.92;
}

.reels-side-rail {
  position: absolute;
  right: 0.45rem;
  bottom: 6.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  z-index: 3;
  color: var(--neutral-0);
  font-size: var(--font-size-xl);
  text-shadow: 0 1px 3px rgba(var(--rgb-black), 0.55);
}

.reels-rail-chip {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--radius-sm);
  background: rgba(40, 40, 40, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  border: 1px solid rgba(var(--rgb-white), 0.12);
}

.reels-bottom-meta {
  position: absolute;
  left: 0.65rem;
  right: 3.75rem;
  bottom: 3.25rem;
  z-index: 3;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.reels-avatar-chip {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-round);
  border: 2px solid rgba(var(--rgb-white), 0.35);
  object-fit: cover;
  flex-shrink: 0;
}

.reels-bottom-text {
  min-width: 0;
}

.reels-handle-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.reels-handle {
  color: var(--neutral-0);
  font-weight: 700;
  font-size: var(--font-size-caption);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px rgba(var(--rgb-black), 0.55);
  max-width: 12rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.reels-follow-btn-pill {
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-xs);
  border: none;
  background: var(--neutral-0);
  color: var(--neutral-900);
  font-size: var(--font-size-2xs);
  font-weight: 700;
  cursor: default;
}

.reels-caption-preview {
  margin: 0.2rem 0 0;
  color: rgba(var(--rgb-white), 0.95);
  font-size: var(--font-size-xs);
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 1px 3px rgba(var(--rgb-black), 0.55);
}

.reels-tab-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.5rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 0.5rem;
  font-size: var(--font-size-xl);
  color: rgba(var(--rgb-white), 0.85);
  z-index: 3;
}

.reels-tab-active {
  color: var(--neutral-0);
}

.iphone-screen--reels .iphone-home-indicator--feed-preview {
  display: none !important;
}


/* ── Phase 2g: social partials inline-style replacements ───────────────── */

.social-page-header__icon {
  color: var(--sp-primary);
  margin-right: 0.5rem;
  font-size: var(--font-size-2xl);
}

.social-page-header__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.strategy-card__heading {
  margin-bottom: 1rem;
  color: var(--neutral-800);
}

.strategy-card__lead {
  margin-bottom: 1rem;
}

.sp-form-group--tight-bottom {
  margin-bottom: 1rem;
}

.sp-form-control--resize-v {
  resize: vertical;
}

.strategia-ai-status {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--brand-green);
}

.strategia-ai-status.is-error {
  border-left-color: var(--color-danger);
}

.strategia-ai-status__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.strategia-ai-status__text {
  font-weight: 500;
}

.strategia-result {
  margin-top: 1.5rem;
}

.strategia-result__divider {
  border-color: var(--color-border-alt);
}

.strategia-result__title {
  font-weight: 600;
  color: var(--neutral-800);
  margin-bottom: 0.75rem;
}

.strategia-result-overview {
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.5;
}

.strategia-result-pillars {
  margin-bottom: 1rem;
}

.strategia-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 0.5rem;
}

.btn-social-link-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-social-green--wizard {
  background: var(--color-ai);
  text-decoration: none;
}

.strategia-pillars-title {
  font-size: var(--font-size-sm);
}

.strategia-pillars-list {
  margin: 0.375rem 0 0 1rem;
  padding: 0;
  font-size: var(--font-size-sm);
}

.brand-autocompila-banner.is-visible {
  display: flex;
}

.brand-summary-pre-line {
  white-space: pre-line;
}

.brand-controls-grid--narrow {
  max-width: 32rem;
}

.sp-form-group--mb-0 {
  margin-bottom: 0;
}

.brand-logo-advanced-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.brand-logo-label {
  margin-bottom: 0.625rem;
}

.brand-logo-preview-img:not(.is-visible) {
  display: none;
}

.brand-logo-preview-img.is-visible {
  display: block;
}

.brand-file-input-hidden {
  display: none;
}

.brand-categories-row {
  margin-bottom: 0.75rem;
}

.drawer-heading-icon {
  color: var(--sp-primary);
  margin-right: 0.5rem;
}

.drawer-load-error {
  margin: 0 1.25rem 0.5rem;
  padding: 0.75rem 1rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.post-drawer-step-hint {
  margin-bottom: 1rem;
}

.post-drawer-file-input {
  display: none;
}

.sp-form-group--platforms {
  margin-top: 1.5rem;
}

.platform-selector-hint {
  margin-bottom: 0.75rem;
}

.post-drawer-step.is-active {
  display: flex;
}

.post-drawer-step:not(.is-active) {
  display: none;
}

.editor-header-status.is-visible {
  display: inline-flex;
}

.drawer-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(var(--rgb-white), 0.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.drawer-loading-text {
  margin-top: 1rem;
  color: var(--sp-text-muted);
}

.ai-modal-title-icon {
  color: var(--color-ai);
  margin-right: 0.5rem;
}

.sp-form-group--mt-md {
  margin-top: 1.25rem;
}

.sp-form-group--mt-lg {
  margin-top: 1.5rem;
}

.sp-form-group--mt-sm {
  margin-top: 0.75rem;
}

.ai-brand-description-input {
  font-size: var(--font-size-base);
}

.ai-file-input-hidden {
  display: none;
}

.ai-selected-media-count {
  margin-top: 0.75rem;
  font-size: var(--font-size-sm);
  color: var(--sp-text-muted);
}

.ai-generation-placeholder-icon {
  font-size: var(--font-size-3xl);
  color: var(--color-gray-300);
}

.edit-post-form {
  margin-top: 1.5rem;
}

.ai-modal-footer-actions {
  display: flex;
  gap: 0.75rem;
}

.ai-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(var(--rgb-white), 0.95);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.ai-loading-icon {
  font-size: var(--font-size-5xl);
  color: var(--color-ai);
}

.ai-loading-title {
  margin-top: 1rem;
  font-weight: 500;
  color: var(--color-gray-700);
}

.ai-loading-subtext {
  font-size: var(--font-size-sm);
  color: var(--color-gray-400);
}

/* calendario / media library / setup wizard (pages batch) */
.brand-kit-setup-banner {
  margin: 1rem 0 1.5rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--neutral-100) 0%, var(--brand-green-50) 100%);
  border: 1px solid var(--brand-green-300);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-kit-setup-banner__main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-kit-setup-banner__icon-wrap {
  width: 48px;
  height: 48px;
  background: var(--color-green-500);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-kit-setup-banner__icon-wrap .bi {
  font-size: var(--font-size-2xl);
  color: var(--neutral-0);
}

.brand-kit-setup-banner__title {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-success-ink-deep);
}

.brand-kit-setup-banner__text {
  margin: 0.25rem 0 0;
  font-size: var(--font-size-sm);
  color: var(--color-success-deep);
}

.brand-kit-setup-banner__hint {
  opacity: 0.9;
}

.brand-kit-setup-banner__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.btn-social-outline--green {
  border-color: var(--color-green-500);
  color: var(--color-success-ink-deep);
}

.btn-social-outline--violet {
  border-color: var(--color-ai);
  color: var(--color-ai-ink);
}

.post-editor-container.d-none {
  display: none !important;
}

/* Match SITO Pro page padding so the studio-sized editor fits the viewport. */
@media (min-width: 1201px) {
  body.social-editor-open .app-content-container {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
  }
}

@media (max-width: 380px) {
  .iphone-frame {
    --phone-frame-w: 260px;
  }
}

.editor-footer-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-delete--spaced {
  margin-left: auto;
}

.editor-section.is-active {
  display: flex;
}

.editor-section:not(.is-active) {
  display: none;
}

.form-hint--spaced {
  margin-top: 0.5rem;
}

.post-editor-file-input {
  display: none;
}

#mediaPreviewArea {
  display: none !important;
}

.media-preview-el:not(.is-visible) {
  display: none;
}

.social-empty-state--spaced {
  margin-top: 1.5rem;
}

.ai-generate-strategy-btn {
  margin-top: 1rem;
}

.ai-field.is-dimmed {
  opacity: 0.65;
}

.social-conn-dashboard-wrap {
  max-width: 960px;
}

.media-library-file-input {
  display: none;
}

.social-setup-wizard-config {
  display: none;
}

.social-setup-wizard-modal .modal-content {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.media-upload-area.is-disabled {
  pointer-events: none;
}
