:root {
    color-scheme: dark;
    --bg: #0f1115;
    --surface: #181c25;
    --surface-soft: #222836;
    --text: #ebedf3;
    --muted: #9aa3b2;
    --accent: #3a82f7;
    --danger: #c34040;
    --border: #2e3749;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Lock scroll only on conference pages */
body:has(.conference) {
    overflow: hidden;
    height: 100%;
}

h1, h2, p { margin: 0; }

.landing {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: auto;
}

.card {
    width: min(520px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    display: grid;
    gap: 14px;
}

.subtitle, .hint { color: var(--muted); }

.form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    transition: border-color .15s, box-shadow .15s;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(58,130,247,.12);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.actions a {
    text-decoration: none;
}

.hint-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
}

.hint-link:hover {
    text-decoration: underline;
}

.btn {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    line-height: 1.2;
    transition: background .15s, border-color .15s, box-shadow .15s;
}

.btn:hover {
    border-color: var(--muted);
    box-shadow: 0 1px 6px rgba(0,0,0,.35);
}

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
}
.btn.primary:hover { background: #2870e0; border-color: #2870e0; }

.btn.danger {
    background: var(--danger);
    border-color: var(--danger);
}
.btn.danger:hover { background: #a83232; border-color: #a83232; }

.btn.sm { font-size: 12px; padding: 5px 10px; border-radius: 8px; }

.conference {
    height: 100dvh;
    max-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 260px;
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas:
        "topbar   topbar"
        "content  tabs"
        "content  sidebar"
        "navmenu  navmenu"
        "controls controls";
    gap: 8px;
    padding: 8px;
    overflow: hidden;
}

/* grid-area assignments */
.conference > header.topbar   { grid-area: topbar; }
.conference > section.content { grid-area: content; }
.conference > aside.sidebar   { grid-area: sidebar; }
.conference > nav.mobile-panel-tabs { grid-area: tabs; }
.conference > .room-nav-menu  { grid-area: navmenu; }
.conference > footer.controls { grid-area: controls; }

.topbar,
.controls {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.topbar h1 {
    font-size: 16px;
}

#statusText { color: var(--muted); }

.content {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.videos {
    flex: 1 1 0;
    min-height: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-flow: dense;
    align-content: start;
    overflow: auto;
}

.video-card {
    background: #090b10;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.video-card video {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #000;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--muted);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}

/* Desktop: show only active panel */
.conference .compact-panel {
    display: none;
}
.conference .compact-panel.active {
    display: grid;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}
/* Desktop: chat messages fill the remaining sidebar height */
.conference .chat-panel.compact-panel.active {
    grid-template-rows: auto auto 1fr auto auto;
}
.conference .chat-panel.compact-panel.active .chat-messages {
    max-height: none;
    min-height: 0;
    overflow-y: auto;
}

/* Tab bar — visible on both desktop and mobile */
.mobile-panel-tabs {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mobile-tab-btn {
    padding: 5px 2px;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    border-radius: 7px;
}

.mobile-tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    display: grid;
    gap: 10px;
}

.panel h2 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.table-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    color: #d6def3;
    font-size: 13px;
    font-weight: 600;
    background: #121825;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    font-size: 13px;
}

.data-table tbody tr:hover td { background: rgba(58,130,247,.05); }
.data-table tbody tr:last-child td { border-bottom: none; }

.admin-page.landing {
    place-items: start;
    justify-items: center;
}

body:has(.admin-page) {
    overflow-x: hidden;
    max-width: 100vw;
}

.admin-page .card {
    width: min(1280px, 100%);
    max-width: 100%;
    gap: 0;
    padding: 0;
    overflow: visible;
}

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.admin-page-header .brand {
    margin: 0;
    padding: 0;
    border: none;
}

.admin-page input {
    padding: 7px 10px;
    font-size: 13px;
}

.admin-page .btn {
    padding: 7px 12px;
    font-size: 13px;
}

.admin-page h1 {
    font-size: 18px;
}

.admin-section {
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
}
.admin-section:last-child {
    border-bottom: none;
}

.admin-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 14px;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
    line-height: 1.5;
}

.admin-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.admin-section-head .admin-section-title { margin-bottom: 0; }

.stat-chip {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 12px;
    white-space: nowrap;
}

.admin-subtitle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.admin-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
    align-items: end;
}

.admin-inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.small-check-label {
    font-size: 12px;
    gap: 6px;
}

.admin-inline-form input[type="password"] {
    max-width: 160px;
    font-size: 12px;
    padding: 6px 10px;
}

.admin-user-actions {
    min-width: 240px;
    vertical-align: middle;
}

.admin-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-actions-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
}

.admin-actions-stack .btn { font-size: 12px; padding: 5px 10px; border-radius: 8px; }
.admin-actions-stack .admin-inline-form input[type="password"] { font-size: 12px; padding: 5px 8px; }

@media (min-width: 960px) {
    .admin-page .admin-grid-2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .admin-page .admin-filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .admin-page.landing { padding: 0; align-items: start; }
    .admin-page .card { border-radius: 0; border-left: none; border-right: none; width: 100vw; max-width: 100vw; }
    .admin-page-header { padding: 10px 12px; gap: 8px; flex-wrap: wrap; align-items: flex-start; flex-direction: column; }
    .admin-page-header .brand { min-width: 0; width: 100%; }
    .admin-page-header .brand-name { font-size: 13px; }
    .admin-page-header .brand-logo { width: 28px; height: 28px; }
    .admin-page-header .admin-session-info { display: none; }
    .admin-page-header .actions { gap: 6px; flex-wrap: nowrap; width: 100%; }
    .admin-page-header .actions .btn { font-size: 12px; padding: 7px 12px; border-radius: 8px; flex: 1 1 0; text-align: center; justify-content: center; }
    .admin-section { padding: 12px 14px; }
    .admin-grid-2 { grid-template-columns: 1fr; }
    .admin-filters { grid-template-columns: 1fr 1fr; }
    .admin-actions-row { flex-wrap: wrap; }

    /* Users table → card list */
    .admin-users-wrap { border: none; border-radius: 0; }
    .admin-users-table { min-width: unset; }
    .admin-users-table thead { display: none; }
    .admin-users-table tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 8px;
        padding: 10px 12px;
        background: var(--surface);
    }
    .admin-users-table tbody tr:hover td { background: transparent; }
    .admin-users-table td {
        display: block;
        border: none;
        padding: 0;
    }
    .admin-users-table td:first-child { margin-bottom: 8px; }
    /* Rol / Estado / Crear salas — inline badges */
    .admin-users-table td:nth-child(2),
    .admin-users-table td:nth-child(3),
    .admin-users-table td:nth-child(4) {
        display: inline-block;
        margin-right: 4px;
        margin-bottom: 8px;
    }
    /* Actions — full width below badges */
    .admin-users-table td.admin-user-actions {
        min-width: unset;
        border-top: 1px solid var(--border);
        padding-top: 8px;
        margin-top: 2px;
    }

    /* Audit table — hide less important columns, reset min-width */
    .admin-audit-table { min-width: unset; }
    .admin-audit-table th:nth-child(2),
    .admin-audit-table td:nth-child(2),
    .admin-audit-table th:nth-child(5),
    .admin-audit-table td:nth-child(5),
    .admin-audit-table th:nth-child(6),
    .admin-audit-table td:nth-child(6) { display: none; }
}

.audit-scroll-wrap {
    max-height: 320px;
    overflow-y: auto;
}

/* Status / role badges */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
}
.badge-green  { background: rgba(74,222,128,.15); color: #4ade80; border: 1px solid rgba(74,222,128,.3); }
.badge-red    { background: rgba(195,64,64,.15);  color: #f87171; border: 1px solid rgba(195,64,64,.3); }
.badge-blue   { background: rgba(58,130,247,.15); color: #6aabff; border: 1px solid rgba(58,130,247,.3); }
.badge-muted  { background: rgba(154,163,178,.1); color: var(--muted); border: 1px solid var(--border); }

/* User avatar initials circle */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6c45e8);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .03em;
    border: 1px solid rgba(58,130,247,.3);
}

.admin-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-user-cell-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.admin-user-cell-info small {
    font-size: 11px;
    color: var(--muted);
}

.admin-session-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    padding: 7px 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    white-space: nowrap;
}
.admin-session-info strong { color: var(--text); }

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.alert {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
}

.alert.error {
    border-color: var(--danger);
    color: #ffbcbc;
}

.alert.success {
    border-color: var(--accent);
    color: #bee4ff;
}

.auth-page {
    background:
        radial-gradient(1200px 500px at 20% -5%, #1a2a4f 0%, rgba(26, 42, 79, 0) 65%),
        radial-gradient(1000px 450px at 100% 110%, #1e3f6f 0%, rgba(30, 63, 111, 0) 60%),
        var(--bg);
}

.auth-shell {
    width: min(1080px, 100%);
    padding: 0;
    overflow: hidden;
    grid-template-columns: 360px 1fr;
    display: grid;
    gap: 0;
}

.auth-brand {
    padding: 30px;
    background: linear-gradient(165deg, #1f2f58 0%, #162239 55%, #111827 100%);
    border-right: 1px solid var(--border);
    display: grid;
    align-content: start;
    gap: 14px;
}

.auth-brand h1 {
    font-size: 30px;
    letter-spacing: 0.3px;
}

.auth-features {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #c6d0e8;
    display: grid;
    gap: 8px;
    font-size: 14px;
}

.auth-content {
    padding: 28px;
    display: grid;
    gap: 14px;
}

.auth-title {
    font-size: 22px;
}

.auth-form-card {
    background: rgba(13, 17, 26, 0.55);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.auth-form-card h2 {
    font-size: 18px;
}

.auth-form-card .btn {
    margin-top: 4px;
}

#participantsList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
    color: var(--muted);
}

.chat-panel {
    min-height: 0;
    grid-template-rows: auto 1fr auto;
}

.chat-messages {
    background: #0e1219;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    overflow: auto;
    min-height: 120px;
    max-height: 300px;
}

.chat-item {
    margin-bottom: 8px;
    font-size: 13px;
}

.chat-item strong {
    color: #d7def0;
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-jump-btn {
    justify-self: end;
    padding: 6px 10px;
    font-size: 12px;
}

.emoji-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.emoji-btn {
    border: 1px solid var(--border);
    background: #101624;
    color: var(--text);
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 15px;
}

.notes-panel {
    grid-template-rows: auto auto 1fr;
    min-height: 220px;
}

.notes-panel .actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.notes-input {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    border: 1px solid var(--border);
    background: #0d131f;
    color: var(--text);
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
}

.file-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-form input[type="file"] {
    padding: 8px;
}

.drop-zone {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    color: var(--muted);
    background: #0d131f;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone.active {
    border-color: var(--accent);
    background: #14213a;
    color: #cde3ff;
}

.upload-progress {
    width: 100%;
    height: 9px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0c1220;
}

.upload-progress-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #2f7df3 0%, #5ea0ff 100%);
    transition: width 0.1s linear;
}

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 7px;
    max-height: 180px;
    overflow: auto;
}

.file-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    background: #0f1522;
}

.file-item-main {
    display: grid;
    gap: 4px;
}

.file-thumb {
    width: 100%;
    max-width: 160px;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: cover;
}

.file-item-meta {
    color: var(--muted);
    font-size: 12px;
}

.file-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-preview-link {
    color: #9ec9ff;
    font-size: 12px;
}

.file-list a {
    color: #b7d8ff;
    text-decoration: none;
}

.file-list a:hover {
    text-decoration: underline;
}

/* =====================================================
   RESPONSIVE — all breakpoints
   ===================================================== */

/* --- Large desktop (≥1400px) — wider sidebar, bigger tiles --- */
@media (min-width: 1400px) {
    .conference {
        grid-template-columns: 1fr 300px;
    }
    .videos {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* --- Tablet landscape / small desktop (≤1024px) --- */
@media (max-width: 1024px) {
    .conference {
        grid-template-columns: 1fr 230px;
    }
    .conference[data-moderator-view] {
        grid-template-columns: 1fr 220px;
    }
}

/* --- Tablet portrait (≤900px) --- */
@media (max-width: 900px) {
    /* Landing / auth */
    .landing {
        padding: 16px;
    }
    .auth-shell {
        grid-template-columns: 1fr;
    }
    .auth-brand {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 20px;
    }
    .auth-content {
        padding: 20px;
    }
    .auth-grid {
        grid-template-columns: 1fr;
    }

    /* Conference */
    .conference .topbar {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        padding: 5px 10px;
        gap: 6px;
    }
    .conference .topbar h1 {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .conference .topbar small { display: none; }
    .conference .topbar .actions { display: none; }

    /* Single-column — cameras above, panels below */
    .conference {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto auto auto auto;
        grid-template-areas:
            "topbar"
            "content"
            "tabs"
            "sidebar"
            "navmenu"
            "controls";
    }
    .conference[data-moderator-view] {
        grid-template-columns: 1fr;
    }

    /* Tab bar: full-width row on mobile */
    .conference .mobile-panel-tabs {
        display: grid;
    }

    /* Sidebar: collapsed drawer — expands when a tab is tapped */
    .conference .sidebar {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        display: block;
    }
    .conference .sidebar.panel-open {
        max-height: 260px;
        overflow: hidden;
        display: block;
    }
    /* Show only the active panel inside the drawer */
    .conference .sidebar .compact-panel {
        display: none;
    }
    .conference .sidebar .compact-panel.active {
        display: grid;
        max-height: 256px;
        overflow-y: auto;
    }

    /* Video tiles */
    .videos {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .video-card--featured,
    .video-card--mic-on {
        grid-column: span 1;
        grid-row: span 1;
        order: unset;
    }

    /* Controls: compact horizontal row */
    .conference .controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 5px 8px;
        gap: 5px;
    }
    .conference .controls .btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 9px 4px;
        font-size: 12px;
        width: auto;
        text-align: center;
    }

    /* Branding: hide text in topbar */
    .topbar-brand-name { display: none; }
    .topbar-brand-logo { height: 34px; border-radius: 4px; }

    /* Tables */
    .data-table th,
    .data-table td {
        padding: 8px;
        font-size: 12px;
    }
}

/* --- Phone landscape (≤680px) --- */
@media (max-width: 680px) {
    .conference .sidebar.panel-open {
        max-height: 220px;
    }

    /* Host camera full-width on top */
    .video-card--featured,
    .video-card--mic-on {
        grid-column: 1 / -1;
        order: -1;
    }

    /* Swipe container */
    /* Swipe container is now transparent — active-class controls visibility */
    .conference.mobile-compact .panels-swipe-container {
        display: contents;
    }

    /* Landing */
    .landing .btn,
    .auth-page .btn {
        width: 100%;
    }
    .landing .actions > .btn,
    .landing .actions > a.btn {
        width: 100%;
        text-align: center;
    }
    .admin-grid-2 { grid-template-columns: 1fr; }
    .admin-filters { grid-template-columns: 1fr 1fr; }

    .notes-panel .actions,
    .file-form,
    .chat-form { flex-wrap: wrap; }
    .chat-jump-btn { width: 100%; }
    .chat-form .btn,
    .file-form .btn { width: 100%; }
}

/* --- Phone portrait (≤430px) --- */
@media (max-width: 430px) {
    .conference {
        padding: 4px;
        gap: 4px;
    }
    .conference .sidebar.panel-open {
        max-height: 200px;
    }
    .conference .topbar {
        padding: 4px 6px;
    }
    .conference .topbar h1 {
        font-size: 13px;
    }
    .conference .controls {
        padding: 3px 4px;
        gap: 3px;
    }
    .conference .controls .btn {
        padding: 8px 2px;
        font-size: 10px;
    }
    .videos {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 4px;
        padding: 4px;
    }
    .admin-filters { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    .landing { padding: 10px; }
    .auth-brand { padding: 14px; }
    .auth-content { padding: 14px; }
}

.error-page {
    padding: 40px;
    text-align: center;
}
.mt-20 { margin-top: 20px; }

/* Panel de acceso en index */
.access-panel {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
}
.access-panel[hidden] { display: none; }
.guest-token-panel { margin-top: 10px; }
.guest-token-panel[hidden] { display: none; }

/* Panel de administración de acceso (room_access_admin.php) */
.tab-container { margin-top: 20px; }
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
}
.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text);
    border-radius: 8px 8px 0 0;
    transition: color .2s, background .2s;
    opacity: .6;
}
.tab-btn:hover {
    opacity: .85;
    background: var(--surface-soft);
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--surface-soft);
    opacity: 1;
}
.tab-panel { display: none; padding: 20px 0; }
.tab-panel.active { display: block; }

/* Tarjetas de solicitudes */
.request-card {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--surface-soft);
    color: var(--text);
}
.request-card strong { color: var(--text); }
.request-card small { color: var(--muted); }
.request-card.approved {
    border-left: 4px solid #4ade80;
    background: rgba(74,222,128,.08);
}
.request-card.rejected {
    border-left: 4px solid var(--danger);
    background: rgba(195,64,64,.08);
}
.request-actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.request-actions button { padding: 6px 12px; font-size: 12px; }

/* Tarjetas de tokens de invitación */
.token-card {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    margin-bottom: 12px;
    background: rgba(58,130,247,.07);
    color: var(--text);
    word-break: break-all;
}
.token-card strong { color: var(--text); }
.token-card span { color: var(--muted); font-size: 13px; }
.token-code {
    background: var(--bg);
    padding: 8px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    margin: 10px 0;
    border: 1px solid var(--border);
    color: #7dd3fc;
    letter-spacing: .03em;
}
.token-url {
    background: var(--bg);
    padding: 8px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 11px;
    margin: 8px 0 4px;
    border: 1px solid var(--border);
    color: var(--accent);
    overflow-x: auto;
}
.panel-mt { margin-top: 20px; }
.actions-mt { margin-top: 30px; }
.token-actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

/* Lobby overlay (room_guest.php) */
.lobby-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.lobby-overlay[hidden] { display: none; }
.lobby-card {
    width: 100%;
    max-width: 400px;
    margin: 0 16px;
}
.lobby-card h2 { margin-bottom: 8px; }
.lobby-card p { margin-bottom: 16px; color: var(--muted, #666); }

/* === Tarjeta destacada del moderador (vista de otros participantes) === */
.video-card--featured {
    grid-column: span 2;
    grid-row: span 2;
}
.video-card--featured video {
    aspect-ratio: 16 / 9;
}
.video-card--featured .video-meta {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 12px;
}

/* === Tarjeta con micrófono encendido: siempre grande === */
.video-card--mic-on {
    order: -1;
    grid-column: span 2;
    grid-row: span 2;
}
.video-card--mic-on video {
    aspect-ratio: 16 / 9;
}

/* === Participante activo hablando: solo glow verde === */
.video-card--speaking {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.video-card--speaking .video-meta {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

/* === Vista del moderador: grid expandido para ver todos === */
.conference[data-moderator-view] .content {
    grid-template-columns: 1fr 240px;
}
.conference[data-moderator-view] .videos {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* === Swipeable panel container === */
.panels-swipe-container {
    display: contents; /* transparent on desktop - no layout effect */
}

/* === Slide-up nav menu above controls === */
.room-nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
    border-bottom: none;
    /* hidden by default: slid down out of view */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
    padding-top: 0;
    padding-bottom: 0;
}
.room-nav-menu.open {
    max-height: 300px;
    opacity: 1;
    padding: 10px 8px;
}
.room-nav-menu .btn {
    width: 100%;
    text-align: center;
    text-decoration: none;
}

/* === Branding === */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.brand-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}
.brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

/* Topbar branding (conference rooms) */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}
.topbar-brand-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
}
.topbar-brand-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

/* Marca de agua del logo en sala de conferencia */
.conference::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('img/logo.jpg') no-repeat center center;
    background-size: clamp(260px, 35vw, 520px);
    opacity: 0.045;
    filter: grayscale(100%) brightness(1.6);
    pointer-events: none;
    z-index: 0;
}

/* Asegurar que todo el contenido de la sala quede encima de la marca de agua */
.conference > * {
    position: relative;
    z-index: 1;
}

/* Auth page brand override - centered */
.auth-brand .brand {
    flex-direction: column;
    text-align: center;
    border-bottom: none;
    margin-bottom: 8px;
    padding-bottom: 0;
}
.auth-brand .brand-name {
    font-size: 1.1rem;
}

