:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --sidebar: #111827;
    --radius: 18px;
    --shadow: 0 14px 40px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar {
    position: sticky; top: 0; height: 100vh; padding: 22px;
    display: flex; flex-direction: column; gap: 26px;
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 14px;
    display: grid; place-items: center; font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 8px 24px rgba(99, 102, 241, .35);
}
.brand strong { display: block; }
.brand span { display: block; color: #94a3b8; font-size: 12px; margin-top: 3px; }
.nav-list { display: grid; gap: 8px; }
.nav-list a { padding: 12px 14px; border-radius: 12px; color: #cbd5e1; transition: .2s ease; }
.nav-list a:hover, .nav-list a.active { color: #fff; background: rgba(255,255,255,.09); transform: translateX(2px); }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 12px; background: rgba(255,255,255,.07); border-radius: 14px; }
.user-chip .avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #111827; font-weight: 800; }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: #94a3b8; margin-top: 2px; }
.logout-link { color: #fca5a5; font-size: 14px; padding: 0 10px; }

.admin-main { min-width: 0; }
.topbar {
    height: 78px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 22px; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(22,163,74,.12); }
.content-wrap { padding: 28px; max-width: 1500px; margin: 0 auto; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-header h2, .card-header h3 { margin: 0; }
.card p:last-child { margin-bottom: 0; }
.stat-card { overflow: hidden; position: relative; }
.stat-card::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(79,70,229,.08); right: -40px; top: -40px; }
.stat-label { color: var(--muted); font-size: 14px; }
.stat-value { font-size: 34px; font-weight: 800; margin-top: 5px; }

.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 20px rgba(79,70,229,.2); }
.btn-secondary { background: #eef2ff; color: #4338ca; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-dark { background: #111827; color: #fff; }
.btn-sm { padding: 8px 11px; border-radius: 10px; font-size: 13px; }
.icon-button { border: 0; background: transparent; font-size: 25px; cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.form-group { display: grid; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 700; font-size: 14px; }
input, select, textarea {
    width: 100%; border: 1px solid #dbe1ea; background: #fff; border-radius: 12px; padding: 11px 12px; color: var(--text); outline: none; transition: .18s;
}
input:focus, select:focus, textarea:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(99,102,241,.11); }
.help { font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-muted { background: #e5e7eb; color: #4b5563; }
.badge-blue { background: #e0e7ff; color: #3730a3; }
.badge-warning { background: #fef3c7; color: #92400e; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.screen-card { display: grid; gap: 16px; }

.content-campaign {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin-bottom: 8px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.screen-card-top { display:flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.screen-card h3 { margin: 0 0 5px; }
.screen-meta { color: var(--muted); font-size: 13px; }
.media-preview { aspect-ratio: 16 / 9; border-radius: 14px; background: #0f172a; overflow: hidden; display: grid; place-items: center; color: #cbd5e1; }
.media-preview.vertical { aspect-ratio: 9 / 16; max-height: 360px; margin: 0 auto; }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }

.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background:
        radial-gradient(circle at 20% 10%, rgba(124,58,237,.18), transparent 30%),
        radial-gradient(circle at 90% 80%, rgba(79,70,229,.18), transparent 30%),
        #0f172a;
}
.login-card { width: min(440px, 100%); background: rgba(255,255,255,.97); border-radius: 24px; padding: 30px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.login-logo { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items:center; color:#fff; font-weight:900; background: linear-gradient(135deg,#6366f1,#8b5cf6); margin-bottom: 20px; }
.login-card h1 { margin: 0 0 8px; }
.login-card .intro { margin: 0 0 24px; color: var(--muted); }
.login-card .form-group { margin-bottom: 14px; }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-switch { margin-top: 20px; text-align:center; color: var(--muted); font-size: 13px; }
.login-switch a { color: #4f46e5; font-weight: 700; }
.error-box { padding: 11px 13px; border-radius: 12px; background:#fee2e2; color:#991b1b; margin-bottom:14px; font-size:14px; }

.player-body { background: #000; color: #fff; overflow: hidden; }
.player-stage { width: 100vw; height: 100vh; position: relative; display:grid; place-items:center; background:#000; }
.player-media { width:100%; height:100%; object-fit:contain; display:block; background:#000; }
.player-empty { text-align:center; padding:30px; color:#94a3b8; }
.player-empty h1 { color:#fff; }
.player-overlay { position:absolute; inset:0; display:grid; place-items:center; background:linear-gradient(180deg,rgba(15,23,42,.78),rgba(0,0,0,.82)); z-index:5; transition:.3s; }
.player-overlay.hidden { opacity:0; pointer-events:none; }
.player-start { width:min(440px,calc(100% - 40px)); text-align:center; }
.player-start h1 { margin: 0 0 10px; }
.player-start p { color:#cbd5e1; margin:0 0 22px; }
.player-start .btn { font-size:18px; padding:15px 22px; width:100%; }
.player-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 0 18px;
    padding: 11px 14px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 14px;
    background: rgba(255,255,255,.07);
    backdrop-filter: blur(8px);
}
.player-countdown-number {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(124,58,237,.92);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 8px 24px rgba(124,58,237,.28);
}
.player-countdown-text {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
}

.player-tools { position:absolute; top:18px; right:18px; z-index:7; display:flex; gap:8px; opacity:.18; transition:.2s; }
.player-tools:hover { opacity:1; }
.player-tools a, .player-tools button { border:0; border-radius:10px; padding:9px 11px; color:#fff; background:rgba(15,23,42,.75); cursor:pointer; }

.mobile-only { display:none; }
@media (max-width: 1050px) {
    .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
    .admin-shell { display:block; }
    .sidebar { position:fixed; inset:0 auto 0 0; width:280px; z-index:50; transform:translateX(-105%); transition:.25s ease; box-shadow:20px 0 60px rgba(0,0,0,.25); }
    .sidebar.open { transform:translateX(0); }
    .mobile-only { display:inline-flex; }
    .desktop-only { display:none; }
    .topbar { height:68px; padding:0 16px; }
    .topbar h1 { font-size:19px; }
    .content-wrap { padding:16px; }
    .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns:1fr; }
    .form-group.full { grid-column:auto; }
    .card { padding:17px; border-radius:16px; }
    .table-as-cards table, .table-as-cards thead, .table-as-cards tbody, .table-as-cards th, .table-as-cards td, .table-as-cards tr { display:block; }
    .table-as-cards thead { display:none; }
    .table-as-cards tr { border:1px solid var(--line); border-radius:14px; padding:12px; margin-bottom:12px; background:#fff; }
    .table-as-cards td { border:0; padding:7px 4px; }
    .table-as-cards td::before { content:attr(data-label); display:block; color:var(--muted); font-size:11px; font-weight:800; text-transform:uppercase; margin-bottom:2px; }
}
@media (max-width: 480px) {
    .login-card { padding:24px 20px; border-radius:20px; }
    .actions .btn { flex:1; }
}

.app-dialog { border: 0; padding: 0; background: transparent; width: min(760px, calc(100% - 28px)); max-width: 760px; }
.app-dialog::backdrop { background: rgba(15,23,42,.65); backdrop-filter: blur(4px); }
.dialog-card { background: #fff; border-radius: 22px; padding: 22px; box-shadow: 0 30px 90px rgba(0,0,0,.28); max-height: min(88vh, 900px); overflow-y: auto; }
.dialog-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; }
.dialog-head h3 { margin:0 0 4px; font-size:21px; }
.dialog-close { width:38px; height:38px; border:0; border-radius:12px; background:#f1f5f9; cursor:pointer; font-size:25px; line-height:1; }
.dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:4px; }
.check-row { display:flex; align-items:center; gap:9px; font-weight:600; padding:7px 0; }
.check-row input { width:auto; }
@media (max-width: 620px) {
    .app-dialog { width: calc(100% - 18px); }
    .dialog-card { padding:18px; border-radius:18px; }
    .dialog-actions { flex-direction:column-reverse; }
    .dialog-actions .btn { width:100%; }
}

/* Subida múltiple de contenidos */
.upload-dropzone {
    border: 2px dashed #c7d2fe;
    border-radius: 18px;
    min-height: 190px;
    padding: 26px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(180deg, #fafaff 0%, #f8fafc 100%);
    transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
    outline: none;
}
.upload-dropzone:hover,
.upload-dropzone:focus-visible,
.upload-dropzone.dragover {
    border-color: #6366f1;
    background: #eef2ff;
    box-shadow: 0 0 0 5px rgba(99,102,241,.09);
}
.upload-dropzone.dragover { transform: scale(1.01); }
.upload-dropzone-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 29px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 10px 24px rgba(79,70,229,.24);
    margin-bottom: 4px;
}
.upload-dropzone strong { font-size: 16px; }
.upload-dropzone span { color: #4b5563; font-size: 14px; }
.upload-dropzone small { color: var(--muted); font-size: 12px; margin-top: 3px; }

.upload-selection {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}
.upload-selection[hidden] { display: none; }
.upload-selection-head {
    min-height: 48px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}
.upload-selection-head strong { font-size: 13px; }
.upload-clear {
    border: 0;
    background: transparent;
    color: #b91c1c;
    cursor: pointer;
    font-weight: 800;
    font-size: 12px;
    padding: 5px;
}
.upload-file-list { display: grid; }
.upload-file-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}
.upload-file-item:last-child { border-bottom: 0; }
.upload-file-preview {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #0f172a;
    color: #fff;
    font-size: 22px;
}
.upload-file-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-file-preview.video { background: linear-gradient(135deg, #111827, #312e81); }
.upload-file-info { min-width: 0; display: grid; gap: 4px; }
.upload-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
    font-size: 13px;
}
.upload-file-meta { color: var(--muted); font-size: 11px; }
.upload-title-input { margin-top: 3px; padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.upload-remove {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #fee2e2;
    color: #b91c1c;
    cursor: pointer;
    font-size: 21px;
    line-height: 1;
    font-weight: 800;
}
.upload-remove:hover { background: #fecaca; }

@media (max-width: 620px) {
    .upload-dropzone { min-height: 165px; padding: 22px 14px; }
    .upload-file-item { grid-template-columns: 48px minmax(0, 1fr) 34px; gap: 9px; padding: 11px; }
    .upload-file-preview { width: 48px; height: 48px; }
}

/* Biblioteca agrupada por campañas */
.library-page-header { align-items: flex-end; }
.library-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 16px 18px;
    box-shadow: none;
}
.library-search { flex: 1; max-width: 720px; display: grid; gap: 7px; }
.library-search label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.library-view-control { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.library-view-label { color: var(--muted); font-size: 13px; font-weight: 800; }
.library-size-buttons { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.library-size-button {
    width: 38px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    background: #fff;
    color: #312e81;
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15,23,42,.06);
    transition: .18s ease;
}
.library-size-button:hover:not(:disabled) { background: #eef2ff; transform: translateY(-1px); }
.library-size-button:disabled { opacity: .32; cursor: default; box-shadow: none; }

.campaign-library { --library-card-min: 200px; display: grid; gap: 14px; }
.campaign-library.library-size-0 { --library-card-min: 150px; }
.campaign-library.library-size-1 { --library-card-min: 200px; }
.campaign-library.library-size-2 { --library-card-min: 255px; }
.campaign-library.library-size-3 { --library-card-min: 330px; }

.campaign-group {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(15,23,42,.055);
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.campaign-group.is-open { border-color: #c7d2fe; box-shadow: 0 12px 34px rgba(79,70,229,.08); }
.campaign-summary {
    width: 100%;
    min-height: 88px;
    border: 0;
    background: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    text-align: left;
    cursor: pointer;
    color: inherit;
    transition: background .18s ease;
}
.campaign-summary:hover { background: #fbfcff; }
.campaign-summary-info { min-width: 0; }
.campaign-title-line { display: flex; align-items: center; gap: 9px; min-width: 0; }
.campaign-title-line h3 { margin: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-count {
    min-width: 27px;
    height: 27px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 900;
    flex: 0 0 auto;
}
.campaign-meta { margin-top: 5px; color: var(--muted); font-size: 12px; }
.campaign-summary-side { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.campaign-miniatures { display: flex; align-items: center; padding-left: 12px; }
.campaign-miniature {
    width: 46px;
    height: 46px;
    margin-left: -12px;
    border: 3px solid #fff;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #111827;
    box-shadow: 0 2px 8px rgba(15,23,42,.12);
}
.campaign-miniature:first-child { margin-left: 0; }
.campaign-miniature img { width: 100%; height: 100%; object-fit: contain !important; object-position: center; background: #0f172a; }
.campaign-miniature-video { color: #fff; font-size: 17px; transform: translateX(1px); }
.campaign-miniature-web { color: #fff; font-size: 9px; font-weight: 900; letter-spacing: .04em; }
.campaign-toggle-text { color: #4f46e5; font-size: 12px; font-weight: 850; white-space: nowrap; }
.campaign-chevron { font-size: 22px; color: #64748b; transition: transform .2s ease; transform: translateY(-2px); }
.campaign-group.is-open .campaign-chevron { transform: rotate(180deg) translateY(2px); }

.campaign-body { border-top: 1px solid #eef2f7; padding: 18px; background: #fbfcff; }
.campaign-body[hidden] { display: none; }
.library-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--library-card-min), 1fr));
    gap: 14px;
    transition: .2s ease;
}
.content-library-card {
    min-width: 0;
    padding: 13px;
    display: grid;
    align-content: start;
    gap: 11px;
    border-radius: 15px;
    box-shadow: 0 5px 18px rgba(15,23,42,.055);
    transition: transform .18s ease, box-shadow .18s ease;
}
.content-library-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.09); }
.content-library-card[hidden] { display: none; }
.library-media-preview { position: relative; aspect-ratio: 16 / 9; border-radius: 11px; background: #0f172a; overflow: hidden; display: grid; place-items: center; }
.library-media-preview.is-vertical {
    aspect-ratio: 9 / 16;
    width: min(100%, 220px);
    justify-self: center;
}
.library-media-preview.is-horizontal, .library-media-preview.is-both { aspect-ratio: 16 / 9; }
.library-media-preview img, .library-media-preview video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #0f172a;
}
.library-media-preview.is-vertical img, .library-media-preview.is-vertical video {
    object-fit: contain !important;
}

.library-video-badge {
    position: absolute;
    left: 9px;
    bottom: 9px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(15,23,42,.78);
    backdrop-filter: blur(5px);
    font-size: 11px;
    padding-left: 2px;
}
.library-web-preview { width: 100%; padding: 14px; display: grid; gap: 7px; text-align: center; font-weight: 900; }
.library-web-preview small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #94a3b8; font-size: 10px; font-weight: 500; }
.content-library-info { min-width: 0; }
.content-library-info h4 { margin: 0 0 5px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-library-actions { margin-top: auto; }
.content-library-actions form, .content-library-actions .btn { width: 100%; }

.library-size-0 .content-library-card { padding: 9px; gap: 8px; }
.library-size-0 .content-library-info h4 { font-size: 12px; }
.library-size-0 .screen-meta { font-size: 10px; }
.library-size-0 .content-library-actions .btn { padding: 6px 8px; font-size: 11px; }
.library-size-0 .library-video-badge { width: 24px; height: 24px; left: 6px; bottom: 6px; font-size: 9px; }

.library-size-2 .content-library-card { padding: 15px; }
.library-size-2 .content-library-info h4 { font-size: 15px; }
.library-size-3 .content-library-card { padding: 17px; }
.library-size-3 .content-library-info h4 { font-size: 16px; }
.library-no-results { margin-top: 14px; }

@media (max-width: 820px) {
    .library-page-header { align-items: stretch; }
    .library-page-header .btn { flex: 0 0 auto; }
    .library-toolbar { align-items: stretch; }
    .library-search { max-width: none; }
    .campaign-summary { padding: 14px; min-height: 78px; }
    .campaign-miniatures { display: none; }
    .campaign-body { padding: 13px; }
    .campaign-library.library-size-2 { --library-card-min: 220px; }
    .campaign-library.library-size-3 { --library-card-min: 280px; }
}

@media (max-width: 620px) {
    .library-page-header { flex-direction: column; align-items: stretch; }
    .library-page-header .btn { width: 100%; }
    .library-toolbar { padding: 13px; flex-direction: column; }
    .library-view-control { justify-content: space-between; }
    .campaign-summary { align-items: flex-start; }
    .campaign-summary-side { gap: 7px; }
    .campaign-toggle-text { display: none; }
    .campaign-title-line h3 { font-size: 15px; }
    .campaign-meta { font-size: 11px; }
    .library-content-grid { grid-template-columns: repeat(auto-fill, minmax(var(--library-card-min), 1fr)); gap: 10px; }
    .campaign-library.library-size-0 { --library-card-min: 125px; }
    .campaign-library.library-size-1 { --library-card-min: 145px; }
    .campaign-library.library-size-2 { --library-card-min: 190px; }
    .campaign-library.library-size-3 { --library-card-min: 100%; }
}

/* Ajuste visual: los contenidos verticales se muestran completos, sin recorte. */
@media (max-width: 620px) {
    .library-media-preview.is-vertical { width: min(100%, 190px); }
}

/* Gestión de campañas y orden de reproducción */
.campaign-summary {
    padding: 0;
    cursor: default;
    align-items: stretch;
    background: #fff;
}
.campaign-summary:hover { background: #fff; }
.campaign-summary-main {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: background .18s ease;
}
.campaign-summary-main:hover { background: #fbfcff; }
.campaign-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 14px 12px 0;
}
.campaign-actions form { margin: 0; }
.campaign-action-button {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #4338ca;
    min-height: 36px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
    white-space: nowrap;
    transition: .18s ease;
}
.campaign-action-button:hover { background: #eef2ff; border-color: #c7d2fe; }
.campaign-action-button.is-danger { color: #b91c1c; }
.campaign-action-button.is-danger:hover { background: #fef2f2; border-color: #fecaca; }

.campaign-playback-toolbar {
    margin-bottom: 14px;
    padding: 13px 14px;
    border: 1px solid #dbe4ff;
    background: #f8faff;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.campaign-playback-toolbar > div { min-width: 0; display: grid; gap: 3px; }
.campaign-playback-toolbar strong { font-size: 13px; }
.campaign-playback-toolbar span { color: var(--muted); font-size: 11px; }
.campaign-playback-toolbar small { color: #4338ca; font-size: 10px; font-weight: 750; }
.campaign-playback-toolbar .btn.is-dirty { box-shadow: 0 0 0 4px rgba(99,102,241,.12); }

.playlist-card { position: relative; }
.playlist-card[draggable="true"] { cursor: grab; }
.playlist-card[draggable="true"]:active { cursor: grabbing; }
.playlist-card.is-dragging {
    opacity: .45;
    transform: scale(.985);
    box-shadow: 0 0 0 2px #818cf8;
}
.playlist-card-head {
    min-height: 31px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.playlist-order-number {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 11px;
    font-weight: 900;
}
.playlist-drag-handle {
    color: #94a3b8;
    font-size: 17px;
    line-height: 1;
    letter-spacing: -3px;
    padding-right: 4px;
    user-select: none;
}
.playlist-move-buttons { margin-left: auto; display: flex; gap: 4px; }
.playlist-move-buttons button {
    width: 29px;
    height: 29px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
}
.playlist-move-buttons button:hover { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.playlist-duration {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
}
.playlist-duration label { color: #64748b; font-size: 11px; font-weight: 800; }
.playlist-duration-input { display: flex; align-items: center; gap: 5px; }
.playlist-duration-input input {
    width: 70px;
    height: 32px;
    padding: 5px 7px;
    border-radius: 8px;
    text-align: right;
    font-size: 12px;
    font-weight: 800;
}
.playlist-duration-input span { color: #64748b; font-size: 11px; font-weight: 800; }
.playlist-duration-video { color: #4338ca; font-size: 11px; font-weight: 850; }

@media (max-width: 980px) {
    .campaign-summary { flex-wrap: wrap; }
    .campaign-summary-main { flex-basis: 100%; padding-bottom: 10px; }
    .campaign-actions { width: 100%; padding: 0 14px 13px; justify-content: flex-end; }
}

@media (max-width: 620px) {
    .campaign-summary-main { padding: 13px 14px 9px; align-items: flex-start; }
    .campaign-actions { justify-content: stretch; gap: 6px; }
    .campaign-actions form { flex: 1; }
    .campaign-action-button { width: 100%; }
    .campaign-playback-toolbar { align-items: stretch; flex-direction: column; }
    .campaign-playback-toolbar .btn { width: 100%; }
    .playlist-drag-handle { display: none; }
    .playlist-card[draggable="true"] { cursor: default; }
    .playlist-move-buttons button { width: 34px; height: 32px; }
    .playlist-duration { padding: 7px 9px; }
    .playlist-duration-input input { width: 64px; }
}

/* Asignación de campañas a pantallas */
.screen-campaign-box {
    display: grid;
    gap: 3px;
    margin: 12px 0;
    padding: 12px 13px;
    border: 1px solid #dbe4ff;
    border-radius: 13px;
    background: #f8faff;
}
.screen-campaign-box.is-empty {
    border-color: #e2e8f0;
    background: #f8fafc;
}
.screen-campaign-label {
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.screen-campaign-box strong {
    color: #172033;
    font-size: 14px;
    line-height: 1.25;
}
.screen-campaign-box small {
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
}
.screen-card-actions { flex-wrap: wrap; }
.screen-card-actions form { margin: 0; }
.campaign-select-warning {
    padding: 10px 12px;
    border: 1px solid #fde68a;
    border-radius: 11px;
    background: #fffbeb;
    color: #92400e;
    font-size: 11px;
    line-height: 1.45;
    font-weight: 700;
}

/* Reproductor de campañas */
.player-media-mount {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #000;
}
.player-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

@media (max-width: 620px) {
    .screen-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .screen-card-actions .btn,
    .screen-card-actions form,
    .screen-card-actions form .btn { width: 100%; }
    .screen-card-actions form { grid-column: 1 / -1; }
}

/* Panel de pantallas en directo */
.screen-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}
.screen-page-head h2 { margin: 0 0 5px; }
.screen-page-head-actions { display: flex; align-items: center; gap: 12px; }
.screen-live-indicator {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 39px;
    padding: 8px 11px;
    border: 1px solid #dcfce7;
    border-radius: 12px;
    background: #f0fdf4;
    color: #166534;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}
.screen-live-indicator small { color: #6b7280; font-size: 10px; font-weight: 700; }
.screen-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 5px rgba(34,197,94,.11);
    animation: screenLivePulse 1.8s ease-in-out infinite;
}
@keyframes screenLivePulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(34,197,94,.10); }
    50% { box-shadow: 0 0 0 8px rgba(34,197,94,.03); }
}

.screen-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.screen-overview-card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    padding: 16px 17px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    color: #111827;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15,23,42,.045);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.screen-overview-card::after {
    content: '';
    position: absolute;
    width: 74px;
    height: 74px;
    right: -28px;
    top: -28px;
    border-radius: 50%;
    background: #eef2ff;
}
.screen-overview-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,.07); }
.screen-overview-card.is-active { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.08), 0 12px 28px rgba(15,23,42,.06); }
.screen-overview-online::after { background: #dcfce7; }
.screen-overview-offline::after { background: #fef3c7; }
.screen-overview-disabled::after { background: #e5e7eb; }
.screen-overview-label { display: block; color: #64748b; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.screen-overview-card strong { display: block; margin: 3px 0 2px; font-size: 30px; line-height: 1; }
.screen-overview-card small { display: block; max-width: 90%; color: #94a3b8; font-size: 10px; line-height: 1.35; }

.screen-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.screen-filter-result { color: #64748b; font-size: 11px; font-weight: 750; }
.screen-filter-buttons {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #fff;
}
.screen-filter-buttons button {
    border: 0;
    border-radius: 8px;
    padding: 7px 10px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
    transition: .16s ease;
}
.screen-filter-buttons button:hover { color: #3730a3; background: #f8fafc; }
.screen-filter-buttons button.is-active { color: #4338ca; background: #eef2ff; }

.screen-grid { align-items: stretch; }
.screen-card {
    position: relative;
    overflow: hidden;
    gap: 13px;
    padding: 18px;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, opacity .2s ease;
}
.screen-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #f59e0b;
}
.screen-card.screen-state-online::before { background: #22c55e; }
.screen-card.screen-state-disabled::before { background: #94a3b8; }
.screen-card.screen-state-online { border-color: #d9f5df; }
.screen-card.screen-state-disabled { opacity: .82; }
.screen-card:hover { transform: translateY(-2px); box-shadow: 0 17px 40px rgba(15,23,42,.09); }

.screen-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.screen-identity > div { min-width: 0; }
.screen-identity h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-device-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    border: 1px solid #e0e7ff;
}
.screen-device-icon > span {
    position: relative;
    display: block;
    border: 2px solid #4f46e5;
    border-radius: 3px;
}
.screen-device-icon.horizontal > span { width: 24px; height: 15px; }
.screen-device-icon.vertical > span { width: 14px; height: 24px; }
.screen-device-icon > span::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 10px;
    height: 2px;
    border-radius: 2px;
    background: #4f46e5;
    transform: translateX(-50%);
}

.screen-status-badge { flex: 0 0 auto; }
.screen-status-badge i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.screen-state-online .screen-status-badge i { box-shadow: 0 0 0 4px rgba(22,163,74,.10); }

.screen-specs { display: flex; flex-wrap: wrap; gap: 7px; }
.screen-spec {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #edf1f5;
    color: #475569;
    font-size: 10px;
    font-weight: 800;
}
.mini-orientation {
    display: inline-block;
    border: 1.5px solid #64748b;
    border-radius: 2px;
}
.mini-orientation.horizontal { width: 13px; height: 8px; }
.mini-orientation.vertical { width: 7px; height: 12px; }
.audio-symbol { min-width: 18px; color: #4f46e5; font-size: 9px; font-weight: 900; letter-spacing: -1px; }

.screen-campaign-box { margin: 0; padding: 12px 13px 13px; }
.screen-campaign-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.screen-campaign-change {
    border: 0;
    border-radius: 8px;
    padding: 5px 8px;
    background: #eef2ff;
    color: #4338ca;
    cursor: pointer;
    font-size: 10px;
    font-weight: 850;
    transition: .16s ease;
}
.screen-campaign-change:hover { background: #e0e7ff; transform: translateY(-1px); }

.screen-connection-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    background: #fbfcfe;
}
.screen-connection-indicator {
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 5px rgba(245,158,11,.10);
}
.screen-connection-indicator.online { background: #22c55e; box-shadow: 0 0 0 5px rgba(34,197,94,.10); }
.screen-connection-indicator.disabled { background: #94a3b8; box-shadow: 0 0 0 5px rgba(148,163,184,.10); }
.screen-connection-copy { min-width: 0; display: grid; gap: 1px; }
.screen-connection-copy > span { color: #94a3b8; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.screen-connection-copy strong { color: #334155; font-size: 12px; }
.screen-connection-copy small { color: #94a3b8; font-size: 9px; }

.screen-card-actions { margin-top: auto; }
.screen-card-actions .btn { min-height: 34px; }
.screen-filter-empty { padding: 34px 20px; text-align: center; color: #64748b; }

@media (max-width: 1100px) {
    .screen-overview-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .screen-page-head { align-items: flex-start; }
    .screen-page-head-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 720px) {
    .screen-page-head { display: grid; }
    .screen-page-head-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
    .screen-live-indicator { justify-content: center; }
    .screen-page-head-actions .btn { width: 100%; }
    .screen-overview-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
    .screen-overview-card { padding: 13px 14px; border-radius: 14px; }
    .screen-overview-card strong { font-size: 25px; }
    .screen-overview-card small { display: none; }
    .screen-filter-bar { align-items: stretch; flex-direction: column; }
    .screen-filter-buttons { overflow-x: auto; width: 100%; }
    .screen-filter-buttons button { flex: 1 0 auto; }
    .screen-card { padding: 16px; }
}

@media (max-width: 420px) {
    .screen-overview-label { font-size: 9px; }
    .screen-card-top { align-items: flex-start; }
    .screen-device-icon { width: 38px; height: 38px; flex-basis: 38px; }
    .screen-status-badge { padding: 5px 8px; font-size: 10px; }
    .screen-card-actions { grid-template-columns: 1fr; }
    .screen-card-actions form { grid-column: auto; }
}
.screen-card[hidden], .screen-filter-empty[hidden] { display: none !important; }

/* =========================================================
   PROGRAMACIÓN DE CAMPAÑAS + INICIO EN DIRECTO
   ========================================================= */
.schedule-page-head,
.dashboard-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    margin-bottom:18px;
}
.schedule-page-head h2,
.dashboard-head h2 { margin:0 0 4px; }

.schedule-overview-grid,
.dashboard-status-grid {
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:12px;
    margin-bottom:16px;
}
.schedule-overview-card,
.dashboard-status-card {
    position:relative;
    overflow:hidden;
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:18px;
    padding:17px 18px;
    box-shadow:0 10px 30px rgba(15,23,42,.045);
}
.schedule-overview-card::after,
.dashboard-status-card::after {
    content:"";
    position:absolute;
    width:72px;
    height:72px;
    border-radius:50%;
    right:-24px;
    top:-24px;
    background:#eef2ff;
}
.schedule-overview-card.is-live::after,
.dashboard-status-card.is-online::after { background:#dcfce7; }
.dashboard-status-card.is-offline::after { background:#fef3c7; }
.dashboard-status-card.is-disabled::after { background:#e5e7eb; }
.schedule-overview-card > span,
.dashboard-status-card > span {
    position:relative;
    z-index:1;
    display:block;
    color:#64748b;
    font-size:12px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.035em;
}
.schedule-overview-card > strong,
.dashboard-status-card > strong {
    position:relative;
    z-index:1;
    display:block;
    margin:4px 0 1px;
    color:#0f172a;
    font-size:28px;
    line-height:1;
}
.schedule-overview-card > small,
.dashboard-status-card > small {
    position:relative;
    z-index:1;
    color:#8490a5;
    font-size:11px;
}

.schedule-info-strip {
    display:flex;
    align-items:flex-start;
    gap:12px;
    margin:0 0 18px;
    padding:13px 15px;
    border:1px solid #dbe3ff;
    border-radius:15px;
    background:#f8faff;
}
.schedule-info-icon {
    display:grid;
    place-items:center;
    flex:0 0 26px;
    width:26px;
    height:26px;
    border-radius:50%;
    background:#ebe9ff;
    color:#5b3df5;
    font-weight:900;
}
.schedule-info-strip div { display:flex; flex-direction:column; gap:2px; }
.schedule-info-strip strong { color:#1e293b; font-size:13px; }
.schedule-info-strip span:not(.schedule-info-icon) { color:#64748b; font-size:12px; line-height:1.45; }

.schedule-warning-card {
    display:flex;
    flex-direction:column;
    gap:6px;
    border-color:#fde68a;
    background:#fffbeb;
    color:#92400e;
}
.schedule-warning-card span { font-size:13px; }

.schedule-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px;
}
.schedule-card {
    position:relative;
    overflow:hidden;
    padding:18px;
    border-left:4px solid #cbd5e1;
}
.schedule-card.is-live {
    border-left-color:#22c55e;
    box-shadow:0 14px 40px rgba(34,197,94,.09);
}
.schedule-card-top {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}
.schedule-card-title-row {
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:8px;
}
.schedule-card-title-row h3 { margin:0; color:#101828; font-size:17px; }
.schedule-screen-line {
    display:flex;
    align-items:center;
    gap:6px;
    margin-top:7px;
    color:#667085;
    font-size:12px;
}
.schedule-screen-line strong { color:#344054; }
.schedule-screen-icon {
    display:inline-block;
    width:14px;
    height:10px;
    border:1.5px solid #6d5dfc;
    border-radius:2px;
}
.schedule-screen-icon.vertical { width:8px; height:14px; }
.schedule-priority {
    flex:0 0 auto;
    min-width:58px;
    padding:7px 9px;
    border-radius:12px;
    background:#f8fafc;
    border:1px solid #e5e7eb;
    text-align:center;
}
.schedule-priority span { display:block; color:#94a3b8; font-size:9px; font-weight:800; text-transform:uppercase; }
.schedule-priority strong { color:#475569; font-size:15px; }

.schedule-campaign-box {
    display:flex;
    flex-direction:column;
    gap:2px;
    margin:15px 0 12px;
    padding:12px 13px;
    border:1px solid #e1e6ff;
    border-radius:14px;
    background:linear-gradient(135deg,#fafaff,#f6f7ff);
}
.schedule-campaign-box span,
.schedule-detail-grid span {
    color:#8190a7;
    font-size:10px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.04em;
}
.schedule-campaign-box strong { color:#312e81; font-size:14px; }
.schedule-detail-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
}
.schedule-detail-grid > div {
    min-width:0;
    padding:10px 11px;
    border:1px solid #edf0f5;
    border-radius:12px;
    background:#fff;
}
.schedule-detail-grid strong { display:block; margin-top:3px; color:#334155; font-size:12px; }
.schedule-days {
    display:flex;
    gap:6px;
    margin-top:12px;
    flex-wrap:wrap;
}
.schedule-days span {
    display:grid;
    place-items:center;
    width:27px;
    height:27px;
    border-radius:8px;
    background:#f1f5f9;
    color:#94a3b8;
    font-size:11px;
    font-weight:900;
}
.schedule-days span.active { background:#ede9fe; color:#5b3df5; }
.schedule-card-actions {
    display:flex;
    align-items:center;
    gap:7px;
    margin-top:15px;
    flex-wrap:wrap;
}
.schedule-card-actions form { margin:0; }
.schedule-dialog-card { width:min(760px, calc(100vw - 28px)); }
.schedule-days-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:8px;
}
.schedule-days-heading > label:first-child { margin:0; }
.schedule-all-days-toggle {
    position:relative;
    cursor:pointer;
    user-select:none;
}
.schedule-all-days-toggle input {
    position:absolute;
    opacity:0;
    pointer-events:none;
}
.schedule-all-days-toggle span {
    display:inline-flex;
    align-items:center;
    gap:6px;
    min-height:30px;
    padding:5px 10px;
    border:1px solid #e0e4ed;
    border-radius:999px;
    background:#fff;
    color:#667085;
    font-size:10px;
    font-weight:800;
    transition:.18s ease;
}
.schedule-all-days-toggle span::before {
    content:'✓';
    display:grid;
    place-items:center;
    width:15px;
    height:15px;
    border:1px solid #cfd5df;
    border-radius:50%;
    color:transparent;
    font-size:9px;
    line-height:1;
    transition:.18s ease;
}
.schedule-all-days-toggle:hover span { border-color:#c9c5ff; background:#fafaff; color:#4f46e5; }
.schedule-all-days-toggle input:checked + span {
    border-color:#c9c4ff;
    background:#f5f3ff;
    color:#4f46e5;
}
.schedule-all-days-toggle input:checked + span::before {
    border-color:#7565ff;
    background:#7565ff;
    color:#fff;
}
.schedule-all-days-toggle.is-partial span {
    border-color:#d7d4f5;
    background:#faf9ff;
    color:#625b86;
}
.schedule-all-days-toggle.is-partial span::before {
    content:'–';
    border-color:#aaa3ec;
    background:#eeecff;
    color:#5a50c8;
}
.schedule-day-picker {
    display:grid;
    grid-template-columns:repeat(7,minmax(0,1fr));
    gap:7px;
}
.schedule-day-picker label { cursor:pointer; }
.schedule-day-picker input { position:absolute; opacity:0; pointer-events:none; }
.schedule-day-picker span {
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:39px;
    padding:7px 20px 7px 5px;
    border:1px solid #dfe4ec;
    border-radius:10px;
    color:#64748b;
    background:#fff;
    font-size:11px;
    font-weight:700;
    transition:.18s ease;
}
.schedule-day-picker span::after {
    content:'✓';
    position:absolute;
    top:50%;
    right:7px;
    display:grid;
    place-items:center;
    width:15px;
    height:15px;
    border-radius:50%;
    background:#6d5dfc;
    color:#fff;
    font-size:9px;
    line-height:1;
    opacity:0;
    transform:translateY(-50%) scale(.72);
    transition:.18s ease;
}
.schedule-day-picker label:hover span {
    border-color:#cbc7ff;
    background:#fbfaff;
    color:#5650a6;
}
.schedule-day-picker input:checked + span {
    border-color:#7565ff;
    background:#eeebff;
    color:#4338ca;
    font-weight:850;
    box-shadow:0 0 0 2px rgba(108,92,231,.10), inset 0 0 0 1px rgba(117,101,255,.06);
}
.schedule-day-picker input:checked + span::after {
    opacity:1;
    transform:translateY(-50%) scale(1);
}
.schedule-day-picker input:focus-visible + span {
    outline:2px solid rgba(109,93,252,.34);
    outline-offset:2px;
}

.screen-now-playing {
    display:flex;
    flex-direction:column;
    gap:2px;
    margin-top:10px;
    padding:10px 12px;
    border:1px solid #edf0f5;
    border-radius:13px;
    background:#fbfcfe;
}
.screen-now-playing > span { color:#8a96a8; font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.screen-now-playing > strong { color:#334155; font-size:12px; }
.screen-now-playing > small { color:#8490a5; font-size:10px; }
.screen-now-playing.is-scheduled {
    border-color:#cdeed8;
    background:#f2fbf5;
}
.screen-now-playing.is-scheduled > strong { color:#16794a; }
.screen-now-playing.is-scheduled > small { color:#3a8c64; }

.dashboard-secondary-row {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
    margin-top:12px;
}
.dashboard-library-card {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:15px 17px;
}
.dashboard-library-card > div { display:flex; align-items:baseline; gap:7px; flex-wrap:wrap; }
.dashboard-library-label { color:#64748b; font-size:11px; font-weight:800; text-transform:uppercase; }
.dashboard-library-card strong { color:#111827; font-size:19px; }
.dashboard-library-card small { color:#8793a6; font-size:11px; }
.dashboard-screen-table [data-home-campaign] { color:#172033; }

@media (max-width:1180px) {
    .schedule-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:900px) {
    .schedule-overview-grid,
    .dashboard-status-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .dashboard-secondary-row { grid-template-columns:1fr; }
}
@media (max-width:700px) {
    .schedule-page-head,
    .dashboard-head { align-items:stretch; flex-direction:column; }
    .schedule-page-head .btn { width:100%; }
    .schedule-grid { grid-template-columns:1fr; }
    .schedule-day-picker { grid-template-columns:repeat(4,minmax(0,1fr)); }
    .schedule-detail-grid { grid-template-columns:1fr; }
    .dashboard-library-card { align-items:stretch; flex-direction:column; }
    .dashboard-library-card .btn { width:100%; }
}
@media (max-width:480px) {
    .schedule-overview-grid,
    .dashboard-status-grid { grid-template-columns:1fr 1fr; gap:9px; }
    .schedule-overview-card,
    .dashboard-status-card { padding:14px; border-radius:15px; }
    .schedule-overview-card > strong,
    .dashboard-status-card > strong { font-size:24px; }
    .schedule-day-picker { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* Vista mensual y detección de solapamientos */
.schedule-viewbar {
    display:flex; align-items:center; justify-content:space-between; gap:14px; margin:16px 0;
}
.schedule-view-tabs {
    display:inline-flex; gap:4px; padding:4px; border:1px solid var(--line); border-radius:13px;
    background:#fff; box-shadow:0 5px 18px rgba(15,23,42,.04);
}
.schedule-view-tabs button {
    border:0; border-radius:9px; padding:9px 14px; background:transparent; color:#667085;
    font:inherit; font-size:12px; font-weight:850; cursor:pointer; transition:.18s ease;
}
.schedule-view-tabs button:hover { background:#f8fafc; color:#312e81; }
.schedule-view-tabs button.is-active { background:#eef2ff; color:#4f46e5; box-shadow:inset 0 0 0 1px #d9ddff; }
.schedule-conflict-summary {
    display:flex; align-items:center; gap:7px; min-height:42px; padding:9px 12px;
    border:1px solid #dcefe3; border-radius:13px; background:#f7fcf9; color:#397257; font-size:11px;
}
.schedule-conflict-summary strong { color:#236543; }
.schedule-conflict-summary > span:last-child { color:#6a8173; }
.schedule-conflict-summary.has-conflicts { border-color:#fed7aa; background:#fff8ed; color:#9a5b12; }
.schedule-conflict-summary.has-conflicts strong { color:#9a4b0c; }
.schedule-conflict-summary.has-conflicts > span:last-child { color:#a66a2b; }
.schedule-conflict-dot {
    width:9px; height:9px; flex:0 0 auto; border-radius:50%; background:#22c55e;
    box-shadow:0 0 0 4px rgba(34,197,94,.10);
}
.schedule-conflict-summary.has-conflicts .schedule-conflict-dot { background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.11); }
.schedule-card.has-conflict { border-left-color:#f59e0b; }
.schedule-conflict-badge { border:1px solid #fed7aa; background:#fff7ed; color:#b45309; }

.schedule-month-toolbar {
    display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:14px; padding:13px 15px;
}
.schedule-month-navigation { display:flex; align-items:center; gap:8px; }
.schedule-month-navigation > div { display:flex; flex-direction:column; gap:1px; min-width:180px; padding:0 4px; }
.schedule-month-navigation > div span { color:#8b97a9; font-size:9px; font-weight:850; text-transform:uppercase; letter-spacing:.05em; }
.schedule-month-navigation > div strong { color:#243044; font-size:15px; text-transform:capitalize; }
.schedule-month-filter { display:flex; align-items:center; gap:9px; }
.schedule-month-filter label { color:#667085; font-size:11px; font-weight:800; }
.schedule-month-filter select { min-width:190px; min-height:38px; padding-top:7px; padding-bottom:7px; }
.schedule-month-weekdays {
    display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px; padding:0 1px 7px;
}
.schedule-month-weekdays div { color:#7b8799; font-size:10px; font-weight:900; text-align:center; text-transform:uppercase; letter-spacing:.04em; }
.schedule-month-grid {
    display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px; overflow:hidden;
    border:1px solid #e2e7ef; border-radius:17px; background:#e2e7ef; box-shadow:0 8px 28px rgba(15,23,42,.04);
}
.schedule-month-day { min-width:0; min-height:148px; padding:8px; background:#fff; }
.schedule-month-day.is-clickable { cursor:pointer; transition:background .15s ease, box-shadow .15s ease; }
.schedule-month-day.is-clickable:hover { background:#fbfbff; box-shadow:inset 0 0 0 1px #cbc8ff; position:relative; z-index:1; }
.schedule-month-day.is-clickable:focus-visible { outline:2px solid #6d5dfc; outline-offset:-3px; position:relative; z-index:2; }
.schedule-month-day.is-outside { background:#f8fafc; }
.schedule-month-day.is-outside .schedule-month-events { opacity:.68; }
.schedule-month-day.is-today { box-shadow:inset 0 0 0 2px #6d5dfc; position:relative; z-index:1; }
.schedule-month-day-head { display:flex; align-items:center; justify-content:space-between; gap:6px; margin-bottom:6px; }
.schedule-month-day-head span { display:none; color:#7b8799; font-size:9px; font-weight:800; }
.schedule-month-day-head strong {
    display:grid; place-items:center; width:25px; height:25px; border-radius:50%; color:#263247; font-size:11px;
}
.schedule-month-day.is-today .schedule-month-day-head strong { background:#5b50d8; color:#fff; }
.schedule-month-day.is-outside .schedule-month-day-head strong { color:#a4adbb; }
.schedule-month-events { display:grid; gap:4px; align-content:start; }
.schedule-month-event {
    width:100%; min-width:0; display:grid; grid-template-columns:auto minmax(0,1fr); gap:1px 5px; padding:5px 6px;
    border:1px solid #dfe4ff; border-left:3px solid #6d5dfc; border-radius:8px; background:#f8f8ff;
    color:#334155; text-align:left; cursor:pointer; transition:.15s ease;
}
.schedule-month-event:hover { border-color:#bbb8ff; box-shadow:0 5px 12px rgba(79,70,229,.08); }
.schedule-month-event > span { grid-row:1 / span 2; color:#5b50d8; font-size:9px; font-weight:900; }
.schedule-month-event strong { overflow:hidden; color:#172033; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.schedule-month-event small { overflow:hidden; color:#7c8798; font-size:8px; text-overflow:ellipsis; white-space:nowrap; }
.schedule-month-event.is-paused { border-color:#e5e7eb; border-left-color:#9ca3af; background:#fafafa; opacity:.62; }
.schedule-month-event.has-conflict { border-color:#fed7aa; border-left-color:#f59e0b; background:#fff9ef; }
.schedule-month-more {
    width:100%; border:0; padding:4px 5px; border-radius:7px; background:#f3f4f6; color:#667085;
    font:inherit; font-size:9px; font-weight:850; cursor:pointer;
}
.schedule-month-more:hover { background:#e9ebf0; color:#3f4755; }
.schedule-month-empty { padding:11px 3px; color:#a0a9b8; font-size:9px; text-align:center; }
.schedule-day-dialog-card { width:min(620px,calc(100vw - 28px)); }
.schedule-day-dialog-list { display:grid; gap:8px; padding-top:4px; }
.schedule-day-dialog-empty { margin:2px 0 4px; padding:20px 12px; border:1px dashed #d9deea; border-radius:12px; background:#fafbfc; }
.schedule-day-dialog-actions { display:flex; justify-content:flex-end; margin-top:14px; padding-top:14px; border-top:1px solid #edf0f5; }
.schedule-day-dialog-event {
    width:100%; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px;
    padding:11px 12px; border:1px solid #e2e7ef; border-left:3px solid #6d5dfc; border-radius:12px;
    background:#fff; color:#334155; text-align:left; cursor:pointer;
}
.schedule-day-dialog-event > span { color:#5b50d8; font-size:11px; font-weight:900; white-space:nowrap; }
.schedule-day-dialog-event > div { min-width:0; display:grid; gap:2px; }
.schedule-day-dialog-event strong { overflow:hidden; color:#172033; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.schedule-day-dialog-event small { overflow:hidden; color:#7c8798; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.schedule-day-dialog-event em { padding:4px 7px; border-radius:999px; background:#f3f4f6; color:#667085; font-size:9px; font-style:normal; font-weight:850; }
.schedule-day-dialog-event.is-paused { opacity:.62; border-left-color:#9ca3af; }
.schedule-day-dialog-event.has-conflict { border-color:#fed7aa; border-left-color:#f59e0b; background:#fff9ef; }
.schedule-day-dialog-event.has-conflict em { background:#ffedd5; color:#b45309; }
.schedule-month-mobile { display:none; }

@media (max-width:1050px) {
    .schedule-month-day { min-height:132px; padding:6px; }
    .schedule-month-event { grid-template-columns:1fr; gap:1px; }
    .schedule-month-event > span { grid-row:auto; }
    .schedule-month-event small { display:none; }
}
@media (max-width:900px) {
    .schedule-viewbar { align-items:stretch; flex-direction:column; }
    .schedule-view-tabs { align-self:flex-start; }
    .schedule-conflict-summary { align-items:flex-start; flex-wrap:wrap; }
    .schedule-month-toolbar { align-items:stretch; flex-direction:column; }
    .schedule-month-filter { justify-content:space-between; }
    .schedule-month-filter select { flex:1; min-width:0; }
}
@media (max-width:700px) {
    .schedule-month-desktop { display:none; }
    .schedule-month-mobile { display:grid; gap:10px; }
    .schedule-agenda-day {
        display:grid; grid-template-columns:64px minmax(0,1fr); gap:10px; padding:10px;
        border:1px solid #e2e7ef; border-radius:15px; background:#fff; box-shadow:0 5px 18px rgba(15,23,42,.035);
    }
    .schedule-agenda-day.is-today { border-color:#c7c5ff; box-shadow:0 6px 20px rgba(79,70,229,.08); }
    .schedule-agenda-date { display:flex; align-items:center; flex-direction:column; justify-content:flex-start; gap:4px; padding-top:4px; }
    .schedule-agenda-date > strong { color:#222b3b; font-size:27px; line-height:1; }
    .schedule-agenda-day.is-today .schedule-agenda-date > strong { color:#5b50d8; }
    .schedule-agenda-date > div { display:grid; gap:1px; text-align:center; }
    .schedule-agenda-date span { color:#556176; font-size:9px; font-weight:900; text-transform:uppercase; }
    .schedule-agenda-date small { color:#98a1af; font-size:9px; }
    .schedule-agenda-events { display:grid; gap:6px; min-width:0; }
    .schedule-agenda-event {
        width:100%; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:8px; padding:9px 10px;
        border:1px solid #dfe4ff; border-left:3px solid #6d5dfc; border-radius:10px; background:#f8f8ff; color:#334155; text-align:left;
    }
    .schedule-agenda-event > span { color:#5b50d8; font-size:9px; font-weight:900; white-space:nowrap; }
    .schedule-agenda-event > div { min-width:0; display:grid; gap:1px; }
    .schedule-agenda-event strong { overflow:hidden; color:#172033; font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
    .schedule-agenda-event small { overflow:hidden; color:#7c8798; font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
    .schedule-agenda-event em { display:grid; place-items:center; width:18px; height:18px; border-radius:50%; background:#fff1da; color:#b45309; font-size:10px; font-style:normal; font-weight:900; }
    .schedule-agenda-event.is-paused { opacity:.62; border-left-color:#9ca3af; }
    .schedule-agenda-event.has-conflict { border-color:#fed7aa; border-left-color:#f59e0b; background:#fff9ef; }
    .schedule-day-dialog-actions .btn { width:100%; }
}
@media (max-width:560px) {
    .schedule-view-tabs { display:grid; grid-template-columns:1fr 1fr; width:100%; }
    .schedule-view-tabs button { width:100%; }
    .schedule-month-navigation { display:grid; grid-template-columns:auto 1fr auto; }
    .schedule-month-navigation > div { min-width:0; text-align:center; }
    .schedule-month-navigation > a:last-child { grid-column:1 / -1; width:100%; }
    .schedule-agenda-day { grid-template-columns:52px minmax(0,1fr); padding:8px; }
    .schedule-agenda-event { grid-template-columns:1fr auto; gap:3px 8px; }
    .schedule-agenda-event > span { grid-column:1 / -1; }
}

/* Modal de detalle diario del calendario: overlay propio para evitar que algunos
   navegadores dejen la página inerte después de cerrar un <dialog> modal. */
.schedule-day-overlay {
    position:fixed;
    inset:0;
    z-index:120;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:14px;
    background:rgba(15,23,42,.65);
    backdrop-filter:blur(4px);
    -webkit-backdrop-filter:blur(4px);
}
.schedule-day-overlay[hidden] { display:none !important; }
.schedule-day-overlay .schedule-day-dialog-card {
    width:min(620px,calc(100vw - 28px));
    max-height:min(88vh,900px);
    overflow-y:auto;
}
body.schedule-day-modal-open { overflow:hidden; }


/* Modal de programación más amplio y compacto: en escritorio intenta mostrar
   el formulario completo sin scroll y conserva scroll vertical como respaldo
   en pantallas con poca altura. */
.schedule-app-dialog {
    width:min(1060px, calc(100vw - 28px));
    max-width:1060px;
    overflow:visible;
}
.schedule-app-dialog .schedule-dialog-card {
    width:100%;
    max-height:calc(100dvh - 28px);
    padding:20px 22px 18px;
    overflow-x:hidden;
    overflow-y:auto;
}
.schedule-app-dialog .dialog-head {
    margin-bottom:14px;
}
.schedule-app-dialog .dialog-head h3 {
    font-size:22px;
}
.schedule-app-dialog .schedule-form-compact {
    gap:12px 14px;
}
.schedule-app-dialog .schedule-day-picker span {
    min-height:36px;
}
.schedule-app-dialog .dialog-actions {
    margin-top:0;
    padding-top:2px;
}

@media (min-width: 821px) {
    .schedule-app-dialog .schedule-form-compact {
        grid-template-columns:repeat(4,minmax(0,1fr));
    }
    .schedule-app-dialog .schedule-form-compact > .full,
    .schedule-app-dialog .schedule-field-full,
    .schedule-app-dialog .schedule-field-name,
    .schedule-app-dialog .schedule-field-days,
    .schedule-app-dialog .schedule-form-compact > .dialog-actions {
        grid-column:1 / -1;
    }
    .schedule-app-dialog .schedule-field-half {
        grid-column:span 2;
    }
    .schedule-app-dialog .schedule-field-quarter {
        grid-column:span 1;
    }
    .schedule-app-dialog .campaign-select-warning {
        padding:10px 12px;
        min-height:0;
    }
}

@media (max-width: 820px) {
    .schedule-app-dialog {
        width:calc(100vw - 16px);
        max-width:none;
    }
    .schedule-app-dialog .schedule-dialog-card {
        max-height:calc(100dvh - 16px);
        padding:18px;
    }
}

/* Campo de contraseña con control discreto de visibilidad. */
.password-input-wrap {
    position:relative;
}
.password-input-wrap input {
    padding-right:46px;
}
.password-toggle {
    position:absolute;
    top:50%;
    right:8px;
    width:34px;
    height:34px;
    padding:0;
    border:0;
    border-radius:9px;
    display:grid;
    place-items:center;
    transform:translateY(-50%);
    background:transparent;
    color:#94a3b8;
    cursor:pointer;
    transition:background .18s ease,color .18s ease;
}
.password-toggle:hover,
.password-toggle:focus-visible {
    background:#f1f5f9;
    color:#4f46e5;
    outline:none;
}
.password-toggle svg {
    width:19px;
    height:19px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
}
.password-toggle .password-eye-off { display:none; }
.password-toggle[aria-pressed="true"] .password-eye-on { display:none; }
.password-toggle[aria-pressed="true"] .password-eye-off { display:block; }

@media (max-width:480px) {
    .schedule-days-heading { align-items:flex-start; flex-direction:column; gap:7px; }
    .schedule-all-days-toggle span { min-height:29px; }
}

/* Identidad visual de la aplicación */
.brand-logo {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,255,255,.96);
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 5px;
}
.brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.login-brand-logo {
    width: min(190px, 72%);
    min-height: 64px;
    max-height: 100px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 0 0 20px;
}
.login-brand-logo img {
    display: block;
    max-width: 100%;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.settings-grid {
    display: grid;
    grid-template-columns: minmax(320px, .85fr) minmax(520px, 1.35fr);
    gap: 20px;
    align-items: start;
}
.settings-brand-card { overflow: hidden; }
.brand-settings-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px solid #e6eaf2;
    border-radius: 16px;
    background: linear-gradient(135deg, #f8fafc, #f3f4ff);
}
.brand-preview-box {
    width: 104px;
    height: 82px;
    flex: 0 0 104px;
    display: grid;
    place-items: center;
    padding: 9px;
    border-radius: 15px;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 22px rgba(15,23,42,.06);
    overflow: hidden;
}
.brand-preview-box img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
.brand-preview-fallback {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    font-weight: 900;
    background: linear-gradient(135deg,#6366f1,#8b5cf6);
}
.brand-preview-copy { min-width: 0; display: grid; gap: 4px; }
.brand-preview-copy strong { font-size: 15px; }
.brand-preview-copy span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.brand-upload-form { display: grid; gap: 14px; }
.logo-file-picker {
    min-height: 78px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px;
    border: 1.5px dashed #c7d2fe;
    border-radius: 15px;
    background: #fafaff;
    cursor: pointer;
    transition: .18s ease;
}
.logo-file-picker:hover { border-color: #818cf8; background: #f5f3ff; }
.logo-file-picker > span:last-child { min-width: 0; display: grid; gap: 3px; }
.logo-file-picker strong { color: #4338ca; font-size: 14px; }
.logo-file-picker small { color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-file-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 23px;
    font-weight: 800;
}
.visually-hidden-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.brand-delete-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 980px) {
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .brand-settings-preview { align-items: flex-start; }
    .brand-preview-box { width: 86px; height: 72px; flex-basis: 86px; }
    .login-brand-logo { width: min(170px, 78%); }
}

/* Ajuste de la vista previa del logo en Configuración.
   Solo afecta a Identidad visual; no modifica el logo del panel ni de los accesos. */
.brand-preview-box {
    width: 142px;
    height: 104px;
    flex: 0 0 142px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.brand-preview-box img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    flex: 0 1 auto;
}

@media (max-width: 480px) {
    .brand-settings-preview {
        align-items: center;
    }
    .brand-preview-box {
        width: 112px;
        height: 88px;
        flex-basis: 112px;
        padding: 11px;
    }
}

/* Corrección: respetar los elementos ocultos en la previsualización del logo. */
.brand-preview-box img[hidden],
.brand-preview-box .brand-preview-fallback[hidden] {
    display: none !important;
}

/* Acciones de campañas */
.campaign-playback-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 620px) {
    .campaign-actions > button, .campaign-actions form { flex: 1 1 120px; }
    .campaign-playback-actions { width: 100%; }
    .campaign-playback-actions .btn { flex: 1 1 0; width: auto; }
}
/* Ajuste de las nuevas acciones para que no desborden en móvil. */
.campaign-actions { flex-wrap: wrap; }
.campaign-playback-toolbar > .campaign-playback-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* =========================================================
   Corrección de alineación de contenidos dentro de campañas
   Mantiene las imágenes completas (contain) sin recortarlas.
   ========================================================= */
.campaign-library {
    --library-preview-height: 180px;
}
.campaign-library.library-size-0 { --library-preview-height: 135px; }
.campaign-library.library-size-1 { --library-preview-height: 180px; }
.campaign-library.library-size-2 { --library-preview-height: 225px; }
.campaign-library.library-size-3 { --library-preview-height: 285px; }

.campaign-body .library-content-grid {
    align-items: stretch;
}

.campaign-body .content-library-card {
    height: 100%;
    grid-template-rows: auto var(--library-preview-height) auto auto auto;
    align-content: stretch;
}

.campaign-body .library-media-preview,
.campaign-body .library-media-preview.is-vertical,
.campaign-body .library-media-preview.is-horizontal,
.campaign-body .library-media-preview.is-both {
    width: 100%;
    height: var(--library-preview-height);
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    justify-self: stretch;
    align-self: stretch;
}

.campaign-body .library-media-preview img,
.campaign-body .library-media-preview video,
.campaign-body .library-media-preview.is-vertical img,
.campaign-body .library-media-preview.is-vertical video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
}

.campaign-body .content-library-info {
    min-height: 48px;
    display: grid;
    align-content: start;
}

.campaign-body .playlist-duration {
    align-self: end;
}

.campaign-body .content-library-actions {
    align-self: end;
    margin-top: 0;
}

.campaign-body .content-library-actions form,
.campaign-body .content-library-actions .btn {
    width: 100%;
}

@media (max-width: 620px) {
    .campaign-library.library-size-0 { --library-preview-height: 120px; }
    .campaign-library.library-size-1 { --library-preview-height: 155px; }
    .campaign-library.library-size-2 { --library-preview-height: 205px; }
    .campaign-library.library-size-3 { --library-preview-height: 280px; }

    .campaign-body .content-library-card {
        grid-template-rows: auto var(--library-preview-height) auto auto auto;
    }
}

/* =========================================================
   Ajuste exclusivo del tamaño mínimo de la biblioteca
   Evita desbordes sin alterar los tamaños 1, 2 y 3.
   ========================================================= */
.campaign-library.library-size-0 {
    --library-preview-height: 105px;
}

.library-size-0 .playlist-card-head {
    gap: 5px;
}

/* En el tamaño mínimo los botones ↑/↓ ya permiten ordenar y
   liberamos espacio ocultando únicamente el asa visual de arrastre. */
.library-size-0 .playlist-drag-handle {
    display: none;
}

.library-size-0 .playlist-order-number {
    width: 25px;
    height: 25px;
    border-radius: 8px;
    font-size: 10px;
}

.library-size-0 .playlist-move-buttons {
    gap: 3px;
}

.library-size-0 .playlist-move-buttons button {
    width: 27px;
    height: 27px;
    border-radius: 8px;
    font-size: 14px;
}

/* La duración se coloca en dos líneas solo en la vista mínima,
   evitando que el input salga de la tarjeta. */
.library-size-0 .playlist-duration {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 5px;
    padding: 7px 8px;
}

.library-size-0 .playlist-duration-input {
    width: 100%;
    justify-content: flex-end;
}

.library-size-0 .playlist-duration-input input {
    width: 58px;
    max-width: calc(100% - 18px);
    height: 30px;
}

.library-size-0 .playlist-duration-video {
    line-height: 1.25;
}

@media (max-width: 620px) {
    .campaign-library.library-size-0 {
        --library-preview-height: 92px;
    }

    .library-size-0 .content-library-card {
        padding: 8px;
        gap: 7px;
    }
}

/* =========================================================
   Previsualización de contenidos y duración común por campaña
   ========================================================= */
.campaign-playback-controls {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.campaign-duration-all {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px 7px 11px;
    border: 1px solid #dbe4ff;
    border-radius: 11px;
    background: #fff;
}
.campaign-duration-all-label {
    display: grid;
    gap: 1px;
    line-height: 1.15;
}
.campaign-duration-all-label strong {
    font-size: 11px;
    white-space: nowrap;
}
.campaign-duration-all-label small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
    white-space: nowrap;
}
.campaign-duration-all-control {
    display: flex;
    align-items: center;
    gap: 5px;
}
.campaign-duration-all-control input {
    width: 62px;
    height: 34px;
    padding: 6px 8px;
    text-align: center;
    border-radius: 9px;
}
.campaign-duration-all-control > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}
.campaign-duration-all-control .btn {
    white-space: nowrap;
}
.campaign-duration-all-control .btn.is-applied {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.content-library-card.is-previewable .library-media-preview,
.content-library-card.is-previewable .content-library-info {
    cursor: zoom-in;
}
.content-library-card.is-previewable .library-media-preview::after {
    content: "Ver";
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 3;
    padding: 4px 7px;
    border-radius: 8px;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    opacity: 0;
    transform: translateY(2px);
    transition: .16s ease;
    pointer-events: none;
}
.content-library-card.is-previewable .library-media-preview:hover::after {
    opacity: 1;
    transform: translateY(0);
}

html.content-preview-open,
html.content-preview-open body {
    overflow: hidden;
}
.content-preview-overlay[hidden] {
    display: none !important;
}
.content-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .64);
    backdrop-filter: blur(3px);
}
.content-preview-dialog {
    width: min(1120px, 96vw);
    max-height: 94vh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}
.content-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 17px 19px 14px;
    border-bottom: 1px solid #e8edf5;
}
.content-preview-head h3 {
    margin: 0 0 3px;
    font-size: 18px;
}
.content-preview-stage {
    min-height: 300px;
    max-height: 72vh;
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 16px;
    background: #0f172a;
}
.content-preview-stage img,
.content-preview-stage video {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(72vh - 32px);
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.content-preview-stage iframe {
    display: block;
    width: 100%;
    height: min(68vh, 720px);
    min-height: 420px;
    border: 0;
    border-radius: 10px;
    background: #fff;
}
.content-preview-stage img[hidden],
.content-preview-stage video[hidden],
.content-preview-stage iframe[hidden] {
    display: none !important;
}
.content-preview-footer {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 16px;
    border-top: 1px solid #e8edf5;
    background: #fff;
}
.content-preview-footer-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .campaign-playback-controls {
        width: 100%;
        justify-content: stretch;
    }
    .campaign-duration-all {
        flex: 1 1 100%;
        justify-content: space-between;
    }
    .campaign-playback-actions {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .campaign-duration-all {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
    }
    .campaign-duration-all-control {
        width: 100%;
    }
    .campaign-duration-all-control input {
        flex: 0 0 70px;
    }
    .campaign-duration-all-control .btn {
        flex: 1 1 auto;
    }
    .content-preview-overlay {
        padding: 10px;
    }
    .content-preview-dialog {
        width: 100%;
        max-height: 96vh;
        border-radius: 16px;
    }
    .content-preview-head {
        padding: 14px;
    }
    .content-preview-stage {
        min-height: 220px;
        max-height: 70vh;
        padding: 10px;
    }
    .content-preview-stage img,
    .content-preview-stage video {
        max-height: calc(70vh - 20px);
    }
    .content-preview-stage iframe {
        min-height: 58vh;
        height: 58vh;
    }
    .content-preview-footer {
        align-items: stretch;
        flex-direction: column;
    }
    .content-preview-footer-actions {
        width: 100%;
        margin-left: 0;
    }
    .content-preview-footer-actions .btn {
        flex: 1 1 auto;
    }
}


/* Aviso discreto cuando el autoplay no puede entrar en pantalla completa */
.player-fullscreen-hint {
    position: absolute;
    left: 50%;
    bottom: 24px;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: calc(100% - 32px);
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(15,23,42,.82);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 34px rgba(0,0,0,.28);
    backdrop-filter: blur(10px);
    cursor: pointer;
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: opacity .2s ease, transform .2s ease;
}
.player-fullscreen-hint[hidden] { display: none !important; }
.player-fullscreen-hint.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.player-fullscreen-hint-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(124,58,237,.8);
    color: #fff;
    font-size: 14px;
}
@media (max-width: 480px) {
    .player-fullscreen-hint { bottom: 18px; font-size: 12px; }
}

/* =========================================================
   Transiciones configurables por campaña
   ========================================================= */
.campaign-transition-settings {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px 7px 11px;
    border: 1px solid #e7e3ff;
    border-radius: 11px;
    background: #fff;
}
.campaign-transition-label {
    display: grid;
    gap: 1px;
    line-height: 1.15;
}
.campaign-transition-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}
.campaign-transition-toggle input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #6366f1;
}
.campaign-transition-label small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
    white-space: nowrap;
}
.campaign-transition-control {
    display: flex;
    align-items: center;
    gap: 6px;
}
.campaign-transition-control select {
    width: 124px;
    min-width: 124px;
    height: 34px;
    padding: 5px 28px 5px 9px;
    border-radius: 9px;
    font-size: 11px;
}
.campaign-transition-time {
    display: flex;
    align-items: center;
    gap: 4px;
}
.campaign-transition-time input {
    width: 58px;
    height: 34px;
    padding: 6px 7px;
    text-align: center;
    border-radius: 9px;
}
.campaign-transition-time span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

/* El contenedor solo anima cuando la campaña tiene transiciones activadas. */
.player-media-mount.player-transition-fundido,
.player-media-mount.player-transition-deslizamiento {
    will-change: opacity, transform;
    transition:
        opacity var(--player-transition-step, 400ms) ease,
        transform var(--player-transition-step, 400ms) ease;
}
.player-media-mount.player-transition-fundido.is-transition-out {
    opacity: 0;
}
.player-media-mount.player-transition-fundido.is-transition-in {
    opacity: 0;
    transition: none !important;
}
.player-media-mount.player-transition-deslizamiento.is-transition-out {
    opacity: 0;
    transform: translateX(-3%);
}
.player-media-mount.player-transition-deslizamiento.is-transition-in {
    opacity: 0;
    transform: translateX(3%);
    transition: none !important;
}

@media (max-width: 900px) {
    .campaign-transition-settings {
        flex: 1 1 100%;
        justify-content: space-between;
    }
}

@media (max-width: 620px) {
    .campaign-transition-settings {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
    }
    .campaign-transition-control {
        width: 100%;
        flex-wrap: wrap;
    }
    .campaign-transition-control select {
        flex: 1 1 145px;
        width: auto;
        min-width: 0;
    }
    .campaign-transition-control .btn {
        flex: 1 1 100%;
    }
}


/* =========================================================
   Vista previa completa de campañas
   ========================================================= */
.campaign-action-button.is-preview {
    color: #4338ca;
    background: #f7f7ff;
    border-color: #dddafe;
}
.campaign-action-button.is-preview:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}
html.campaign-preview-open,
html.campaign-preview-open body {
    overflow: hidden;
}
.campaign-preview-overlay[hidden] { display: none !important; }
.campaign-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10030;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15,23,42,.66);
    backdrop-filter: blur(4px);
}
.campaign-preview-dialog {
    width: min(1180px, 97vw);
    max-height: 96vh;
    overflow: auto;
    border: 1px solid rgba(255,255,255,.48);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(15,23,42,.32);
}
.campaign-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px 13px;
    border-bottom: 1px solid #e8edf5;
}
.campaign-preview-head h3 { margin: 0 0 3px; font-size: 18px; }
.campaign-preview-frame-shell {
    width: min(1080px, calc(97vw - 44px));
    margin: 18px auto;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 15px 42px rgba(15,23,42,.22);
}
.campaign-preview-frame-shell.is-horizontal { aspect-ratio: 16 / 9; }
.campaign-preview-frame-shell.is-vertical {
    width: min(430px, calc(97vw - 44px));
    aspect-ratio: 9 / 16;
}
.campaign-preview-frame-shell iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

/* Reproductor embebido de vista previa. */
.campaign-preview-player-body {
    width: 100%;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    background: #000;
}
.campaign-preview-player-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}
.campaign-preview-player-stage .player-media-mount,
.campaign-preview-player-stage .player-media,
.campaign-preview-player-stage .player-frame {
    width: 100%;
    height: 100%;
}
.campaign-preview-player-stage .player-media {
    display: block;
    object-fit: contain;
    background: #000;
}
.campaign-preview-player-stage .player-frame { display: block; border: 0; background: #fff; }
.campaign-preview-player-label {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 5;
    display: grid;
    gap: 1px;
    max-width: calc(100% - 24px);
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    background: rgba(15,23,42,.60);
    color: #fff;
    backdrop-filter: blur(8px);
    pointer-events: none;
    opacity: .78;
}
.campaign-preview-player-label strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.campaign-preview-player-label span { color: #cbd5e1; font-size: 9px; }

/* =========================================================
   Almacenamiento
   ========================================================= */
.settings-storage-card { grid-column: 1 / -1; }
.storage-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.storage-stat {
    min-width: 0;
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid #e7eaf1;
    border-radius: 14px;
    background: #fafbfe;
}
.storage-stat span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.storage-stat strong { color: #172033; font-size: 21px; }
.storage-stat small { color: var(--muted); font-size: 10px; }
.storage-stat.has-warning { border-color: #fed7aa; background: #fffaf3; }
.storage-stat.has-warning strong { color: #b45309; }
.storage-stat.has-error { border-color: #fecaca; background: #fff7f7; }
.storage-stat.has-error strong { color: #b91c1c; }
.storage-details {
    margin: 4px 0 14px;
    border: 1px solid #e7eaf1;
    border-radius: 13px;
    background: #fff;
}
.storage-details summary {
    padding: 11px 13px;
    color: #4338ca;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.storage-file-list {
    max-height: 220px;
    overflow: auto;
    padding: 0 13px 10px;
}
.storage-file-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-top: 1px solid #eef1f6;
    font-size: 11px;
}
.storage-file-list span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.storage-file-list strong { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.storage-clean-form { margin-top: 8px; }
.storage-clean-ok {
    padding: 11px 13px;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    background: #f0fdf4;
    color: #166534;
    font-size: 12px;
    font-weight: 750;
}
.storage-missing-warning {
    margin-top: 12px;
    padding: 11px 13px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: #fff7f7;
    color: #991b1b;
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 820px) {
    .storage-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .campaign-preview-overlay { padding: 10px; }
    .campaign-preview-dialog { width: 100%; max-height: 98vh; border-radius: 16px; }
    .campaign-preview-frame-shell { width: calc(100vw - 38px); margin: 12px auto; }
    .campaign-preview-frame-shell.is-vertical { width: min(390px, calc(100vw - 38px)); }
}
@media (max-width: 480px) {
    .storage-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .storage-stat { padding: 11px; }
    .storage-stat strong { font-size: 17px; }
    .campaign-preview-head { padding: 13px; }
    .campaign-preview-head .help { font-size: 10px; }
}

/* Corrección móvil: mantener accesible el pie del menú lateral con las barras del navegador. */
@media (max-width: 820px) {
    .sidebar {
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-footer {
        flex: 0 0 auto;
    }
}

/* Copias de seguridad */
.settings-backup-card { grid-column: 1 / -1; }
.backup-panels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.backup-panel { border:1px solid var(--border); border-radius:16px; padding:16px; background:var(--soft); display:grid; grid-template-columns:42px 1fr; gap:12px; align-items:start; }
.backup-panel-icon { width:42px; height:42px; border-radius:12px; display:grid; place-items:center; background:rgba(99,76,246,.10); color:var(--primary); font-size:21px; font-weight:900; }
.backup-panel-copy { min-width:0; }
.backup-panel-copy strong { display:block; font-size:15px; margin:1px 0 3px; }
.backup-panel-copy span { color:var(--muted); font-size:12px; line-height:1.45; }
.backup-form { grid-column:1 / -1; display:flex; flex-direction:column; gap:10px; margin-top:4px; }
.backup-media-check { width:max-content; max-width:100%; }
.backup-file-picker { border:1px dashed #c7ccff; background:#fbfbff; border-radius:12px; padding:12px 14px; cursor:pointer; display:flex; flex-direction:column; gap:2px; }
.backup-file-picker span { color:var(--primary); font-weight:800; font-size:13px; }
.backup-file-picker small { color:var(--muted); font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.backup-note { margin-top:12px; padding:10px 12px; border-radius:12px; background:#f8fafc; color:var(--muted); font-size:12px; }

/* Reproducción manual inmediata */
.screen-now-playing.is-manual { border-color:#c4b5fd; background:linear-gradient(135deg,#f5f3ff,#faf8ff); }
.screen-now-playing.is-manual > span { color:#6d28d9; }
.screen-immediate-box { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 12px; border:1px solid #ddd6fe; background:#f5f3ff; border-radius:13px; }
.screen-immediate-box > div { min-width:0; display:flex; flex-direction:column; gap:2px; }
.screen-immediate-box span { color:#6d28d9; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.04em; }
.screen-immediate-box strong { font-size:13px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.screen-immediate-box small { color:var(--muted); font-size:10px; }
.immediate-info { border:1px solid #ddd6fe; background:#f8f7ff; border-radius:12px; padding:11px 12px; color:#5b6475; font-size:12px; line-height:1.45; }

@media (max-width: 760px) {
    .backup-panels { grid-template-columns:1fr; }
    .screen-immediate-box { align-items:flex-start; flex-direction:column; }
    .screen-immediate-box form, .screen-immediate-box .btn { width:100%; }
}

/* Grupos de pantallas y duplicación */
.screen-groups-section { margin: 14px 0 18px; }
.screen-groups-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-bottom:10px; }
.screen-groups-head > div { display:flex; flex-direction:column; gap:2px; }
.screen-groups-head strong { font-size:14px; color:#172033; }
.screen-groups-head span { font-size:11px; color:var(--muted); }
.screen-groups-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.screen-group-card { background:#fff; border:1px solid var(--border); border-radius:16px; padding:14px; box-shadow:0 10px 28px rgba(15,23,42,.045); display:flex; flex-direction:column; gap:11px; }
.screen-group-card-head > div { display:flex; align-items:center; gap:10px; min-width:0; }
.screen-group-card h3 { margin:0 0 2px; font-size:15px; color:#172033; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.screen-group-card small { color:var(--muted); font-size:10px; }
.screen-group-icon { width:34px; height:34px; flex:0 0 34px; display:grid; place-items:center; border-radius:10px; background:#f1efff; color:var(--primary); font-size:17px; font-weight:900; }
.screen-group-members { display:flex; flex-wrap:wrap; gap:6px; min-height:24px; }
.screen-group-members span, .screen-group-pills span { display:inline-flex; align-items:center; min-height:22px; padding:4px 8px; border-radius:999px; background:#f6f7fb; border:1px solid #e7e9f0; color:#667085; font-size:10px; font-weight:700; }
.screen-group-actions { display:flex; flex-wrap:wrap; gap:7px; margin-top:auto; }
.screen-group-actions form { margin:0; }
.screen-group-pills { display:flex; flex-wrap:wrap; gap:5px; margin-top:-5px; }
.screen-group-pills span { background:#f5f3ff; border-color:#e5e0ff; color:#6556d8; }
.group-picker-help { margin:3px 0 9px; }
.required-mark { color:var(--primary); font-weight:900; }
.screen-group-picker { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.screen-group-picker label { position:relative; cursor:pointer; }
.screen-group-picker input { position:absolute; opacity:0; pointer-events:none; }
.screen-group-picker span { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:48px; padding:9px 11px; border:1px solid #d7dce8; border-radius:12px; background:#fbfcff; box-shadow:0 1px 2px rgba(15,23,42,.025); transition:border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease; }
.screen-group-picker strong { font-size:12px; color:#344054; }
.screen-group-picker small { font-size:10px; color:var(--muted); }
.screen-group-picker label:hover span { border-color:#b8b2ee; background:#faf9ff; }
.screen-group-picker input:focus-visible + span { outline:2px solid rgba(99,76,246,.22); outline-offset:2px; }
.screen-group-picker input:checked + span { border-color:#7c6cff; background:#f4f2ff; box-shadow:inset 0 0 0 1px rgba(99,76,246,.16), 0 3px 10px rgba(99,76,246,.06); }
.screen-group-picker input:checked + span::after { content:'✓'; color:var(--primary); font-weight:900; }
.duplicate-screen-summary { display:flex; flex-wrap:wrap; gap:7px; padding:10px 12px; border:1px solid #e5e7eb; background:#f8fafc; border-radius:12px; }
.duplicate-screen-summary span { font-size:11px; font-weight:700; color:#596579; padding:4px 8px; background:#fff; border:1px solid #e7e9ef; border-radius:999px; }

@media (max-width: 1100px) {
    .screen-groups-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .screen-groups-grid { grid-template-columns:1fr; }
    .screen-group-actions { display:grid; grid-template-columns:1fr 1fr; }
    .screen-group-actions .btn, .screen-group-actions form, .screen-group-actions form .btn { width:100%; }
    .screen-group-picker { grid-template-columns:1fr; }
}

/* Ajuste global de acciones de los modales: siempre alineadas a la derecha. */
.dialog-actions,
.dialog-actions.full {
    width: 100%;
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 620px) {
    .dialog-actions,
    .dialog-actions.full {
        flex-direction: row;
        justify-content: flex-end;
    }
    .dialog-actions .btn,
    .dialog-actions.full .btn {
        width: auto;
        max-width: 100%;
    }
}

/* Grupos de pantallas: resumen visual equivalente al de las pantallas individuales. */
.screen-group-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.screen-group-manual-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 10px;
    font-weight: 800;
}
.screen-group-specs {
    margin-top: -2px;
}
.screen-group-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.screen-group-info-box {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fbfcfe;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.screen-group-info-box > span {
    color: #667085;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.screen-group-info-box > strong {
    color: #172033;
    font-size: 12px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.screen-group-info-box > small {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.3;
}
.screen-group-status-box {
    background: #f8fafc;
}
.screen-group-now-box {
    border-color: #d7eadc;
    background: #f4fbf6;
}
.screen-group-last-box {
    background: #fafafa;
}

@media (max-width: 520px) {
    .screen-group-overview {
        grid-template-columns: 1fr;
    }
    .screen-group-info-box > strong {
        white-space: normal;
    }
}

/* Estado independiente de las pantallas virtuales */
.screen-group-card .btn:disabled,
.screen-group-card .screen-campaign-change:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* =========================================================
   EN VIVO · supervisión de pantallas
   ========================================================= */
.live-page {
    display: grid;
    gap: 28px;
}
.live-page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 2px 2px 0;
}
.live-page-intro h2 {
    margin: 0 0 6px;
    font-size: 22px;
}
.live-page-intro p {
    margin: 0;
    color: var(--muted);
    max-width: 760px;
    line-height: 1.55;
}
.live-summary {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.72);
}
.live-summary span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.live-summary strong { color: var(--text); font-size: 14px; }
.live-orientation-section {
    display: grid;
    gap: 14px;
}
.live-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: 0 2px;
}
.live-section-heading h3 {
    margin: 2px 0 0;
    font-size: 18px;
}
.live-section-heading .eyebrow {
    display: block;
    color: #6366f1;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.live-section-count {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 800;
}
.live-grid {
    display: grid;
    gap: 18px;
    align-items: start;
}
.live-grid-horizontal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.live-grid-vertical {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.live-screen-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 34px rgba(15,23,42,.07);
}
.live-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid #edf0f4;
}
.live-screen-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #172033;
    font-size: 13px;
    font-weight: 800;
}
.live-status-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.live-status-pill.is-online { background: #dcfce7; color: #166534; }
.live-status-pill.is-offline { background: #f1f5f9; color: #475569; }
.live-status-pill.is-disabled { background: #fee2e2; color: #991b1b; }
.live-preview {
    position: relative;
    overflow: hidden;
    background: #0b1020;
}
.live-screen-card.is-horizontal .live-preview { aspect-ratio: 16 / 9; }
.live-screen-card.is-vertical .live-preview { aspect-ratio: 9 / 16; }
.live-media,
.live-media > img,
.live-media > video,
.live-media > iframe {
    width: 100%;
    height: 100%;
}
.live-media {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: #080d19;
}
.live-media > img,
.live-media > video {
    display: block;
    object-fit: contain;
    background: #080d19;
}
.live-media > iframe {
    display: block;
    border: 0;
    pointer-events: none;
    background: #fff;
}
.live-no-content {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    width: 100%;
    height: 100%;
    padding: 20px;
    text-align: center;
    color: #cbd5e1;
    background: radial-gradient(circle at 50% 35%, rgba(99,102,241,.15), transparent 48%), #0b1020;
}
.live-no-content span { font-weight: 800; }
.live-no-content small { color: #94a3b8; line-height: 1.35; }
.live-offline-layer,
.live-disabled-layer {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.live-offline-layer[hidden],
.live-disabled-layer[hidden] { display: none !important; }
.live-offline-mesh {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(4,8,16,.62), rgba(4,8,16,.72)),
        repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 1px, transparent 1px 9px),
        repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 1px, transparent 1px 12px);
    backdrop-filter: grayscale(.15);
}
.live-offline-message {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 14px 18px;
    text-align: center;
    color: #fff;
}
.live-offline-message strong {
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    background: rgba(15,23,42,.66);
    box-shadow: 0 8px 28px rgba(0,0,0,.22);
    font-size: 11px;
    letter-spacing: .08em;
}
.live-offline-message span {
    color: rgba(255,255,255,.82);
    font-size: 10px;
    font-weight: 700;
}
.live-disabled-layer {
    z-index: 5;
    padding: 18px;
    color: #fff;
    text-align: center;
    background: rgba(69,10,10,.74);
    backdrop-filter: grayscale(.65);
}
.live-disabled-layer strong {
    font-size: 11px;
    letter-spacing: .07em;
}
.live-card-body {
    display: grid;
    gap: 7px;
    padding: 13px 14px 14px;
}
.live-campaign-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.live-campaign-line > span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.live-campaign-line > strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #172033;
    font-size: 11px;
}
.live-content-title {
    min-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}
.live-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #98a2b3;
    font-size: 9px;
    line-height: 1.3;
}
.live-card-meta > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.live-empty {
    padding: 28px 20px;
    border: 1px dashed #d9dee7;
    border-radius: 16px;
    background: rgba(255,255,255,.55);
}

@media (max-width: 1180px) {
    .live-grid-horizontal { grid-template-columns: 1fr; }
    .live-grid-vertical { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .live-page-intro { align-items: stretch; flex-direction: column; }
    .live-summary { align-self: flex-start; }
    .live-grid-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .live-page { gap: 22px; }
    .live-page-intro h2 { font-size: 19px; }
    .live-summary { width: 100%; justify-content: space-between; }
    .live-summary span { flex: 1 1 0; justify-content: center; }
    .live-grid-horizontal,
    .live-grid-vertical { grid-template-columns: 1fr; }
    .live-screen-card.is-vertical {
        width: min(100%, 330px);
        justify-self: center;
    }
    .live-card-meta { align-items: flex-start; flex-direction: column; gap: 4px; }
}

/* En vivo: control de tamaño y vista ampliada */
.live-intro-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.live-size-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 5px 6px 5px 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15,23,42,.035);
}
.live-size-control > span {
    margin-right: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.live-size-button {
    display: inline-grid;
    place-items: center;
    width: 29px;
    height: 29px;
    padding: 0;
    border: 1px solid #e1e6ee;
    border-radius: 9px;
    background: #f8fafc;
    color: #344054;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.live-size-button:hover:not(:disabled) {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
    transform: translateY(-1px);
}
.live-size-button:disabled {
    opacity: .35;
    cursor: default;
}

.live-screen-card {
    cursor: pointer;
    transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease;
}
.live-screen-card:hover,
.live-screen-card:focus-visible {
    border-color: #cbd5ff;
    box-shadow: 0 16px 40px rgba(15,23,42,.11);
    transform: translateY(-2px);
    outline: none;
}

/* Tamaño compacto */
.live-page.live-size-0 .live-grid-horizontal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.live-page.live-size-0 .live-grid-vertical {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.live-page.live-size-0 .live-card-head {
    padding: 10px 11px;
}
.live-page.live-size-0 .live-card-body {
    padding: 10px 11px 11px;
    gap: 5px;
}
.live-page.live-size-0 .live-screen-name { font-size: 12px; }
.live-page.live-size-0 .live-status-pill { min-height: 21px; padding: 4px 6px; font-size: 8px; }
.live-page.live-size-0 .live-content-title { font-size: 11px; }
.live-page.live-size-0 .live-card-meta { font-size: 8px; }

/* Tamaño grande */
.live-page.live-size-2 .live-grid-horizontal {
    grid-template-columns: 1fr;
}
.live-page.live-size-2 .live-grid-vertical {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.live-viewer {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: grid;
    place-items: center;
    padding: 24px;
}
.live-viewer[hidden] { display: none !important; }
.live-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.72);
    backdrop-filter: blur(4px);
}
.live-viewer-dialog {
    position: relative;
    z-index: 2;
    width: min(1120px, calc(100vw - 48px));
    max-height: calc(100dvh - 48px);
    overflow: auto;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(2,6,23,.34);
}
.live-viewer-close {
    position: absolute;
    top: 13px;
    right: 13px;
    z-index: 8;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #e1e6ee;
    border-radius: 10px;
    background: rgba(255,255,255,.94);
    color: #475467;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(15,23,42,.08);
}
.live-viewer-close:hover { background: #f8fafc; color: #111827; }
.live-viewer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 60px 15px 18px;
    border-bottom: 1px solid #edf0f4;
}
.live-viewer-head h3 {
    margin: 2px 0 0;
    font-size: 18px;
}
.live-viewer-head .eyebrow {
    color: #6366f1;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.live-viewer-preview {
    position: relative;
    overflow: hidden;
    margin: 18px auto 0;
    background: #080d19;
}
.live-viewer-preview.is-horizontal {
    width: min(100% - 36px, 980px);
    aspect-ratio: 16 / 9;
}
.live-viewer-preview.is-vertical {
    width: min(430px, calc(100% - 36px));
    aspect-ratio: 9 / 16;
    max-height: calc(100dvh - 230px);
}
.live-viewer-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    padding: 16px 18px 18px;
}
.live-viewer-info > div:not(.live-viewer-meta) {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.live-viewer-info span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.live-viewer-info strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #172033;
    font-size: 12px;
}
.live-viewer-meta {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-top: 2px;
}
.live-viewer-meta span {
    color: #98a2b3;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

@media (max-width: 1180px) {
    .live-page.live-size-0 .live-grid-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-0 .live-grid-vertical { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-horizontal { grid-template-columns: 1fr; }
    .live-page.live-size-1 .live-grid-vertical { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-2 .live-grid-horizontal { grid-template-columns: 1fr; }
    .live-page.live-size-2 .live-grid-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .live-intro-actions { justify-content: flex-start; }
    .live-page.live-size-0 .live-grid-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-0 .live-grid-vertical { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-2 .live-grid-vertical { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .live-intro-actions { width: 100%; align-items: stretch; flex-direction: column; }
    .live-size-control { align-self: flex-start; }
    .live-page.live-size-0 .live-grid-horizontal,
    .live-page.live-size-0 .live-grid-vertical,
    .live-page.live-size-1 .live-grid-horizontal,
    .live-page.live-size-1 .live-grid-vertical,
    .live-page.live-size-2 .live-grid-horizontal,
    .live-page.live-size-2 .live-grid-vertical { grid-template-columns: 1fr; }
    .live-page.live-size-0 .live-screen-card.is-vertical { width: min(100%, 255px); }
    .live-page.live-size-1 .live-screen-card.is-vertical { width: min(100%, 330px); }
    .live-page.live-size-2 .live-screen-card.is-vertical { width: 100%; }
    .live-viewer { padding: 10px; }
    .live-viewer-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 16px; }
    .live-viewer-head { padding: 15px 54px 13px 14px; }
    .live-viewer-head h3 { font-size: 16px; }
    .live-viewer-preview.is-horizontal { width: calc(100% - 20px); margin-top: 10px; }
    .live-viewer-preview.is-vertical { width: min(82vw, 360px); max-height: calc(100dvh - 210px); margin-top: 10px; }
    .live-viewer-info { grid-template-columns: 1fr; padding: 13px 14px 15px; }
    .live-viewer-meta { grid-column: 1; align-items: flex-start; flex-direction: column; gap: 4px; }
}

/* En vivo v2: más recorrido de tamaños (muy pequeño → grande) */
/* 0 = muy pequeño, 1 = extra compacto, 2 = compacto, 3 = normal, 4 = grande */
.live-page.live-size-0 .live-grid-horizontal { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.live-page.live-size-0 .live-grid-vertical { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.live-page.live-size-1 .live-grid-horizontal { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.live-page.live-size-1 .live-grid-vertical { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.live-page.live-size-2 .live-grid-horizontal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.live-page.live-size-2 .live-grid-vertical { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.live-page.live-size-3 .live-grid-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.live-page.live-size-3 .live-grid-vertical { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.live-page.live-size-4 .live-grid-horizontal { grid-template-columns: 1fr; }
.live-page.live-size-4 .live-grid-vertical { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.live-page.live-size-0 .live-grid,
.live-page.live-size-1 .live-grid { gap: 10px; }
.live-page.live-size-2 .live-grid { gap: 14px; }

.live-page.live-size-0 .live-screen-card { border-radius: 12px; }
.live-page.live-size-0 .live-card-head { gap: 5px; padding: 6px 7px; }
.live-page.live-size-0 .live-card-body { gap: 3px; padding: 6px 7px 7px; }
.live-page.live-size-0 .live-screen-name { font-size: 9px; }
.live-page.live-size-0 .live-status-pill { min-height: 17px; padding: 2px 4px; font-size: 6px; letter-spacing: .02em; }
.live-page.live-size-0 .live-campaign-line { gap: 4px; }
.live-page.live-size-0 .live-campaign-line > span { font-size: 6px; }
.live-page.live-size-0 .live-campaign-line > strong { font-size: 8px; }
.live-page.live-size-0 .live-content-title { min-height: 13px; font-size: 8px; }
.live-page.live-size-0 .live-card-meta { display: none; }
.live-page.live-size-0 .live-offline-message { gap: 3px; padding: 5px; }
.live-page.live-size-0 .live-offline-message strong { padding: 4px 6px; font-size: 7px; }
.live-page.live-size-0 .live-offline-message span { font-size: 7px; }
.live-page.live-size-0 .live-disabled-layer { padding: 6px; }
.live-page.live-size-0 .live-disabled-layer strong { font-size: 7px; }

.live-page.live-size-1 .live-screen-card { border-radius: 14px; }
.live-page.live-size-1 .live-card-head { gap: 7px; padding: 8px 9px; }
.live-page.live-size-1 .live-card-body { gap: 4px; padding: 8px 9px 9px; }
.live-page.live-size-1 .live-screen-name { font-size: 10px; }
.live-page.live-size-1 .live-status-pill { min-height: 19px; padding: 3px 5px; font-size: 7px; }
.live-page.live-size-1 .live-campaign-line > span { font-size: 7px; }
.live-page.live-size-1 .live-campaign-line > strong { font-size: 9px; }
.live-page.live-size-1 .live-content-title { min-height: 15px; font-size: 9px; }
.live-page.live-size-1 .live-card-meta { font-size: 7px; }
.live-page.live-size-1 .live-offline-message strong { padding: 5px 7px; font-size: 8px; }
.live-page.live-size-1 .live-offline-message span { font-size: 8px; }

.live-page.live-size-2 .live-card-head { padding: 10px 11px; }
.live-page.live-size-2 .live-card-body { gap: 5px; padding: 10px 11px 11px; }
.live-page.live-size-2 .live-screen-name { font-size: 12px; }
.live-page.live-size-2 .live-status-pill { min-height: 21px; padding: 4px 6px; font-size: 8px; }
.live-page.live-size-2 .live-content-title { font-size: 11px; }
.live-page.live-size-2 .live-card-meta { font-size: 8px; }

/* El nivel 3 conserva el tamaño normal original. */
.live-page.live-size-3 .live-card-head { padding: 13px 14px; }
.live-page.live-size-3 .live-card-body { gap: 7px; padding: 13px 14px 14px; }
.live-page.live-size-3 .live-screen-name { font-size: 13px; }
.live-page.live-size-3 .live-status-pill { min-height: 24px; padding: 5px 8px; font-size: 9px; }
.live-page.live-size-3 .live-content-title { font-size: 12px; }
.live-page.live-size-3 .live-card-meta { font-size: 9px; }

/* El nivel 4 conserva el tamaño grande anterior. */
.live-page.live-size-4 .live-card-head { padding: 14px 15px; }
.live-page.live-size-4 .live-card-body { gap: 8px; padding: 14px 15px 15px; }

@media (max-width: 1180px) {
    .live-page.live-size-0 .live-grid-horizontal { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .live-page.live-size-0 .live-grid-vertical { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-horizontal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-vertical { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .live-page.live-size-2 .live-grid-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-2 .live-grid-vertical { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .live-page.live-size-3 .live-grid-horizontal { grid-template-columns: 1fr; }
    .live-page.live-size-3 .live-grid-vertical { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-4 .live-grid-horizontal { grid-template-columns: 1fr; }
    .live-page.live-size-4 .live-grid-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .live-page.live-size-0 .live-grid-horizontal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-0 .live-grid-vertical { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-horizontal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-vertical { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .live-page.live-size-2 .live-grid-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-2 .live-grid-vertical { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-3 .live-grid-horizontal { grid-template-columns: 1fr; }
    .live-page.live-size-3 .live-grid-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-4 .live-grid-horizontal,
    .live-page.live-size-4 .live-grid-vertical { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .live-page.live-size-0 .live-grid-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-0 .live-grid-vertical { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-1 .live-grid-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-2 .live-grid-horizontal { grid-template-columns: 1fr; }
    .live-page.live-size-2 .live-grid-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .live-page.live-size-3 .live-grid-horizontal,
    .live-page.live-size-3 .live-grid-vertical,
    .live-page.live-size-4 .live-grid-horizontal,
    .live-page.live-size-4 .live-grid-vertical { grid-template-columns: 1fr; }

    .live-page.live-size-0 .live-screen-card.is-vertical,
    .live-page.live-size-1 .live-screen-card.is-vertical,
    .live-page.live-size-2 .live-screen-card.is-vertical,
    .live-page.live-size-3 .live-screen-card.is-vertical,
    .live-page.live-size-4 .live-screen-card.is-vertical {
        width: 100%;
        justify-self: stretch;
    }
}

/* En vivo: ocultar por completo las orientaciones sin pantallas. */
.live-orientation-section[hidden],
.live-empty[hidden] {
    display: none !important;
}


/* =========================================================
   EN VIVO · modo monitor a pantalla completa
   ========================================================= */
.live-monitor-shell {
    min-width: 0;
}
.live-fullscreen-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: #344054;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15,23,42,.035);
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.live-fullscreen-button:hover {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
    transform: translateY(-1px);
}
.live-fullscreen-button.is-active {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
}
.live-fullscreen-icon {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
}

.live-monitor-shell:fullscreen,
.live-monitor-shell:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    overflow: auto;
    padding: 22px 26px 30px;
    background: var(--bg, #f4f7fb);
}
.live-monitor-shell:fullscreen .live-page,
.live-monitor-shell:-webkit-full-screen .live-page {
    width: min(100%, 1900px);
    min-height: 100%;
    margin: 0 auto;
}
.live-monitor-shell:fullscreen .live-page-intro,
.live-monitor-shell:-webkit-full-screen .live-page-intro {
    position: sticky;
    top: -22px;
    z-index: 20;
    margin: -22px -6px 0;
    padding: 20px 8px 14px;
    background: color-mix(in srgb, var(--bg, #f4f7fb) 94%, transparent);
    border-bottom: 1px solid rgba(226,232,240,.8);
    backdrop-filter: blur(12px);
}
.live-monitor-shell:fullscreen .live-viewer,
.live-monitor-shell:-webkit-full-screen .live-viewer {
    z-index: 2000;
}

@media (max-width: 560px) {
    .live-fullscreen-button {
        align-self: flex-start;
    }
    .live-monitor-shell:fullscreen,
    .live-monitor-shell:-webkit-full-screen {
        padding: 14px 12px 20px;
    }
    .live-monitor-shell:fullscreen .live-page-intro,
    .live-monitor-shell:-webkit-full-screen .live-page-intro {
        top: -14px;
        margin: -14px -2px 0;
        padding: 14px 2px 11px;
    }
}

/* En vivo · fullscreen: la cabecera y sus controles no cambian de posición al variar el tamaño */
.live-monitor-shell:fullscreen .live-page,
.live-monitor-shell:-webkit-full-screen .live-page {
    align-content: start;
    grid-auto-rows: max-content;
}

.live-monitor-shell:fullscreen .live-page-intro,
.live-monitor-shell:-webkit-full-screen .live-page-intro {
    align-self: start;
}

/* =========================================================
   EN VIVO · cabecera móvil compacta y ordenada
   Solo presentación; no cambia la lógica del monitor.
   ========================================================= */
@media (max-width: 560px) {
    .live-page {
        gap: 18px;
    }

    .live-page-intro {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 0;
    }

    .live-page-intro > div:first-child {
        min-width: 0;
    }

    .live-page-intro h2 {
        margin: 0 0 3px;
        font-size: 18px;
        line-height: 1.2;
    }

    .live-page-intro p {
        max-width: none;
        font-size: 12px;
        line-height: 1.38;
    }

    .live-intro-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        justify-content: stretch;
        gap: 7px;
        width: 100%;
    }

    .live-fullscreen-button {
        justify-self: stretch;
        width: 100%;
        min-height: 34px;
        padding: 0 10px;
        gap: 5px;
        border-radius: 10px;
        font-size: 10px;
        box-shadow: none;
    }

    .live-fullscreen-icon {
        width: 15px;
        height: 15px;
        font-size: 14px;
    }

    /* En pantalla completa móvil, "Salir" es suficiente y más limpio. */
    .live-fullscreen-button.is-active #liveFullscreenLabel {
        font-size: 0;
    }
    .live-fullscreen-button.is-active #liveFullscreenLabel::after {
        content: "Salir";
        font-size: 10px;
    }

    .live-size-control {
        justify-self: end;
        min-height: 34px;
        gap: 3px;
        padding: 3px 4px 3px 8px;
        border-radius: 10px;
        box-shadow: none;
    }

    .live-size-control > span {
        margin-right: 1px;
        font-size: 8px;
        letter-spacing: .04em;
    }

    .live-size-button {
        width: 27px;
        height: 27px;
        border-radius: 8px;
        font-size: 16px;
    }

    .live-summary {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0;
        padding: 3px;
        border-radius: 10px;
        box-shadow: none;
        background: rgba(255,255,255,.62);
    }

    .live-summary span {
        min-width: 0;
        justify-content: center;
        gap: 4px;
        padding: 5px 7px;
        border-radius: 8px;
        font-size: 10px;
        line-height: 1.2;
        white-space: nowrap;
    }

    .live-summary span + span {
        border-left: 1px solid var(--line);
        border-radius: 0 8px 8px 0;
    }

    .live-summary strong {
        font-size: 12px;
    }

    .live-section-heading {
        align-items: center;
        gap: 8px;
    }

    .live-section-heading h3 {
        font-size: 17px;
    }

    .live-section-count {
        min-width: 26px;
        height: 26px;
        font-size: 10px;
    }

    .live-monitor-shell:fullscreen,
    .live-monitor-shell:-webkit-full-screen {
        padding: 10px 10px 18px;
    }

    .live-monitor-shell:fullscreen .live-page-intro,
    .live-monitor-shell:-webkit-full-screen .live-page-intro {
        top: -10px;
        margin: -10px 0 0;
        padding: 10px 0 9px;
        background: color-mix(in srgb, var(--bg, #f4f7fb) 97%, transparent);
        border-bottom: 1px solid rgba(226,232,240,.72);
    }
}

/* =========================================================
   EN VIVO · fullscreen limpio
   En modo monitor ocultamos el texto introductorio y dejamos
   únicamente los controles de supervisión en la parte superior.
   ========================================================= */
.live-monitor-shell:fullscreen .live-page-intro > div:first-child,
.live-monitor-shell:-webkit-full-screen .live-page-intro > div:first-child {
    display: none !important;
}

.live-monitor-shell:fullscreen .live-page-intro,
.live-monitor-shell:-webkit-full-screen .live-page-intro {
    justify-content: flex-end;
    padding-top: 12px;
    padding-bottom: 10px;
}

.live-monitor-shell:fullscreen .live-page,
.live-monitor-shell:-webkit-full-screen .live-page {
    gap: 18px;
}

@media (max-width: 560px) {
    .live-monitor-shell:fullscreen .live-page-intro,
    .live-monitor-shell:-webkit-full-screen .live-page-intro {
        padding-top: 7px;
        padding-bottom: 7px;
    }

    .live-monitor-shell:fullscreen .live-page,
    .live-monitor-shell:-webkit-full-screen .live-page {
        gap: 12px;
    }
}

/* En vivo: en pantalla completa ocultar textos de orientación para una vista más limpia */
.live-monitor-shell:fullscreen .live-section-heading > div:first-child,
.live-monitor-shell:-webkit-full-screen .live-section-heading > div:first-child {
    display: none !important;
}
.live-monitor-shell:fullscreen .live-section-heading,
.live-monitor-shell:-webkit-full-screen .live-section-heading {
    justify-content: flex-end;
    align-items: center;
    min-height: 0;
    padding: 0 2px;
}
.live-monitor-shell:fullscreen .live-orientation-section,
.live-monitor-shell:-webkit-full-screen .live-orientation-section {
    gap: 10px;
}

/* En vivo: ocultar contador de orientación en pantalla completa */
.live-monitor-shell:fullscreen .live-section-count,
.live-monitor-shell:-webkit-full-screen .live-section-count {
    display: none !important;
}
.live-monitor-shell:fullscreen .live-section-heading,
.live-monitor-shell:-webkit-full-screen .live-section-heading {
    display: none !important;
}

/* =========================================================
   EN VIVO · marco de pantalla realista en pantalla completa
   Solo afecta al modo monitor fullscreen (PC y móvil).
   ========================================================= */
.live-monitor-shell:fullscreen .live-screen-card,
.live-monitor-shell:-webkit-full-screen .live-screen-card {
    position: relative;
    overflow: hidden;
    border: 2px solid #12151c;
    border-radius: 24px;
    background: linear-gradient(180deg, #2b3037 0%, #171b22 100%);
    padding: 10px;
    box-shadow:
        0 24px 54px rgba(15,23,42,.22),
        0 8px 18px rgba(15,23,42,.14),
        inset 0 1px 0 rgba(255,255,255,.11),
        inset 0 -1px 0 rgba(0,0,0,.28);
}

.live-monitor-shell:fullscreen .live-screen-card::before,
.live-monitor-shell:-webkit-full-screen .live-screen-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 20%),
        linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0) 18%, rgba(0,0,0,.10) 100%);
    z-index: 0;
}

.live-monitor-shell:fullscreen .live-card-head,
.live-monitor-shell:-webkit-full-screen .live-card-head,
.live-monitor-shell:fullscreen .live-card-body,
.live-monitor-shell:-webkit-full-screen .live-card-body,
.live-monitor-shell:fullscreen .live-preview,
.live-monitor-shell:-webkit-full-screen .live-preview {
    position: relative;
    z-index: 1;
}

.live-monitor-shell:fullscreen .live-card-head,
.live-monitor-shell:-webkit-full-screen .live-card-head {
    background: #ffffff;
    border-radius: 12px 12px 0 0;
}

.live-monitor-shell:fullscreen .live-preview,
.live-monitor-shell:-webkit-full-screen .live-preview {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}

.live-monitor-shell:fullscreen .live-card-body,
.live-monitor-shell:-webkit-full-screen .live-card-body {
    background: #ffffff;
    border-radius: 0 0 12px 12px;
}

@media (max-width: 560px) {
    .live-monitor-shell:fullscreen .live-screen-card,
    .live-monitor-shell:-webkit-full-screen .live-screen-card {
        border-radius: 20px;
        padding: 7px;
        box-shadow:
            0 18px 36px rgba(15,23,42,.18),
            0 6px 14px rgba(15,23,42,.12),
            inset 0 1px 0 rgba(255,255,255,.11),
            inset 0 -1px 0 rgba(0,0,0,.28);
    }

    .live-monitor-shell:fullscreen .live-card-head,
    .live-monitor-shell:-webkit-full-screen .live-card-head {
        border-radius: 10px 10px 0 0;
    }

    .live-monitor-shell:fullscreen .live-card-body,
    .live-monitor-shell:-webkit-full-screen .live-card-body {
        border-radius: 0 0 10px 10px;
    }
}

/* =========================================================
   EN VIVO · reordenación de bloques por orientación
   Solo disponible en modo monitor a pantalla completa.
   ========================================================= */
.live-reorder-handle {
    display: none;
}

.live-monitor-shell:fullscreen.live-reorder-enabled .live-orientation-section,
.live-monitor-shell:-webkit-full-screen.live-reorder-enabled .live-orientation-section {
    position: relative;
}

.live-monitor-shell:fullscreen.live-reorder-enabled .live-reorder-handle:not([hidden]),
.live-monitor-shell:-webkit-full-screen.live-reorder-enabled .live-reorder-handle:not([hidden]) {
    display: inline-grid;
    place-items: center;
    justify-self: start;
    width: 32px;
    height: 24px;
    margin: 0 0 -4px 2px;
    padding: 0;
    border: 1px solid rgba(148,163,184,.38);
    border-radius: 9px;
    background: rgba(255,255,255,.68);
    color: #94a3b8;
    cursor: grab;
    font: inherit;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -3px;
    box-shadow: 0 4px 12px rgba(15,23,42,.04);
    backdrop-filter: blur(8px);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.live-monitor-shell:fullscreen.live-reorder-enabled .live-reorder-handle:hover,
.live-monitor-shell:-webkit-full-screen.live-reorder-enabled .live-reorder-handle:hover {
    border-color: #c7d2fe;
    background: rgba(238,242,255,.90);
    color: #6366f1;
}

.live-monitor-shell:fullscreen.live-reorder-enabled .live-reorder-handle:active,
.live-monitor-shell:-webkit-full-screen.live-reorder-enabled .live-reorder-handle:active {
    cursor: grabbing;
}

.live-monitor-shell:fullscreen .live-orientation-section.is-dragging,
.live-monitor-shell:-webkit-full-screen .live-orientation-section.is-dragging {
    opacity: .58;
}

.live-monitor-shell:fullscreen .live-orientation-section.is-drop-target,
.live-monitor-shell:-webkit-full-screen .live-orientation-section.is-drop-target {
    outline: 2px dashed rgba(99,102,241,.42);
    outline-offset: 7px;
    border-radius: 16px;
}

@media (max-width: 560px) {
    /* Esta función está pensada para ratón. En móvil mantenemos el orden guardado,
       pero ocultamos el asa para conservar la vista limpia. */
    .live-monitor-shell:fullscreen .live-reorder-handle,
    .live-monitor-shell:-webkit-full-screen .live-reorder-handle {
        display: none !important;
    }
}

/* =========================================================
   EN VIVO · distribución manual de orientaciones en fullscreen
   Apilado: el primer bloque queda arriba y el segundo abajo.
   Al lado: el primer bloque queda a la izquierda y el segundo a la derecha.
   El asa ⋮⋮ sigue permitiendo cambiar el orden de ambos bloques.
   ========================================================= */
.live-layout-control[hidden] {
    display: none !important;
}
.live-layout-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 5px 6px 5px 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15,23,42,.035);
}
.live-layout-control > span {
    margin-right: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.live-layout-button {
    display: inline-grid;
    place-items: center;
    width: 29px;
    height: 29px;
    padding: 0;
    border: 1px solid #e1e6ee;
    border-radius: 9px;
    background: #f8fafc;
    color: #475467;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.live-layout-button:hover,
.live-layout-button.is-active {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
}
.live-layout-button:hover {
    transform: translateY(-1px);
}

/* En modo lado-a-lado, la cabecera ocupa las dos columnas y las orientaciones una cada una. */
.live-monitor-shell:fullscreen .live-page.live-layout-side,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
    align-items: start;
}
.live-monitor-shell:fullscreen .live-page.live-layout-side .live-page-intro,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side .live-page-intro,
.live-monitor-shell:fullscreen .live-page.live-layout-side .live-empty,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side .live-empty {
    grid-column: 1 / -1;
}
.live-monitor-shell:fullscreen .live-page.live-layout-side .live-orientation-section,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side .live-orientation-section {
    min-width: 0;
    align-self: start;
}

/* Dentro de media pantalla usamos auto-fit para que el zoom siga aprovechando el espacio. */
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-0 .live-grid-horizontal,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-0 .live-grid-horizontal {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-0 .live-grid-vertical,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-0 .live-grid-vertical {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 105px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-1 .live-grid-horizontal,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-1 .live-grid-horizontal {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-1 .live-grid-vertical,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-1 .live-grid-vertical {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-2 .live-grid-horizontal,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-2 .live-grid-horizontal {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-2 .live-grid-vertical,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-2 .live-grid-vertical {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-3 .live-grid-horizontal,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-3 .live-grid-horizontal {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-3 .live-grid-vertical,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-3 .live-grid-vertical {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-4 .live-grid-horizontal,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-4 .live-grid-horizontal {
    grid-template-columns: 1fr;
}
.live-monitor-shell:fullscreen .live-page.live-layout-side.live-size-4 .live-grid-vertical,
.live-monitor-shell:-webkit-full-screen .live-page.live-layout-side.live-size-4 .live-grid-vertical {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

@media (max-width: 560px) {
    .live-layout-control {
        justify-self: end;
        min-height: 34px;
        gap: 3px;
        padding: 3px 4px;
        border-radius: 10px;
        box-shadow: none;
    }
    .live-layout-control > span {
        display: none;
    }
    .live-layout-button {
        width: 27px;
        height: 27px;
        border-radius: 8px;
        font-size: 15px;
    }

    /* En móvil también se permite el modo lado a lado; cada bloque se adapta a su mitad. */
    .live-monitor-shell:fullscreen .live-page.live-layout-side,
    .live-monitor-shell:-webkit-full-screen .live-page.live-layout-side {
        column-gap: 8px;
    }
    .live-monitor-shell:fullscreen .live-page.live-layout-side .live-grid,
    .live-monitor-shell:-webkit-full-screen .live-page.live-layout-side .live-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
}

/* =========================================================
   MODO OSCURO · panel de administración
   La reproducción de cartelería no se modifica.
   ========================================================= */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0f1c;
    --panel: #111827;
    --panel-soft: #0f172a;
    --text: #e8eef7;
    --muted: #94a3b8;
    --line: #263244;
    --border: #263244;
    --soft: #0f172a;
    --primary: #7568f2;
    --primary-2: #8b5cf6;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 16px 44px rgba(0,0,0,.28);
}

html[data-theme="dark"] body.admin-body {
    background: var(--bg);
    color: var(--text);
}
html[data-theme="dark"] .admin-main,
html[data-theme="dark"] .content-wrap { background: var(--bg); }
html[data-theme="dark"] .topbar {
    background: rgba(15,23,42,.90);
    border-bottom-color: var(--line);
    box-shadow: 0 8px 28px rgba(0,0,0,.14);
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .dialog-card,
html[data-theme="dark"] .campaign-group,
html[data-theme="dark"] .schedule-overview-card,
html[data-theme="dark"] .dashboard-status-card,
html[data-theme="dark"] .screen-overview-card,
html[data-theme="dark"] .screen-group-card,
html[data-theme="dark"] .live-screen-card,
html[data-theme="dark"] .live-viewer-dialog,
html[data-theme="dark"] .storage-stat,
html[data-theme="dark"] .storage-details,
html[data-theme="dark"] .backup-panel,
html[data-theme="dark"] .backup-system-panel {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
    box-shadow: 0 14px 38px rgba(0,0,0,.24);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #0b1322;
    border-color: #334155;
    color: var(--text);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #64748b; }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    border-color: #8175f5;
    box-shadow: 0 0 0 4px rgba(124,108,255,.16);
}
html[data-theme="dark"] .btn-secondary {
    background: #25264d;
    color: #c7d2fe;
}
html[data-theme="dark"] .btn-secondary:hover { background: #30315d; }
html[data-theme="dark"] .btn-danger {
    background: rgba(127,29,29,.45);
    color: #fecaca;
}
html[data-theme="dark"] .btn-dark { background: #020617; }
html[data-theme="dark"] .badge-muted { background:#263244; color:#cbd5e1; }
html[data-theme="dark"] .badge-blue { background:#292b59; color:#c7d2fe; }
html[data-theme="dark"] .badge-success { background:#123524; color:#86efac; }
html[data-theme="dark"] .badge-warning { background:#402c0c; color:#fcd34d; }

/* Tablas y listados */
html[data-theme="dark"] th,
html[data-theme="dark"] td { border-bottom-color: var(--line); }
html[data-theme="dark"] .table-as-cards tr { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .empty-state strong { color: var(--text); }

/* Campañas */
html[data-theme="dark"] .upload-selection,
html[data-theme="dark"] .campaign-summary,
html[data-theme="dark"] .campaign-summary:hover,
html[data-theme="dark"] .campaign-action-button,
html[data-theme="dark"] .playlist-move-buttons button,
html[data-theme="dark"] .library-size-button {
    background: var(--panel);
    border-color: var(--line);
    color: #c7d2fe;
}
html[data-theme="dark"] .upload-selection-head,
html[data-theme="dark"] .playlist-duration,
html[data-theme="dark"] .library-size-buttons,
html[data-theme="dark"] .campaign-playback-toolbar {
    background: var(--panel-soft);
    border-color: var(--line);
}
html[data-theme="dark"] .campaign-summary-main:hover,
html[data-theme="dark"] .campaign-action-button:hover,
html[data-theme="dark"] .playlist-move-buttons button:hover,
html[data-theme="dark"] .library-size-button:hover:not(:disabled) {
    background: #1c2540;
    border-color: #4f46a5;
}
html[data-theme="dark"] .upload-dropzone span { color:#cbd5e1; }
html[data-theme="dark"] .content-campaign { background:#272856; color:#c7d2fe; }

/* Pantallas y grupos */
html[data-theme="dark"] .screen-overview-card,
html[data-theme="dark"] .schedule-overview-card,
html[data-theme="dark"] .dashboard-status-card { color: var(--text); }
html[data-theme="dark"] .screen-overview-card::after,
html[data-theme="dark"] .schedule-overview-card::after,
html[data-theme="dark"] .dashboard-status-card::after { background:#1d2741; }
html[data-theme="dark"] .screen-filter-buttons,
html[data-theme="dark"] .screen-group-picker span,
html[data-theme="dark"] .duplicate-screen-summary,
html[data-theme="dark"] .screen-group-info-box {
    background: var(--panel-soft);
    border-color: var(--line);
}
html[data-theme="dark"] .screen-filter-buttons button { color:#94a3b8; }
html[data-theme="dark"] .screen-filter-buttons button:hover,
html[data-theme="dark"] .screen-filter-buttons button.is-active { background:#272856; color:#c7d2fe; }
html[data-theme="dark"] .screen-group-picker strong,
html[data-theme="dark"] .duplicate-screen-summary span,
html[data-theme="dark"] .screen-group-info-box strong { color: var(--text); }
html[data-theme="dark"] .screen-group-picker span { background:#0f172a; }
html[data-theme="dark"] .screen-group-picker label:hover span { background:#172036; }
html[data-theme="dark"] .screen-group-picker input:checked + span { background:#24244e; border-color:#7568f2; }
html[data-theme="dark"] .duplicate-screen-summary span { background:#111827; border-color:#334155; color:#cbd5e1; }

/* Programación */
html[data-theme="dark"] .schedule-month-day,
html[data-theme="dark"] .schedule-day-dialog-event,
html[data-theme="dark"] .schedule-agenda-day,
html[data-theme="dark"] .schedule-agenda-event {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
}
html[data-theme="dark"] .schedule-warning-card,
html[data-theme="dark"] .schedule-conflict-summary.has-conflicts,
html[data-theme="dark"] .schedule-month-event.has-conflict,
html[data-theme="dark"] .schedule-day-dialog-event.has-conflict,
html[data-theme="dark"] .schedule-agenda-event.has-conflict {
    background:#35280d;
    border-color:#7c5d12;
    color:#fcd34d;
}
html[data-theme="dark"] .schedule-info-strip strong,
html[data-theme="dark"] .schedule-month-event,
html[data-theme="dark"] .schedule-day-dialog-event { color:var(--text); }

/* Configuración */
html[data-theme="dark"] .brand-settings-preview,
html[data-theme="dark"] .brand-preview-box,
html[data-theme="dark"] .logo-file-picker,
html[data-theme="dark"] .storage-clean-ok,
html[data-theme="dark"] .smtp-action-panel,
html[data-theme="dark"] .smtp-help-panel {
    background: var(--panel-soft) !important;
    border-color: var(--line) !important;
    color: var(--muted) !important;
}
html[data-theme="dark"] .smtp-help-panel strong,
html[data-theme="dark"] .smtp-action-panel-copy strong { color:var(--text) !important; }
html[data-theme="dark"] .storage-stat.has-warning { background:#34270d; border-color:#7c5d12; }
html[data-theme="dark"] .storage-stat.has-error { background:#351516; border-color:#7f1d1d; }
html[data-theme="dark"] .storage-warning-box { background:#351516; border-color:#7f1d1d; color:#fecaca; }
html[data-theme="dark"] .backup-system-panel {
    background: linear-gradient(135deg, rgba(99,76,246,.12), rgba(17,24,39,.78));
}

/* En vivo */
html[data-theme="dark"] .live-summary,
html[data-theme="dark"] .live-size-control,
html[data-theme="dark"] .live-layout-control,
html[data-theme="dark"] .live-fullscreen-button,
html[data-theme="dark"] .live-size-button,
html[data-theme="dark"] .live-layout-button {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
}
html[data-theme="dark"] .live-screen-name,
html[data-theme="dark"] .live-campaign-line > strong,
html[data-theme="dark"] .live-viewer-head h3 { color:var(--text); }
html[data-theme="dark"] .live-card-head,
html[data-theme="dark"] .live-card-body,
html[data-theme="dark"] .live-viewer-head,
html[data-theme="dark"] .live-viewer-info { background:var(--panel); border-color:var(--line); }
html[data-theme="dark"] .live-empty { background:rgba(15,23,42,.72); border-color:#334155; }
html[data-theme="dark"] .live-viewer-close { background:#172033; border-color:#334155; color:#cbd5e1; }
html[data-theme="dark"] .live-viewer-close:hover { background:#1e293b; color:#fff; }
html[data-theme="dark"] .live-monitor-shell:fullscreen,
html[data-theme="dark"] .live-monitor-shell:-webkit-full-screen { background:var(--bg); }
html[data-theme="dark"] .live-monitor-shell:fullscreen .live-page-intro,
html[data-theme="dark"] .live-monitor-shell:-webkit-full-screen .live-page-intro {
    background:rgba(10,15,28,.94);
    border-bottom-color:var(--line);
}
html[data-theme="dark"] .live-monitor-shell:fullscreen .live-card-head,
html[data-theme="dark"] .live-monitor-shell:-webkit-full-screen .live-card-head,
html[data-theme="dark"] .live-monitor-shell:fullscreen .live-card-body,
html[data-theme="dark"] .live-monitor-shell:-webkit-full-screen .live-card-body { background:#111827; }
html[data-theme="dark"] .live-reorder-handle:not([hidden]) { background:rgba(17,24,39,.82) !important; border-color:#334155 !important; }

/* SweetAlert2 y confirmaciones */
html[data-theme="dark"] .swal2-popup {
    background:#111827;
    color:var(--text);
    border:1px solid var(--line);
}
html[data-theme="dark"] .swal2-title,
html[data-theme="dark"] .swal2-html-container { color:var(--text); }
html[data-theme="dark"] .swal2-close { color:#94a3b8; }

/* Selector de apariencia */
.settings-appearance-card { grid-column: 1 / -1; }
.appearance-form { display:grid; gap:16px; }
.appearance-options {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
}
.appearance-option { position:relative; cursor:pointer; }
.appearance-option input { position:absolute; opacity:0; pointer-events:none; }
.appearance-option-card {
    min-height:86px;
    display:flex;
    align-items:center;
    gap:13px;
    padding:14px 16px;
    border:1px solid var(--line);
    border-radius:15px;
    background:var(--panel-soft);
    transition:border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.appearance-option:hover .appearance-option-card { transform:translateY(-1px); border-color:#b8b2ee; }
.appearance-option input:checked + .appearance-option-card {
    border-color:#7568f2;
    background:rgba(99,76,246,.10);
    box-shadow:inset 0 0 0 1px rgba(99,76,246,.15), 0 6px 18px rgba(99,76,246,.08);
}
.appearance-icon {
    width:38px;
    height:38px;
    flex:0 0 38px;
    display:grid;
    place-items:center;
    border-radius:12px;
    background:#eef2ff;
    color:#4f46e5;
    font-size:20px;
    font-weight:800;
}
.appearance-option-card strong,
.appearance-option-card small { display:block; }
.appearance-option-card strong { color:var(--text); font-size:13px; margin-bottom:3px; }
.appearance-option-card small { color:var(--muted); font-size:11px; line-height:1.35; }
.appearance-actions { display:flex; align-items:center; justify-content:space-between; gap:16px; }
html[data-theme="dark"] .appearance-icon { background:#25264d; color:#c7d2fe; }
html[data-theme="dark"] .appearance-option input:checked + .appearance-option-card { background:#24244e; }

@media (max-width: 760px) {
    .appearance-options { grid-template-columns:1fr; }
    .appearance-option-card { min-height:72px; }
    .appearance-actions { align-items:stretch; flex-direction:column; }
    .appearance-actions .btn { align-self:flex-end; }
}


/* =========================================================
   TEMA ADMIN · selector claro/oscuro en la cabecera
   ========================================================= */
.topbar-title {
    min-width: 0;
    flex: 1 1 auto;
}
.theme-toggle {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(15,23,42,.04);
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.theme-toggle:hover {
    border-color: #c7d2fe;
    background: #f5f3ff;
    color: #5b4de2;
    transform: translateY(-1px);
}
.theme-toggle:focus-visible {
    outline: 3px solid rgba(99,102,241,.22);
    outline-offset: 2px;
}
.theme-toggle-icon {
    grid-area: 1 / 1;
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    font-size: 19px;
    line-height: 1;
    transition: opacity .16s ease, transform .18s ease;
}
.theme-toggle-sun { opacity: 0; transform: rotate(-35deg) scale(.72); }
.theme-toggle-moon { opacity: 1; transform: rotate(0) scale(1); }
html[data-theme="dark"] .theme-toggle {
    border-color: #334155;
    background: #111827;
    color: #fbbf24;
    box-shadow: none;
}
html[data-theme="dark"] .theme-toggle:hover {
    border-color: #4f46e5;
    background: #1e293b;
    color: #fde68a;
}
html[data-theme="dark"] .theme-toggle-moon { opacity: 0; transform: rotate(35deg) scale(.72); }
html[data-theme="dark"] .theme-toggle-sun { opacity: 1; transform: rotate(0) scale(1); }

@media (max-width: 560px) {
    .theme-toggle {
        width: 35px;
        height: 35px;
        border-radius: 10px;
    }
    .theme-toggle-icon { font-size: 17px; }
}

/* ==========================================================
   ROTACIÓN DE REPRODUCCIÓN POR PANTALLA
   Permite usar TVs Android instaladas físicamente en vertical
   aunque el navegador permanezca siempre en orientación horizontal.
   ========================================================== */
.player-rotation-shell {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
    transform: translate(-50%, -50%);
    transform-origin: center center;
}
.player-rotation-shell[data-rotation="-90"],
.player-rotation-shell[data-rotation="90"] {
    width: 100vh;
    height: 100vw;
}
.player-rotation-shell[data-rotation="-90"] {
    transform: translate(-50%, -50%) rotate(-90deg);
}
.player-rotation-shell[data-rotation="90"] {
    transform: translate(-50%, -50%) rotate(90deg);
}
.player-rotation-shell[data-rotation="180"] {
    transform: translate(-50%, -50%) rotate(180deg);
}

.screen-rotation-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.screen-rotation-picker label {
    position: relative;
    cursor: pointer;
}
.screen-rotation-picker input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.screen-rotation-picker label > span {
    min-height: 96px;
    display: grid;
    grid-template-columns: 38px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line, #dbe3ef);
    border-radius: 14px;
    background: var(--panel, #fff);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease;
}
.screen-rotation-picker label:hover > span {
    border-color: #b8b9ff;
    transform: translateY(-1px);
}
.screen-rotation-picker input:checked + span {
    border-color: #6d5dfc;
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(109,93,252,.12);
}
.screen-rotation-picker b {
    grid-row: 1 / 3;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #eef0ff;
    color: #5b4df4;
    font-size: 22px;
    line-height: 1;
}
.screen-rotation-picker strong {
    color: var(--text, #0f172a);
    font-size: 13px;
    line-height: 1.2;
}
.screen-rotation-picker small {
    color: var(--muted, #64748b);
    font-size: 11px;
    line-height: 1.3;
}
.screen-rotation-symbol {
    min-width: 16px;
    display: inline-grid;
    place-items: center;
    font-weight: 900;
    color: #6557f5;
}
.live-rotation-state {
    white-space: nowrap;
}

html[data-theme="dark"] .screen-rotation-picker label > span {
    background: #111827;
    border-color: #334155;
}
html[data-theme="dark"] .screen-rotation-picker label:hover > span {
    border-color: #5b5bd6;
}
html[data-theme="dark"] .screen-rotation-picker input:checked + span {
    background: #24244e;
    border-color: #7c6cff;
    box-shadow: 0 0 0 3px rgba(124,108,255,.16);
}
html[data-theme="dark"] .screen-rotation-picker b {
    background: #25264d;
    color: #c7d2fe;
}

@media (max-width: 760px) {
    .screen-rotation-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 430px) {
    .screen-rotation-picker {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   CONFIGURACIÓN DE PANTALLA · ajuste visual de modales
   Mantiene visibles títulos/etiquetas en claro y oscuro y
   da más espacio al selector de rotación sin alterar su lógica.
   ========================================================= */
.screen-config-dialog {
    width: min(880px, calc(100% - 28px));
    max-width: 880px;
}
.screen-config-dialog .dialog-card {
    color: var(--text);
}
.screen-config-dialog .dialog-head h3,
.screen-config-dialog .form-group > label,
.screen-config-dialog .check-row {
    color: var(--text) !important;
    opacity: 1 !important;
    visibility: visible !important;
}
.screen-config-dialog .dialog-head h3 {
    font-weight: 800;
}
.screen-config-dialog .form-group > label {
    display: block;
    line-height: 1.25;
}
.screen-config-dialog .form-group > label.check-row,
.screen-config-dialog .form-group .check-row {
    display: flex;
}
.screen-config-dialog .screen-rotation-group {
    padding-top: 2px;
}
.screen-config-dialog .screen-rotation-group > label {
    margin-bottom: 2px;
}
.screen-config-dialog .screen-rotation-picker {
    gap: 12px;
}
.screen-config-dialog .screen-rotation-picker label > span {
    min-height: 100px;
    padding: 14px 13px;
}
.screen-config-dialog .screen-rotation-picker small {
    font-size: 10.5px;
}
.screen-config-dialog .form-group:has(.check-row) {
    align-content: start;
}
html[data-theme="dark"] .screen-config-dialog .dialog-card {
    background: var(--panel);
    color: var(--text);
}
@media (max-width: 760px) {
    .screen-config-dialog {
        width: calc(100% - 18px);
    }
}


/* =========================================================
   CONFIGURACIÓN DE PANTALLA · distribución compacta v3
   Equilibra credenciales, campaña y opciones sin cambiar
   la lógica de acceso ni almacenar contraseñas recuperables.
   ========================================================= */
.screen-config-dialog .screen-password-group {
    min-width: 0;
}
.screen-password-status {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 11px;
    border: 1px solid var(--line, #dbe3ef);
    border-radius: 11px;
    background: #f8fafc;
}
.screen-password-dots {
    color: var(--text, #0f172a);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    line-height: 1;
}
.screen-password-badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #5b4df4;
    font-size: 10.5px;
    font-weight: 800;
    white-space: nowrap;
}
.screen-config-lower {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(260px, .9fr);
    gap: 16px;
    align-items: stretch;
}
.screen-config-lower .form-group {
    min-width: 0;
    margin: 0;
}
.screen-campaign-setting,
.screen-options-setting {
    padding: 15px;
    border: 1px solid var(--line, #dbe3ef);
    border-radius: 14px;
    background: #fbfcff;
}
.screen-campaign-setting {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.screen-campaign-setting select {
    width: 100%;
}
.screen-options-list {
    display: grid;
    gap: 8px;
}
.screen-options-list .check-row {
    display: grid !important;
    grid-template-columns: 18px 1fr;
    gap: 9px;
    align-items: start;
    margin: 0;
    padding: 8px 9px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(219,227,239,.8);
}
.screen-options-list .check-row input {
    margin-top: 3px;
}
.screen-options-list .check-row span {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.screen-options-list .check-row strong {
    color: var(--text, #0f172a);
    font-size: 12px;
    line-height: 1.25;
}
.screen-options-list .check-row small {
    color: var(--muted, #64748b);
    font-size: 10.5px;
    line-height: 1.35;
    font-weight: 500;
}
.screen-config-dialog .dialog-actions {
    margin-top: 2px;
}
html[data-theme="dark"] .screen-password-status,
html[data-theme="dark"] .screen-campaign-setting,
html[data-theme="dark"] .screen-options-setting {
    background: #111827;
    border-color: #334155;
}
html[data-theme="dark"] .screen-password-badge {
    background: #24244e;
    color: #c7d2fe;
}
html[data-theme="dark"] .screen-options-list .check-row {
    background: #0f172a;
    border-color: #334155;
}
@media (max-width: 760px) {
    .screen-config-lower {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   CONFIGURACIÓN DE PANTALLA · ajuste visual v4
   - La edición ya no muestra un bloque de contraseña no recuperable.
   - Opciones simples y proporcionadas.
   - Botón de cierre con mayor contraste y área clicable.
   ========================================================= */
.screen-config-dialog .screen-orientation-edit {
    max-width: 420px;
}

.screen-config-dialog .screen-config-lower {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr);
    gap: 22px;
    align-items: start;
}

.screen-config-dialog .screen-campaign-setting,
.screen-config-dialog .screen-options-setting {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.screen-config-dialog .screen-options-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 4px;
}

.screen-config-dialog .screen-options-list .check-row {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
    min-height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.screen-config-dialog .screen-options-list .check-row input {
    margin: 0;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.screen-config-dialog .screen-options-list .check-row span {
    display: inline;
    color: var(--text, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.screen-config-dialog .screen-campaign-setting .help {
    margin-top: 7px;
}

/* Cierre más visible en los modales de Crear/Editar pantalla. */
.screen-config-dialog .dialog-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #94a3b8;
    border-radius: 13px;
    background: #ffffff;
    color: #334155 !important;
    font-size: 27px;
    font-weight: 500;
    line-height: 1;
    opacity: 1 !important;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .08);
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.screen-config-dialog .dialog-close:hover {
    background: #f1f5f9;
    border-color: #64748b;
    color: #0f172a !important;
    transform: translateY(-1px);
}
html[data-theme="dark"] .screen-config-dialog .screen-campaign-setting,
html[data-theme="dark"] .screen-config-dialog .screen-options-setting,
html[data-theme="dark"] .screen-config-dialog .screen-options-list .check-row {
    background: transparent;
    border-color: transparent;
}
html[data-theme="dark"] .screen-config-dialog .screen-options-list .check-row span {
    color: var(--text);
}
html[data-theme="dark"] .screen-config-dialog .dialog-close {
    background: #172033;
    border-color: #64748b;
    color: #f8fafc !important;
    box-shadow: 0 3px 10px rgba(0,0,0,.28);
}
html[data-theme="dark"] .screen-config-dialog .dialog-close:hover {
    background: #25324a;
    border-color: #94a3b8;
}

@media (max-width: 760px) {
    .screen-config-dialog .screen-orientation-edit { max-width: none; }
    .screen-config-dialog .screen-config-lower { grid-template-columns: 1fr; gap: 18px; }
}

/* =========================================================
   CONFIGURACIÓN DE PANTALLA · distribución edición v5
   - Orientación y cambio de contraseña en la misma fila.
   - Campaña a ancho completo para mostrar mejor nombres largos.
   - Opciones debajo, compactas y sin ocupar espacio innecesario.
   ========================================================= */
.screen-config-dialog .screen-orientation-edit,
.screen-config-dialog .screen-password-change-edit {
    min-width: 0;
    max-width: none;
}

.screen-config-dialog .screen-password-change-edit .help {
    margin-top: 7px;
}

.screen-config-dialog .screen-campaign-edit-full {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.screen-config-dialog .screen-campaign-edit-full select {
    width: 100%;
    max-width: none;
    text-overflow: ellipsis;
}

.screen-config-dialog .screen-options-edit-full {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
}

.screen-config-dialog .screen-options-edit-full .screen-options-list {
    width: fit-content;
    min-width: 260px;
}

html[data-theme="dark"] .screen-config-dialog .screen-campaign-edit-full,
html[data-theme="dark"] .screen-config-dialog .screen-options-edit-full {
    background: transparent;
    border-color: transparent;
}

@media (max-width: 760px) {
    .screen-config-dialog .screen-options-edit-full .screen-options-list {
        width: 100%;
        min-width: 0;
    }
}


/* =========================================================
   CONFIGURACIÓN DE PANTALLA · ajuste fino edición v6
   Solo afina la fila Orientación / Cambiar contraseña.
   El resto del modal conserva exactamente la distribución v5.
   ========================================================= */
.screen-config-dialog .screen-edit-main-row {
    display: grid;
    grid-template-columns: minmax(0, .98fr) minmax(0, 1.02fr);
    gap: 16px;
    align-items: start;
}
.screen-config-dialog .screen-edit-main-row .form-group {
    min-width: 0;
    margin: 0;
}
.screen-config-dialog .screen-edit-main-row select,
.screen-config-dialog .screen-edit-main-row input {
    min-height: 46px;
}
.screen-config-dialog .screen-password-change-edit .help {
    margin-top: 4px;
    line-height: 1.3;
}
@media (max-width: 760px) {
    .screen-config-dialog .screen-edit-main-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}
