:root {
    --bg: #07070b;
    --bg-soft: #0d0d14;
    --bg-card: #12121c;
    --bg-card-hover: #171724;
    --bg-input: #0a0a12;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f5f5f7;
    --muted: #9ca0ad;
    --muted-2: #6f7584;
    --red: #e50914;
    --red-2: #ff3b4e;
    --red-soft: rgba(229, 9, 20, 0.14);
    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, 0.14);
    --yellow: #f59e0b;
    --yellow-soft: rgba(245, 158, 11, 0.14);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --radius: 16px;
    --radius-sm: 12px;
    --sidebar-width: 280px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.admin-body { min-height: 100vh; }

.admin-shell {
    min-height: 100vh;
    display: flex;
    background:
        radial-gradient(circle at top left, rgba(229, 9, 20, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(99, 102, 241, 0.08), transparent 24%),
        var(--bg);
}

.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 10, 16, 0.92);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--red-2), var(--red));
    display: grid;
    place-items: center;
    box-shadow: 0 10px 30px rgba(229, 9, 20, 0.28);
}

.brand-mark svg {
    width: 22px;
    height: 22px;
    color: white;
}

.sidebar-brand strong {
    display: block;
    font-size: 1.02rem;
    font-weight: 700;
}

.sidebar-brand span {
    color: var(--muted);
    font-size: 0.82rem;
}

.sidebar-nav {
    padding: 18px 14px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section + .sidebar-section {
    margin-top: 18px;
}

.sidebar-section-title {
    display: block;
    padding: 0 12px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    transition: 0.2s ease;
    margin-bottom: 4px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.sidebar-link.is-active {
    background: var(--red-soft);
    color: white;
    border: 1px solid rgba(229, 9, 20, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.sidebar-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-footer {
    padding: 16px 14px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-link.subtle {
    font-size: 0.92rem;
}

.danger-text { color: #ff8f96 !important; }

.admin-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 7, 11, 0.82);
    backdrop-filter: blur(16px);
}

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

.topbar-title h1 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
}

.topbar-title p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-online {
    background: var(--green-soft);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.22);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.topbar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 8px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, var(--red-2), var(--red));
    font-weight: 700;
}

.topbar-user-card strong {
    display: block;
    font-size: 0.9rem;
}

.topbar-user-card span {
    color: var(--muted);
    font-size: 0.78rem;
}

.admin-content {
    padding: 28px;
    flex: 1;
}

.admin-footer {
    padding: 18px 28px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.86rem;
}

.stats-grid,
.content-grid {
    display: grid;
    gap: 20px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 24px;
}

.content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card,
.stat-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -20px -20px auto;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--red-soft);
}

.stat-label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin-top: 8px;
}

.card-wide { grid-column: 1 / -1; }

.card-header {
    margin-bottom: 20px;
}

.card-header h2,
.card-header h3,
.form-section h3 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
}

.card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.form-grid,
.form-sections,
.form-section {
    display: grid;
    gap: 14px;
}

.form-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .full,
.form-section .full {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(229, 9, 20, 0.55);
    box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.12);
}

textarea {
    min-height: 140px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
}

.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--red-2), var(--red));
    color: white;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(229, 9, 20, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(229, 9, 20, 0.28);
}

.btn-secondary {
    background: #242433;
    box-shadow: none;
}

.btn-danger,
.btn-small.btn-danger {
    background: #8b1530;
    box-shadow: none;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.84rem;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

code,
pre {
    background: #0b0b12;
    border: 1px solid var(--border);
    border-radius: 10px;
}

code {
    padding: 3px 8px;
    font-size: 0.86rem;
}

pre {
    padding: 16px;
    overflow: auto;
    font-size: 0.88rem;
}

.table-actions,
.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-pill.ok {
    background: var(--green-soft);
    color: #86efac;
}

.status-pill.off {
    background: rgba(120, 120, 120, 0.14);
    color: #d1d5db;
}

.status-pill.warn {
    background: var(--yellow-soft);
    color: #fcd34d;
}

.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid rgba(229, 9, 20, 0.28);
    background: var(--red-soft);
    color: #ffb4ba;
    font-weight: 500;
}

.alert.success,
.alert.ok {
    border-color: rgba(34, 197, 94, 0.28);
    background: var(--green-soft);
    color: #bbf7d0;
}

.alert.error {
    border-color: rgba(229, 9, 20, 0.28);
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.method-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    display: grid;
    gap: 6px;
    background: rgba(255,255,255,0.02);
}

.method-item.enabled {
    border-color: rgba(229, 9, 20, 0.28);
    background: var(--red-soft);
}

.method-item.disabled { opacity: 0.55; }

.preview-login {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    min-height: 220px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-left {
    padding: 24px;
    background: linear-gradient(90deg, #2a0810, #12080d 55%, #050505);
}

.preview-right { background: #050505; }

.preview-tabs {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.preview-tabs span {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
}

.api-block {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--text);
}

.inline-activate-form {
    display: grid;
    gap: 8px;
    min-width: 260px;
}

.icon-button,
.mobile-only { display: none; }

.sidebar-overlay { display: none; }

.auth-body {
    min-height: 100vh;
    background: var(--bg);
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-hero {
    position: relative;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(229, 9, 20, 0.22), transparent 30%),
        linear-gradient(135deg, #1a0508, #09090d 65%);
    overflow: hidden;
}

.auth-hero h1 {
    font-size: 3.2rem;
    margin: 0 0 14px;
    font-weight: 800;
}

.auth-hero p,
.auth-hero li {
    color: var(--muted);
    line-height: 1.7;
    max-width: 520px;
}

.auth-hero ul {
    padding-left: 18px;
    margin-top: 24px;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 32px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.auth-card h2 {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.auth-card p {
    color: var(--muted);
    margin-top: 0;
}

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid,
    .form-grid.two-cols,
    .method-grid,
    .auth-layout,
    .preview-login { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-overlay.is-visible {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 35;
    }
    .admin-main { margin-left: 0; width: 100%; }
    .mobile-only { display: inline-flex; }
    .icon-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: rgba(255,255,255,0.03);
        color: var(--text);
    }
    .icon-button svg { width: 20px; height: 20px; }
    .admin-content,
    .admin-footer,
    .topbar { padding-left: 18px; padding-right: 18px; }
}

body.modal-open { overflow: hidden; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
}

.modal-overlay[hidden] { display: none !important; }

.modal-card {
    width: min(560px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.modal-card.modal-wide { width: min(760px, 100%); }

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
}

.modal-body { display: grid; gap: 12px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.detail-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.detail-grid strong {
    display: block;
    word-break: break-all;
}

@media (max-width: 700px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.support-preview {
    display: inline-flex;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
}

.support-preview-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
}

.hint-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.7;
}

/* Identidade visual PlayVods */
.admin-shell {
    position: relative;
    background:
        linear-gradient(135deg, rgba(3, 3, 7, 0.96), rgba(10, 1, 3, 0.88)),
        var(--app-bg) center / cover fixed no-repeat;
}

.admin-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 52% 12%, rgba(229, 9, 20, 0.18), transparent 34%),
        linear-gradient(90deg, rgba(0,0,0,0.36), transparent 40%, rgba(0,0,0,0.28));
}

.sidebar,
.topbar {
    background: rgba(5, 5, 9, 0.82);
    backdrop-filter: blur(22px) saturate(135%);
}

.sidebar-brand {
    min-height: 104px;
    padding: 18px 18px;
}

.brand-mark {
    width: 92px;
    height: 54px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.brand-mark svg { display: none; }

.brand-mark::before {
    content: "";
    display: block;
    width: 92px;
    height: 54px;
    background: var(--app-logo) center / contain no-repeat;
    filter: drop-shadow(0 10px 18px rgba(229, 9, 20, 0.3));
}

.sidebar-brand strong { font-size: 1.08rem; }
.sidebar-brand span { color: rgba(255,255,255,0.58); }

.card,
.stat-card,
.auth-card,
.modal-card {
    background: linear-gradient(145deg, rgba(22, 18, 25, 0.9), rgba(8, 8, 13, 0.84));
    border-color: rgba(255, 255, 255, 0.11);
    backdrop-filter: blur(18px) saturate(120%);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

.sidebar-link.is-active {
    background: linear-gradient(90deg, rgba(229, 9, 20, 0.28), rgba(229, 9, 20, 0.08));
    border-color: rgba(255, 49, 61, 0.34);
    box-shadow: inset 3px 0 0 var(--red-2), 0 10px 30px rgba(229, 9, 20, 0.08);
}

.auth-body {
    background:
        linear-gradient(90deg, rgba(2,2,5,0.56), rgba(2,2,5,0.9)),
        var(--app-bg) center / cover fixed no-repeat;
}

.auth-hero {
    background:
        linear-gradient(90deg, rgba(5,1,3,0.3), rgba(5,1,3,0.82)),
        var(--app-bg) center / cover no-repeat;
}

.auth-hero::before {
    content: "";
    width: min(440px, 78%);
    height: 150px;
    margin-bottom: 28px;
    background: var(--app-logo) left center / contain no-repeat;
    filter: drop-shadow(0 18px 30px rgba(229, 9, 20, 0.34));
}

.auth-hero h1 { display: none; }

.topbar-title p,
.card-header p,
.auth-card p { color: rgba(255,255,255,0.58); }

/* Fluxo de cadastro por ação/modal */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(22, 18, 25, 0.88), rgba(8, 8, 13, 0.76));
    backdrop-filter: blur(18px) saturate(120%);
    box-shadow: var(--shadow);
}

.page-toolbar h2 {
    margin: 2px 0 4px;
    font-size: 1.3rem;
}

.page-toolbar p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.eyebrow {
    display: block;
    color: #ff737d;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.config-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.summary-item {
    min-width: 0;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
}

.summary-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-item strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-section-panel {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}

.modal-card.modal-xl {
    width: min(920px, 100%);
}

.modal-header > div {
    min-width: 0;
}

.modal-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.checkbox-line input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    margin: 0;
    accent-color: var(--red-2);
}

.btn:disabled,
button.btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.empty-cell {
    padding: 32px 18px;
    text-align: center;
    color: var(--muted);
}

.support-overview {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.support-preview-small {
    margin-bottom: 10px;
}

.support-preview-small .support-preview-image {
    width: 76px;
    height: 76px;
}

.modal-body > div > .hint {
    margin-bottom: 0;
}

@media (max-width: 1000px) {
    .config-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .page-toolbar {
        align-items: stretch;
        flex-direction: column;
        padding: 18px;
    }

    .toolbar-actions {
        justify-content: stretch;
    }

    .page-toolbar > .btn,
    .toolbar-actions .btn {
        width: 100%;
    }

    .config-summary-grid {
        grid-template-columns: 1fr;
    }

    .modal-overlay {
        place-items: start center;
        padding: 12px;
        overflow-y: auto;
    }

    .modal-card,
    .modal-card.modal-wide,
    .modal-card.modal-xl {
        width: 100%;
        max-height: none;
        padding: 18px;
        margin: 8px 0;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* Ajustes finais de contraste e responsividade */
.btn.btn-secondary,
button.btn.btn-secondary {
    background: #242433;
    box-shadow: none;
}

.btn.btn-secondary:hover,
button.btn.btn-secondary:hover {
    background: #303044;
    box-shadow: none;
}

@media (max-width: 700px) {
    .topbar {
        align-items: center;
        gap: 10px;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .topbar-left {
        min-width: 0;
        flex: 1;
    }

    .topbar-title {
        min-width: 0;
    }

    .topbar-title h1 {
        font-size: 1.18rem;
        line-height: 1.2;
    }

    .topbar-title p {
        display: none;
    }

    .topbar-actions {
        gap: 7px;
        flex-shrink: 0;
    }

    .badge {
        padding: 7px 9px;
        font-size: 0.76rem;
    }

    .topbar-user-card {
        padding: 6px;
    }

    .topbar-user-card > div:last-child {
        display: none;
    }

    .user-avatar {
        width: 34px;
        height: 34px;
    }
}

/* ========================================================================
   EXTREME FLIX — identidade cinematográfica e responsiva
   ======================================================================== */
:root {
    --red: var(--brand-primary, #e50914);
    --red-2: color-mix(in srgb, var(--brand-primary, #e50914) 78%, white);
    --red-soft: color-mix(in srgb, var(--brand-primary, #e50914) 17%, transparent);
    --bg: #080808;
    --bg-soft: #101010;
    --bg-card: rgba(24, 24, 24, 0.92);
    --bg-card-hover: rgba(31, 31, 31, 0.96);
    --bg-input: #111;
    --text: #f7f7f7;
    --muted: #a9a9a9;
    --muted-2: #737373;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.17);
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar-width: 272px;
}

body,
button,
input,
textarea,
select {
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.admin-shell {
    background:
        linear-gradient(rgba(8, 8, 8, .94), rgba(8, 8, 8, .985)),
        var(--app-bg, none) center / cover fixed no-repeat,
        #080808;
}

.sidebar {
    background: rgba(8, 8, 8, .96);
    box-shadow: 22px 0 70px rgba(0, 0, 0, .28);
}

.sidebar-brand {
    min-height: 88px;
    padding: 19px 18px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 11px;
}

.brand-mark.has-image {
    width: 76px;
    padding: 5px;
    background: rgba(255,255,255,.035);
    box-shadow: none;
}

.brand-mark.has-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-text {
    min-width: 0;
}

.brand-text strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-link {
    min-height: 45px;
    border: 1px solid transparent;
}

.sidebar-link.is-active {
    position: relative;
    background: rgba(255,255,255,.075);
    border-color: rgba(255,255,255,.08);
    box-shadow: none;
}

.sidebar-link.is-active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--brand-primary, #e50914);
    box-shadow: 0 0 16px color-mix(in srgb, var(--brand-primary, #e50914) 70%, transparent);
}

.sidebar-link.is-active .sidebar-icon {
    color: var(--brand-primary, #e50914);
}

.topbar {
    min-height: 84px;
    padding: 18px 30px;
    background: rgba(8, 8, 8, .86);
    border-bottom-color: rgba(255,255,255,.07);
}

.panel-url-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #d8d8d8;
    background: rgba(255,255,255,.035);
    font-size: .8rem;
    font-weight: 700;
}

.admin-content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px;
}

.card,
.page-toolbar,
.stat-card {
    border-color: rgba(255,255,255,.08);
    background: linear-gradient(145deg, rgba(28,28,28,.94), rgba(14,14,14,.96));
    box-shadow: 0 16px 50px rgba(0,0,0,.24);
}

.card:hover,
.stat-card:hover {
    border-color: rgba(255,255,255,.13);
}

.btn,
button.btn {
    background: var(--brand-primary, #e50914);
    border-color: transparent;
    border-radius: 8px;
    font-weight: 750;
    box-shadow: none;
}

.btn:hover,
button.btn:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
    box-shadow: 0 10px 28px color-mix(in srgb, var(--brand-primary, #e50914) 28%, transparent);
}

.btn.btn-secondary,
button.btn.btn-secondary {
    background: rgba(109,109,110,.68);
    color: #fff;
    border-color: rgba(255,255,255,.10);
}

input,
textarea,
select {
    border-radius: 8px;
    background: #111;
    border-color: rgba(255,255,255,.12);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand-primary, #e50914);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary, #e50914) 18%, transparent);
}

.eyebrow {
    color: color-mix(in srgb, var(--brand-primary, #e50914) 78%, white);
}

/* Identidade visual */
.branding-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(380px, .88fr);
    gap: 22px;
    align-items: start;
}

.branding-form-card,
.live-preview-card {
    min-width: 0;
}

.form-row {
    display: grid;
    gap: 14px;
}

.form-row.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.color-control,
.range-control {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #111;
}

.color-control input[type="color"] {
    width: 42px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.color-control code {
    color: #ddd;
}

.range-control input[type="range"] {
    flex: 1;
    min-width: 0;
    padding: 0;
    accent-color: var(--brand-primary, #e50914);
    border: 0;
    box-shadow: none;
}

.range-control output {
    width: 48px;
    text-align: right;
    font-weight: 750;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.upload-box {
    display: flex;
    flex-direction: column;
    min-height: 174px;
    padding: 17px;
    border: 1px dashed rgba(255,255,255,.19);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
}

.upload-box:hover {
    border-color: color-mix(in srgb, var(--brand-primary, #e50914) 70%, white);
    background: color-mix(in srgb, var(--brand-primary, #e50914) 6%, transparent);
}

.upload-kicker {
    color: color-mix(in srgb, var(--brand-primary, #e50914) 72%, white);
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.upload-box strong {
    margin: 4px 0 12px;
}

.upload-box input[type="file"] {
    width: 100%;
    margin-top: auto;
    padding: 8px;
    font-size: .78rem;
}

.upload-box small {
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.35;
}

.branding-actions {
    justify-content: flex-start;
}

.inline-reset-form {
    margin-top: 10px;
}

.streaming-preview {
    position: relative;
    min-height: 440px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    background: var(--preview-bg) center / cover no-repeat, #111;
    box-shadow: inset 0 -120px 90px rgba(0,0,0,.80);
}

.streaming-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(0,0,0,.97) 0%, rgba(0,0,0,.72) 38%, rgba(0,0,0,.15) 76%),
        linear-gradient(0deg, rgba(0,0,0,.97) 0%, transparent 55%);
    opacity: var(--preview-overlay, .72);
}

.preview-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.55), transparent 22%);
    z-index: 1;
}

.preview-nav,
.preview-hero-copy,
.preview-row {
    position: relative;
    z-index: 2;
}

.preview-nav {
    display: flex;
    align-items: center;
    gap: 17px;
    padding: 17px 19px;
    font-size: .72rem;
}

.preview-nav img {
    width: 100px;
    height: 32px;
    object-fit: contain;
    object-position: left center;
    margin-right: 4px;
}

.preview-nav strong {
    color: var(--preview-red);
    font-size: 1.05rem;
}

.preview-hero-copy {
    max-width: 66%;
    padding: 80px 24px 0;
}

.preview-badge {
    display: inline-flex;
    padding: 5px 8px;
    border-left: 3px solid var(--preview-red);
    background: rgba(255,255,255,.10);
    font-size: .62rem;
    font-weight: 850;
    letter-spacing: .09em;
}

.preview-hero-copy h3 {
    margin: 10px 0 7px;
    font-size: clamp(1.8rem, 5vw, 3rem);
    line-height: 1;
}

.preview-hero-copy p {
    margin: 0;
    color: #ddd;
    font-size: .82rem;
}

.preview-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    font-size: .72rem;
}

.preview-buttons b,
.preview-buttons span {
    display: inline-flex;
    padding: 9px 12px;
    border-radius: 5px;
}

.preview-buttons b {
    background: #fff;
    color: #111;
}

.preview-buttons span {
    background: rgba(109,109,110,.75);
}

.preview-row {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 18px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}

.preview-row i {
    height: 74px;
    border-radius: 5px;
    background: linear-gradient(135deg, #2c2c2c, #111);
    border: 1px solid rgba(255,255,255,.08);
}

.preview-row i:nth-child(2) { background: linear-gradient(135deg, #5b0e14, #1a0b0d); }
.preview-row i:nth-child(3) { background: linear-gradient(135deg, #333, #171717); }
.preview-row i:nth-child(4) { background: linear-gradient(135deg, #1d263c, #10141d); }

.asset-status-list {
    display: grid;
    gap: 1px;
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--border);
}

.asset-status-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    background: #121212;
}

.asset-status-list span {
    color: var(--muted);
    font-size: .82rem;
}

.asset-status-list code {
    max-width: 64%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Login cinematográfico */
.login-page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background: #050505;
    color: #fff;
}

.login-cinematic-bg,
.login-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.login-cinematic-bg {
    background: var(--login-bg) center / cover no-repeat;
    transform: scale(1.02);
}

.login-vignette {
    background:
        linear-gradient(90deg, rgba(0,0,0,.97) 0%, rgba(0,0,0,.84) 38%, rgba(0,0,0,.46) 72%, rgba(0,0,0,.76) 100%),
        linear-gradient(0deg, rgba(0,0,0,.98) 0%, transparent 55%),
        linear-gradient(180deg, rgba(0,0,0,.77), transparent 28%);
}

.login-header,
.login-stage,
.login-footer {
    position: relative;
    z-index: 2;
}

.login-header {
    height: 96px;
    display: flex;
    align-items: center;
    width: min(1460px, calc(100% - 80px));
    margin: 0 auto;
}

.login-header img {
    width: min(230px, 45vw);
    max-height: 64px;
    object-fit: contain;
    object-position: left center;
}

.login-header strong {
    color: var(--brand-primary, #e50914);
    font-size: 1.7rem;
    font-weight: 900;
}

.login-stage {
    min-height: calc(100vh - 150px);
    min-height: calc(100dvh - 150px);
    width: min(1460px, calc(100% - 80px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 440px;
    gap: clamp(50px, 8vw, 150px);
    align-items: center;
    padding: 30px 0 90px;
}

.login-copy {
    max-width: 720px;
}

.login-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #dedede;
    font-size: .76rem;
    font-weight: 850;
    letter-spacing: .16em;
}

.login-eyebrow::before {
    content: "";
    width: 28px;
    height: 3px;
    border-radius: 3px;
    background: var(--brand-primary, #e50914);
}

.login-copy h1 {
    margin: 16px 0 20px;
    font-size: clamp(3rem, 5.4vw, 6.1rem);
    line-height: .96;
    letter-spacing: -.055em;
}

.login-copy p {
    max-width: 620px;
    margin: 0;
    color: #d0d0d0;
    font-size: clamp(1rem, 1.35vw, 1.24rem);
}

.login-feature-row {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 28px;
}

.login-feature-row span {
    padding: 8px 11px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(0,0,0,.28);
    color: #d4d4d4;
    font-size: .75rem;
    font-weight: 650;
}

.login-card {
    padding: 34px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    background: rgba(12,12,12,.87);
    box-shadow: 0 30px 100px rgba(0,0,0,.52);
    backdrop-filter: blur(22px);
}

.login-card-head {
    display: flex;
    gap: 13px;
    align-items: center;
    margin-bottom: 27px;
}

.login-lock-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--brand-primary, #e50914) 22%, transparent);
    color: var(--brand-primary, #e50914);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-primary, #e50914) 7%, transparent);
}

.login-card h2 {
    margin: 0;
    font-size: 1.55rem;
}

.login-card-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .87rem;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    margin-top: 7px;
    color: #d5d5d5;
    font-size: .78rem;
    font-weight: 750;
}

.login-form input {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    color: #fff;
    background: rgba(24,24,24,.92);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 78px;
}

.password-field button {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    padding: 7px 8px;
    border: 0;
    background: transparent;
    color: #c9c9c9;
    font-size: .72rem;
    font-weight: 750;
    cursor: pointer;
}

.login-submit {
    height: 53px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding: 0 18px;
    border: 0;
    border-radius: 7px;
    background: var(--brand-primary, #e50914);
    color: #fff;
    font-size: .92rem;
    font-weight: 800;
    cursor: pointer;
    transition: .2s ease;
}

.login-submit:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.login-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 22px;
    text-align: center;
    color: rgba(255,255,255,.42);
    font-size: .72rem;
}

@media (max-width: 1120px) {
    .branding-layout {
        grid-template-columns: 1fr;
    }

    .live-preview-card {
        order: -1;
    }

    .login-stage {
        grid-template-columns: minmax(0, 1fr) 400px;
        gap: 44px;
    }
}

@media (max-width: 820px) {
    .admin-content {
        padding: 20px;
    }

    .form-row.two-columns,
    .form-row.three-columns,
    .upload-grid {
        grid-template-columns: 1fr;
    }

    .upload-box {
        min-height: 145px;
    }

    .login-header,
    .login-stage {
        width: min(100% - 36px, 560px);
    }

    .login-header {
        height: 84px;
        justify-content: center;
    }

    .login-header img {
        object-position: center;
    }

    .login-stage {
        min-height: calc(100dvh - 112px);
        display: block;
        padding: 28px 0 80px;
    }

    .login-copy {
        display: none;
    }

    .login-card {
        padding: 26px 22px;
    }

    .login-vignette {
        background: linear-gradient(0deg, rgba(0,0,0,.98), rgba(0,0,0,.72)), linear-gradient(90deg, rgba(0,0,0,.78), rgba(0,0,0,.62));
    }
}

/* Mobile first: navegação tocável, formulários sem zoom e conteúdo sem cortes. */
@media (max-width: 900px) {
    html {
        scroll-padding-top: 76px;
    }

    .admin-shell,
    .admin-main,
    .admin-content {
        min-width: 0;
    }

    .sidebar {
        width: min(86vw, 320px);
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }

    .topbar {
        min-height: 64px;
        padding-top: env(safe-area-inset-top);
    }

    .admin-content {
        padding: 16px 13px calc(28px + env(safe-area-inset-bottom));
    }

    .page-toolbar,
    .card,
    .stat-card {
        border-radius: 14px;
    }

    .page-toolbar,
    .card {
        padding: 18px;
    }

    .stats-grid,
    .content-grid,
    .branding-layout,
    .upload-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    input,
    select,
    textarea,
    button,
    .btn {
        min-height: 48px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table {
        min-width: 680px;
    }

    .modal-card {
        width: min(100% - 24px, 680px);
        max-height: calc(100dvh - 24px);
        margin: 12px;
    }

    .modal-actions,
    .branding-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        padding-bottom: env(safe-area-inset-bottom);
        background: linear-gradient(180deg, transparent, #151515 18%);
    }
}

@media (max-width: 700px) {
    .desktop-only {
        display: none !important;
    }

    .admin-content {
        padding: 16px 13px 28px;
    }

    .topbar {
        min-height: 68px;
        padding-left: 13px;
        padding-right: 13px;
    }

    .page-toolbar {
        border-radius: 12px;
    }

    .streaming-preview {
        min-height: 360px;
    }

    .preview-hero-copy {
        max-width: 82%;
        padding-top: 62px;
    }

    .preview-row i {
        height: 55px;
    }

    .asset-status-list > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .asset-status-list code {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 520px) {
    .admin-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .page-toolbar,
    .card,
    .stat-card {
        padding: 15px;
    }

    .page-toolbar,
    .card-head,
    .modal-actions,
    .branding-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .page-toolbar .btn,
    .modal-actions .btn,
    .branding-actions .btn,
    .branding-actions button {
        width: 100%;
        justify-content: center;
    }

    .upload-box {
        min-height: 156px;
    }

    .streaming-preview {
        min-height: 330px;
    }

    .preview-hero-copy {
        max-width: 94%;
        padding: 58px 15px 24px;
    }
}

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