:root {
    --bg: #fff7ed;
    --surface: #ffffff;
    --surface-strong: #111827;
    --text: #1f2937;
    --muted: #5b6472;
    --line: #e5e7eb;
    --primary: #c1121f;
    --primary-strong: #8f0e17;
    --gold: #f5b301;
    --green: #0f7a4f;
    --danger: #b42318;
    --shadow: 0 20px 50px rgba(17, 24, 39, .12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(193, 18, 31, .08), transparent 34%),
        linear-gradient(315deg, rgba(245, 179, 1, .18), transparent 28%),
        var(--bg);
}

button, input { font: inherit; }
button, a { transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(245, 179, 1, .7); outline-offset: 2px; }

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 36px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0 20px; }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: .95; letter-spacing: 0; }
.muted { color: var(--muted); margin: 8px 0 0; }

.export-link, .secondary-link, .upload-row button, .action-btn, .login-form button, .pager button {
    border: 0;
    border-radius: 8px;
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    text-decoration: none;
}

.export-link, .upload-row button, .login-form button {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 24px rgba(193, 18, 31, .22);
}

.export-link:hover, .upload-row button:hover, .login-form button:hover { background: var(--primary-strong); transform: translateY(-1px); }
.secondary-link {
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
}
.secondary-link:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.secondary-link.compact { min-height: 38px; padding: 0 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.session-name { margin: 8px 0 0; color: var(--muted); font-weight: 700; }
.optional { color: var(--muted); font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stats-grid article, .upload-card, .filters-card, .video-card, .login-card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(17, 24, 39, .08);
    box-shadow: var(--shadow);
}
.stats-grid article { border-radius: 8px; padding: 16px; }
.stats-grid span { display: block; color: var(--muted); font-size: .88rem; }
.stats-grid strong { display: block; margin-top: 6px; font-size: 2rem; line-height: 1; }

.toolbar { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; margin-bottom: 18px; }
.upload-card, .filters-card { border-radius: 8px; padding: 16px; }
label { display: block; font-weight: 800; margin-bottom: 8px; }
.upload-row { display: flex; gap: 10px; }
input[type="file"], input[type="search"], input[type="password"], input[type="text"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filter-tabs button, .pager button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
}
.filter-tabs button.active { background: var(--surface-strong); color: #fff; border-color: var(--surface-strong); }

.video-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.video-card { border-radius: 8px; overflow: hidden; display: grid; grid-template-columns: 220px 1fr; min-height: 170px; }
.video-frame { position: relative; background: #0b1020; min-height: 170px; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-content { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.video-kicker { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-weight: 700; font-size: .84rem; }
.badge { border-radius: 999px; padding: 4px 9px; font-size: .75rem; line-height: 1; color: #fff; background: #64748b; white-space: nowrap; }
.badge.PENDIENTE { background: #854d0e; }
.badge.APROBADO { background: var(--green); }
.badge.DESCARTADO { background: var(--danger); }
.video-title { margin: 0; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.video-meta { margin: 0; color: var(--muted); font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.action-btn { min-height: 40px; border: 1px solid transparent; }
.approve { background: rgba(15, 122, 79, .12); color: var(--green); border-color: rgba(15, 122, 79, .25); }
.reject { background: rgba(180, 35, 24, .11); color: var(--danger); border-color: rgba(180, 35, 24, .25); }
.details { background: #fff; color: var(--text); border-color: var(--line); }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 22px 0 0; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

.modal { width: min(780px, calc(100% - 28px)); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 32px 90px rgba(0, 0, 0, .35); }
.modal::backdrop { background: rgba(17, 24, 39, .58); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.icon-button { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 1.7rem; line-height: 1; }
.modal-body { padding: 18px; max-height: min(72vh, 720px); overflow: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.detail-grid div { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fafafa; }
.detail-grid span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 4px; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.notice.error { color: var(--danger); font-weight: 800; }
.log-modal { width: min(940px, calc(100% - 28px)); }
.log-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.log-list { display: grid; gap: 10px; }
.log-row { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fafafa; }
.log-row div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.log-row span { color: var(--muted); font-size: .88rem; }
.log-row p { margin: 8px 0 0; line-height: 1.4; overflow-wrap: anywhere; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); border-radius: 8px; padding: 24px; }
.login-form { margin-top: 16px; display: grid; gap: 12px; }

@media (max-width: 900px) {
    .toolbar, .video-list { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
    .app-shell { width: min(100% - 20px, 1180px); padding-top: 14px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .topbar-actions, .export-link, .secondary-link { width: 100%; }
    .upload-row { flex-direction: column; }
    .video-card { grid-template-columns: 1fr; }
    .video-frame { aspect-ratio: 16 / 9; min-height: 0; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
