:root {
    --navy: #1a2744;
    --navy-2: #243456;
    --accent: #3b82f6;
    --accent-2: #60a5fa;
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --ok: #059669;
    --err: #dc2626;
    --shadow: 0 10px 40px rgba(26, 39, 68, .08);
    --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: Inter, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
    background: var(--navy);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 8px 24px rgba(26, 39, 68, .25);
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 72px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand small { display: block; color: #94a3b8; font-size: 12px; font-weight: 500; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: grid; place-items: center; font-size: 20px;
}
.brand-mark.lg { width: 56px; height: 56px; font-size: 28px; }

.search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 999px;
    padding: 8px 14px;
    max-width: 420px;
}
.search input {
    flex: 1; border: 0; background: transparent; color: #fff; outline: none;
}
.search input::placeholder { color: #94a3b8; }

.top-nav { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.top-nav a { color: #cbd5e1; font-weight: 500; font-size: 14px; }
.top-nav a:hover { color: #fff; }
.who { color: #e2e8f0; font-size: 13px; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    border: 0; border-radius: 12px; padding: 10px 16px;
    font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff; }
body:not(.login-body) .page .btn-ghost,
.panel-form .btn-ghost,
.admin-actions .btn-ghost,
.filters .btn-ghost { background: #eef2ff; color: var(--navy); }
.btn-block { width: 100%; justify-content: center; }

.page { flex: 1; padding-bottom: 48px; }
.hero {
    background: radial-gradient(1200px 400px at 10% -10%, rgba(59,130,246,.18), transparent 50%),
                linear-gradient(180deg, #e8eef8, var(--bg));
    padding: 48px 0 24px;
}
.hero-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 32px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-size: 12px; font-weight: 700; margin: 0 0 8px; }
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.15; margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 17px; max-width: 52ch; }
.hero-stats { display: flex; gap: 24px; margin-top: 24px; }
.hero-stats strong { display: block; font-size: 24px; }
.hero-stats span { color: var(--muted); font-size: 13px; }
.hero-panel { position: relative; min-height: 180px; }
.hero-orb {
    position: absolute; inset: 10px auto auto 20px;
    width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,.35), transparent 70%);
    filter: blur(8px);
}
.hero-card {
    position: relative;
    background: var(--navy); color: #fff;
    border-radius: 24px; padding: 28px;
    box-shadow: var(--shadow);
}
.hero-card i { font-size: 28px; color: var(--accent-2); }

.cats { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 28px; }
.cat-pill {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--border);
    border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px;
}
.cat-pill em { font-style: normal; background: #f1f5f9; border-radius: 999px; padding: 1px 8px; color: var(--muted); font-size: 12px; }
.cat-pill.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.cat-pill.is-on em { background: rgba(255,255,255,.15); color: #fff; }

.section-head { margin: 8px 0 20px; }
.section-head h1, .section-head h2 { margin: 0 0 6px; }
.section-head p { margin: 0; color: var(--muted); }
.row-between { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }

.grid-videos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
}
.grid-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.card-type {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 8px;
    transition: transform .18s ease, box-shadow .18s ease;
}
.card-type:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(26,39,68,.14); }
.type-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--cat, var(--accent)) 16%, white);
    color: var(--cat, var(--accent));
    font-size: 22px;
}
.card-type h3 { margin: 8px 0 0; font-size: 22px; }
.card-type p { margin: 0; color: var(--muted); }
.card-type small { color: var(--muted); }
.card-video {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform .18s ease, box-shadow .18s ease;
}
.card-video:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(26,39,68,.14); }
.thumb { position: relative; aspect-ratio: 16/9; background: #0f172a; }
.thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.play {
    position: absolute; inset: 0; margin: auto;
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(26,39,68,.78); color: #fff;
    display: grid; place-items: center; font-size: 22px;
}
.dur, .badge-draft {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,.72); color: #fff;
    font-size: 12px; padding: 2px 7px; border-radius: 6px;
}
.badge-draft { left: 8px; right: auto; background: #b45309; }
.meta { padding: 14px 14px 16px; }
.meta .chip { margin: 0 6px 6px 0; }
.meta h3 { margin: 8px 0 6px; font-size: 16px; line-height: 1.3; }
.meta p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.meta small { color: var(--muted); }
.chip {
    display: inline-flex; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--cat, var(--accent));
    background: color-mix(in srgb, var(--cat, var(--accent)) 12%, white);
    padding: 3px 8px; border-radius: 999px;
}

.empty {
    text-align: center; background: #fff; border: 1px dashed var(--border);
    border-radius: var(--radius); padding: 48px 20px; color: var(--muted);
}
.empty i { font-size: 36px; color: var(--accent); }
.empty.compact { padding: 24px; }

.player-page { padding-top: 24px; }
.back { display: inline-flex; gap: 8px; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.player-shell {
    position: relative;
    background: #000; border-radius: 20px; overflow: hidden;
    aspect-ratio: 16/9; box-shadow: var(--shadow);
}
.player-shell video, .player-shell iframe { width: 100%; height: 100%; border: 0; }
.yt-shield {
    position: absolute; z-index: 3; pointer-events: auto;
    background: transparent;
}
.yt-shield-top { top: 0; left: 0; right: 0; height: 62px; }
.yt-shield-share { top: 0; right: 0; width: 168px; height: 78px; }
.yt-shield-logo { right: 0; bottom: 0; width: 148px; height: 56px; }
.locked-player iframe { pointer-events: auto; }
.player-shell video::-webkit-media-controls-download-button { display: none !important; }
.player-shell video::-webkit-media-controls-enclosure { overflow: hidden; }
.player-shell video::-webkit-media-controls-panel { width: calc(100% + 30px); }
.protected-player { pointer-events: auto; user-select: none; }
.player-fallback { height: 100%; display: grid; place-items: center; color: #fff; text-align: center; padding: 24px; }
.player-info { padding: 22px 4px 32px; }
.player-info h1 { margin: 10px 0; font-size: clamp(22px, 3vw, 32px); }
.player-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 14px; }
.desc { color: #334155; line-height: 1.6; max-width: 70ch; }

.flash { border-radius: 12px; padding: 12px 14px; margin: 16px 0; font-weight: 600; }
.flash-ok { background: #ecfdf5; color: var(--ok); }
.flash-error { background: #fef2f2; color: var(--err); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.stat strong { font-size: 28px; display: block; }
.stat span { color: var(--muted); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.admin-home { padding-top: 28px; }
.two-col { display: grid; grid-template-columns: 1.5fr .8fr; gap: 22px; }
.side-cats { background: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); height: fit-content; }
.side-cats ul { list-style: none; margin: 0; padding: 0; }
.side-cats li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.side-cats em { margin-left: auto; color: var(--muted); }

.panel-form, .table-wrap {
    background: #fff; border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}
.panel-form.wide { max-width: 760px; }
.panel-form h2 { margin-top: 0; }
.panel-form label, .login-form label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 12px; }
.panel-form input, .panel-form select, .panel-form textarea,
.login-form input, .filters input, .filters select {
    width: 100%; margin-top: 6px; border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px; background: #fff;
}
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.check { display: flex !important; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }

.source-tabs { display: flex; gap: 8px; margin: 8px 0 14px; }
.tab {
    flex: 1; background: #f8fafc; border: 1px solid var(--border); border-radius: 12px;
    padding: 10px; text-align: center; cursor: pointer;
}
.tab:has(input:checked) { border-color: var(--accent); background: #eff6ff; }
.tab input { display: none; }
.source-panel { display: none; }
body.js-ready .source-panel { display: none; }
.source-panel.is-on, .source-panel:first-of-type { display: block; }

.dropzone {
    border: 2px dashed #cbd5e1; border-radius: 16px; padding: 28px; text-align: center;
    background: #f8fafc; cursor: pointer; display: grid; gap: 6px; justify-items: center;
}
.dropzone i { font-size: 32px; color: var(--accent); }
.dropzone input { display: none; }
.dropzone.is-drag { border-color: var(--accent); background: #eff6ff; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); padding: 8px; }
.table td { border-bottom: 1px solid var(--border); padding: 12px 8px; vertical-align: top; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; }
.link-danger, .actions button { background: none; border: 0; color: var(--err); cursor: pointer; padding: 0; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.share-copy { display: flex; gap: 8px; margin: 8px 0 4px; align-items: center; }
.share-copy input { flex: 1; font-size: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.share-copy .btn { padding: 8px 12px; color: var(--navy); background: #eef2ff; }
.table tr.is-new td { background: #eff6ff; }
.share-opt { display: none; }
.share-opt.is-on { display: block; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
code.ip { font-size: 12px; background: #f1f5f9; padding: 2px 6px; border-radius: 6px; }
.filters input, .filters select { max-width: 280px; }

.site-footer {
    margin-top: auto; background: var(--navy); color: #94a3b8;
    padding: 18px 0; font-size: 13px;
}
.site-footer .wrap { display: flex; justify-content: space-between; }

.login-body { background: var(--navy); min-height: 100vh; display: block; }
.login-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-brand {
    color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center;
    background:
        radial-gradient(600px 300px at 80% 10%, rgba(59,130,246,.3), transparent),
        var(--navy);
}
.login-form-wrap { background: #f8fafc; display: grid; place-items: center; padding: 32px; }
.login-form { width: min(420px, 100%); background: #fff; padding: 32px; border-radius: 20px; box-shadow: var(--shadow); }
.login-form h2 { margin: 0 0 8px; }
.back-link { display: inline-flex; gap: 6px; margin-top: 16px; color: var(--muted); font-weight: 600; }

@media (max-width: 900px) {
    .hero-grid, .two-col, .login-split, .stat-grid, .form-row { grid-template-columns: 1fr; }
    .search { display: none; }
    .topbar-inner { flex-wrap: wrap; padding: 10px 0; }
    .login-brand { display: none; }
}
