:root {
    --bg: #f5f7f9;
    --panel: #ffffff;
    --text: #17212b;
    --muted: #647282;
    --line: #dce3ea;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --danger: #b42318;
    --warning: #a15c07;
    --shadow: 0 12px 30px rgba(20, 33, 45, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 Arial, Helvetica, sans-serif;
}

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

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

button.secondary,
.button.secondary {
    background: #e7eef2;
    color: var(--text);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 28px;
    align-items: center;
    min-height: 64px;
    padding: 0 28px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--text);
    font-size: 19px;
    font-weight: 800;
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--muted);
}

nav a.active {
    background: #e6f3f1;
    color: var(--accent-strong);
}

.account {
    display: flex;
    gap: 14px;
    align-items: center;
    color: var(--muted);
}

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

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    padding: 34px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 30px;
}

.login-card p {
    margin: 0 0 26px;
    color: var(--muted);
}

form.stack,
.login-card form {
    display: grid;
    gap: 12px;
}

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

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 78px;
    resize: vertical;
}

.check {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    align-items: center;
}

.check input {
    width: auto;
    min-height: auto;
}

.hero,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 30px;
}

.hero h1 {
    margin: 0;
    font-size: 34px;
}

.hero p {
    margin: 8px 0 0;
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 8px !important;
    color: var(--accent-strong) !important;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 12px;
}

.metric-grid,
.admin-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.metric-grid article {
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric-grid strong {
    display: block;
    font-size: 32px;
}

.metric-grid span,
.match-card p,
.panel-head p {
    color: var(--muted);
}

.panel {
    margin: 18px 0;
    padding: 22px;
}

.subpanel {
    box-shadow: none;
}

.panel h1,
.panel h2,
.panel h3 {
    margin-top: 0;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 3px 9px;
    background: #edf3f6;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.cards {
    display: grid;
    gap: 12px;
}

.match-card {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.match-card h2 {
    margin: 10px 0 4px;
}

.actions,
.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.compact-form {
    gap: 6px;
}

.compact-form input {
    min-width: 130px;
}

.player,
.preview {
    overflow: hidden;
    border-radius: 8px;
    background: #111820;
}

.player {
    aspect-ratio: 16 / 9;
}

.player-placeholder {
    display: grid;
    height: 100%;
    min-height: 280px;
    place-content: center;
    gap: 10px;
    padding: 18px;
    color: #e7eef2;
    text-align: center;
}

.player-placeholder strong {
    font-size: 24px;
}

.player-placeholder span {
    max-width: 100%;
    color: #9eb0bf;
    overflow-wrap: anywhere;
}

.player-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 420px;
    border: 0;
    background: #111820;
}

.stream-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
}

.hidden {
    display: none !important;
}

.director-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 18px;
}

.control-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

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

.mode-grid button.active {
    background: var(--accent-strong);
    outline: 3px solid #b9ddd8;
}

.camera-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 10px 0;
}

pre {
    overflow: auto;
    white-space: pre-wrap;
    border-radius: 6px;
    padding: 14px;
    background: #101820;
    color: #e7eef2;
}

.flash {
    margin-bottom: 16px;
    border-radius: 6px;
    padding: 12px 14px;
    background: #e6f3f1;
    color: var(--accent-strong);
    font-weight: 700;
}

.flash.error {
    background: #fff0ed;
    color: var(--danger);
}

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

@media (max-width: 880px) {
    .topbar,
    .hero,
    .match-card,
    .panel-head {
        display: grid;
        grid-template-columns: 1fr;
    }

    nav,
    .account,
    .actions,
    .inline-form {
        flex-wrap: wrap;
    }

    .metric-grid,
    .admin-grid,
    .director-grid,
    .table-grid {
        grid-template-columns: 1fr;
    }
}
