/* VYCAST (powered by VORIX) · panel de administración. Oscuro por defecto, claro según el sistema. */
:root {
  --bg: #0B0D12;
  --bg-2: #0F1219;
  --surface: #141823;
  --surface-2: #1A1F2D;
  --surface-3: #212738;
  --border: #232838;
  --border-strong: #2F3547;
  --text: #E8EAF0;
  --muted: #8A90A2;
  --accent: #7C5CFF;
  --accent-hover: #937BFF;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --accent-text: #B5A4FF;
  --on-accent: #FFFFFF;
  --success: #22C55E;
  --success-soft: rgba(34, 197, 94, 0.14);
  --warning: #F59E0B;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --focus: #A894FF;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --sidebar: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F6F7FB;
    --bg-2: #EEF0F6;
    --surface: #FFFFFF;
    --surface-2: #F3F4F8;
    --surface-3: #E9EBF2;
    --border: #E1E4EC;
    --border-strong: #CDD2DE;
    --text: #141823;
    --muted: #5D6476;
    --accent: #6A45FF;
    --accent-hover: #5A35F0;
    --accent-soft: rgba(106, 69, 255, 0.1);
    --accent-text: #5A35F0;
    --success: #16A34A;
    --success-soft: rgba(22, 163, 74, 0.12);
    --warning: #B45309;
    --warning-soft: rgba(217, 119, 6, 0.13);
    --danger: #DC2626;
    --danger-soft: rgba(220, 38, 38, 0.1);
    --focus: #6A45FF;
    --shadow: 0 10px 30px rgba(20, 24, 35, 0.14);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--accent-text); }
img, video { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip:focus { top: 12px; }

.icon { flex: none; display: block; }

/* ------------------------------------------------------------- Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14.5px; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px -8px var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-outline-danger:hover { background: var(--danger-soft); }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 15.5px; border-radius: 12px; }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 13.5px; border-radius: 8px; }
.btn-icon { padding: 0; width: 40px; min-height: 40px; }
.btn-sm.btn-icon { width: 32px; min-height: 32px; }
.btn-block { width: 100%; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent;
  animation: spin .8s linear infinite;
}
.btn-primary.busy::after, .btn-danger.busy::after { border-color: #fff transparent #fff transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------- Formularios */
.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { min-height: 80px; resize: vertical; }
input[type="time"].input, input[type="date"].input { min-width: 0; }
.input-sm { min-height: 34px; padding: 5px 9px; font-size: 14px; }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 0; display: grid; gap: 14px; min-width: 0; }
.fieldset legend { padding: 0 6px; font-weight: 600; font-size: 14px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); padding: 10px 12px; border-radius: 10px; font-weight: 550; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.intro { margin-top: -4px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }

/* Interruptor */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; position: relative; user-select: none; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s; }
.switch-input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch-input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch-input:disabled + .switch-track { opacity: .5; }
.switch-label { font-weight: 550; }

/* Botones en grupo */
.segmented { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; min-height: 36px; }
.seg:hover { color: var(--text); }
.seg[aria-checked="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* Chips de días */
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg-2); font-weight: 700; cursor: pointer; color: var(--muted); }
.day-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day-mini { display: inline-flex; gap: 3px; }
.day-mini span { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: color-mix(in srgb, var(--muted) 60%, transparent); }
.day-mini span.on { background: var(--accent-soft); color: var(--accent-text); }

/* ------------------------------------------------------------- Estructura */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px; background: var(--bg-2); border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 4px 6px; }
.brand-mark { border-radius: 9px; display: block; }
.brand-name { font-weight: 800; letter-spacing: .08em; font-size: 17px; }
.brand-sub { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: .02em; }
.brand-name .cast { color: #6E74F0; }
.tenant-switch, .tenant-one { display: grid; gap: 4px; padding: 0 4px; }
.tenant-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }
.tenant-one strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-select { min-height: 40px; font-weight: 600; }
.nav { display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px;
}
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav-link[aria-current="page"] .icon { color: var(--accent-text); }
.sidebar-foot { margin-top: auto; }
.user-menu { position: relative; }
.user-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px;
  background: transparent; border: 1px solid var(--border); cursor: pointer; text-align: left;
}
.user-btn:hover { background: var(--surface); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-hover), var(--accent)); color: #fff; font-weight: 700; flex: none; }
.user-meta { display: grid; min-width: 0; flex: 1; }
.user-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: var(--muted); font-size: 12.5px; }
.user-chev { color: var(--muted); }
.menu { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); z-index: 20; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font-weight: 550; text-align: left; }
.menu-item:hover, .menu-item:focus { background: var(--surface-2); }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.bottomnav { display: none; }
.main { flex: 1; outline: none; }
.page { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { display: grid; gap: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 220px; min-width: 200px; }

.boot { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

/* ------------------------------------------------------------- Inicio de sesión */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px 16px;
  background: radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), radial-gradient(700px 400px at 100% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 28px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.login-brand .brand-mark { border-radius: 12px; }
.login-card h1 { font-size: 23px; }
.login-foot { font-size: 13px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 86px; }
.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }

/* ------------------------------------------------------------- Tarjetas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-flat { padding: 0; overflow: hidden; }
.stack { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: grid; gap: 6px; text-decoration: none; color: inherit; position: relative; overflow: hidden; }
a.stat:hover { border-color: var(--border-strong); background: var(--surface-2); }
.stat-label { color: var(--muted); font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.stat-value { font-size: 32px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.stat-sub { color: var(--muted); font-size: 13px; }
.stat-ok .stat-label .icon { color: var(--success); }
.stat-bad .stat-value { color: var(--danger); }
.stat-warn .stat-value { color: var(--warning); }
.stat-accent .stat-label .icon { color: var(--accent-text); }

/* Insignias y puntos */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1.6; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-vyora { background: linear-gradient(90deg, #7C5CFF, #22D3EE); color: #fff; letter-spacing: .06em; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-on { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.dot-off { background: var(--muted); opacity: .7; }

/* Vacío, carga, error */
.empty { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 48px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.empty-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.empty p { color: var(--muted); max-width: 460px; }
.empty .btn { margin-top: 8px; }
.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 28px; justify-content: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); font-weight: 550; flex-wrap: wrap; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--text); font-size: 14px; }
.notice .icon { color: var(--accent-text); margin-top: 2px; }
.notice-warn { background: var(--warning-soft); }
.notice-warn .icon { color: var(--warning); }

/* ------------------------------------------------------------- Tablas */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--bg-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; background: var(--bg-2); }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ------------------------------------------------------------- Ventanas */
dialog.modal {
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
}
dialog.modal:not([open]) { display: none; }
dialog.modal-sm { width: min(440px, calc(100vw - 24px)); }
dialog.modal-lg { width: min(860px, calc(100vw - 24px)); }
dialog.modal-xl { width: min(1100px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(5, 6, 10, 0.66); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); }
.confirm-text { font-size: 15.5px; }

/* Panel lateral (detalle) */
dialog.drawer {
  margin: 0 0 0 auto; height: 100vh; height: 100dvh; max-height: none; width: min(720px, 100vw);
  border: 0; border-left: 1px solid var(--border-strong); border-radius: 0; padding: 0;
  background: var(--bg); color: var(--text); box-shadow: var(--shadow);
}
dialog.drawer[open] { display: flex; flex-direction: column; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: .4; } }
.drawer-head { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--bg-2); position: sticky; top: 0; z-index: 2; }
.drawer-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { padding: 18px; overflow-y: auto; display: grid; gap: 16px; align-content: start; flex: 1; }

/* Avisos */
.toasts { position: fixed; z-index: 1000; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(380px, calc(100vw - 24px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-weight: 550; animation: toastin .2s ease-out; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-success .icon { color: var(--success); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--accent-text); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------- Pantallas */
.screens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.screen-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; height: 100%; align-content: start; font: inherit; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; color: inherit; width: 100%; }
.screen-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.screen-card.offline { border-style: dashed; }
.sc-top { display: flex; align-items: center; gap: 10px; }
.sc-name { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-playing { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); font-size: 14px; min-width: 0; }
.sc-playing .icon { color: var(--accent-text); }
.sc-playing span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; }
.sc-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.sc-meta .icon { width: 15px; height: 15px; }
.orient { color: var(--muted); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.code-input { font-family: var(--mono); font-size: 34px; letter-spacing: .35em; text-align: center; text-transform: uppercase; font-weight: 700; min-height: 72px; padding-left: .35em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cmd-grid .btn { justify-content: flex-start; min-height: 48px; white-space: normal; text-align: left; }
.shot { border-radius: 10px; overflow: hidden; background: #000; display: grid; place-items: center; min-height: 160px; border: 1px solid var(--border); }
.shot img { display: block; width: 100%; height: auto; }
.timeline { display: grid; gap: 0; font-size: 13.5px; }
.timeline > div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.timeline > div:last-child { border-bottom: 0; }
.sync-ok { color: var(--success); font-weight: 650; }
.sync-wait { color: var(--warning); font-weight: 650; }
.expected { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent-soft), transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.expected .big { font-size: 18px; font-weight: 700; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* ------------------------------------------------------------- Biblioteca */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 26px; display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; text-align: center; background: color-mix(in srgb, var(--surface) 55%, transparent); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { color: var(--accent-text); }
.dz-text { display: grid; gap: 2px; text-align: left; }
.uploads { display: grid; gap: 8px; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.upload-row .progress { grid-column: 1 / -1; }
.upload-row.err { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.upload-row .ur-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); transition: width .15s; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 10; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--bg-2) 0 50%) 50% / 20px 20px; display: grid; place-items: center; overflow: hidden; border: 0; padding: 0; width: 100%; cursor: pointer; color: var(--muted); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.thumb .thumb-type { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; }
.thumb .thumb-dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.7); color: #fff; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 650; }
.media-body { padding: 12px 14px; display: grid; gap: 6px; flex: 1; align-content: start; }
.media-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.media-actions { display: flex; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.media-actions .spacer { flex: 1; }
.preview-big { background: #000; border-radius: 10px; display: grid; place-items: center; min-height: 200px; overflow: hidden; }
.preview-big img, .preview-big video { max-height: 70vh; width: auto; max-width: 100%; display: block; }

/* ------------------------------------------------------------- Listas */
.pl-list { display: grid; gap: 10px; }
.pl-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; }
.pl-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pl-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.pl-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pl-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 20px; display: grid; gap: 14px; }
.items { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: auto 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.item.dragging { opacity: .45; }
.item.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.item.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.item.playing { border-color: var(--accent); }
.item-grip { cursor: grab; color: var(--muted); padding: 6px 2px; border: 0; background: transparent; }
.item-thumb { width: 64px; height: 40px; border-radius: 6px; background: var(--bg-2); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.item-thumb img, .item-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-main { min-width: 0; display: grid; }
.item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { color: var(--muted); font-size: 12.5px; }
.item-dur { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.item-dur input { width: 72px; text-align: right; }
.item-btns { display: flex; gap: 2px; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--accent); box-shadow: var(--shadow); }
.save-bar .grow { flex: 1; }
.frame-wrap { display: grid; place-items: center; background: var(--bg-2); border-radius: var(--radius); padding: 14px; border: 1px solid var(--border); }
.frame { position: relative; background: #000; border-radius: 8px; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; box-shadow: 0 0 0 6px #05060a, 0 8px 30px rgba(0,0,0,.5); }
.frame.portrait { width: auto; height: 420px; max-width: 100%; aspect-ratio: 9 / 16; }
.frame > img, .frame > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.frame .frame-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #8A90A2; font-size: 14px; text-align: center; padding: 10px; }
.frame-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); width: 0; }
.preview-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick { position: relative; border: 2px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); cursor: pointer; padding: 0; text-align: left; color: inherit; }
.pick[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick .thumb { cursor: inherit; }
.pick .pick-name { padding: 6px 8px; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .pick-check { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55); border: 2px solid #fff; display: grid; place-items: center; color: #fff; }
.pick[aria-pressed="true"] .pick-check { background: var(--accent); border-color: var(--accent); }
.pick:not([aria-pressed="true"]) .pick-check .icon { visibility: hidden; }

/* ------------------------------------------------------------- Programación */
.rules { display: grid; gap: 10px; }
.rule { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.rule.disabled { opacity: .6; }
.rule-main { display: grid; gap: 6px; min-width: 0; }
.rule-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.rule-line { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.rule-line > span { display: inline-flex; align-items: center; gap: 5px; }
.rule-line .icon { width: 15px; height: 15px; }
.rule-when { display: grid; gap: 6px; justify-items: start; }
.prio { display: grid; place-items: center; min-width: 54px; padding: 4px 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); }
.prio b { font-size: 18px; line-height: 1.1; }
.prio small { color: var(--muted); font-size: 11px; }
.week { display: grid; grid-template-columns: 44px repeat(7, minmax(0, 1fr)); gap: 6px; }
.week-hours { display: grid; grid-template-rows: 28px repeat(24, 1fr); height: 520px; font-size: 11px; color: var(--muted); }
.week-hours span { transform: translateY(-7px); text-align: right; padding-right: 6px; }
.week-col { display: grid; grid-template-rows: 28px 1fr; height: 520px; min-width: 0; }
.week-day { text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; }
.week-day.today { color: var(--accent-text); }
.week-track { position: relative; background: repeating-linear-gradient(to bottom, var(--bg-2) 0, var(--bg-2) calc(100% / 24 - 1px), var(--border) calc(100% / 24 - 1px), var(--border) calc(100% / 24)); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.week-block { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 5px; font-size: 11px; font-weight: 650; color: #0B0D12; overflow: hidden; line-height: 1.2; }
.week-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ------------------------------------------------------------- Menús en vivo */
.frame > .mn-host { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.mn-editor { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 20px; align-items: start; }
.mn-side { position: sticky; top: 20px; display: grid; gap: 10px; }
.mn-stage-wrap { display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-height: 120px; }
.mn-stage { position: relative; overflow: hidden; border-radius: 6px; background: #000; box-shadow: 0 0 0 5px #05060a, 0 8px 30px rgba(0,0,0,.5); }
.mn-prods { display: grid; gap: 10px; }
.mn-prod { display: grid; grid-template-columns: 22px 84px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; }
.mn-num { font-weight: 700; color: var(--muted); padding-top: 26px; text-align: center; }
.mn-photo { width: 84px; height: 84px; margin-top: 18px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--surface); display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted); overflow: hidden; cursor: pointer; padding: 4px; font: 600 11.5px/1.2 var(--font); text-align: center; }
.mn-photo:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); }
.mn-photo:disabled { cursor: default; }
.mn-photo.has { border-style: solid; padding: 0; }
.mn-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mn-fields { display: grid; gap: 8px; min-width: 0; }
.mn-line { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(120px, 1fr); gap: 8px; }
label.mini { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); font-weight: 600; min-width: 0; }
label.mini .input { color: var(--text); font-weight: 400; }
.input.mn-price { font-weight: 750; font-size: 17px; }
.input.input-bad { border-color: var(--danger); }
.price-hint { font-size: 12px; color: var(--accent-text); font-weight: 650; min-height: 15px; }
.mn-btns { display: flex; flex-direction: column; gap: 2px; padding-top: 14px; }
.tpl-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card { text-align: left; padding: 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); color: inherit; cursor: pointer; display: grid; gap: 4px; font: inherit; }
.tpl-card:hover { border-color: var(--border-strong); }
.tpl-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl-card b { font-size: 15px; }
.tpl-card > span:last-child { color: var(--muted); font-size: 13px; }
.tpl-ic { color: var(--accent-text); }
.brand-grid { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; align-items: start; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.color-field { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); font-size: 13.5px; cursor: pointer; }
.color-field input[type="color"] { width: 36px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; }
.logo-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-thumb { width: 130px; height: 56px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12px; }
.logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.price-sample { font-size: 20px; padding: 6px 0; }
.pick-none .thumb { color: var(--muted); }
.thumb.thumb-menu { background: var(--accent-soft); color: var(--accent-text); cursor: inherit; }
.item-thumb.is-menu { background: var(--accent-soft); color: var(--accent-text); }

/* ------------------------------------------------------------- Pantalla dividida (agregado) */
.sp-dg { display: block; flex: none; }
.sp-dg rect { stroke: currentColor; stroke-width: 2; fill: none; }
.sp-dg .sp-dg-main { fill: color-mix(in srgb, currentColor 30%, transparent); }
.sp-dg .sp-dg-side { fill: color-mix(in srgb, currentColor 14%, transparent); }
.sp-dg .sp-dg-ticker { fill: currentColor; }
.sp-dg-t { fill: currentColor; font: 700 16px var(--font); }
.sp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-card-dg { color: var(--accent-text); display: flex; height: 62px; align-items: center; margin-bottom: 4px; }
.sp-card:disabled { cursor: default; }
.sp-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint.sp-warn { color: var(--warning); font-weight: 600; }
.sp-wrap { min-width: 0; overflow: hidden; }
.sp-fit { position: relative; overflow: hidden; border-radius: 6px; background: #000; box-shadow: 0 0 0 5px #05060a, 0 8px 30px rgba(0,0,0,.5); max-width: 100%; }
.frame > .mn-host .sp-stage, .sp-stage { position: absolute; transform-origin: 0 0; background: #000; overflow: hidden; }
.sp-z { position: absolute; overflow: hidden; background: #000; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.sp-z > img, .sp-z > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.sp-mh { position: absolute; inset: 0; }
.sp-chip { position: absolute; left: 10px; top: 10px; max-width: calc(100% - 20px); background: rgba(0,0,0,.6); color: #fff; padding: 3px 10px; border-radius: 8px; font: 650 15px/1.4 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; z-index: 2; }
.sp-ph { position: absolute; inset: 8px; display: grid; place-content: center; gap: 6px; text-align: center; border: 3px dashed #3a4052; border-radius: 12px; color: #8A90A2; font: 500 22px/1.3 var(--font); padding: 10px; }
.sp-ph b { color: #E8EAF0; font-size: 26px; }
.sp-ph.warn { border-color: #B45309; color: #F59E0B; }
.sp-tk { position: absolute; inset: 0; display: flex; align-items: center; font-weight: 800; letter-spacing: .02em; font-family: var(--font); }
.sp-tk .lane { flex: 1 1 auto; overflow: hidden; white-space: nowrap; }
.sp-tk .tx { display: inline-block; padding-left: 100%; animation: spTick 20s linear infinite; }
.sp-tk .ck { flex: none; height: 100%; display: flex; align-items: center; padding: 0 .8em; font-variant-numeric: tabular-nums; }
@keyframes spTick { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.item-thumb.is-split, .thumb.thumb-split { background: var(--accent-soft); color: var(--accent-text); }
.thumb.thumb-split { cursor: inherit; }

/* ------------------------------------------------------------- Otros */
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.role-card { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 4px; font-size: 13.5px; }
.role-card b { font-size: 14.5px; }
.secret { display: flex; gap: 8px; }
.secret .input { font-family: var(--mono); font-size: 13.5px; }
.sheet-nav { display: grid; gap: 2px; margin-top: 12px; }
.sheet-actions { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.sheet-actions .btn { justify-content: flex-start; }
.load-more { display: flex; justify-content: center; padding: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* ------------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .mn-editor, .brand-grid { grid-template-columns: 1fr; }
  .mn-side { position: static; }
  .rule { grid-template-columns: minmax(0, 1fr) auto; }
  .rule-when { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bg-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
  .topbar-tenant { margin-left: auto; color: var(--muted); font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
  .bottomnav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--bg-2); border-top: 1px solid var(--border);
    padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .bn-link { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 650; background: transparent; border: 0; cursor: pointer; min-height: 52px; align-content: center; }
  .bn-link[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }
  .page { padding: 18px 16px 100px; gap: 18px; }
  h1 { font-size: 22px; }
  .grid-2 { grid-template-columns: 1fr; }
  .toasts { bottom: 84px; right: 12px; }
  .save-bar { bottom: 76px; }
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .mn-prod { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
  .mn-num { display: none; }
  .mn-photo { width: 64px; height: 64px; }
  .mn-line { grid-template-columns: minmax(0, 1fr) 112px; }
  .mn-btns { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 6px; }
  .tpl-cards { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .item { grid-template-columns: auto 52px minmax(0, 1fr); }
  .item-thumb { width: 52px; }
  .item-btns { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 6px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .screens-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .timeline > div { grid-template-columns: 1fr; gap: 0; }
  .week { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); gap: 3px; }
  .week-block { font-size: 0; padding: 0; }
  .week-day { font-size: 10px; letter-spacing: -0.02em; }
  .frame.portrait { height: 360px; }
  .dz-text { text-align: center; }
  dialog.modal { max-height: calc(100dvh - 16px); }
  .modal-body { padding: 16px; }
  .table th, .table td { padding: 10px; }
  .hide-m { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.steps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.row-link { text-decoration: none; color: inherit; }
.row-link:hover { background: var(--surface-2); }
