body[data-page="dashboard"] {
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(232, 238, 247, 0.98)),
        var(--bg-main);
}

body[data-page="dashboard"].dark {
    background:
        linear-gradient(180deg, rgba(8, 13, 24, 0.98), rgba(4, 8, 14, 1)),
        var(--bg-main);
}

.dashboard-app {
    width: min(calc(100% - 28px), 1440px);
    display: grid;
    grid-template-columns: 282px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding-top: 24px;
}

.dashboard-sidebar,
.dashboard-topbar,
.dashboard-section,
.dashboard-savebar {
    border: 1px solid rgba(100, 116, 139, 0.18);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
}

body.dark .dashboard-sidebar,
body.dark .dashboard-topbar,
body.dark .dashboard-section,
body.dark .dashboard-savebar {
    background: rgba(12, 18, 31, 0.86);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.26);
}

.dashboard-sidebar {
    position: sticky;
    top: 108px;
    display: grid;
    gap: 16px;
    padding: 16px;
    border-radius: 8px;
}

.dashboard-sidebar-head {
    display: grid;
    gap: 8px;
}

.dashboard-sidebar h1,
.dashboard-topbar h2,
.dashboard-section h3,
.dashboard-section h4,
.setting-block h4,
.setting-block h5 {
    letter-spacing: 0;
}

.dashboard-sidebar h1 {
    margin: 0;
    font-size: 1.9rem;
    line-height: 1;
}

.dashboard-sidebar p,
.dashboard-topbar p,
.setting-block p,
.info-strip span,
.dashboard-savebar span,
.dashboard-field small {
    color: #64748b;
}

body.dark .dashboard-sidebar p,
body.dark .dashboard-topbar p,
body.dark .setting-block p,
body.dark .info-strip span,
body.dark .dashboard-savebar span,
body.dark .dashboard-field small {
    color: #a7b4c8;
}

.dashboard-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 100%;
    color: #3152b7;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.dark .dashboard-kicker {
    color: #9db7ff;
}

.dashboard-status {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-height: 46px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 0.92rem;
    font-weight: 700;
}

.dashboard-status.ok {
    border-color: rgba(22, 163, 74, 0.22);
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
}

.dashboard-status.error {
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

body.dark .dashboard-status {
    color: #bfdbfe;
}

body.dark .dashboard-status.ok {
    color: #bbf7d0;
}

body.dark .dashboard-status.error {
    color: #fecaca;
}

.dashboard-auth-actions,
.dashboard-top-actions,
.inline-actions,
.section-title-actions,
.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.dashboard-auth-actions a,
.dashboard-top-actions a,
.dashboard-top-actions button,
.inline-actions button,
.section-title-actions button,
.dashboard-actions button,
.dashboard-actions a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: #2563eb;
    color: #ffffff;
    text-decoration: none;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.dashboard-top-actions button.secondary,
.inline-actions button.secondary,
.section-title-actions button.secondary,
.dashboard-actions a.secondary,
.dashboard-actions button.secondary {
    background: rgba(100, 116, 139, 0.14);
    color: #0f172a;
    box-shadow: none;
}

body.dark .dashboard-top-actions button.secondary,
body.dark .inline-actions button.secondary,
body.dark .section-title-actions button.secondary,
body.dark .dashboard-actions a.secondary,
body.dark .dashboard-actions button.secondary {
    color: #e5e7eb;
}

.dashboard-auth-actions a {
    width: 100%;
}

.dashboard-menu {
    display: grid;
    gap: 6px;
}

.dashboard-menu a {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 44px;
    padding: 10px;
    border-radius: 8px;
    color: #334155;
    text-decoration: none;
    font-weight: 800;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.dashboard-menu a:hover,
.dashboard-menu a:focus-visible,
.dashboard-menu a.active {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    outline: none;
}

.dashboard-menu a:hover,
.dashboard-menu a:focus-visible {
    transform: translateX(3px);
}

body.dark .dashboard-menu a {
    color: #dbe5f2;
}

body.dark .dashboard-menu a:hover,
body.dark .dashboard-menu a:focus-visible,
body.dark .dashboard-menu a.active {
    background: rgba(96, 165, 250, 0.14);
    color: #bfdbfe;
}

.dashboard-menu small {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
}

.dashboard-main {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 20px;
    border-radius: 8px;
}

.dashboard-topbar h2 {
    margin: 6px 0 8px;
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    line-height: 1;
}

.dashboard-topbar p {
    max-width: 72ch;
}

.dashboard-form {
    display: grid;
    gap: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.dashboard-section {
    display: grid;
    gap: 18px;
    padding: 20px;
    border-radius: 8px;
    scroll-margin-top: 120px;
}

.dashboard-section[hidden] {
    display: none;
}

.dashboard-section.is-active {
    animation: dashboard-section-in 0.28s ease both;
}

@keyframes dashboard-section-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.section-title-row h3,
.section-title-row h4 {
    margin: 4px 0 0;
}

.section-title-row h3 {
    font-size: 1.35rem;
}

.section-title-row h4 {
    font-size: 1.05rem;
}

.section-title-row-small {
    align-items: start;
}

.section-pill,
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-chip.active {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.status-chip.inactive {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.status-chip.warning {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

body.dark .section-pill,
body.dark .status-chip.inactive {
    color: #cbd5e1;
}

body.dark .status-chip.active {
    color: #bbf7d0;
}

body.dark .status-chip.warning {
    color: #fde68a;
}

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

.status-tile {
    display: grid;
    gap: 10px;
    min-height: 136px;
    padding: 14px;
    border: 1px solid rgba(100, 116, 139, 0.16);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.8);
}

body.dark .status-tile {
    background: rgba(15, 23, 42, 0.56);
    border-color: rgba(148, 163, 184, 0.14);
}

.status-tile-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.status-tile h4 {
    margin: 0;
    font-size: 0.95rem;
}

.status-tile p {
    margin: 0;
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

body.dark .status-tile p {
    color: #a7b4c8;
}

.channel-overview {
    display: grid;
    gap: 12px;
}

.channel-matrix {
    display: grid;
    border: 1px solid rgba(100, 116, 139, 0.16);
    border-radius: 8px;
    overflow: hidden;
}

.matrix-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(90px, 0.3fr) minmax(0, 1.4fr);
    gap: 12px;
    align-items: center;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.55);
    border-bottom: 1px solid rgba(100, 116, 139, 0.12);
}

.matrix-row:last-child {
    border-bottom: 0;
}

.matrix-row strong,
.matrix-row span {
    min-width: 0;
}

.matrix-row .channel-value {
    color: #475569;
    overflow-wrap: anywhere;
}

body.dark .matrix-row {
    background: rgba(15, 23, 42, 0.42);
}

body.dark .matrix-row .channel-value {
    color: #cbd5e1;
}

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

.setting-block {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(100, 116, 139, 0.18);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.72);
}

.setting-block-wide {
    grid-column: 1 / -1;
}

body.dark .setting-block {
    background: rgba(15, 23, 42, 0.48);
    border-color: rgba(148, 163, 184, 0.16);
}

.setting-block-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.setting-block-head-compact {
    align-items: center;
}

.setting-block h4,
.setting-block h5 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 1rem;
}

.setting-block h5 {
    font-size: 0.95rem;
}

.setting-block p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.9rem;
}

.setting-block.is-disabled {
    opacity: 0.72;
}

.field-grid {
    display: grid;
    gap: 12px;
}

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

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

.dashboard-field {
    display: grid;
    gap: 7px;
    min-width: 0;
    font-weight: 800;
}

.dashboard-field-compact {
    gap: 6px;
}

.dashboard-field span {
    color: #334155;
    font-size: 0.88rem;
}

body.dark .dashboard-field span {
    color: #e2e8f0;
}

.dashboard-field input,
.dashboard-field textarea,
.dashboard-field select,
.repeater-input,
.repeater-select {
    width: 100%;
    min-height: 44px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(100, 116, 139, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: #0f172a;
    font: inherit;
    font-weight: 650;
}

.dashboard-field textarea,
.repeater-textarea {
    min-height: 96px;
    resize: vertical;
}

.repeater-textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(100, 116, 139, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: #0f172a;
    font: inherit;
    font-weight: 650;
    resize: vertical;
}

.dashboard-field input:focus,
.dashboard-field textarea:focus,
.dashboard-field select:focus,
.repeater-input:focus,
.repeater-select:focus,
.repeater-textarea:focus {
    border-color: rgba(37, 99, 235, 0.72);
    outline: 3px solid rgba(37, 99, 235, 0.14);
}

.dashboard-field input:disabled,
.dashboard-field textarea:disabled,
.dashboard-field select:disabled,
.repeater-input:disabled,
.repeater-select:disabled,
.repeater-textarea:disabled {
    cursor: not-allowed;
    opacity: 0.64;
}

body.dark .dashboard-field input,
body.dark .dashboard-field textarea,
body.dark .dashboard-field select,
body.dark .repeater-input,
body.dark .repeater-select,
body.dark .repeater-textarea {
    background: rgba(2, 6, 23, 0.52);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.24);
}

.info-strip {
    display: grid;
    gap: 6px;
    align-content: center;
    padding: 14px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.16);
}

.info-strip strong {
    color: #1d4ed8;
}

body.dark .info-strip strong {
    color: #bfdbfe;
}

.switch-control {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    cursor: pointer;
    color: #475569;
    font-weight: 800;
    user-select: none;
}

.switch-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-control input + span,
.switch-control.labeled input + span {
    width: 48px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    background: #94a3b8;
    transition: background 0.18s ease;
}

.switch-control input + span::before,
.switch-control.labeled input + span::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
    transition: transform 0.18s ease;
}

.switch-control input:checked + span,
.switch-control.labeled input:checked + span {
    background: #16a34a;
}

.switch-control input:checked + span::before,
.switch-control.labeled input:checked + span::before {
    transform: translateX(20px);
}

.switch-control input:focus-visible + span {
    outline: 3px solid rgba(37, 99, 235, 0.22);
}

.nested-controls {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px dashed rgba(100, 116, 139, 0.26);
    border-radius: 8px;
}

.custom-linked-role-area {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(100, 116, 139, 0.18);
}

.custom-linked-role-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.custom-linked-role-head h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
}

.custom-linked-role-head p {
    max-width: 780px;
    margin: 0;
    line-height: 1.5;
}

.linked-custom-role-card {
    gap: 14px;
    padding: 14px;
}

.linked-custom-role-members {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px dashed rgba(100, 116, 139, 0.24);
    border-radius: 8px;
}

.linked-custom-role-members > strong {
    color: #334155;
}

body.dark .linked-custom-role-members > strong {
    color: #e2e8f0;
}

.repeater-list {
    display: grid;
    gap: 10px;
}

.repeater-list:empty::before {
    content: "Noch keine Eintr\00e4ge.";
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border: 1px dashed rgba(100, 116, 139, 0.28);
    border-radius: 8px;
    color: #64748b;
    font-weight: 800;
}

.repeater-row {
    display: grid;
    gap: 10px;
    align-items: start;
    padding: 12px;
    border: 1px solid rgba(100, 116, 139, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.62);
}

.repeater-row-twitch {
    grid-template-columns: minmax(140px, 0.9fr) minmax(180px, 1fr) minmax(150px, 0.8fr) minmax(200px, 1.2fr) 44px;
}

.repeater-row-voice {
    grid-template-columns: minmax(0, 1fr) 44px;
}

.repeater-row-move {
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 44px;
}

.repeater-row-birthday {
    grid-template-columns: minmax(190px, 1fr) minmax(150px, 0.55fr) 44px;
}

.repeater-row-linked-member {
    grid-template-columns: minmax(190px, 1fr) 44px;
}

body.dark .repeater-row {
    background: rgba(15, 23, 42, 0.48);
}

.repeater-remove {
    width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
    cursor: pointer;
}

body.dark .repeater-remove {
    color: #fecaca;
}

.dashboard-savebar {
    position: sticky;
    bottom: 14px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border-radius: 8px;
}

.dashboard-savebar > div:first-child {
    display: grid;
    gap: 3px;
}

.dashboard-actions button:disabled,
.section-title-actions button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.hidden {
    display: none !important;
}

@media (max-width: 1180px) {
    .dashboard-app {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: static;
    }

    .dashboard-menu {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-menu a {
        grid-template-columns: 20px minmax(0, 1fr);
    }

    .dashboard-menu small {
        grid-column: 2;
    }

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

    .repeater-row-twitch {
        grid-template-columns: repeat(2, minmax(0, 1fr)) 44px;
    }

    .repeater-row-twitch .repeater-textarea {
        grid-column: 1 / 3;
    }
}

@media (max-width: 860px) {
    .dashboard-topbar,
    .dashboard-savebar,
    .section-title-row,
    .custom-linked-role-head,
    .setting-block-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-top-actions,
    .dashboard-actions,
    .inline-actions {
        align-items: stretch;
    }

    .dashboard-top-actions a,
    .dashboard-top-actions button,
    .dashboard-actions button,
    .dashboard-actions a,
    .inline-actions button {
        width: 100%;
    }

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

    .field-grid-two,
    .field-grid-three,
    .settings-stack,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .matrix-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

@media (max-width: 620px) {
    .dashboard-app {
        width: min(calc(100% - 16px), 1440px);
        padding-top: 16px;
    }

    .dashboard-sidebar,
    .dashboard-topbar,
    .dashboard-section,
    .dashboard-savebar {
        padding: 14px;
    }

    .dashboard-menu {
        grid-template-columns: 1fr;
    }

    .repeater-row,
    .repeater-row-twitch,
    .repeater-row-voice,
    .repeater-row-move,
    .repeater-row-birthday,
    .repeater-row-linked-member {
        grid-template-columns: 1fr;
    }

    .repeater-row-twitch .repeater-textarea {
        grid-column: auto;
    }

    .repeater-remove {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-menu a,
    .dashboard-section.is-active {
        animation: none;
        transition: none;
    }
}
