:root {
    --bg: #050710;
    --bg-elevated: #0b0f1e;
    --bg-card: #12162a;
    --accent: #9146FF; /* Twitch lilla – som index2.php */
    --accent-soft: rgba(145, 70, 255, 0.10);
    --accent-soft-2: rgba(145, 70, 255, 0.18);
    --text-main: #f5f5f7;
    --text-muted: #9ca3af;
    --success: #22c55e;
    --warning: #facc15;
    --danger: #f97373;
    --border-subtle: rgba(148, 163, 184, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #111827 0, #020617 40%, #000 100%);
    color: var(--text-main);
}

/* Shell & layout */

.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.page {
    flex: 1;
    width: 100%;
    margin: 0;
    padding: 18px 0 26px 0;
}

/* Topbar / brand */

.topbar {
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
}

.topbar-inner {
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.brand-logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: radial-gradient(circle at 30% 0, #a855f7 0, #4c1d95 55%, #020617 100%);
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.9),
        0 12px 30px rgba(88, 28, 135, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #f9fafb;
}

.brand-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Topbar links */

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

.pill-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.92);
    font-size: 12px;
}

.pill-meta-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.pill-meta-value {
    font-variant-numeric: tabular-nums;
}

.top-link {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.92);
    color: var(--text-main);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.top-link:hover {
    border-color: rgba(145, 70, 255, 0.9);
    color: #f5f5f7;
}

.top-link-active {
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.98);
}

/* Headline / over-skrift */

.headline-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.headline-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.headline-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.headline-main {
    font-size: 22px;
    font-weight: 600;
}

.headline-main span {
    color: var(--accent);
}

.headline-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Cards / generelt indhold */

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

.card {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background:
        radial-gradient(circle at top right, rgba(99,102,241,0.16), transparent 60%),
        radial-gradient(circle at bottom left, rgba(168,85,247,0.21), transparent 55%),
        rgba(15, 23, 42, 0.97);
    box-shadow:
        0 18px 55px rgba(15, 23, 42, 0.92),
        0 0 0 1px rgba(15, 23, 42, 0.86);
    padding: 14px 14px 12px 14px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}

.label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 1px;
}

.value {
    font-size: 13px;
    font-weight: 500;
}

.value + .value {
    margin-top: 2px;
}

/* Rolle-tag */

.tag-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.92);
    font-size: 11px;
}

.tag-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--accent);
}

/* Links inde i kort */

.link-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
}

.link-list a {
    font-size: 13px;
    color: var(--text-main);
    text-decoration: none;
}

.link-list a span {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 6px;
}

.link-list a:hover {
    text-decoration: underline;
}

/* Footer */

.footer-inner {
    padding: 12px 0 16px 0;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.9);
}

.footer-inner a {
    color: var(--accent);
    text-decoration: none;
}

.footer-inner a:hover {
    text-decoration: underline;
}

/* SETTINGS / SYSTEM-SIDE */

.settings-wrapper {
    max-width: 720px;
    margin: 24px auto 0;
}

.settings-card {
    border-radius: 18px;
    padding: 20px 22px;
    background:
        radial-gradient(circle at top right, rgba(99,102,241,0.18), transparent 55%),
        radial-gradient(circle at bottom left, rgba(168,85,247,0.2), transparent 55%),
        rgba(15,23,42,0.98);
    border: 1px solid rgba(129, 140, 248, 0.7);
    box-shadow: 0 18px 45px rgba(15,23,42,0.9);
}

.settings-card h1 {
    font-size: 20px;
    margin: 0 0 6px;
}

.settings-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-muted);
}

.form-group select,
.form-group input,
.form-group textarea {
    font-size: 13px;
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid rgba(148,163,184,0.7);
    background: #020617;
    color: #e5e7eb;
}

.form-group textarea {
    min-height: 80px;
}

.notice {
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 10px;
    border: 1px solid rgba(145,70,255,0.85);
    color: #e0f2fe;
    background: rgba(30, 64, 175, 0.8);
}

.notice.error {
    border-color: rgba(248,113,113,0.9);
    color: #fee2e2;
    background: rgba(88,28,28,0.8);
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(148,163,184,0.7);
    background: #020617;
}

.mode-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--accent);
}

/* Users / tabeller */

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.users-table th,
.users-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(148,163,184,0.2);
    font-size: 13px;
}

.users-table th {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.search-box {
    margin-top: 8px;
}

.search-box input {
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148,163,184,0.7);
    background: #020617;
    color: #e5e7eb;
    font-size: 13px;
}

/* Fælles table-stil (kan bruges på nye sider) */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 4px;
}

.table thead {
    background: rgba(15, 23, 42, 0.98);
}

.table th,
.table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

.table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.table tr:hover td {
    background: rgba(15, 23, 42, 0.9);
}

/* Channels / keys */

.keys-section {
    margin-top: 12px;
}

.keys-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

@media (max-width: 900px) {
    .keys-grid-compact {
        grid-template-columns: minmax(0, 1fr);
    }
}

.key-card {
    border-radius: 16px;
    padding: 10px 12px;
    background:
        radial-gradient(circle at top right, rgba(99,102,241,0.16), transparent 60%),
        radial-gradient(circle at bottom left, rgba(168,85,247,0.21), transparent 55%),
        rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(129, 140, 248, 0.8);
    box-shadow: 0 18px 45px rgba(15,23,42,0.9);
}

.key-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.key-title {
    font-size: 14px;
    font-weight: 600;
    word-break: break-word;
}

.key-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.key-delete-btn {
    border-radius: 999px;
    border: 1px solid rgba(248,113,113,0.8);
    background: rgba(127,29,29,0.9);
    color: #fee2e2;
    font-size: 11px;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
}

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

@media (max-width: 720px) {
    .proto-cols {
        grid-template-columns: minmax(0, 1fr);
    }
}

.proto-box {
    border-radius: 10px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.98);
    padding: 6px 7px;
    font-size: 11px;
}

.proto-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.line-label {
    font-size: 11px;
    color: var(--text-muted);
}

.line-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.line-value {
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    word-break: break-all;
    flex: 1;
}

.copy-btn {
    border: none;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 10px;
    cursor: pointer;
    background: rgba(15,23,42,0.95);
    color: #e5e7eb;
    border: 1px solid rgba(148,163,184,0.6);
    white-space: nowrap;
}

.copy-btn:hover {
    border-color: var(--accent);
}

.small-muted {
    font-size: 11px;
    color: var(--text-muted);
}

/* Badges, key actions */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background: rgba(15, 23, 42, 0.96);
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--accent);
}

.badge-muted {
    color: var(--text-muted);
}

.key-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.key-btn {
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background: rgba(15, 23, 42, 0.96);
    color: var(--text-main);
    cursor: pointer;
    text-decoration: none;
}

.key-btn:hover {
    border-color: var(--accent);
}

/* Primær knap – samme stil som index2.php */

.btn-primary {
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: #020617;
    font-weight: 500;
    box-shadow: 0 14px 35px rgba(79, 70, 229, 0.66);
}

.btn-primary:hover {
    filter: brightness(1.05);
}

/* RESPONSIVE */

@media (max-width: 720px) {
    .container {
        padding-inline: 16px;
    }

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

    .headline-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-inner {
        flex-direction: column;
    }

    .top-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
