/* uè social — tema sopra Bootstrap 5 */
:root {
    --ue-ink: #17181C;
    --ue-bg: #F6F6F3;
    --ue-card: #FFFFFF;
    --ue-border: #E4E4DE;
    --ue-blue: #2340D8;
    --ue-blue-hover: #1A2FA3;
    --ue-muted: #6B6C72;

    --ue-scheduled-bg: #E6ECFD; --ue-scheduled: #1F3FBF;
    --ue-published-bg: #E3F3E8; --ue-published: #1E6B3A;
    --ue-error-bg: #FBE5E2; --ue-error: #A3261A;
    --ue-tiktok-bg: #FDF0DC; --ue-tiktok: #8A4B05;
    --ue-draft-bg: #EEEEEA; --ue-draft: #4A4B52;

    --ue-ig: #B8336A; --ue-fb: #2F55B5; --ue-tt: #17181C;

    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-bg: var(--ue-bg);
    --bs-body-color: var(--ue-ink);
    --bs-emphasis-color: var(--ue-ink);
    --bs-secondary-color: var(--ue-muted);
    --bs-border-color: var(--ue-border);
    --bs-primary: var(--ue-blue);
    --bs-primary-rgb: 35, 64, 216;
    --bs-link-color: var(--ue-blue);
    --bs-link-color-rgb: 35, 64, 216;
    --bs-link-hover-color: var(--ue-blue-hover);
    --bs-link-hover-color-rgb: 26, 47, 163;
    --bs-border-radius: 10px;
    --bs-border-radius-lg: 14px;
    --bs-border-radius-sm: 8px;
    --bs-focus-ring-color: rgba(35, 64, 216, .25);

    --ue-bottom-nav: 64px;
    --ue-dropbar: 56px;
}

body { background: var(--ue-bg); -webkit-font-smoothing: antialiased; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4 { font-weight: 700; letter-spacing: -.01em; }
.page-title { font-size: 1.5rem; margin: 0; }
.text-muted, .text-secondary { color: var(--ue-muted) !important; }
.small-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ue-muted); }

/* Pulsanti */
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: 10px; }
.btn-sm { min-height: 36px; }
.btn-primary {
    --bs-btn-bg: var(--ue-blue); --bs-btn-border-color: var(--ue-blue);
    --bs-btn-hover-bg: var(--ue-blue-hover); --bs-btn-hover-border-color: var(--ue-blue-hover);
    --bs-btn-active-bg: var(--ue-blue-hover); --bs-btn-active-border-color: var(--ue-blue-hover);
    --bs-btn-disabled-bg: var(--ue-blue); --bs-btn-disabled-border-color: var(--ue-blue);
}
.btn-outline-secondary { --bs-btn-color: var(--ue-ink); --bs-btn-border-color: var(--ue-border); --bs-btn-hover-bg: #ECECE7; --bs-btn-hover-color: var(--ue-ink); --bs-btn-hover-border-color: var(--ue-border); --bs-btn-active-bg: #E4E4DE; --bs-btn-active-color: var(--ue-ink); background: #fff; }
.btn-dark { --bs-btn-bg: var(--ue-ink); --bs-btn-border-color: var(--ue-ink); }
.btn-icon { width: 44px; padding: 0; }

/* Card */
.card { --bs-card-border-color: var(--ue-border); --bs-card-border-radius: 14px; --bs-card-inner-border-radius: 13px; background: var(--ue-card); }
.form-control, .form-select { border-color: var(--ue-border); min-height: 44px; border-radius: 10px; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--ue-blue); }
.form-label { font-weight: 600; font-size: .9rem; }
textarea.form-control { min-height: 96px; }

/* Barra superiore */
.ue-topbar { background: var(--ue-ink); color: #fff; position: sticky; top: 0; z-index: 1030; }
.ue-topbar .container-xl { min-height: 60px; display: flex; align-items: center; gap: 1.25rem; }
.ue-logo { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -.02em; white-space: nowrap; }
.ue-logo:hover { color: #fff; }
.ue-logo span { color: #8EA2FF; }
.ue-menu { display: flex; gap: .25rem; }
.ue-menu a { color: rgba(255,255,255,.72); text-decoration: none; font-weight: 600; padding: .55rem .85rem; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.ue-menu a:hover { color: #fff; background: rgba(255,255,255,.08); }
.ue-menu a.active { color: #fff; background: rgba(255,255,255,.14); }
.ue-topbar .btn-icon { color: rgba(255,255,255,.8); }
.ue-topbar .btn-icon:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Navigazione in basso (mobile) */
.ue-bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--ue-border); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.ue-bottom-nav a { flex: 1; min-height: var(--ue-bottom-nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ue-muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.ue-bottom-nav a.active { color: var(--ue-blue); }
.ue-bottom-nav svg { width: 22px; height: 22px; }

.ue-dropbar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--ue-bottom-nav) + 10px + env(safe-area-inset-bottom)); z-index: 1029; background: var(--ue-ink); color: #fff; border-radius: 14px; min-height: var(--ue-dropbar); display: flex; align-items: center; gap: .75rem; padding: 0 1rem; text-decoration: none; font-weight: 600; box-shadow: 0 8px 24px rgba(23,24,28,.25); }
.ue-dropbar:hover { color: #fff; }
.ue-dropbar .plus { width: 34px; height: 34px; border-radius: 10px; background: var(--ue-blue); display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 991.98px) {
    body.has-bottom-nav main { padding-bottom: calc(var(--ue-bottom-nav) + 24px + env(safe-area-inset-bottom)); }
    body.has-dropbar main { padding-bottom: calc(var(--ue-bottom-nav) + var(--ue-dropbar) + 40px + env(safe-area-inset-bottom)); }
}

/* Clienti */
.client-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.client-chip { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .85rem; }

/* Stati e badge */
.status { display: inline-flex; align-items: center; white-space: nowrap; font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; }
.status-draft { background: var(--ue-draft-bg); color: var(--ue-draft); }
.status-scheduled { background: var(--ue-scheduled-bg); color: var(--ue-scheduled); }
.status-published { background: var(--ue-published-bg); color: var(--ue-published); }
.status-error { background: var(--ue-error-bg); color: var(--ue-error); }
.status-tiktok { background: var(--ue-tiktok-bg); color: var(--ue-tiktok); }
.pf { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 20px; padding: 0 .3rem; border-radius: 6px; font-size: .65rem; font-weight: 700; color: #fff; }
.pf-ig { background: var(--ue-ig); } .pf-fb { background: var(--ue-fb); } .pf-tt { background: var(--ue-tt); }

/* Griglie media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
@media (max-width: 575.98px) { .media-grid { grid-template-columns: repeat(3, 1fr); gap: .35rem; } }
.media-tile { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #E9E9E4; border: 1px solid var(--ue-border); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .tile-badge { position: absolute; left: 6px; bottom: 6px; background: rgba(23,24,28,.78); color: #fff; font-size: .7rem; font-weight: 700; padding: .1rem .4rem; border-radius: 6px; display: inline-flex; align-items: center; gap: .2rem; }
.media-tile .tile-flag { position: absolute; right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; }
.media-tile.is-selected { outline: 3px solid var(--ue-blue); outline-offset: -3px; }
.media-tile .tile-order { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%; background: var(--ue-blue); color: #fff; font-weight: 700; font-size: .8rem; display: flex; align-items: center; justify-content: center; }
button.media-tile { padding: 0; width: 100%; }

/* Bozze */
.draft-card { display: block; color: inherit; text-decoration: none; height: 100%; transition: border-color .15s; }
.draft-card:hover { border-color: #C9C9C2; color: inherit; }
.draft-thumbs { display: flex; gap: 4px; height: 120px; overflow: hidden; border-radius: 13px 13px 0 0; background: #EDEDE8; }
.draft-thumbs img { flex: 1; min-width: 0; object-fit: cover; height: 100%; }
.draft-thumbs .more { flex: 0 0 52px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ue-muted); }
.copy-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; color: #3B3C42; }

/* Nastro */
.client-bubbles { display: flex; flex-wrap: wrap; gap: .5rem; }
.client-bubble { min-height: 44px; border: 1.5px solid var(--ue-border); background: #fff; border-radius: 999px; padding: .35rem 1rem .35rem .7rem; display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--ue-ink); }
.client-bubble.active { border-color: var(--ue-ink); background: var(--ue-ink); color: #fff; }
.drop-zone { border: 2px dashed #CFCFC8; border-radius: 14px; background: #fff; padding: 1.25rem; text-align: center; }
.drop-zone.is-over { border-color: var(--ue-blue); background: #F2F4FE; }
.queue-item { display: flex; align-items: center; gap: .75rem; padding: .6rem; border: 1px solid var(--ue-border); border-radius: 12px; background: #fff; }
.queue-item .qi-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #EDEDE8; flex: none; }
.queue-item .progress { height: 6px; }
.tape-group { border: 1px solid var(--ue-border); border-radius: 14px; background: #fff; padding: .85rem; }
.tape-strip { display: flex; gap: .4rem; overflow-x: auto; }
.tape-strip .media-tile { flex: 0 0 84px; width: 84px; }

/* Varie */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ue-muted); }
.empty-state > svg { width: 40px; height: 40px; margin-bottom: .75rem; opacity: .5; }
.char-count { font-size: .75rem; color: var(--ue-muted); }
.char-count.over { color: var(--ue-error); font-weight: 700; }
.filter-pills { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pills .btn { white-space: nowrap; border-radius: 999px; min-height: 38px; font-size: .85rem; }
.filter-pills .btn.active { background: var(--ue-ink); color: #fff; border-color: var(--ue-ink); }
.alert { border-radius: 12px; }
.ue-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ue-auth .card { width: 100%; max-width: 420px; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #F1F1EC; border: 1px solid var(--ue-border); border-radius: 10px; padding: .6rem .8rem; word-break: break-all; }
.icon { width: 18px; height: 18px; flex: none; }
.preview-frame { background: #111; border-radius: 14px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.preview-frame img, .preview-frame video { max-width: 100%; max-height: 70vh; display: block; }
[x-cloak] { display: none !important; }

/* Calendario */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.cal-day { background: #EFEFEA; border-radius: 14px; padding: .4rem; min-height: 420px; display: flex; flex-direction: column; }
.cal-day.is-today { background: #E6ECFD; }
.cal-day.is-past .cal-day-head { opacity: .55; }
.cal-day-head { display: flex; align-items: baseline; justify-content: space-between; padding: .2rem .35rem .45rem; font-size: .8rem; font-weight: 600; color: var(--ue-muted); }
.cal-day.is-today .cal-day-num { background: var(--ue-blue); color: #fff; border-radius: 999px; padding: 0 .45rem; }
.cal-day-num { font-size: 1rem; color: var(--ue-ink); font-weight: 700; }
.cal-list { flex: 1; display: flex; flex-direction: column; gap: .4rem; min-height: 80px; }
.cal-card { display: block; overflow: hidden; padding: .5rem; color: inherit; text-decoration: none; border-radius: 10px; }
.cal-card:hover { color: inherit; border-color: #C9C9C2; }
.cal-card.movable { cursor: grab; }
.cal-card .copy-2 { font-size: .78rem; }
.cal-card-lg { padding: .85rem; }
.cal-card-lg .copy-2 { font-size: .9rem; }
.cal-thumb { position: relative; height: 72px; border-radius: 8px; overflow: hidden; margin-bottom: .35rem; background: #EDEDE8; }
.cal-card-lg .cal-thumb { height: 160px; }
.cal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cal-side { width: 290px; flex: none; }
.pf-failed { outline: 2px solid var(--ue-error); outline-offset: 1px; }
.draft-item { display: flex; align-items: center; gap: .5rem; padding: .4rem; border: 1px solid var(--ue-border); border-radius: 10px; background: #fff; cursor: grab; }
.draft-item img, .draft-noimg { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; background: #EDEDE8; }
.cal-list .draft-item { opacity: .6; }
.sortable-ghost { opacity: .4; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.week-day { display: flex; flex-direction: column; align-items: center; padding: .4rem 0; border-radius: 12px; background: #fff; border: 1px solid var(--ue-border); color: var(--ue-ink); text-decoration: none; min-height: 72px; }
.week-day.is-today { border-color: var(--ue-blue); }
.week-day.active { background: var(--ue-ink); color: #fff; border-color: var(--ue-ink); }
.week-count { font-size: .7rem; font-weight: 700; color: var(--ue-blue); min-height: 1em; }
.week-day.active .week-count { color: #8EA2FF; }
.flex-none { flex: none; }
.form-select-sm { min-height: 38px; }
.cal-card .status { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Sezioni con ancora: non finiscono sotto la barra in alto */
[id].card { scroll-margin-top: 80px; }
.config-section.is-focus { border-color: var(--ue-blue); box-shadow: 0 0 0 3px rgba(35, 64, 216, .15); }
