:root {
    --pm-bg: #0e1420;
    --pm-sidebar: #111827;
    --pm-card: #161f2e;
    --pm-card-2: #1b2536;
    --pm-border: rgba(255, 255, 255, 0.08);
    --pm-text: #ffffff;
    --pm-text-muted: #9aa4b2;
    --pm-orange: #ff7a1a;
    --pm-orange-dark: #e8690f;
    --pm-green: #22c55e;
    --pm-red: #ef4444;
    --pm-blue: #3b82f6;
    --pm-purple: #a855f7;
    --pm-input-bg: #0f1622;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--pm-text);
    background: var(--pm-bg);
}

a {
    color: inherit;
}

/* ============================================================
   PANTALLA DE LOGIN: foto de fondo + tarjeta centrada
   ============================================================ */
.pm-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background-image: linear-gradient(rgba(10, 14, 22, 0.55), rgba(10, 14, 22, 0.75)), url('login-fondo.jpg');
    background-size: cover;
    background-position: center;
}

.pm-login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--pm-border);
    border-radius: 18px;
    padding: 32px 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
}

.pm-login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 900;
    font-size: 24px;
    color: var(--pm-orange);
    margin-bottom: 4px;
}

.pm-login-card .pm-subtitle {
    text-align: center;
    color: var(--pm-text-muted);
    font-size: 13px;
    margin: 0 0 22px;
}

.pm-login-footer {
    text-align: center;
    color: var(--pm-text-muted);
    font-size: 12px;
    margin-top: 18px;
    line-height: 1.6;
}

/* ============================================================
   ESTRUCTURA GENERAL: barra superior + barra lateral + contenido
   ============================================================ */
.pm-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.pm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--pm-sidebar);
    border-bottom: 1px solid var(--pm-border);
}

.pm-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pm-back {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--pm-border);
    color: var(--pm-text-muted);
    text-decoration: none;
    font-size: 16px;
}

.pm-back:hover {
    color: var(--pm-text);
    border-color: var(--pm-text-muted);
}

.pm-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    font-size: 18px;
    color: var(--pm-orange);
}

.pm-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--pm-text-muted);
}

.pm-user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pm-logout {
    color: #ff8478;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.pm-logout:hover {
    background: rgba(239, 68, 68, 0.12);
}

.pm-body {
    flex: 1;
    display: flex;
    align-items: stretch;
}

.pm-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--pm-sidebar);
    border-right: 1px solid var(--pm-border);
    padding: 18px 12px;
}

.pm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--pm-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.pm-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--pm-text);
}

.pm-nav-item.activo {
    background: var(--pm-orange);
    color: #1a0f00;
}

.pm-main {
    flex: 1;
    padding: 26px;
    min-width: 0;
}

.pm-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}

@media (min-width: 1000px) {
    .pm-main-grid.pm-con-panel-imagenes {
        grid-template-columns: 1fr 340px;
    }
}

.pm-footer-note {
    text-align: center;
    color: var(--pm-text-muted);
    font-size: 12px;
    padding: 16px;
}

/* ============================================================
   TARJETAS Y FORMULARIOS
   ============================================================ */
.pm-card {
    width: 100%;
    background: var(--pm-card);
    border: 1px solid var(--pm-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.pm-card.pm-wide {
    max-width: none;
}

.pm-card h1 {
    font-size: 20px;
    margin: 0 0 4px;
}

.pm-card .pm-subtitle {
    color: var(--pm-text-muted);
    font-size: 13px;
    margin: 0 0 20px;
}

.pm-card h2 {
    font-size: 16px;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pm-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pm-orange);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--pm-border);
}

label {
    display: block;
    font-size: 13px;
    color: var(--pm-text-muted);
    margin: 14px 0 6px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--pm-border);
    background: var(--pm-input-bg);
    color: var(--pm-text);
    font-size: 14px;
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 70px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--pm-orange);
}

input[type="file"] {
    padding: 9px 10px;
    font-size: 13px;
    color: var(--pm-text-muted);
}

.pm-hint {
    font-size: 12px;
    color: var(--pm-text-muted);
    margin-top: 4px;
}

/* ============================================================
   BOTONES
   ============================================================ */
.pm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: var(--pm-orange);
    color: #1a0f00;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.pm-btn:hover {
    background: var(--pm-orange-dark);
}

.pm-btn.pm-full {
    width: 100%;
    margin-top: 18px;
}

.pm-btn.pm-secondary {
    background: transparent;
    border: 1px solid var(--pm-border);
    color: var(--pm-text);
}

.pm-btn.pm-secondary:hover {
    border-color: var(--pm-text-muted);
    background: rgba(255, 255, 255, 0.04);
}

.pm-btn.pm-verde {
    background: var(--pm-green);
    color: #04240f;
}

.pm-btn.pm-verde:hover {
    filter: brightness(1.08);
}

.pm-btn.pm-rojo {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ff8478;
}

.pm-btn.pm-rojo:hover {
    background: rgba(239, 68, 68, 0.24);
}

.pm-btn-sm {
    padding: 7px 12px;
    font-size: 11px;
    border-radius: 999px;
    font-weight: 700;
}

.pm-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--pm-border);
    background: transparent;
    color: var(--pm-text-muted);
    cursor: pointer;
    font-size: 15px;
}

.pm-btn-icon:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--pm-text);
}

/* ============================================================
   ALERTAS
   ============================================================ */
.pm-alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

.pm-alert.pm-ok {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.pm-alert.pm-error {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ff8478;
}

/* ============================================================
   TABLA "LISTA DE USUARIOS / EMISORAS"
   ============================================================ */
.pm-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.pm-list-toolbar .pm-list-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 800;
}

.pm-count-chip {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--pm-text-muted);
}

.pm-list-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.pm-filtros {
    display: inline-flex;
    background: var(--pm-input-bg);
    border-radius: 999px;
    padding: 3px;
    border: 1px solid var(--pm-border);
}

.pm-filtro-btn {
    border: none;
    background: transparent;
    color: var(--pm-text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
}

.pm-filtro-btn.activo {
    background: var(--pm-orange);
    color: #1a0f00;
}

.pm-buscador {
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid var(--pm-border);
    background: var(--pm-input-bg);
    color: var(--pm-text);
    font-size: 13px;
    min-width: 200px;
}

.pm-tabla-wrap {
    overflow-x: auto;
}

.pm-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pm-tabla th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pm-text-muted);
    padding: 0 12px 12px;
    border-bottom: 1px solid var(--pm-border);
    white-space: nowrap;
}

.pm-tabla td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--pm-border);
    vertical-align: middle;
    white-space: nowrap;
}

.pm-tabla tr:last-child td {
    border-bottom: none;
}

.pm-tabla tr.pm-fila-oculta {
    display: none;
}

.pm-id-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 700;
    font-size: 12px;
}

.pm-tabla a.pm-link {
    color: #ffb27a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.pm-tabla a.pm-link:hover {
    text-decoration: underline;
}

.pm-empty {
    text-align: center;
    color: var(--pm-text-muted);
    font-size: 13px;
    padding: 30px 0;
}

/* Badges de tipo / estado */
.pm-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 999px;
}

.pm-badge.pm-tipo-radio {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
}

.pm-badge.pm-tipo-tv {
    background: rgba(59, 130, 246, 0.18);
    color: #7cb0ff;
}

.pm-badge.pm-estado-activo {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
}

.pm-badge.pm-generales {
    background: rgba(255, 122, 26, 0.16);
    color: #ffb27a;
}

/* ============================================================
   MODALES
   ============================================================ */
.pm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 14, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.pm-modal-overlay.pm-visible {
    display: flex;
}

.pm-modal {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--pm-card);
    border: 1px solid var(--pm-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pm-modal.pm-modal-ancho {
    max-width: 720px;
}

.pm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pm-modal-header h2 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 17px;
}

.pm-modal-close {
    background: transparent;
    border: none;
    color: var(--pm-text-muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.pm-modal-close:hover {
    color: var(--pm-text);
}

.pm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--pm-border);
}

/* ============================================================
   IMÁGENES DE LA APP (Splash / Background / Logo)
   ============================================================ */
.pm-imagen-item {
    margin-bottom: 20px;
}

.pm-imagen-preview {
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 1px solid var(--pm-border);
    object-fit: cover;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.04);
}

/* ============================================================
   INTERRUPTORES (toggles) — Opciones visuales
   ============================================================ */
.pm-switch-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.pm-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.pm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pm-switch-track {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
}

.pm-switch-track::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s;
}

.pm-switch input:checked + .pm-switch-track {
    background: var(--pm-orange);
}

.pm-switch input:checked + .pm-switch-track::before {
    transform: translateX(18px);
}

.pm-switch-label {
    font-size: 13px;
    color: var(--pm-text);
}

/* ============================================================
   MULTI RADIO / MULTI TV (listas dinámicas ya existentes)
   ============================================================ */
.pm-multi-section {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--pm-border);
}

.pm-multi-section h3 {
    border: none;
    padding: 0;
    margin-bottom: 4px;
}

.pm-multi-row {
    display: grid;
    grid-template-columns: 1fr 1.6fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

@media (max-width: 900px) {
    .pm-multi-row {
        grid-template-columns: 1fr;
    }

    .pm-main {
        padding: 16px;
    }

    .pm-topbar {
        padding: 12px 14px;
    }

    .pm-body {
        flex-direction: column;
    }

    .pm-sidebar {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px;
        border-right: none;
        border-bottom: 1px solid var(--pm-border);
    }

    .pm-nav-item {
        flex: 1 1 auto;
        justify-content: center;
        margin-bottom: 0;
        white-space: nowrap;
    }

    .pm-card {
        padding: 16px;
    }

    .pm-list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pm-list-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .pm-filtros {
        justify-content: center;
    }

    .pm-buscador {
        min-width: 0;
        width: 100%;
    }

    .pm-tabla-wrap .pm-tabla td:last-child {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }

    .pm-tabla-wrap .pm-tabla td:last-child .pm-btn {
        width: 100%;
    }

    .pm-modal {
        padding: 18px;
    }
}

@media (max-width: 480px) {
    .pm-login-card {
        padding: 24px 20px;
    }

    .pm-topbar-right span.pm-user-chip {
        display: none;
    }
}

.pm-btn-quitar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--pm-border);
    background: rgba(239, 68, 68, 0.14);
    color: #ff8478;
    font-size: 15px;
    cursor: pointer;
}

.pm-btn-quitar:hover {
    background: rgba(239, 68, 68, 0.28);
}

.pm-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 20px;
}

@media (min-width: 640px) {
    .pm-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   REPRODUCTOR DE PRUEBA (vista previa de transmisión)
   ============================================================ */
.pm-preview-box {
    background: var(--pm-input-bg);
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0 4px;
}

.pm-preview-box audio,
.pm-preview-box video {
    width: 100%;
    border-radius: 8px;
    margin-top: 10px;
    background: #000;
}

.pm-preview-status {
    font-size: 12px;
    color: var(--pm-text-muted);
    margin-top: 8px;
}

.pm-preview-status.pm-ok-text {
    color: #4ade80;
}

.pm-preview-status.pm-error-text {
    color: #ff8478;
}
