/* ==========================================================================
   PianoEditorialeFacile — design system
   Un solo foglio di stile per tutta l'app. Ordine: token → base → layout →
   componenti → pagine. I template non definiscono stili propri: se serve un
   pattern nuovo, va aggiunto qui come componente riutilizzabile.
   ========================================================================== */

/* ---------- Token ---------- */
:root {
    /* Superfici: tela calda + pannello bianco. */
    --canvas: #f1f1ec;
    --surface: #ffffff;
    --surface-2: #f7f7f4;
    --surface-3: #efefea;
    --border: #e4e3dc;
    --border-strong: #cfcec6;

    /* Testo (contrasti ≥ 4.5:1 su --surface). */
    --ink: #15161a;
    --text: #15161a;
    --text-2: #4d4f57;
    --text-3: #63656c;

    /* Identità: inchiostro + "segnale" lime. Il lime è solo riempimento
       (mai testo su bianco): con testo inchiostro il contrasto è 15:1. */
    --signal: #cdf23b;
    --signal-soft: #f1f9d2;
    --signal-ink: #3d4a05;

    --ink-hover: #2b2d33;
    --ink-soft: #ececef;

    /* Semantica. */
    --success: #147a4b;  --success-soft: #e3f4ea;
    --warning: #8a5a00;  --warning-soft: #fcf1d6;
    --danger:  #b42332;  --danger-soft:  #fbe7e9;
    --info:    #1f5fb8;  --info-soft:    #e6effc;
    --neutral: #55575e;  --neutral-soft: #efefeb;

    /* Forma. */
    --r-xs: 5px; --r-sm: 7px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-full: 999px;
    --shadow-xs: 0 1px 0 rgba(21, 22, 26, 0.04);
    --shadow-sm: 0 1px 2px rgba(21, 22, 26, 0.06), 0 0 0 1px rgba(21, 22, 26, 0.02);
    --shadow-md: 0 6px 18px -6px rgba(21, 22, 26, 0.14), 0 2px 4px rgba(21, 22, 26, 0.04);
    --shadow-lg: 0 24px 48px -16px rgba(21, 22, 26, 0.28), 0 4px 10px rgba(21, 22, 26, 0.06);

    /* Spaziatura (scala 4). */
    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
    --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

    --sidebar-w: 248px;
    --font: "Inter", "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --t-fast: 120ms var(--ease);
    --t: 180ms var(--ease);

    /* Colori piattaforma: identificazione, non decorazione. */
    --p-facebook: #1877f2; --p-instagram: #e1306c; --p-tiktok: #111111; --p-youtube: #ff0000;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; flex-shrink: 0; }
img, video { max-width: 100%; }
::selection { background: var(--signal); color: var(--ink); }
[hidden] { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: fixed; top: 8px; left: 8px; z-index: 500; transform: translateY(-150%);
    background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600;
    transition: transform var(--t);
}
.skip-link:focus { transform: none; }

/* Tipografia utility (poche, usate davvero). */
.t-xs { font-size: 12px; }
.t-sm { font-size: 13px; }
.t-md { font-size: 14px; }
.t-lg { font-size: 16px; }
.t-2 { color: var(--text-2); }
.t-3 { color: var(--text-3); }
.t-strong { font-weight: 600; }
.t-danger { color: var(--danger); }
.t-success { color: var(--success); }
.t-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.t-prewrap { white-space: pre-line; overflow-wrap: anywhere; }
.t-mono { font-family: var(--mono); font-size: 12px; }

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-6 { gap: var(--s-6); }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.ml-auto { margin-left: auto; }
.d-block { display: block; }
.mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); } .mb-5 { margin-bottom: var(--s-5); }
.items-start { align-items: flex-start; }
.callout-text-flush { margin: 0; color: var(--text); }

/* ==========================================================================
   Layout
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    height: 100vh; position: sticky; top: 0;
    display: flex; flex-direction: column;
    padding: var(--s-3) var(--s-3) var(--s-3);
    z-index: 60;
}

.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.btn.drawer-close { display: none; margin-bottom: 8px; }
.bottom-nav { display: none; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--signal);
    display: grid; place-items: center; flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.brand-name span { color: var(--text-3); font-weight: 500; }

/* Selettore cliente: il contesto di lavoro è sempre visibile. */
.ctx-switch { position: relative; margin-bottom: var(--s-3); }
.ctx-switch > summary {
    list-style: none; display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--r-md); background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-xs); cursor: pointer;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.ctx-switch > summary::-webkit-details-marker { display: none; }
.ctx-static-body { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }
.ctx-switch > summary:hover { border-color: var(--border-strong); }
.ctx-switch[open] > summary { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
.ctx-label { font-size: 11px; color: var(--text-3); line-height: 1.2; }
.ctx-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.ctx-switch .menu { left: 0; right: 0; top: calc(100% + 6px); }

.btn-create { width: 100%; margin-bottom: var(--s-4); }

.nav { display: flex; flex-direction: column; gap: var(--s-4); flex: 1; overflow-y: auto; min-height: 0; padding-bottom: var(--s-3); }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-label {
    font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: 0.02em;
    padding: 0 10px 4px; display: flex; align-items: center; gap: 6px; min-width: 0;
}
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm);
    font-size: 13.5px; font-weight: 500; color: var(--text-2);
    transition: background var(--t-fast), color var(--t-fast);
    position: relative;
}
.nav-item svg { color: var(--text-3); transition: color var(--t-fast); }
.nav-item:hover { background: rgba(21, 22, 26, 0.05); color: var(--text); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.nav-item[aria-current="page"] svg { color: var(--ink); }
.nav-count {
    margin-left: auto; font-size: 11px; font-weight: 700; min-width: 20px; height: 18px; padding: 0 6px;
    border-radius: var(--r-full); display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
    background: var(--surface-3); color: var(--text-2);
}
.nav-count.is-alert { background: var(--danger); color: #fff; }
.nav-count.is-warn { background: var(--warning-soft); color: var(--warning); }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: var(--s-3); }
.user-menu { position: relative; }
.user-menu > summary {
    list-style: none; display: flex; align-items: center; gap: 10px; padding: 6px 8px;
    border-radius: var(--r-sm); cursor: pointer;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: rgba(21, 22, 26, 0.05); }
.user-menu .menu { bottom: calc(100% + 6px); left: 0; right: 0; }

.main { flex: 1; min-width: 0; padding: var(--s-2) var(--s-2) var(--s-2) 0; display: flex; flex-direction: column; }
.main-panel {
    flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs); min-width: 0; display: flex; flex-direction: column;
}
.page { width: 100%; max-width: 1200px; margin: 0 auto; padding: var(--s-8) var(--s-10) var(--s-12); }
.page-narrow { max-width: 880px; margin-left: 0; }
.page-wide { max-width: 1440px; }

/* Topbar solo mobile. */
.topbar { display: none; }
.scrim { display: none; }

/* Intestazione pagina: dove sono / cosa posso fare. */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-head-text { min-width: 0; flex: 1 1 320px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); font-weight: 500; display: inline-flex; align-items: center; min-height: 24px; }
.crumbs a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.crumbs svg { color: var(--border-strong); }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-sub { color: var(--text-2); font-size: 14px; margin-top: 6px; max-width: 640px; }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

.section { margin-top: var(--s-8); }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); flex-wrap: wrap; }
.section-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.section-sub { font-size: 13px; color: var(--text-3); }
.section-link { font-size: 13px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.section-link:hover { color: var(--text); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-6); align-items: start; }

/* ==========================================================================
   Componenti
   ========================================================================== */

/* ---------- Bottoni ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 14px; border-radius: var(--r-sm);
    font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap;
    border: 1px solid transparent; background: none; color: var(--text);
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
    user-select: none; text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 1px 2px rgba(21,22,26,0.2); }
.btn-primary:hover { background: var(--ink-hover); }
.btn-signal { background: var(--signal); color: var(--ink); box-shadow: 0 1px 2px rgba(21,22,26,0.12); }
.btn-signal:hover { background: #c1e62c; }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #9a1c2a; }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; border-radius: 6px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn .kbd { margin-left: 4px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

.spinner {
    width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex-shrink: 0;
    border: 2px solid currentColor; border-right-color: transparent; opacity: 0.8;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kbd {
    font-family: var(--font); font-size: 11px; font-weight: 600; line-height: 1;
    padding: 3px 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text-3); box-shadow: 0 1px 0 var(--border);
}
.btn-primary .kbd { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.8); box-shadow: none; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: var(--s-4); }
.label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: baseline; gap: 6px; }
.label .opt { font-weight: 400; color: var(--text-3); font-size: 12px; }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.field-error { font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.field-error.is-hint { color: var(--text-2); gap: 0; display: block; }
.field-error.is-hint .link { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.pw-rules { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 3px 12px; font-size: 12.5px; color: var(--text-3); }
.pw-rules li { display: flex; align-items: center; gap: 6px; transition: color var(--t-fast); }
.pw-rules svg { opacity: 0.35; flex-shrink: 0; transition: opacity var(--t-fast); }
.pw-rules li.is-met { color: var(--success); }
.pw-rules li.is-met svg { opacity: 1; }
.pw-rules li.is-missing { color: var(--danger); }
.input, .select, .textarea {
    width: 100%; font-size: 14px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    padding: 8px 11px; min-height: 38px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: #6f7178; opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.input[readonly] { background: var(--surface-2); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.select {
    appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6d74' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.input-sm { min-height: 30px; padding: 4px 9px; font-size: 13px; }
.input-group { display: flex; gap: var(--s-2); align-items: stretch; }
.input-group .input { flex: 1; min-width: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-4); }
.form-row .field + .field { margin-top: 0; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }

/* Controllo segmentato (radio). */
.segmented {
    display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-md);
    border: 1px solid var(--border); max-width: 100%; overflow-x: auto;
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .segmented a {
    display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 7px;
    font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.segmented span:hover, .segmented a:hover { color: var(--text); }
.segmented input:checked + span, .segmented a[aria-current="page"], .segmented a.is-active {
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.segmented input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 1px; }
.segmented label.is-disabled > span { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; text-decoration-thickness: 1px; }
.segmented-block { display: flex; width: 100%; }
.segmented-block label, .segmented-block a { flex: 1; }
.segmented-block span, .segmented-block a { width: 100%; justify-content: center; }

/* Input file nativo: stesso linguaggio dei bottoni secondari. */
input[type="file"].input { padding: 4px; min-height: 38px; font-size: 13px; color: var(--text-2); cursor: pointer; }
input[type="file"]::file-selector-button {
    font: inherit; font-weight: 600; font-size: 13px; color: var(--text); margin-right: 10px;
    height: 28px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border-strong);
    background: var(--surface-2); cursor: pointer; transition: background var(--t-fast);
}
input[type="file"]::file-selector-button:hover { background: var(--surface-3); }

/* Scelta a card (radio/checkbox grandi con descrizione). */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-2); }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px; height: 100%;
    border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.choice-body:hover { border-color: var(--text-3); }
.choice input:checked + .choice-body { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: var(--surface); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--ink); outline-offset: 2px; }
.choice input:disabled + .choice-body { opacity: 0.5; cursor: not-allowed; }
.choice input:disabled + .choice-body:hover { border-color: var(--border-strong); }
.choice-title { font-size: 13.5px; font-weight: 600; }
.choice-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.choice-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.choice input:checked + .choice-body .choice-icon { background: var(--ink); color: var(--signal); }

/* Selezione account social (chip con avatar piattaforma). */
.account-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s-2); }
.account-pick { position: relative; display: block; min-width: 0; }
.account-pick-body > .grow { min-width: 0; }
.account-picker.is-single { grid-template-columns: minmax(0, 1fr); }
.account-pick input { position: absolute; opacity: 0; pointer-events: none; }
.account-pick-body {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 9px; min-height: 52px;
    border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.account-pick-body:hover { border-color: var(--text-3); }
.account-pick-check {
    margin-left: auto; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong);
    display: grid; place-items: center; color: transparent; flex-shrink: 0; transition: all var(--t-fast);
}
.account-pick input:checked + .account-pick-body { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.account-pick input:checked + .account-pick-body .account-pick-check { background: var(--ink); border-color: var(--ink); color: var(--signal); }
.account-pick input:focus-visible + .account-pick-body { outline: 2px solid var(--ink); outline-offset: 2px; }
.account-pick input:disabled + .account-pick-body { opacity: 0.5; cursor: not-allowed; }

/* ---------- Card / superfici ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card + .card { margin-top: var(--s-4); }
.stack > .card + .card, .stack > section + section,
.grid-2 > .card, .grid-3 > .card, .client-grid > .card, .stats > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head.plain { border-bottom: 0; padding-bottom: 0; }
.card-title { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: var(--s-5); }
.card-foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.card-muted { background: var(--surface-2); box-shadow: none; }
.card-link { transition: border-color var(--t-fast), box-shadow var(--t-fast); display: block; }
.card-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

/* Liste a righe (item cliccabili). */
.list { display: flex; flex-direction: column; }
.list-item {
    display: flex; align-items: center; gap: var(--s-3); padding: 12px var(--s-5); min-height: 56px;
    border-top: 1px solid var(--border); position: relative;
}
.list-item:first-child { border-top: 0; }
a.list-item { transition: background var(--t-fast); }
a.list-item:hover { background: var(--surface-2); }
.list-item .chev { color: var(--border-strong); transition: transform var(--t-fast), color var(--t-fast); }
a.list-item:hover .chev { color: var(--text-3); transform: translateX(2px); }
.list-compact .list-item { padding: 10px var(--s-4); min-height: 48px; }
.list-title { font-size: 13.5px; font-weight: 600; }
.list-meta { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-meta .sep::before { content: "·"; }

/* ---------- Badge di stato ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
    border-radius: var(--r-full); font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1;
    background: var(--neutral-soft); color: var(--neutral);
}
.badge svg { width: 12px; height: 12px; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge-ink     { background: var(--ink); color: #fff; }
.badge-signal  { background: var(--signal); color: var(--ink); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.badge-sm { height: 19px; padding: 0 6px; font-size: 11px; }
.badge-live::before { animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 50% { opacity: 0.35; } }

/* ---------- Avatar ---------- */
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    font-size: 12.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); letter-spacing: -0.01em;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-xs { width: 16px; height: 16px; font-size: 7.5px; flex-shrink: 0; }
.avatar-client.avatar-xs { border-radius: 4px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar-xl { width: 56px; height: 56px; font-size: 20px; }
/* Avatar cliente: quadrato arrotondato, colore deterministico (vedi _ui.client_avatar). */
.avatar-client { border-radius: 9px; color: #fff; }
.avatar-client.avatar-sm { border-radius: 6px; }
.avatar-client.avatar-lg { border-radius: 12px; }
.avatar-client.avatar-xl { border-radius: 14px; }

/* Avatar account social: iniziale + piattaforma in basso a destra. */
.acct-avatar { position: relative; flex-shrink: 0; }
.acct-avatar .platform-badge { position: absolute; right: -5px; bottom: -5px; box-shadow: 0 0 0 2px var(--surface); }

.platform-badge { border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; color: #fff; }
.platform-stack { display: inline-flex; align-items: center; }
.platform-stack > * + * { margin-left: -5px; }
.platform-stack .platform-badge { box-shadow: 0 0 0 2px var(--surface); }

/* ---------- Tabs (link) ---------- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s-5); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 7px; padding: 10px 10px 11px; margin-bottom: -1px;
    font-size: 13.5px; font-weight: 600; color: var(--text-3); white-space: nowrap;
    border-bottom: 2px solid transparent; transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"], .tab.is-active { color: var(--text); border-bottom-color: var(--ink); }
.tab-count { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tab-count.is-alert { background: var(--danger-soft); color: var(--danger); }
.tab-count.is-warn { background: var(--warning-soft); color: var(--warning); }

/* ---------- Menu a tendina (details/summary + JS per chiusura) ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.menu {
    position: absolute; z-index: 80; min-width: 220px; padding: 5px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    animation: pop-in 140ms var(--ease);
}
.menu-right { right: 0; top: calc(100% + 6px); }
.menu-label { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 8px 10px 4px; letter-spacing: 0.02em; }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px;
    font-size: 13.5px; font-weight: 500; color: var(--text); border: 0; background: none; text-align: left;
}
.menu-item svg { color: var(--text-3); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item[aria-current="true"] { font-weight: 600; }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger svg { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }
.menu-scroll { max-height: 300px; overflow-y: auto; }
.menu form { margin: 0; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Dialog (modale nativo <dialog>) ---------- */
dialog.modal {
    border: 0; padding: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
}
dialog.modal[open] { animation: modal-in 200ms var(--ease); }
dialog.modal::backdrop { background: rgba(21, 22, 26, 0.45); backdrop-filter: blur(2px); animation: fade-in 200ms var(--ease); }
.modal-head { padding: var(--s-5) var(--s-6) 0; display: flex; align-items: flex-start; gap: var(--s-3); }
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.modal-sub { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.modal-body { padding: var(--s-5) var(--s-6); }
.modal-foot { padding: var(--s-4) var(--s-6); display: flex; justify-content: flex-end; gap: var(--s-2); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); flex-wrap: wrap; }
.modal-close { margin-left: auto; margin-top: -4px; margin-right: -8px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Callout (avvisi in pagina) ---------- */
.callout {
    display: flex; gap: var(--s-3); align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md);
    border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px;
}
.callout > svg { margin-top: 1px; }
.callout-title { font-weight: 600; }
.callout-text { color: var(--text-2); margin-top: 2px; font-size: 13px; }
.callout-actions { display: flex; gap: var(--s-2); margin-top: var(--s-2); flex-wrap: wrap; }
.callout-info { background: var(--info-soft); border-color: #cddcf5; }
.callout-info > svg { color: var(--info); }
.callout-warning { background: var(--warning-soft); border-color: #f1dfae; }
.callout-warning > svg { color: var(--warning); }
.callout-danger { background: var(--danger-soft); border-color: #f2c8cd; }
.callout-danger > svg { color: var(--danger); }
.callout-success { background: var(--success-soft); border-color: #c3e6d2; }
.callout-success > svg { color: var(--success); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--s-10) var(--s-6); display: flex; flex-direction: column; align-items: center; }
.empty-art {
    width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: var(--s-4);
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
    box-shadow: 0 1px 0 var(--surface) inset, var(--shadow-xs);
}
.empty-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.empty-text { font-size: 13.5px; color: var(--text-2); max-width: 420px; margin-top: 6px; }
.empty-actions { display: flex; gap: var(--s-2); margin-top: var(--s-5); flex-wrap: wrap; justify-content: center; }
.empty-sm { padding: var(--s-6) var(--s-4); }
.empty-sm .empty-art { width: 44px; height: 44px; border-radius: 12px; margin-bottom: var(--s-3); }

/* ---------- Toast ---------- */
.toasts {
    position: fixed; bottom: var(--s-5); right: var(--s-5); z-index: 300;
    display: flex; flex-direction: column; gap: var(--s-2); width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; gap: 10px; align-items: flex-start;
    background: var(--ink); color: #fff; padding: 12px 12px 12px 14px; border-radius: var(--r-md);
    box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 1.45;
    animation: toast-in 240ms var(--ease);
}
.toast-icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--signal); color: var(--ink); }
.toast-error .toast-icon { background: #ff5c6c; color: #fff; }
.toast-info .toast-icon { background: rgba(255,255,255,0.18); color: #fff; }
.toast-msg { flex: 1; padding-top: 1px; overflow-wrap: anywhere; }
.toast-close { background: none; border: 0; color: rgba(255,255,255,0.6); padding: 2px; border-radius: 4px; display: grid; }
.toast-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
.toast.is-leaving { animation: toast-out 180ms var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* ---------- Tooltip (CSS, anche da tastiera) ---------- */
[data-tip] { position: relative; }
/* Solo dove esiste l'hover (non su touch) e solo mentre visibile: un pseudo-elemento
   nascosto ma largo allargava la pagina di qualche pixel ai bordi dello schermo. */
[data-tip]::after { display: none; }
@media (hover: hover) {
    [data-tip]:hover::after, [data-tip]:focus-visible::after { display: block; }
}
[data-tip]::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
    background: var(--ink); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35; padding: 6px 9px; border-radius: 6px;
    white-space: normal; width: max-content; max-width: 260px; text-align: left;
    opacity: 0; pointer-events: none; transition: opacity var(--t-fast), transform var(--t-fast); z-index: 90;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 250ms; }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; position: relative; }   /* position: i testi .sr-only (assoluti) restano dentro e non allargano la pagina */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 10px var(--s-5); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px var(--s-5); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

/* ---------- Statistiche ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-3); }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5);
    display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative;
}
a.stat { transition: border-color var(--t-fast), box-shadow var(--t-fast); }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 12px; color: var(--text-3); }
.stat.is-alert { border-color: #f2c8cd; background: linear-gradient(180deg, var(--danger-soft), var(--surface) 70%); }
.stat.is-alert .stat-value { color: var(--danger); }
.stat.is-warn { border-color: #f1dfae; background: linear-gradient(180deg, var(--warning-soft), var(--surface) 70%); }

/* Barra proporzionale semplice (analytics). */
.meter { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; display: flex; }
.meter > span { display: block; height: 100%; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 45%, var(--surface-3) 65%); background-size: 300% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r-sm); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Paginazione ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Progress / checklist onboarding ---------- */
.progress { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: inherit; transition: width 400ms var(--ease); }
.checklist { display: flex; flex-direction: column; }
.check-step { display: flex; align-items: center; gap: var(--s-3); padding: 12px var(--s-5); border-top: 1px solid var(--border); }
.check-step:first-child { border-top: 0; }
.check-step-mark {
    width: 24px; height: 24px; border-radius: 50%; border: 1.5px dashed var(--border-strong); flex-shrink: 0;
    display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--text-3);
}
.check-step.is-done .check-step-mark { border: 0; background: var(--ink); color: var(--signal); }
.check-step.is-done .check-step-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.check-step.is-current { background: var(--signal-soft); }
.check-step.is-current .check-step-mark { border: 2px solid var(--ink); color: var(--ink); border-style: solid; }
.check-step-title { font-size: 13.5px; font-weight: 600; }
.check-step-text { font-size: 12.5px; color: var(--text-3); }

/* ==========================================================================
   Pagine
   ========================================================================== */

/* ---------- Home ---------- */
.hero-greet { font-size: 13px; color: var(--text-3); font-weight: 500; }
.attention-item { display: flex; gap: var(--s-3); align-items: flex-start; padding: 14px var(--s-5); border-top: 1px solid var(--border); }
.attention-item:first-child { border-top: 0; }
.attention-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.attention-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.attention-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.attention-icon.is-info { background: var(--info-soft); color: var(--info); }

.day-group + .day-group { border-top: 1px solid var(--border); }
.day-label { font-size: 12px; font-weight: 650; color: var(--text-2); padding: 10px var(--s-5) 0; display: flex; align-items: center; gap: 8px; }
.day-label.is-today { color: var(--ink); }
.day-label.is-today::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--signal); }
.time-cell { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; width: 46px; flex-shrink: 0; }

/* ---------- Clienti ---------- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-4); }
.client-card { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); height: 100%; }
.client-card-stats { display: flex; gap: var(--s-4); font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.client-card-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
.client-card.is-archived { opacity: 0.65; }

/* ---------- Contenuti ---------- */
.content-row { display: flex; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); align-items: flex-start; position: relative; }
.content-row:first-child { border-top: 0; }
.content-row:hover { background: var(--surface-2); }
.content-thumb {
    width: 64px; height: 64px; border-radius: var(--r-md); background: var(--surface-3); flex-shrink: 0; overflow: hidden;
    display: grid; place-items: center; color: var(--text-3); position: relative; border: 1px solid var(--border);
}
.content-thumb img, .content-thumb video { width: 100%; height: 100%; object-fit: cover; }
.content-thumb .thumb-kind { position: absolute; right: 4px; bottom: 4px; background: rgba(21,22,26,0.7); color: #fff; border-radius: 4px; padding: 2px; display: grid; }
.content-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.content-title { font-size: 14px; font-weight: 650; letter-spacing: -0.005em; display: inline; }
.content-title-link::after { content: ""; position: absolute; inset: 0; }
.content-title-link:focus-visible { outline: none; }
.content-title-link:focus-visible::after { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: var(--r-sm); }
.content-excerpt { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.content-pubs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; position: relative; z-index: 1; }
.pub-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px 0 3px; border-radius: var(--r-full);
    font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--border); white-space: nowrap;
}
.pub-chip .platform-badge { box-shadow: none; }
.pub-chip.is-failed { border-color: #f2c8cd; background: var(--danger-soft); color: var(--danger); }
.pub-chip.is-published { color: var(--success); }
.pub-chip.is-scheduled, .pub-chip.is-pending { color: var(--info); }
.pub-chip.is-publishing { color: var(--info); }
.pub-chip.is-canceled { color: var(--text-3); text-decoration: line-through; }
.content-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; position: relative; z-index: 1; }


/* Header cliente (contesto). */
.client-head { display: flex; align-items: center; gap: var(--s-4); min-width: 0; }
.client-head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ---------- Composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s-6); align-items: start; }
.composer-main { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.composer-aside { position: sticky; top: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.step-head { display: flex; align-items: center; gap: 10px; padding: var(--s-4) var(--s-5) 0; min-width: 0; }
.step-num {
    width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-2);
    font-size: 12px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0;
}
.step-title { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; flex-shrink: 0; }
.step-aside { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.step-body { padding: var(--s-4) var(--s-5) var(--s-5); }
.step-summary, .step-edit { display: none; }
/* Stepper (attivato dal JS del composer): una sezione aperta alla volta. */
.is-stepped .step:not(.is-active) > .step-body { display: none; }
.is-stepped .step:not(.is-active) .step-head { padding-bottom: var(--s-4); }
.is-stepped .step:not(.is-active) .step-aside { display: none; }
.step.is-active { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.step.is-active .step-num { background: var(--ink); color: #fff; }
.step.is-done { cursor: pointer; }
.step.is-done:hover { border-color: var(--border-strong); }
.step.is-done .step-num { background: var(--success); color: #fff; }
.step.is-done .step-summary { display: block; margin-left: auto; min-width: 0; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.is-done .step-edit { display: inline-flex; flex-shrink: 0; margin: -6px -8px -6px 0; }
.step.is-pending .step-num { background: var(--surface-3); color: var(--text-2); }
.step.is-pending .step-summary { color: var(--text-3); }
.step.is-invalid { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.step.is-invalid .step-num { background: var(--danger); color: #fff; }
.step.is-invalid .step-summary { color: var(--danger); font-weight: 500; }
.step-note { margin-right: auto; font-size: 12.5px; color: var(--warning); background: var(--warning-soft); border-radius: var(--r-sm); padding: 6px 10px; }
.step.is-upcoming { background: transparent; border-style: dashed; }
.step.is-upcoming .step-title { color: var(--text-3); font-weight: 600; }
.step-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); padding: 0 var(--s-5) var(--s-5); margin-top: calc(-1 * var(--s-2)); }
.step-foot .field-error { margin-right: auto; }
.step-foot .field-error.is-todo { color: var(--text-3); }
.step-foot [data-step-next].is-appearing { animation: next-in 0.25s ease-out; }
@keyframes next-in { from { opacity: 0; transform: translateX(-4px); } }
@media (prefers-reduced-motion: reduce) { .step-foot [data-step-next].is-appearing { animation: none; } }
.step.is-entering { animation: step-in 0.3s ease-out; }
@keyframes step-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .step.is-entering { animation: none; } }

.textarea-wrap { position: relative; }
.textarea-wrap .textarea { min-height: 160px; padding-bottom: 34px; }
.textarea-meta { position: absolute; left: 1px; right: 1px; bottom: 1px; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: 6px 10px; border-radius: 0 0 var(--r-sm) var(--r-sm); background: linear-gradient(transparent, var(--surface) 40%); font-size: 12px; color: var(--text-3); pointer-events: none; }
.char-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.char-count.is-over { color: var(--danger); }
.char-count.is-near { color: var(--warning); }

.dropzone {
    border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: var(--s-6) var(--s-4);
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
    background: var(--surface-2); cursor: pointer; position: relative;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--ink); background: var(--signal-soft); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.dropzone-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); margin-bottom: 4px; }
.dropzone-title { font-size: 13.5px; font-weight: 600; }
.dropzone-sub { font-size: 12.5px; color: var(--text-3); }
/* Con dei file già in lista l'area resta, piccola, per aggiungerne altri. */
.dropzone.is-compact { flex-direction: row; justify-content: center; padding: var(--s-3) var(--s-4); gap: var(--s-3); }
.dropzone.is-compact .dropzone-icon { width: 30px; height: 30px; border-radius: 9px; margin: 0; }
.dropzone.is-compact .dropzone-sub { display: none; }
/* «Trascina qui» e «Scegli dalla libreria»: due riquadri alla pari, stessa altezza. */
.media-sources { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.media-sources > .dropzone { width: 100%; font: inherit; color: inherit; justify-content: center; }
.media-sources[hidden] { display: none; }
.media-sources > button.dropzone:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.media-sources > button.dropzone[aria-expanded="true"] { border-style: solid; border-color: var(--ink); background: var(--signal-soft); }
.media-sources.is-compact > .dropzone { min-height: 68px; flex-direction: row; justify-content: center; padding: var(--s-3) var(--s-4); gap: var(--s-3); }
.media-sources.is-compact > .dropzone .dropzone-icon { width: 30px; height: 30px; border-radius: 9px; margin: 0; flex: none; }
.media-sources.is-compact > .dropzone .dropzone-sub { display: none; }
@media (max-width: 560px) { .media-sources { grid-template-columns: 1fr; } }
.file-list { list-style: none; margin: 0 0 var(--s-3); padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.file-item { display: flex; align-items: center; gap: var(--s-2); padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
.file-item .file-preview-thumb { width: 48px; height: 48px; }
.file-item .grow { min-width: 0; margin-left: 4px; }
.file-item-pos { width: 20px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }

.file-preview { display: flex; align-items: center; gap: var(--s-3); padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.file-preview-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; flex-shrink: 0; color: var(--text-3); }
.file-preview-thumb img, .file-preview-thumb video { width: 100%; height: 100%; object-fit: cover; }

.media-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--s-2); max-height: 260px; overflow-y: auto; padding: 2px; }
.media-pick { position: relative; display: block; aspect-ratio: 1; }
.media-pick input { position: absolute; opacity: 0; pointer-events: none; }
.media-pick.is-disabled { opacity: 0.35; cursor: not-allowed; }
.media-pick.is-disabled .media-pick-body { filter: grayscale(1); }
.media-pick-body { position: absolute; inset: 0; border-radius: var(--r-md); overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); cursor: pointer; display: grid; place-items: center; color: var(--text-3); transition: box-shadow var(--t-fast); }
.media-pick-body img, .media-pick-body video { width: 100%; height: 100%; object-fit: cover; }
.media-pick input:checked + .media-pick-body { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.media-pick input:focus-visible + .media-pick-body { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-3); }
.media-pick-check { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--signal); display: none; place-items: center; }
.media-pick input:checked + .media-pick-body .media-pick-check { display: grid; }
.media-pick .thumb-kind { position: absolute; left: 6px; bottom: 6px; background: rgba(21,22,26,0.7); color: #fff; border-radius: 4px; padding: 2px; display: grid; }

.disclosure > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 0; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { color: var(--text); }
.disclosure > summary svg { transition: transform var(--t-fast); }
.disclosure[open] > summary svg { transform: rotate(90deg); }
.disclosure-body { padding-top: var(--s-3); }

.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; }
.slot-row { display: flex; gap: var(--s-2); align-items: center; }
.slot-row + .slot-row { margin-top: var(--s-2); }

/* Riepilogo + CTA: card flottante in fondo alla colonna del composer. */
.submit-bar {
    position: sticky; bottom: var(--s-4); z-index: 20;
    padding: 10px 10px 10px var(--s-5); background: rgba(255,255,255,0.94); backdrop-filter: blur(10px);
    border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
}
.submit-summary { flex: 1; min-width: 200px; font-size: 13px; color: var(--text-2); }
.submit-summary strong { color: var(--text); }
.issues { display: flex; flex-direction: column; gap: 6px; }
.issue { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.issue svg { margin-top: 1px; }
.issue.is-error { color: var(--danger); }
.issue.is-warning { color: var(--warning); }
.issue.is-ok { color: var(--success); }

/* ---------- Anteprima social ---------- */
.preview-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.preview-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 10px 0; }
.preview-tab {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 4px; border-radius: var(--r-full);
    border: 1px solid transparent; background: none; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.preview-tab:hover { background: var(--surface-3); }
.preview-tab[aria-selected="true"] { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-xs); }
.preview-stage { padding: var(--s-4); background: var(--surface-2); border-top: 1px solid var(--border); margin-top: 10px; display: flex; justify-content: center; }
.preview-note { padding: 10px var(--s-4); font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); display: flex; gap: 6px; align-items: flex-start; }

.mock { width: 100%; max-width: 320px; background: #fff; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; font-size: 13px; color: #111; box-shadow: var(--shadow-sm); }
.mock-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.mock-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.mock-meta { font-size: 11px; color: #777; }
.mock-media { background: #e9e9e6; display: grid; place-items: center; color: #595959; overflow: hidden; position: relative; }
.mock-media img, .mock-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mock-media.r-square { aspect-ratio: 1 / 1; }
.mock-media.r-portrait { aspect-ratio: 4 / 5; }
.mock-media.r-vertical { aspect-ratio: 9 / 16; }
.mock-media.r-wide { aspect-ratio: 16 / 9; }
.mock-text { padding: 10px 12px; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.45; }
.mock-text .more { color: #777; }
.mock-text strong { font-weight: 600; }
.mock-actions { display: flex; gap: 14px; padding: 8px 12px 0; color: #222; }
.mock-empty { color: #666; font-style: italic; }
.mock-vertical { max-width: 230px; position: relative; background: #111; color: #fff; border: 0; border-radius: 16px; }
.mock-vertical .mock-media { background: #222; color: #666; }
.mock-overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 12px 12px; background: linear-gradient(transparent, rgba(0,0,0,0.75)); font-size: 12px; line-height: 1.4; }
.mock-overlay .mock-name { color: #fff; }
/* YouTube: Short (verticale fino a 3 minuti) o video normale, deciso dal video */
.mock-yt-title { font-weight: 600; font-size: 14px; line-height: 1.3; padding: 10px 12px 2px; }
.mock-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; }
.mock-wrap > .mock:not(.mock-vertical) { width: 100%; }
.mock-yt-note { margin-top: 10px; max-width: 300px; font-size: 12px; line-height: 1.45; color: var(--text-2); text-align: center; }
.mock-yt-note strong { color: var(--text); }
.mock-short { overflow: hidden; }
.mock-short-label { position: absolute; top: 10px; left: 12px; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.mock-short-actions { position: absolute; right: 6px; bottom: 92px; display: flex; flex-direction: column; gap: 12px; align-items: center; color: #fff; }
.mock-short-actions span { display: flex; flex-direction: column; align-items: center; gap: 2px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.mock-short-actions small { font-size: 9.5px; font-weight: 600; }
.mock-short-info { padding-right: 56px; }
.mock-short-channel { display: flex; align-items: center; gap: 6px; }
.mock-short-sub { margin-left: 4px; background: #fff; color: #0f0f0f; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.mock-short-title { margin-top: 6px; font-size: 12.5px; line-height: 1.35; }
.mock-draft-note { position: absolute; top: 10px; left: 10px; right: 10px; background: rgba(255,255,255,0.92); color: #111; border-radius: 8px; font-size: 11px; padding: 6px 8px; line-height: 1.35; }

/* ---------- Dettaglio contenuto ---------- */
.pub-card { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }
.pub-card:first-child { border-top: 0; }
.pub-card.is-failed { background: linear-gradient(90deg, var(--danger-soft), transparent 60%); }
.pub-error { margin-top: 8px; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid #f2c8cd; border-radius: var(--r-sm); padding: 8px 10px; }
.pub-error-raw { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-top: 4px; overflow-wrap: anywhere; }
.pub-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

.attached-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s-2); }
.attached-item { position: relative; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-3); }
.attached-item img, .attached-item video { width: 100%; height: 100%; object-fit: cover; }
.attached-item form { position: absolute; top: 5px; right: 5px; }
.attached-remove { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(21,22,26,0.72); color: #fff; display: grid; place-items: center; }
.attached-remove:hover { background: var(--danger); }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }
.timeline-item:first-child { border-top: 0; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); margin-top: 5px; flex-shrink: 0; }
.timeline-item.is-current .timeline-dot { background: var(--ink); box-shadow: 0 0 0 3px var(--signal); }

/* ---------- Calendario ---------- */
.cal-toolbar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.cal-month { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; min-width: 180px; }
.cal-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { position: relative; }
.filter-chip input { position: absolute; opacity: 0; pointer-events: none; }
.filter-chip input + span {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 4px; border-radius: var(--r-full);
    border: 1px solid var(--border-strong); font-size: 12.5px; font-weight: 600; color: var(--text-3); cursor: pointer; background: var(--surface);
    transition: all var(--t-fast);
}
.filter-chip span .platform-badge, .filter-chip span .avatar { opacity: 0.35; filter: grayscale(1); transition: all var(--t-fast); }
.filter-chip input:checked + span { color: var(--text); border-color: var(--ink); }
.filter-chip input:checked + span .platform-badge, .filter-chip input:checked + span .avatar { opacity: 1; filter: none; }
.filter-chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.cal { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.cal-week + .cal-week { border-top: 1px solid var(--border); }
.cal-day { min-height: 128px; padding: 6px; border-left: 1px solid var(--border); position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: background var(--t-fast); }
.cal-day:first-child { border-left: 0; }
.cal-day.is-out { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--surface) 6px, var(--surface) 12px); }
.cal-day.is-past { background: var(--surface-2); }
.cal-day.is-weekend:not(.is-out):not(.is-past) { background: #fcfcfa; }
.cal-day-top { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.cal-num { font-size: 12.5px; font-weight: 600; color: var(--text-2); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.cal-day.is-past .cal-num { color: var(--text-3); }
.cal-day.is-today .cal-num { background: var(--ink); color: var(--signal); }
.cal-add { opacity: 0; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); transition: opacity var(--t-fast), background var(--t-fast); }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--surface-3); color: var(--text); }
.cal-items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-more { font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 2px 6px; }
.cal-event {
    display: flex; align-items: center; gap: 5px; padding: 3px 6px 3px 3px; border-radius: 6px; min-width: 0;
    font-size: 11.5px; line-height: 1.3; background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--info); transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.cal-event:hover { box-shadow: var(--shadow-md); }
.cal-event .ev-time { font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-event .ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); min-width: 0; }
.cal-event.is-published { border-left-color: var(--success); }
.cal-event.is-failed { border-left-color: var(--danger); background: var(--danger-soft); border-color: #f2c8cd; border-left-color: var(--danger); }
.cal-event.is-publishing, .cal-event.is-pending { border-left-color: var(--info); }
.cal-event[draggable="true"] { cursor: grab; }
.cal-event.is-dragging { opacity: 0.4; }
.cal-day.is-drop { background: var(--signal-soft); box-shadow: inset 0 0 0 2px var(--ink); }
.cal-legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: var(--s-3); align-items: center; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.agenda-day { display: flex; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }
.agenda-day:first-child { border-top: 0; }
.agenda-date { width: 56px; flex-shrink: 0; text-align: center; }
.agenda-dow { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.agenda-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.agenda-day.is-today .agenda-num { color: var(--ink); }
.agenda-day.is-today .agenda-date { background: var(--signal-soft); border-radius: var(--r-md); padding: 4px 0; }
.agenda-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.agenda-item { display: flex; align-items: center; gap: var(--s-3); padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; transition: border-color var(--t-fast), background var(--t-fast); }
.agenda-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.agenda-item.is-failed { border-color: #f2c8cd; background: var(--danger-soft); }
.agenda-item { border-left: 3px solid var(--info); }
.agenda-item.is-published { border-left-color: var(--success); }
.agenda-item.is-failed { border-left-color: var(--danger); }
.agenda-item.is-canceled { border-left-color: var(--border-strong); }

/* ---------- Account social ---------- */
.account-card { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); flex-wrap: wrap; }
.account-card:first-child { border-top: 0; }
.account-card.is-disconnected { background: linear-gradient(90deg, var(--warning-soft), transparent 70%); }
.connect-card { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); height: 100%; }
.connect-card-head { display: flex; align-items: center; gap: var(--s-3); }
.connect-card-title { font-size: 14.5px; font-weight: 650; }
.connect-card-text { font-size: 13px; color: var(--text-2); flex: 1; }
.connect-card-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ---------- Libreria ---------- */
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s-4); }
.library-item { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; transition: box-shadow var(--t-fast), border-color var(--t-fast); }
.library-item:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.library-thumb { aspect-ratio: 4 / 3; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); position: relative; overflow: hidden; }
.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }
.library-thumb .thumb-kind { position: absolute; left: 8px; bottom: 8px; background: rgba(21,22,26,0.72); color: #fff; border-radius: 5px; padding: 3px; display: grid; }
.library-meta { padding: 10px 12px; display: flex; align-items: center; gap: var(--s-2); }

/* ---------- Analytics ---------- */
.hour-bars { display: flex; flex-direction: column; gap: 8px; }
.hour-bar { display: grid; grid-template-columns: 52px 1fr auto; gap: var(--s-3); align-items: center; font-size: 12.5px; }
.hour-bar .meter { height: 10px; }
.hour-bar .meter > span { background: var(--ink); border-radius: inherit; }
.hour-bar:first-child .meter > span { background: linear-gradient(90deg, var(--ink), #3a3d46); box-shadow: inset -4px 0 0 var(--signal); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; }
.tag small { color: var(--text-3); font-weight: 500; }

/* ---------- Notifiche ---------- */
.notif { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); align-items: flex-start; }
.notif:first-child { border-top: 0; }
.notif.is-unread { background: linear-gradient(90deg, var(--signal-soft), transparent 50%); }
.notif.is-unread .notif-msg { font-weight: 500; color: var(--text); }
.notif-msg { font-size: 13.5px; color: var(--text-2); overflow-wrap: anywhere; }
.notif-actions { display: flex; gap: 2px; flex-shrink: 0; margin: -4px -6px 0 0; }
.notif-delete { color: var(--text-3); }
.notif-delete:hover { color: var(--danger); }
.notif.is-leaving { opacity: 0; transform: translateX(8px); transition: opacity 0.18s, transform 0.18s; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: var(--surface); }
.auth-panel { display: flex; flex-direction: column; padding: var(--s-8) var(--s-10); }
.auth-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.auth-form { width: 100%; max-width: 380px; }
.auth-title { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.auth-sub { color: var(--text-2); margin-top: 6px; margin-bottom: var(--s-6); }
.auth-foot { font-size: 13px; color: var(--text-2); margin-top: var(--s-5); text-align: center; }
.auth-foot a, .link { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.auth-foot a:hover, .link:hover { text-decoration-color: var(--ink); }
.auth-aside {
    margin: var(--s-3); border-radius: var(--r-xl); background: var(--ink); color: #fff; position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end; padding: var(--s-10);
}
.auth-aside::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(600px 300px at 85% 10%, rgba(205, 242, 59, 0.16), transparent 60%),
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px) 0 0 / 100% 44px,
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px) 0 0 / 44px 100%;
}
.auth-aside > * { position: relative; }
.auth-quote { font-size: 28px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.2; max-width: 480px; }
.auth-quote em { font-style: normal; color: var(--signal); }
.auth-points { display: flex; flex-direction: column; gap: 10px; margin-top: var(--s-6); color: rgba(255,255,255,0.72); font-size: 14px; }
.auth-points div { display: flex; gap: 10px; align-items: center; }
.auth-points svg { color: var(--signal); }
.auth-preview { position: absolute; top: var(--s-10); left: var(--s-10); right: var(--s-10); display: flex; flex-direction: column; gap: 8px; }
.auth-preview-row { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: rgba(255,255,255,0.85); backdrop-filter: blur(4px); }
.auth-preview-row .t { font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; width: 44px; }
.auth-preview-row .badge { margin-left: auto; }
.auth-error { margin-bottom: var(--s-4); }
.auth-single { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6); background: var(--canvas); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-md); padding: var(--s-8); }

/* Anteprima pubblica per il cliente. */
/* ---------- Anteprima pubblica per il cliente ---------- */
.pv { min-height: 100vh; background: var(--canvas); display: flex; flex-direction: column; }
.pv-wrap { width: 100%; max-width: 980px; margin: 0 auto; padding-left: var(--s-5); padding-right: var(--s-5); }
.pv-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--s-8) 0 var(--s-6); }
.pv-head-row { display: flex; align-items: center; gap: var(--s-5); }
.pv-avatar { width: 84px; height: 84px; border-radius: 22px; font-size: 28px; flex-shrink: 0; }
.pv-kicker { font-size: 12.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.pv-title { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; margin-top: 2px; }
.pv-stats { display: flex; gap: var(--s-5); margin-top: var(--s-2); font-size: 14px; color: var(--text-2); }
.pv-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
.pv-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; padding-top: var(--s-5); padding-bottom: var(--s-4); }
.pv-toolbar .segmented > button {
    display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 7px; border: 0; background: none;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; cursor: pointer;
}
.pv-toolbar .segmented > button:hover { color: var(--text); }
.pv-toolbar .segmented > button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.pv-toolbar .segmented > button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.pv-count { font-weight: 600; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.pv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pv-tile { position: relative; aspect-ratio: 4 / 5; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--surface-3); cursor: pointer; display: block; }
.pv-tile img, .pv-tile video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.pv-tile:hover img, .pv-tile:hover video { transform: scale(1.03); }
.pv-tile:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pv-tile-kind { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); display: grid; }
.pv-tile-foot { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 26px 10px 9px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.62)); color: #fff; font-size: 12px; font-weight: 600; }
.pv-textcard { width: 100%; height: 100%; display: flex; align-items: flex-start; justify-content: flex-start; padding: 20px 18px 48px; text-align: left;
    background: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); color: #fff; }
.pv-textcard span { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

.pv-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pv-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pv-status.is-scheduled { background: var(--info-soft); color: var(--info); }
.pv-status.is-published { background: var(--success-soft); color: var(--success); }
.pv-tile-foot .pv-status { background: rgba(255, 255, 255, 0.92); }

.pv-list { display: flex; flex-direction: column; gap: var(--s-6); }
.pv-group-title { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--s-2); }
.pv-row { width: 100%; display: flex; align-items: center; gap: var(--s-4); padding: 12px; margin-bottom: 8px; text-align: left; font: inherit; color: inherit;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.pv-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.pv-row:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pv-date { width: 44px; flex-shrink: 0; text-align: center; line-height: 1.05; }
.pv-date span { display: block; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.pv-date small { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; }
.pv-row-thumb { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--surface-3); }
.pv-row-thumb img, .pv-row-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-row-thumb .pv-textcard { padding: 6px; align-items: center; }
.pv-row-thumb .pv-textcard span { font-size: 8px; -webkit-line-clamp: 5; }
.pv-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pv-row-title { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-row-text { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-row-meta { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pv-platforms { display: inline-flex; gap: 3px; }
.pv-empty-filter { text-align: center; color: var(--text-3); padding: var(--s-8) 0; }

.pv-foot { margin-top: auto; padding: var(--s-10) var(--s-5) var(--s-8); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.pv-foot-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* Dettaglio di un post */
dialog.pv-modal { width: min(980px, calc(100vw - 32px)); max-width: none; padding: 0; overflow: hidden; }
.pv-detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); max-height: min(86vh, 760px); }
.pv-media { position: relative; background: #0d0d0f; display: grid; place-items: center; min-height: 320px; }
.pv-slide { width: 100%; height: 100%; display: grid; place-items: center; }
.pv-slide img, .pv-slide video { width: 100%; height: 100%; max-height: min(86vh, 760px); object-fit: contain; display: block; }
.pv-slide .pv-textcard { min-height: 420px; }
/* Post di solo testo: niente riquadro che ripete il testo, una colonna sola. */
dialog.pv-modal:has(.pv-detail.is-textonly) { width: min(560px, calc(100vw - 32px)); }
.pv-detail.is-textonly { grid-template-columns: 1fr; }
.pv-slide .pv-textcard span { font-size: 22px; -webkit-line-clamp: 12; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); color: #111; display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.pv-nav.is-prev { left: 12px; }
.pv-nav.is-next { right: 12px; }
.pv-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.pv-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); }
.pv-dots i.is-on { background: #fff; }
.pv-info { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.pv-info-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--border); }
.pv-info-head strong { display: block; font-size: 14px; }
.pv-info-head small { display: block; font-size: 12px; color: var(--text-3); }
.pv-info-body { padding: 18px; overflow-y: auto; flex: 1; }
.pv-info-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.pv-caption { white-space: pre-line; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; color: var(--text); }
.pv-info-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); }
.pv-info-platforms { display: flex; flex-wrap: wrap; gap: 10px; }
.pv-info-platforms span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }

@media (max-width: 700px) {
    .pv-wrap { padding-left: var(--s-4); padding-right: var(--s-4); }
    .pv-head { padding: var(--s-6) 0 var(--s-5); }
    .pv-avatar { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
    .pv-title { font-size: 22px; }
    .pv-grid { gap: 3px; }
    .pv-tile { border-radius: 4px; }
    .pv-tile-foot { padding: 18px 6px 6px; font-size: 10.5px; }
    .pv-tile-foot .pv-status { display: none; }
    .pv-textcard { padding: 10px 9px 30px; }
    .pv-textcard span { font-size: 11px; -webkit-line-clamp: 5; }
    .pv-row { gap: var(--s-3); padding: 10px; }
    .pv-row-thumb { width: 52px; height: 52px; }
    .pv-row .pv-status { display: none; }
    dialog.pv-modal { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; margin: 0; }
    .pv-detail { grid-template-columns: 1fr; grid-template-rows: auto 1fr; max-height: 100dvh; height: 100%; }
    .pv-media { min-height: 0; max-height: 55dvh; }
    .pv-slide img, .pv-slide video { max-height: 55dvh; }
    .pv-slide .pv-textcard { min-height: 260px; }
    .pv-detail.is-textonly { grid-template-rows: 1fr; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
    .composer { grid-template-columns: minmax(0, 1fr) 320px; }
    .split { grid-template-columns: minmax(0, 1fr) 300px; }
    .page { padding: var(--s-6) var(--s-6) var(--s-10); }
}

@media (max-width: 1000px) {
    .composer { grid-template-columns: minmax(0, 1fr); }
    .composer-aside { position: static; order: 2; }
    .split { grid-template-columns: minmax(0, 1fr); }
    .split-aside-first > aside { order: -1; }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

@media (max-width: 1100px) {
    .btn.drawer-close { display: inline-flex; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: min(300px, 86vw);
        background: var(--canvas); transform: translateX(-102%); transition: transform 240ms var(--ease), box-shadow 240ms var(--ease);
    }
    body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .scrim { display: block; position: fixed; inset: 0; background: rgba(21,22,26,0.4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease); }
    body.nav-open .scrim { opacity: 1; pointer-events: auto; }
    body.nav-open { overflow: hidden; }
    .topbar {
        display: flex; align-items: center; gap: var(--s-2); height: 56px; padding: 0 var(--s-2) 0 var(--s-2);
        position: sticky; top: 0; z-index: 40; background: rgba(241,241,236,0.92); backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--border);
    }
    .topbar-ctx { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
    .main { padding: 0; }
    .main-panel { border-radius: 0; border: 0; }
    .page { padding: var(--s-5) var(--s-4) var(--s-10); }
    .page-title { font-size: 22px; }
    .submit-bar { padding: 10px; }
    .submit-summary { flex-basis: 100%; order: -1; padding: 0 4px; }
    .submit-bar .btn-lg { flex: 1; }
    .toasts { right: var(--s-4); left: var(--s-4); bottom: var(--s-4); width: auto; }
}

/* Stepper su telefono: il riepilogo va sotto il titolo invece di schiacciarlo. */
@media (max-width: 700px) {
    .step-head { flex-wrap: wrap; row-gap: 2px; }
    .step.is-done .step-summary { order: 3; flex-basis: 100%; margin-left: 32px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .step.is-done .step-edit { margin-left: auto; }
    .step-foot { flex-wrap: wrap; }
    .step-foot [data-step-next] { width: 100%; justify-content: center; }
}
@media (max-width: 400px) {
    /* 3 opzioni devono stare in 320px senza scorrere: si perdono le icone, non le parole. */
    .segmented span, .segmented a { padding: 0 10px; gap: 0; }
    .segmented span svg { display: none; }
}
@media (max-width: 700px) {
    /* Barra in basso: Home · Contenuti · (+) · Calendario · Menu */
    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(255,255,255,0.96); backdrop-filter: blur(10px);
        border-top: 1px solid var(--border); box-shadow: 0 -6px 18px -12px rgba(21,22,26,0.25);
    }
    body.nav-open .bottom-nav { display: none; }
    .bottom-item {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px;
        border: 0; background: none; font-size: 11px; font-weight: 600; color: var(--text-3); border-radius: var(--r-md);
    }
    .bottom-item[aria-current="page"] { color: var(--text); }
    .bottom-item[aria-current="page"] svg { color: var(--ink); }
    .bottom-item[aria-current="page"]::before { content: ""; position: absolute; top: -7px; width: 24px; height: 3px; border-radius: 0 0 3px 3px; background: var(--ink); }
    .bottom-create {
        justify-self: center; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-top: -18px;
        background: var(--ink); color: var(--signal); box-shadow: 0 6px 16px -4px rgba(21,22,26,0.5), 0 0 0 4px var(--surface);
    }
    .bottom-dot { position: absolute; top: 8px; left: calc(50% + 6px); width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }
    .topbar-create { display: none; }
    .page { padding-bottom: calc(var(--s-10) + 76px); }
    .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
    .submit-bar { bottom: calc(68px + env(safe-area-inset-bottom)); }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .page-head { align-items: stretch; }
    .page-actions { width: 100%; }
    .page-actions > .btn, .page-actions > form, .page-actions > .dropdown { flex: 1; }
    .page-actions > form .btn, .page-actions > .dropdown > summary { width: 100%; }
    .page-actions > .btn-icon, .page-actions > .dropdown.is-icon { flex: 0 0 auto; }
    .page-actions > .dropdown.is-icon > summary { width: 44px; }
    .list-item, .content-row, .pub-card, .notif, .attention-item, .account-card { padding-left: var(--s-4); padding-right: var(--s-4); }
    .content-row { flex-wrap: wrap; }
    .content-thumb { width: 52px; height: 52px; }
    .content-side { flex-direction: row; flex-wrap: wrap; align-items: center; width: 100%; justify-content: space-between; padding-left: calc(52px + var(--s-4)); }
    .cal-desktop { display: none; }
    .agenda-day { padding: var(--s-3) var(--s-4); gap: var(--s-3); }
    .agenda-date { width: 44px; }
    .agenda-item { padding: 8px; gap: var(--s-2); }
    .agenda-item .badge, .agenda-item .acct-avatar .avatar { display: none; }
    .agenda-item .acct-avatar .platform-badge { position: static; box-shadow: none; }
    .card-body { padding: var(--s-4); }
    .card-head { padding: var(--s-3) var(--s-4); }
    .step-head { padding: var(--s-4) var(--s-4) 0; }
    .step-body { padding: var(--s-3) var(--s-4) var(--s-4); }
    .account-picker { grid-template-columns: minmax(0, 1fr); }
    .auth-panel { padding: var(--s-5) var(--s-4); }
    .auth-card { padding: var(--s-6) var(--s-5); }
    .stat-value { font-size: 24px; }
    .table th, .table td { padding-left: var(--s-4); padding-right: var(--s-4); }
    .modal-foot .btn { flex: 1; }
    .hide-sm { display: none !important; }
}
/* Touch: bersagli da almeno 44px e campi a 16px (sotto, iOS ingrandisce la pagina al focus). */
@media (max-width: 700px), (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 40px; }
    .btn-icon { min-width: 44px; }
    .btn-icon.btn-sm { min-width: 40px; }
    .input, .select, .textarea { font-size: 16px; min-height: 44px; }
    .input-sm { min-height: 40px; }
    .segmented span, .segmented a { height: 38px; }
    .tab { padding-top: 13px; padding-bottom: 13px; }
    .menu-item { padding: 12px 10px; }
    .nav-item { padding: 11px 10px; }
    .filter-chip input + span, .preview-tab { height: 36px; }
    .client-head-meta a, .crumbs a, .link { padding: 6px 0; display: inline-block; }
    .section-link { padding: 6px 0; }
    .cal-add { opacity: 1; width: 32px; height: 32px; }
    .check input, input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
    input[type="file"].input { min-height: 44px; }
    .disclosure > summary { padding: 11px 0; }
    .topbar-ctx { min-height: 44px; }
    .client-head-meta a { padding: 11px 0; margin: -11px 0; }
}
@media (min-width: 701px) {
    .cal-mobile-only { display: none; }
    .show-sm { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

@media print {
    .sidebar, .topbar, .toasts, .page-actions, .submit-bar { display: none !important; }
    .main { padding: 0; } .main-panel { border: 0; box-shadow: none; }
}

/* Titolo di gruppo con conteggi affiancati e tono neutro per i controlli "da fare". */
.issue.is-todo { color: var(--text-3); }

/* La scorciatoia da tastiera non ha senso su schermi touch. */
@media (pointer: coarse) { .kbd { display: none; } }

/* Anteprima di un carosello: scorrevole (scroll-snap), con frecce, pallini cliccabili e contatore */
.mock-carousel { display: block; }
.mock-track { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; outline: none; }
.mock-track::-webkit-scrollbar { display: none; }
.mock-track:focus-visible { box-shadow: inset 0 0 0 2px #2a78d6; }
.mock-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.mock-slide img, .mock-slide video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mock-count { position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11.5px; font-weight: 600; pointer-events: none; }
.mock-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, 0.88); color: #15161a; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); cursor: pointer; padding: 0; }
.mock-nav:hover { background: #fff; }
.mock-nav:focus-visible { outline: 2px solid #2a78d6; outline-offset: 2px; }
.mock-nav[hidden] { display: none; }
.mock-nav.is-prev { left: 8px; }
.mock-nav.is-next { right: 8px; }
.mock-dots { position: absolute; bottom: 2px; left: 0; right: 0; display: flex; justify-content: center; }
.mock-dot { width: 18px; height: 22px; padding: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.mock-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 2px rgba(0, 0, 0, 0.4); transition: transform 120ms; }
.mock-dot.is-active::before { background: #fff; transform: scale(1.25); }
.mock-dot:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .mock-dot::before { transition: none; } }

/* Revisione di un contenuto da parte del cliente */
.review-box { margin-bottom: var(--s-5); border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); }
.review-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-4); padding-left: 42px; }
.review-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s-3); }
.review-media.is-single { grid-template-columns: minmax(0, 420px); }
.review-media figure { margin: 0; position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface-3); }
.review-media img, .review-media video { width: 100%; display: block; max-height: 520px; object-fit: contain; background: #000; }
.review-media img { background: var(--surface-3); }
.review-media figcaption { position: absolute; top: 8px; left: 8px; min-width: 22px; height: 22px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
@media (max-width: 700px) { .review-actions { padding-left: 0; } .review-actions > * { flex: 1; } .review-actions .btn { width: 100%; justify-content: center; } }

/* Team */
.select-sm { min-height: 30px; padding: 4px 28px 4px 9px; font-size: 13px; width: auto; max-width: 220px; }
.member-client .select.is-missing { border-color: var(--warning); color: var(--warning); background-color: var(--warning-soft); }
.member-delete { color: var(--text-3); }
.member-delete:hover { color: var(--danger); }
.t-right { text-align: right; }

/* Clienti archiviati: riattiva o elimina */
.client-cell { display: flex; flex-direction: column; }
.client-cell .client-card { border-bottom-left-radius: 0; border-bottom-right-radius: 0; flex: 1; }
.client-card-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: 8px 12px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); background: var(--surface-2); }
.is-danger-text { color: var(--danger); }
.is-danger-text:hover { background: var(--danger-soft); color: var(--danger); }

/* Un titolo o un testo senza spazi (es. un URL lungo) non deve allargare la pagina. */
.content-title, .content-excerpt, .list-item, .notif, .pub-card { overflow-wrap: anywhere; }

/* Touch: i pulsanti piccoli restano comodi da toccare (almeno 40 px). */
@media (pointer: coarse) {
    .btn-sm, .btn-icon, .menu-item { min-height: 40px; }
    .btn-icon { min-width: 40px; }
}

/* Accessibilita': bersagli di tocco/clic di almeno 24x24 px (WCAG 2.2, 2.5.8) anche per i pulsanti piccoli. */
.attached-remove, .cal-event { min-height: 24px; min-width: 24px; }

/* Avviso in evidenza (es. verifica a due fattori obbligatoria) */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--border); background: var(--surface-2, #f4f4f1); }
.notice.is-warning { background: #fff6e0; border-color: #f0d9a0; color: #5c4300; }

/* Andamento (grafici a colonne): una serie sola, blu validato per il contrasto sulla scheda bianca */
.trend-kpis { display: flex; gap: 28px; margin-bottom: 10px; }
.trend-kpi { font-size: 26px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.trend-kpi-2 { font-size: 18px; color: var(--text-2); font-weight: 600; padding-top: 6px; }
.trend-chart { position: relative; }
.trend-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.trend-grid { stroke: var(--border); stroke-width: 1; }
.trend-axis { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend-bar { fill: #2a78d6; }
.trend-bar.is-hover { fill: #1d5fb0; }
.trend-hit { fill: transparent; cursor: default; outline: none; }
.trend-hit:focus-visible { stroke: var(--text); stroke-width: 1.5; }
.trend-tip { position: absolute; top: 0; pointer-events: none; background: var(--text, #15161a); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 2; }
.trend-tip b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.trend-table { margin-top: 10px; }
.trend-table summary { cursor: pointer; }

/* Pagine pubbliche: privacy, termini, assistenza */
.legal-body { background: var(--canvas, #f3f3ef); }
.legal-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: 860px; margin: 0 auto; padding: 20px 20px 8px; }
.legal-nav { display: flex; align-items: center; gap: 18px; font-size: 14px; flex-wrap: wrap; }
.legal-nav a:not(.btn) { color: var(--text-2); padding: 6px 2px; }
.legal-nav a[aria-current="page"] { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 5px; }
.legal { max-width: 860px; margin: 12px auto 0; padding: 28px 28px 36px; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 14px; line-height: 1.65; color: var(--text); }
.legal h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal li, .legal dd { font-size: 15px; }
.legal ul, .legal ol { padding-left: 22px; margin: 8px 0; }
.legal a { text-decoration: underline; text-underline-offset: 3px; }
.legal a.btn { text-decoration: none; }
.legal-lead { font-size: 16px; color: var(--text-2); margin: 0 0 8px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.legal-table th { color: var(--text-3); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.legal-faq dt { font-weight: 600; margin-top: 14px; }
.legal-faq dd { margin: 4px 0 0; color: var(--text-2); }
.legal-todo { background: #fff6e0; border: 1px dashed #d9a400; color: #5c4300; padding: 0 6px; border-radius: 4px; font-size: .92em; }
.legal-foot { max-width: 860px; margin: 0 auto; padding: 16px 20px 40px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.legal .notice { margin-bottom: 18px; }
@media (max-width: 640px) { .legal { padding: 20px 16px 28px; border-radius: 0; border-left: 0; border-right: 0; } .legal-table thead { display: none; } .legal-table td { display: block; border: 0; padding: 4px 0; } .legal-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); } }


/* Scelta del colore di un'etichetta: pallini selezionabili, il scelto ha il contorno (nessun codice in pagina: la CSP lo vieta). */
.swatch { position: relative; display: inline-flex; cursor: pointer; }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatch span { display: block; width: 28px; height: 28px; border-radius: 50%; background: var(--swatch); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .12s, transform .12s; }
.swatch:hover span { transform: scale(1.08); }
.swatch input:checked + span { outline-color: var(--swatch); }
.swatch input:focus-visible + span { outline-color: var(--text); }


/* Campo «Etichette» dei form: stessa forma di un campo di testo; chip con la ✕ e «+ Aggiungi» che apre un menu con ricerca. */
.label-field-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 5px 6px 5px 9px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.label-field-box:hover { border-color: var(--text-3); }
.label-field.is-open .label-field-box, .label-field-box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
.label-field-tags { display: contents; }
.label-field-empty { color: #6f7178; font-size: 14px; }
.label-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 9px; border-radius: var(--r-full); font-size: 13px; font-weight: 500; color: var(--text); background: color-mix(in srgb, var(--swatch) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--swatch) 38%, var(--surface)); }
.label-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--swatch); flex: none; }
.label-tag-x { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); font-size: 15px; line-height: 1; cursor: pointer; }
.label-tag-x:hover { background: rgba(21, 22, 26, 0.1); color: var(--text); }
.label-tag-x:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.label-field-add { display: inline-flex; align-items: center; gap: 5px; height: 26px; margin-left: auto; padding: 0 11px 0 9px; border: 1px dashed var(--border-strong); border-radius: var(--r-full); background: transparent; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.label-field-add:hover { border-style: solid; border-color: var(--text-3); background: var(--surface-2); color: var(--text); }
.label-field-add:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.label-pop { position: fixed; z-index: 90; width: 300px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop-in 140ms var(--ease); }
.label-pop-search { padding: 8px; border-bottom: 1px solid var(--border); }
.label-pop-list { max-height: 232px; overflow-y: auto; padding: 5px; }
.label-pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font-size: 13.5px; text-align: left; color: var(--text); cursor: pointer; }
.label-pop-item:hover, .label-pop-item.is-active { background: var(--surface-3); }
.label-pop-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--swatch); flex: none; }
.label-pop-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-pop-check { display: inline-flex; margin-left: auto; color: var(--ink); visibility: hidden; }
.label-pop-item.is-selected .label-pop-check { visibility: visible; }
.label-pop-item.is-selected { font-weight: 600; }
.label-pop-create { font-weight: 600; }
.label-pop-create .label-pop-plus { display: inline-flex; color: var(--text-2); }
.label-pop-empty { padding: 14px 12px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.label-pop-error { padding: 8px 12px; font-size: 12.5px; color: var(--danger); border-top: 1px solid var(--border); }
.label-pop-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); background: var(--surface-2); }
.label-pop-foot a { color: var(--text-2); text-decoration: underline; }

/* «Personalizza per social» nei form: un pannello con una scheda per piattaforma. */
.variants { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.variants[open] { background: var(--surface); border-color: var(--border-strong); }
.variants-summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; border-radius: var(--r-md); }
.variants-summary::-webkit-details-marker { display: none; }
.variants-summary:hover { background: var(--surface-3); }
.variants-summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.variants-summary-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.variants-summary-text strong { font-size: 14px; color: var(--text); }
.variants-summary-text span { font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.variants-summary > svg { flex: none; color: var(--text-3); transition: transform var(--t-fast); }
.variants[open] > .variants-summary > svg { transform: rotate(180deg); }
.variants-count { flex: none; padding: 2px 9px; border-radius: var(--r-full); background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; }
.variants-body { padding: 0 14px 14px; }
.variants-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.variants-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 8px; border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.variants-tab:hover { background: var(--surface-3); color: var(--text); }
.variants-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.variants-tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.variants-tab[hidden] { display: none; }
.variants-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success, #16a34a); flex: none; }
.variants-tab[aria-selected="true"] .variants-dot { box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px #fff; }
.variants-pane[hidden] { display: none; }
.variants-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; font-size: 12.5px; color: var(--text-3); }
.variants-status.is-custom { color: var(--text-2); }
@media (max-width: 640px) { .variants-tab { height: 40px; } .variants-summary-text span { display: none; } }

.library-open { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin-top: var(--s-3); }
.library-open .hint { margin: 0; }
#media-library { margin-top: var(--s-3); }
