:root {
    --primary: #7f005c;
    --secondary: #0F508C;
    --card-bg: #fbe9f6;
    --ink: #202124;
    --muted: #626a73;
    --line: #e2e7ee;
    --surface: #ffffff;
    --page: #f6f8fb;
    --success: #0b7a4b;
    --danger: #b3261e;
    --shadow: 0 14px 34px rgba(22, 28, 45, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--secondary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    display: block;
    max-width: 100%;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 12px clamp(16px, 4vw, 44px);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    color: var(--ink);
    font-weight: 700;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    background: var(--primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
}

.brand-logo {
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.brand-mark-large {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    font-size: 20px;
}

.login-brand-logo {
    width: auto;
    max-width: min(260px, 80vw);
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.18));
}

.brand-name {
    white-space: nowrap;
}

.brand-preview {
    margin-top: 22px;
    padding: 18px;
    background: #f9fbfd;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.brand-preview-bar {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.brand-preview-bar img {
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.nav-links a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.user-area {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    color: var(--muted);
    font-size: 14px;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 34px auto 56px;
}

.page-shell.narrow {
    width: min(560px, calc(100% - 32px));
}

.section-heading {
    display: flex;
    gap: 18px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 22px;
}

.section-heading h1,
.project-cover h1,
.player-heading h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 8px 18px rgba(127, 0, 92, 0.22);
}

.button-secondary {
    color: #fff;
    background: var(--secondary);
    box-shadow: 0 8px 18px rgba(15, 80, 140, 0.20);
}

.button-ghost {
    color: var(--secondary);
    background: #eef5fb;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.alert-success {
    color: var(--success);
    background: #e7f5ee;
}

.alert-error {
    color: var(--danger);
    background: #fcebea;
}

.login-page {
    min-height: 100vh;
    background: #fff;
}

.login-shell {
    width: 100%;
}

.login-hero {
    min-height: 46vh;
    display: flex;
    align-items: flex-end;
    padding: clamp(28px, 5vw, 64px);
    color: #fff;
    background-image:
        linear-gradient(90deg, rgba(20, 22, 32, 0.70), rgba(20, 22, 32, 0.14)),
        url("../img/login-header.png");
    background-position: center;
    background-size: cover;
}

.login-brand {
    display: flex;
    gap: 16px;
    align-items: center;
}

.login-brand h1 {
    margin: 0;
    font-size: clamp(36px, 7vw, 68px);
    line-height: 1;
}

.login-brand p {
    margin: 8px 0 0;
    font-size: clamp(16px, 2vw, 22px);
}

.login-panel {
    width: min(480px, calc(100% - 32px));
    margin: -48px auto 48px;
}

.form-card,
.permission-panel,
.empty-state {
    padding: clamp(20px, 3vw, 30px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-form {
    background: var(--card-bg);
}

.form-card h1,
.form-card h2,
.permission-panel h2,
.log-section h2,
.empty-state h2 {
    margin-top: 0;
}

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

.form-grid.three {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cfd7df;
    border-radius: 8px;
    font: inherit;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(15, 80, 140, 0.15);
    border-color: var(--secondary);
}

.full {
    grid-column: 1 / -1;
}

.check-row {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--ink);
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 22px;
}

.form-actions.inline {
    margin-top: 0;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

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

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

th {
    color: var(--muted);
    background: #f9fbfd;
    font-size: 13px;
    text-transform: uppercase;
}

td code {
    color: var(--primary);
    font-weight: 700;
}

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

.actions form {
    display: inline;
}

.actions button {
    padding: 0;
    color: var(--secondary);
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
}

.actions .danger-button {
    color: var(--danger);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}

.project-card {
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid #efcfe7;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.project-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.project-card-body {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.project-card h2 {
    margin: 0;
    font-size: 22px;
}

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

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chips span {
    padding: 5px 9px;
    color: var(--secondary);
    background: #e8f2fb;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.project-cover {
    overflow: hidden;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.project-cover-image {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
}

.project-cover-content {
    display: grid;
    gap: 18px;
    padding: clamp(24px, 4vw, 44px);
}

.project-cover-content p {
    max-width: 820px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
}

.player-heading {
    margin-bottom: 18px;
}

.storyline-frame {
    width: 100%;
    height: min(78vh, 820px);
    min-height: 560px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.permissions-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: 22px;
}

.permission-panel {
    box-shadow: none;
}

.permission-panel label + label {
    margin-top: 12px;
}

.log-section {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

.empty-state {
    background: var(--card-bg);
}

@media (max-width: 880px) {
    .topbar {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .nav-links,
    .user-area {
        justify-content: flex-start;
    }

    .form-grid,
    .form-grid.three,
    .permissions-layout {
        grid-template-columns: 1fr;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .storyline-frame {
        min-height: 420px;
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
        margin-top: 20px;
    }

    .login-hero {
        min-height: 42vh;
        padding: 24px 18px;
    }

    .login-brand {
        align-items: flex-start;
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .form-actions,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }
}
