:root {
    --header-height: 52px;
    --sidebar-width: 248px;
    --sidebar-collapsed-width: 56px;
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    min-width: 280px;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-color: var(--background);
    background-image: url('/assets/images/background.png');
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

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

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 12px;
    z-index: 100;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--navigation);
    color: var(--text);
}

.skip-link:focus {
    top: 8px;
}

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 30;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-inline: 20px;
    background: var(--navigation);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    width: clamp(110px, 24vw, 190px);
    height: 100%;
    min-width: 0;
}

.brand-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 40px;
    object-fit: contain;
}

.topbar-title {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar {
    position: fixed;
    inset: var(--header-height) auto 0 0;
    z-index: 20;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--navigation);
    border-right: 1px solid var(--border);
    transition: width 180ms ease;
}

.sidebar-toolbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 6px 10px 18px;
}

.sidebar-title {
    min-width: 0;
    margin-right: auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-toggle {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: var(--hover);
}

.icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 6px 16px;
    overscroll-behavior: contain;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 11px;
    border-radius: 8px;
    color: var(--text);
}

.nav-link + .nav-link {
    margin-top: 2px;
}

.nav-link[aria-current="page"] {
    background: var(--hover);
    color: var(--accent);
}

.nav-link:hover {
    background: var(--hover);
}

.nav-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.main {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    left: var(--sidebar-width);
    min-width: 0;
    padding: 56px 72px 40px 60px;
    overflow: hidden;
    transition: left 180ms ease, padding-left 180ms ease;
}

.page-content {
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-wrap: anywhere;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 8px;
}

.page-title {
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 650;
    line-height: 1.3;
}

.panel {
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid var(--border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(2px);
}

.panel + .panel {
    margin-top: 18px;
}

.panel h2,
.panel h3 {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 650;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.dashboard-card {
    min-width: 0;
    min-height: 142px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: var(--hover);
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-card-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.dashboard-card-text {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--background);
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
}

.module-placeholder {
    min-height: 260px;
    display: grid;
    align-content: center;
    justify-items: start;
}

.module-placeholder .icon {
    width: 34px;
    height: 34px;
    margin-bottom: 14px;
    color: var(--accent);
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main {
    left: var(--sidebar-collapsed-width);
    padding-left: 36px;
}

body.sidebar-collapsed .sidebar-toolbar {
    justify-content: center;
    padding-inline: 5px;
}

body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .nav-label {
    display: none;
}

body.sidebar-collapsed .toggle-icon {
    transform: rotate(180deg);
}

@media (max-width: 900px) {
    .main {
        padding-right: 34px;
        padding-left: 34px;
    }
}

@media (max-width: 700px) {
    :root {
        --sidebar-width: clamp(156px, 42vw, 220px);
    }

    .topbar {
        padding-inline: 14px;
    }

    .topbar-title {
        display: none;
    }

    .sidebar {
        box-shadow: 8px 0 20px rgb(0 0 0 / 16%);
    }

    .main {
        left: var(--sidebar-collapsed-width);
        padding: 20px 20px 24px 12px;
    }

    body.sidebar-collapsed .main {
        padding-left: 12px;
    }

    body.sidebar-collapsed .sidebar {
        box-shadow: none;
    }

    .sidebar-toolbar {
        padding-left: 10px;
    }

    .panel {
        padding: 14px;
    }

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

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .main,
    .dashboard-card {
        transition: none;
    }
}

/* Discord-Accountschutz */
.topbar-account {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.topbar-username {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 650;
}

.topbar-logout,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 650;
}

.topbar-logout:hover,
.secondary-button:hover {
    background: var(--hover);
    border-color: var(--accent);
}

.auth-shell {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow-y: auto;
}

.auth-card {
    width: min(100%, 480px);
    padding: clamp(24px, 5vw, 42px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(4px);
    box-shadow: 0 20px 55px rgb(0 0 0 / 28%);
    text-align: center;
}

.auth-logo {
    display: block;
    max-width: min(230px, 78%);
    max-height: 84px;
    width: auto;
    height: auto;
    margin: 0 auto 24px;
    object-fit: contain;
}

.auth-card h1 {
    margin: 0 0 12px;
    font-size: clamp(25px, 5vw, 34px);
    line-height: 1.2;
}

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

.discord-login-button {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 26px;
    padding: 10px 16px;
    border-radius: 9px;
    background: #5865f2;
    color: #fff;
    font-weight: 750;
    transition: filter 140ms ease, transform 140ms ease;
}

.discord-login-button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.discord-login-button svg {
    width: 23px;
    height: 23px;
}

.auth-error {
    margin-top: 18px;
    padding: 10px 12px;
    border: 1px solid #6f3941;
    border-radius: 8px;
    background: #3a2026;
    color: #ffd7dc;
    text-align: left;
    font-size: 14px;
}

.auth-status-code {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.auth-card .secondary-button {
    margin-top: 24px;
}

@media (max-width: 700px) {
    .topbar-username {
        display: none;
    }

    .topbar-account {
        gap: 7px;
    }

    .topbar-logout {
        padding-inline: 9px;
        font-size: 13px;
    }
}

/* Server- und Nachrichtenmodule */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.page-heading-row > div:first-child {
    min-width: 0;
}

.page-title-inline {
    margin-bottom: 4px;
    padding-bottom: 0;
    border-bottom: 0;
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.primary-button,
.secondary-button,
.icon-button {
    appearance: none;
    border: 0;
    font: inherit;
    cursor: pointer;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 15px;
    border: 1px solid color-mix(in srgb, var(--accent) 70%, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 20%, var(--surface));
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.primary-button:hover {
    background: color-mix(in srgb, var(--accent) 30%, var(--surface));
    border-color: var(--accent);
    transform: translateY(-1px);
}

.small-button {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 13px;
}

.disabled-button {
    opacity: .55;
    pointer-events: none;
}

.compact-panel {
    padding: 16px 18px;
}

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

.runtime-item {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.runtime-label,
.eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.runtime-value {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.status-dot-online {
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 14%, transparent);
}

.status-dot-offline {
    background: #dc6c78;
}

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

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

.section-heading h2,
.section-heading h3,
.section-heading h4,
.module-master-row h2,
.small-section-heading h4 {
    margin: 0 0 3px;
}

.section-heading p,
.module-master-row p,
.small-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.small-section-heading {
    margin: 2px 0 10px;
}

.server-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.server-card {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
}

.server-card-inactive {
    opacity: .72;
}

.server-card-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}

.server-icon {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--surface);
}

.server-icon-fallback {
    display: grid;
    place-items: center;
    color: var(--text);
    font-weight: 800;
    font-size: 20px;
}

.server-card-copy {
    min-width: 0;
}

.server-card-title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.server-card-title-row h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.mini-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.mini-status-online,
.status-active {
    border-color: color-mix(in srgb, var(--success) 45%, var(--border));
    color: var(--success);
}

.mini-status-offline,
.status-error,
.status-pending_delete {
    border-color: #6f3941;
    color: #f3a8b1;
}

.status-pending,
.status-pending_update {
    border-color: color-mix(in srgb, var(--warning) 50%, var(--border));
    color: var(--warning);
}

.empty-state {
    min-height: 230px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 28px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--background) 72%, transparent);
}

.empty-state .icon {
    width: 38px;
    height: 38px;
    color: var(--accent);
}

.empty-state h2,
.empty-state h3,
.empty-state p {
    margin: 0;
}

.empty-state p {
    max-width: 610px;
    color: var(--muted);
}

.compact-empty-state {
    min-height: 150px;
}

.server-select-form select,
.form-field input[type="text"],
.form-field input[type="url"],
.form-field input[type="number"],
.form-field select,
.form-field textarea,
.embed-field-row input[type="text"],
.embed-field-row textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text);
    font: inherit;
}

.server-select-form select,
.form-field input[type="text"],
.form-field input[type="url"],
.form-field input[type="number"],
.form-field select,
.embed-field-row input[type="text"] {
    min-height: 42px;
    padding: 8px 10px;
}

.form-field textarea,
.embed-field-row textarea {
    display: block;
    padding: 10px;
    resize: vertical;
}

.server-select-form select {
    min-width: min(310px, 36vw);
    padding: 8px 34px 8px 10px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.server-select-form select:focus,
.embed-field-row input:focus,
.embed-field-row textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.selected-server-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.selected-server-bar strong {
    display: block;
    font-size: 17px;
}

.module-tabs {
    display: flex;
    gap: 4px;
    margin: 18px 0;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--navigation) 94%, transparent);
    overflow-x: auto;
}

.module-tab {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 13px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.module-tab:hover,
.module-tab.is-active {
    background: var(--hover);
    color: var(--text);
}

.module-tab.is-active {
    color: var(--accent);
}

.notice {
    margin-bottom: 16px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 13px;
}

.notice-success {
    border-color: color-mix(in srgb, var(--success) 45%, var(--border));
    color: var(--success);
}

.stacked-form {
    display: grid;
    gap: 18px;
}

.stacked-form.panel {
    display: grid;
}

.message-event-card {
    overflow: visible;
}

.message-basic-grid {
    margin-top: 20px;
}

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

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

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

.form-field {
    min-width: 0;
    display: grid;
    gap: 6px;
    margin-top: 14px;
}

.form-grid .form-field {
    margin-top: 0;
}

.form-field > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.form-checkbox-field {
    align-content: center;
    grid-template-columns: auto 1fr;
    align-items: center;
}

.form-checkbox-field input,
.inline-checkbox input {
    accent-color: var(--accent);
}

.switch-control {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

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

.switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--background);
    transition: background 140ms ease, border-color 140ms ease;
}

.switch-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 140ms ease, background 140ms ease;
}

.switch-control input:checked + .switch-slider {
    background: color-mix(in srgb, var(--accent) 24%, var(--surface));
    border-color: var(--accent);
}

.switch-control input:checked + .switch-slider::after {
    transform: translateX(20px);
    background: var(--accent);
}

.switch-control input:focus-visible + .switch-slider {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.switch-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.embed-editor {
    display: grid;
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.embed-fields {
    display: grid;
    gap: 10px;
}

.embed-field-row {
    display: grid;
    grid-template-columns: minmax(150px, .7fr) minmax(240px, 1.3fr) auto 38px;
    align-items: center;
    gap: 8px;
}

.embed-field-row textarea {
    min-height: 42px;
}

.inline-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.icon-button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
}

.danger-button:hover,
.danger-outline-button:hover {
    border-color: #a44c59;
    background: #3a2026;
    color: #ffd7dc;
}

.color-input-wrap {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 8px;
}

.color-input-wrap input[type="color"] {
    width: 48px;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    cursor: pointer;
}

.placeholders-panel h3 {
    margin-bottom: 10px;
}

.placeholder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.placeholder-list code {
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--accent);
    font-size: 12px;
}

.sticky-form-actions,
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.sticky-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 10px 0 2px;
    background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--background) 96%, transparent) 25%);
}

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

.embed-message-row {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.embed-message-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
    color: var(--muted);
    font-size: 12px;
}

.embed-message-title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.embed-message-title-row strong {
    color: var(--text);
    font-size: 14px;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.row-actions form {
    margin: 0;
}

.error-text {
    color: #f3a8b1;
}

.embed-editor-panel {
    scroll-margin-top: 20px;
}

[hidden] {
    display: none !important;
}

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

    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .embed-field-row {
        grid-template-columns: 1fr 1fr;
    }

    .embed-field-row .inline-checkbox,
    .embed-field-row .icon-button {
        justify-self: start;
    }
}

@media (max-width: 700px) {
    .page-heading-row,
    .section-heading,
    .module-master-row,
    .server-card,
    .embed-message-row {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading-row .primary-button,
    .section-heading .primary-button,
    .server-card-actions .primary-button,
    .server-card-actions .secondary-button {
        width: 100%;
    }

    .server-select-form,
    .server-select-form select {
        width: 100%;
        min-width: 0;
    }

    .server-runtime-grid,
    .form-grid-2,
    .form-grid-3,
    .server-card-grid,
    .embed-field-row {
        grid-template-columns: 1fr;
    }

    .server-card-main {
        align-items: flex-start;
    }

    .row-actions,
    .form-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .row-actions > *,
    .row-actions form,
    .form-actions > * {
        flex: 1 1 auto;
    }

    .row-actions button,
    .row-actions a,
    .form-actions button,
    .form-actions a {
        width: 100%;
    }
}

/* Befehle */
.command-card {
    display: grid;
    gap: 18px;
}

.command-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.command-title-group {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.command-title-group h2 {
    margin: 0 0 4px;
}

.command-title-group p {
    margin: 0;
    color: var(--muted);
}

.command-name {
    flex: 0 0 auto;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 12%, var(--background));
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
}

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

.command-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.command-option code {
    padding: 4px 7px;
    border-radius: 6px;
    background: var(--surface);
    color: var(--accent);
    font-weight: 800;
}

.command-option div {
    display: grid;
    gap: 2px;
}

.command-option strong {
    font-size: 13px;
}

.command-option span {
    color: var(--muted);
    font-size: 12px;
}

.command-permission-form {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.command-role-list {
    display: grid;
    gap: 8px;
}

.command-role-row {
    display: grid;
    grid-template-columns: 20px 12px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    cursor: pointer;
}

.command-role-row:hover {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    background: color-mix(in srgb, var(--surface) 72%, var(--background));
}

.command-role-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.command-role-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--role-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--role-color) 25%, transparent);
}

.command-role-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.command-role-id {
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 700px) {
    .command-card-header,
    .command-title-group {
        align-items: stretch;
        flex-direction: column;
    }

    .command-option-grid {
        grid-template-columns: 1fr;
    }

    .command-role-row {
        grid-template-columns: 20px 12px minmax(0, 1fr);
    }

    .command-role-id {
        grid-column: 3;
    }
}

/* Backups */
.backup-layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, .7fr);
    gap: 14px;
}

.backup-create-panel,
.backup-summary-panel {
    min-width: 0;
}

.backup-summary-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
}

.backup-summary-number {
    margin-top: 3px;
    color: var(--text);
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1;
}

.backup-summary-panel > span:not(.eyebrow) {
    color: var(--muted);
}

.backup-summary-latest {
    width: 100%;
    display: grid;
    gap: 3px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.backup-summary-latest small,
.backup-summary-latest span {
    color: var(--muted);
    font-size: 12px;
}

.backup-active-job {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.backup-active-icon {
    width: 28px;
    height: 28px;
    border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: backup-spin .8s linear infinite;
}

@keyframes backup-spin {
    to { transform: rotate(360deg); }
}

.backup-active-copy {
    min-width: 0;
}

.backup-active-copy h2 {
    margin: 2px 0 3px;
    font-size: 18px;
}

.backup-active-copy p {
    margin: 0;
    color: var(--muted);
}

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

.backup-scope-list span {
    position: relative;
    padding: 10px 10px 10px 30px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--muted);
    font-size: 13px;
}

.backup-scope-list span::before {
    content: '✓';
    position: absolute;
    left: 11px;
    top: 9px;
    color: var(--accent);
    font-weight: 900;
}

.backup-warning-note {
    margin: 0;
}

.backup-list,
.backup-job-list {
    display: grid;
    gap: 9px;
}

.backup-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(280px, .9fr) auto;
    align-items: center;
    gap: 16px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--background);
}

.backup-row-main {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.backup-row-title {
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.backup-row-title strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backup-row-main code {
    width: fit-content;
    max-width: 100%;
    padding: 3px 6px;
    border-radius: 5px;
    background: var(--surface);
    color: var(--accent);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backup-row-main > span {
    color: var(--muted);
    font-size: 12px;
}

.backup-tag {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

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

.backup-counts span {
    display: grid;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.backup-counts strong {
    color: var(--text);
    font-size: 15px;
}

.danger-outline-button {
    border-color: color-mix(in srgb, #ff5e69 55%, var(--border));
    color: #ff9ca4;
}

.danger-outline-button:hover:not(:disabled) {
    border-color: #ff5e69;
    color: #ffd4d7;
}

.backup-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
}

.backup-row-actions form {
    margin: 0;
}

.delete-backup-button {
    border-color: color-mix(in srgb, #ff5e69 68%, var(--border));
    background: color-mix(in srgb, #ff5e69 8%, var(--background));
    color: #ff9ca4;
}

.delete-backup-button:hover:not(:disabled) {
    border-color: #ff5e69;
    background: color-mix(in srgb, #ff5e69 15%, var(--background));
    color: #ffe1e3;
}

.backup-empty-list {
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.backup-job-row {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(220px, 1.4fr) auto auto;
    align-items: center;
    gap: 16px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.backup-job-actions,
.backup-job-actions form {
    margin: 0;
}

.backup-job-actions {
    display: flex;
    justify-content: flex-end;
}

.backup-job-action,
.backup-job-progress {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.backup-job-action span,
.backup-job-progress span,
.backup-job-progress small {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.mini-status-error {
    border-color: color-mix(in srgb, #ff5e69 50%, var(--border));
    background: color-mix(in srgb, #ff5e69 10%, var(--background));
    color: #ff9ca4;
}

.mini-status-processing,
.mini-status-pending {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--background));
    color: var(--accent);
}

button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 1000px) {
    .backup-layout-grid,
    .backup-row {
        grid-template-columns: 1fr;
    }

    .backup-row-actions,
    .backup-row-actions form,
    .backup-row-actions form button {
        width: 100%;
    }

    .backup-row-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .backup-active-job,
    .backup-job-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .backup-job-actions,
    .backup-job-actions form,
    .backup-job-actions button {
        width: 100%;
    }

    .backup-scope-list,
    .backup-counts {
        grid-template-columns: 1fr;
    }
}

/* Statistik */
.statistics-page {
    display: grid;
    gap: 18px;
}

.statistics-page > .page-heading-row {
    margin-bottom: 0;
}

.statistics-server-bar {
    margin-bottom: 0;
}

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

.statistics-summary-card {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 5px;
}

.statistics-summary-card > span:last-child {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.statistics-summary-value {
    margin: 3px 0 2px;
    color: var(--text);
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1;
}

.statistics-summary-text {
    min-width: 0;
    margin: 4px 0 2px;
    color: var(--text);
    font-size: 18px;
    overflow-wrap: anywhere;
}

.statistics-settings-panel {
    gap: 20px;
}

.statistics-master-row {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.statistics-form-grid {
    align-items: start;
}

.statistics-field-hint {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.statistics-field-hint code {
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--background);
    color: var(--accent);
}

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

.statistics-info-item {
    min-width: 0;
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.statistics-info-item strong {
    color: var(--text);
    font-size: 14px;
}

.statistics-info-item > span:last-child {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.statistics-actions {
    margin-top: 0;
}

@media (max-width: 900px) {
    .statistics-summary-grid,
    .statistics-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .statistics-master-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .statistics-master-row .switch-control,
    .statistics-actions,
    .statistics-actions .primary-button {
        width: 100%;
    }

    .statistics-master-row .switch-control {
        justify-content: flex-start;
    }
}

/* Voice */
.voice-page {
    display: grid;
    gap: 18px;
}

.voice-page > .page-heading-row,
.voice-server-bar {
    margin-bottom: 0;
}

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

.voice-summary-card {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 5px;
}

.voice-summary-card > span:last-child {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.voice-summary-value {
    margin: 3px 0 2px;
    color: var(--text);
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1;
}

.voice-summary-text {
    min-width: 0;
    margin: 4px 0 2px;
    color: var(--text);
    font-size: 17px;
    overflow-wrap: anywhere;
}

.voice-status-on {
    color: var(--success);
}

.voice-status-off {
    color: var(--muted);
}

.voice-settings-panel {
    gap: 20px;
}

.voice-master-row {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.voice-form-grid {
    align-items: start;
}

.voice-wide-field {
    grid-column: 1 / -1;
}

.voice-field-hint {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.voice-field-hint code {
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--background);
    color: var(--accent);
}

.voice-color-wrap {
    grid-template-columns: 48px minmax(0, 1fr);
}

.voice-section-divider {
    height: 1px;
    background: var(--border);
}

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

.voice-button-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.voice-button-card > strong {
    display: block;
    margin-bottom: 9px;
    color: var(--text);
    font-size: 14px;
}

.voice-button-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 10px;
}

.voice-button-fields .form-field {
    margin-top: 0;
}

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

.voice-info-item {
    min-width: 0;
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.voice-info-item strong {
    color: var(--text);
    font-size: 14px;
}

.voice-info-item > span:last-child {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.voice-actions {
    margin-top: 0;
}

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

@media (max-width: 800px) {
    .voice-button-grid,
    .voice-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .voice-summary-grid,
    .voice-button-fields {
        grid-template-columns: 1fr;
    }

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

    .voice-master-row .switch-control,
    .voice-actions,
    .voice-actions .primary-button {
        width: 100%;
    }

    .voice-master-row .switch-control {
        justify-content: flex-start;
    }
}
