:root {
    color-scheme: dark;
    --bg: #0f1117;
    --card: #171b25;
    --card-2: #202637;
    --text: #eef2ff;
    --muted: #9aa4bf;
    --brand: #5865f2;
    --danger: #ed4245;
    --border: #2a3144;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1b2140, var(--bg));
    color: var(--text);
}

header {
    border-bottom: 1px solid var(--border);
    background: rgba(15,17,23,.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 5;
}

header > div, main {
    width: min(1150px, calc(100% - 32px));
    margin: 0 auto;
}

header > div {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

h1 { font-size: 24px; margin: 0; }
h2 { margin-top: 0; }
a { color: var(--text); text-decoration: none; }
nav { display: flex; gap: 18px; align-items: center; color: var(--muted); }
.user { color: var(--muted); }
main { padding: 28px 0 60px; }

.card, .guild-card {
    background: linear-gradient(180deg, var(--card), #131722);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0,0,0,.18);
}

.card {
    padding: 24px;
    margin-bottom: 20px;
}

.hero {
    text-align: center;
    padding: 52px 24px;
}

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

.guild-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    transition: transform .15s ease, border-color .15s ease;
}
.guild-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.guild-card span { display: block; color: var(--muted); margin-top: 3px; }
.guild-icon, .guild-placeholder {
    width: 48px; height: 48px; border-radius: 16px;
    object-fit: cover;
    background: var(--card-2);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    color: white;
    background: var(--brand);
    font-weight: 700;
    cursor: pointer;
}
button.danger, .danger { background: var(--danger); color: white; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

input, select, textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0f1320;
    color: var(--text);
    margin-top: 7px;
}

label { color: var(--muted); font-weight: 600; }
label.check, label.switch { display: inline-flex; gap: 8px; align-items: center; color: var(--text); }
label.check input, label.switch input { width: auto; margin: 0; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-grid textarea, .form-grid button { grid-column: 1 / -1; }

p { color: var(--muted); line-height: 1.6; }
table { width: 100%; border-collapse: collapse; overflow: hidden; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
small, code { color: var(--muted); }
.inline { display: inline; }

@media (max-width: 760px) {
    header > div { align-items: flex-start; flex-direction: column; padding: 18px 0; }
    .form-grid { grid-template-columns: 1fr; }
    table { display: block; overflow-x: auto; }
}

.stack {
    display: grid;
    gap: 16px;
}

.sub-card {
    background: rgba(32, 38, 55, .55);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
}

.sub-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.sub-card h3 {
    margin: 0 0 4px;
}

.detail-grid, .check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.detail-toggle, .pill-check {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    background: #101522;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
}

.detail-toggle input, .pill-check input {
    width: auto;
    margin: 0;
}

.notice {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 12px 0 18px;
    font-weight: 700;
}
.notice.success {
    background: rgba(87, 242, 135, .12);
    border: 1px solid rgba(87, 242, 135, .35);
    color: #aaf0c0;
}
.muted { color: var(--muted); }
.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.row-actions button {
    padding: 8px 10px;
    font-size: 13px;
}

.notice.error {
    background: rgba(237, 66, 69, .13);
    border: 1px solid rgba(237, 66, 69, .38);
    color: #ffb6b8;
}
.button.secondary, button.secondary {
    background: #31384d;
}
.compact-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.dashboard-hero {
    display: grid;
    gap: 22px;
}
.guild-title {
    display: flex;
    align-items: center;
    gap: 16px;
}
.guild-overview-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    object-fit: cover;
    background: var(--card-2);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 28px;
}
.quick-stats, .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}
.quick-stats > div, .info-grid > div {
    background: rgba(32, 38, 55, .55);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}
.quick-stats strong, .info-grid strong {
    display: block;
    font-size: 22px;
    color: var(--text);
    word-break: break-word;
}
.quick-stats span, .info-grid span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.module-card {
    display: block;
    padding: 16px;
    border-radius: 16px;
    background: rgba(32, 38, 55, .55);
    border: 1px solid var(--border);
    transition: transform .15s ease, border-color .15s ease;
}
.module-card:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
}
.module-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.module-head h3 {
    margin: 0;
}
.module-card p {
    min-height: 48px;
    margin-bottom: 10px;
}
.module-meta {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}
.badge {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid var(--border);
    background: #252c3d;
    color: var(--muted);
}
.badge.ok {
    background: rgba(87, 242, 135, .12);
    border-color: rgba(87, 242, 135, .35);
    color: #aaf0c0;
}
.badge.off {
    background: rgba(154, 164, 191, .10);
    color: #c4ccdd;
}
.badge.warning {
    background: rgba(250, 166, 26, .12);
    border-color: rgba(250, 166, 26, .35);
    color: #ffd18a;
}
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}
@media (max-width: 760px) {
    .guild-title { align-items: flex-start; }
    .quick-stats, .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .overview-grid { grid-template-columns: 1fr; }
    .module-card p { min-height: 0; }
}

.detail-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: #101522;
    border: 1px solid var(--border);
    border-radius: 14px;
}
.detail-card .detail-toggle {
    padding: 0;
    background: transparent;
    border: 0;
}
.detail-card select {
    margin-top: 0;
}
.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 760px) {
    .grid.two { grid-template-columns: 1fr; }
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mobile-menu {
    display: none;
    padding: 9px 12px;
    background: #31384d;
}
.dashboard-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.content-area {
    min-width: 0;
}
.side-nav {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 116px);
    overflow: auto;
    background: linear-gradient(180deg, rgba(23,27,37,.96), rgba(19,23,34,.96));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,.16);
}
.side-title {
    padding: 8px 8px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.side-title strong,
.side-title span {
    display: block;
}
.side-title span {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}
.side-search,
.module-search,
.select-filter,
.check-filter,
.table-filter {
    margin: 0 0 12px;
    background: #0b0f1a;
}
.side-nav nav {
    display: grid;
    gap: 6px;
}
.side-nav nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 12px;
    color: var(--muted);
    border: 1px solid transparent;
}
.side-nav nav a:hover,
.side-nav nav a.active {
    color: var(--text);
    background: rgba(88,101,242,.14);
    border-color: rgba(88,101,242,.32);
}
.side-nav nav a span {
    width: 22px;
    text-align: center;
}
.section-head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-head h2,
.section-head p {
    margin-bottom: 0;
}
.section-head .module-search {
    width: min(320px, 100%);
    flex: 0 0 min(320px, 45%);
}
.guild-card,
.module-card,
.button,
button,
.side-nav nav a,
input,
select,
textarea {
    transition: border-color .15s ease, transform .15s ease, background .15s ease, box-shadow .15s ease;
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(88,101,242,.8);
    box-shadow: 0 0 0 3px rgba(88,101,242,.16);
}
button:hover,
.button:hover {
    transform: translateY(-1px);
}
button:disabled,
.button:disabled {
    opacity: .55;
    cursor: not-allowed;
}
[hidden] {
    display: none !important;
}
.table-filter {
    max-width: 360px;
}
select.searchable-select + small,
.select-filter + select.searchable-select {
    margin-top: 0;
}
@media (max-width: 1000px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .mobile-menu {
        display: inline-flex;
    }
    .side-nav {
        display: none;
        position: fixed;
        top: 86px;
        left: 16px;
        right: 16px;
        z-index: 20;
        max-height: calc(100vh - 110px);
    }
    .side-nav.open {
        display: block;
    }
}
@media (max-width: 760px) {
    header > div {
        gap: 12px;
    }
    nav {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .section-head {
        display: block;
    }
    .section-head .module-search {
        width: 100%;
        margin-top: 14px;
    }
    .card {
        padding: 18px;
        border-radius: 15px;
    }
    .quick-stats strong,
    .info-grid strong {
        font-size: 18px;
    }
    .side-nav {
        top: 118px;
    }
}
@media (max-width: 480px) {
    header > div, main {
        width: min(100% - 20px, 1150px);
    }
    .quick-stats, .info-grid {
        grid-template-columns: 1fr;
    }
    .actions {
        display: grid;
    }
    .actions .button,
    .actions button {
        width: 100%;
    }
}

.setup-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.setup-progress-card,
.setup-actions > form {
    background: rgba(32, 38, 55, .55);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}
.setup-progress-card h3,
.setup-actions h3 { margin: 0; }
.progress {
    height: 9px;
    background: #101522;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 14px;
}
.progress span {
    display: block;
    height: 100%;
    background: var(--brand);
}
.setup-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.setup-actions p { margin-bottom: 0; }
.setup-list {
    color: var(--muted);
    line-height: 1.8;
}
.setup-list li::marker { color: var(--brand); font-weight: 800; }

.backup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin: 14px 0;
}
.backup-option {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(32, 38, 55, .55);
}
.backup-option input { margin-top: 4px; }
.backup-option span {
    display: grid;
    gap: 5px;
}
.backup-option small,
.backup-option em {
    color: var(--muted);
    font-style: normal;
    line-height: 1.35;
}
.danger-zone textarea {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    resize: vertical;
}
.notice.warn {
    border-color: rgba(250, 204, 21, .35);
    background: rgba(250, 204, 21, .08);
}

/* v0.18 Bot / Wartung */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.stat-card strong {
    font-size: 1.15rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.stat-card span {
    color: var(--muted);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.inline-form {
    display: inline-flex;
    margin: 4px 6px 4px 0;
}

.inline-form button {
    width: auto;
}

/* Advanced Embed Builder */
.embed-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr);
    gap: 18px;
    align-items: start;
}
.embed-builder-form textarea[name="content"],
.embed-builder-form textarea[name="description"],
.embed-builder-form .embed-fields-panel,
.embed-builder-form button[type="submit"] {
    grid-column: 1 / -1;
}
.embed-fields-panel {
    background: rgba(15, 19, 32, .72);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}
.embed-fields-panel h4 { margin: 0 0 6px; }
.embed-field-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr auto;
    gap: 12px;
    align-items: end;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}
.inline-check { padding-bottom: 12px; }
.embed-preview-panel {
    position: sticky;
    top: 96px;
    background: rgba(15, 19, 32, .72);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}
.discord-message-preview {
    background: #313338;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 16px;
    margin: 12px 0;
    color: #dbdee1;
}
.preview-content {
    white-space: pre-wrap;
    margin-bottom: 10px;
    color: #f2f3f5;
}
.preview-content:empty { display: none; }
.discord-embed-preview {
    position: relative;
    border-left: 4px solid #5865F2;
    background: #2b2d31;
    border-radius: 4px;
    padding: 12px 12px 12px 14px;
    min-height: 90px;
    overflow: hidden;
}
.preview-author {
    font-size: 13px;
    font-weight: 700;
    color: #f2f3f5;
    margin-bottom: 8px;
}
.preview-author img,
.preview-footer img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 6px;
}
.preview-title {
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    word-break: break-word;
}
.preview-description {
    white-space: pre-wrap;
    word-break: break-word;
    color: #dbdee1;
    line-height: 1.42;
}
.preview-thumb {
    float: right;
    width: 80px;
    min-height: 1px;
    margin-left: 12px;
}
.preview-thumb img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 6px;
    object-fit: cover;
}
.preview-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.preview-field { min-width: 0; }
.preview-field.wide { grid-column: 1 / -1; }
.preview-field-name {
    font-weight: 800;
    color: #f2f3f5;
    font-size: 13px;
    margin-bottom: 3px;
}
.preview-field-value {
    white-space: pre-wrap;
    word-break: break-word;
    color: #dbdee1;
    font-size: 13px;
}
.preview-image img {
    display: block;
    max-width: 100%;
    max-height: 260px;
    border-radius: 8px;
    margin-top: 12px;
    object-fit: contain;
}
.preview-footer {
    color: #b5bac1;
    font-size: 12px;
    margin-top: 12px;
}
@media (max-width: 980px) {
    .embed-builder-layout { grid-template-columns: 1fr; }
    .embed-preview-panel { position: static; }
    .embed-field-row { grid-template-columns: 1fr; }
    .preview-fields { grid-template-columns: 1fr; }
}

/* v0.20.7 Embed Builder formatting help */
.embed-help {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}
.embed-help summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
}
.embed-help-grid {
    display: grid;
    gap: 14px;
}
.embed-help-grid h4 {
    margin: 0 0 8px;
    color: var(--text);
}
.snippet-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.snippet-pill {
    display: inline-flex;
    width: auto;
    max-width: 100%;
    justify-content: flex-start;
    padding: 7px 9px;
    margin: 4px 4px 4px 0;
    border: 1px solid var(--border);
    background: #101522;
    color: var(--text);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    overflow-wrap: anywhere;
}
.snippet-pill:hover {
    background: rgba(88,101,242,.18);
    border-color: rgba(88,101,242,.45);
}
.snippet-pill code {
    color: #d8defd;
    margin-right: 4px;
    overflow-wrap: anywhere;
}
.small-note {
    font-size: 12px;
    line-height: 1.45;
}

/* v0.20.11 Embed Builder Discord-like preview */
.discord-mention {
    display: inline-block;
    background: rgba(88, 101, 242, .28);
    color: #dee3ff;
    border-radius: 4px;
    padding: 0 3px;
    font-weight: 700;
}
.preview-link {
    color: #00a8fc;
    text-decoration: none;
}
.preview-link:hover { text-decoration: underline; }
.preview-inline-code {
    background: #1e1f22;
    border-radius: 4px;
    padding: 1px 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .92em;
}
.preview-spoiler {
    background: #1e1f22;
    color: transparent;
    border-radius: 3px;
    padding: 0 3px;
}
.preview-spoiler:hover { color: #dbdee1; }
.preview-quote {
    display: inline-block;
    border-left: 4px solid #4e5058;
    padding-left: 8px;
    color: #dbdee1;
}
.preview-heading {
    display: inline-block;
    font-size: 1.15em;
    font-weight: 800;
    color: #f2f3f5;
}

/* v0.20.12 Embed Builder Vorschau Cache-/Markdown-Fix */
.preview-code-block {
    display: block;
    background: #1e1f22;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 6px;
    padding: 8px 10px;
    margin: 6px 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .92em;
}
.preview-heading.h1 { font-size: 1.32em; }
.preview-heading.h2 { font-size: 1.22em; }
.preview-heading.h3 { font-size: 1.12em; }

/* v0.20.23 Automatisierungen */
.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.grid-form .form-full { grid-column: 1 / -1; }
.row-between {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.card.compact { padding: 16px; }
.badge.bad {
    background: rgba(237, 66, 69, .13);
    border-color: rgba(237, 66, 69, .38);
    color: #ffb6b8;
}
@media (max-width: 760px) {
    .grid-form { grid-template-columns: 1fr; }
    .row-between { flex-direction: column; }
}

/* v0.20.25 Social Notifications */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 12px 0;
}
.help-grid > div {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255,255,255,.03);
}
.actions-cell details {
    margin: 6px 0;
}
.danger-text {
    color: #ff7b7b;
}

/* v0.20.31 Owner-Dashboard */
.guild-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}
.guild-mini span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}
.button.small {
    padding: 7px 10px;
    font-size: 13px;
}
.danger-details summary {
    cursor: pointer;
    list-style: none;
}
.danger-details summary::-webkit-details-marker {
    display: none;
}
.danger-box {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid rgba(239, 68, 68, .45);
    border-radius: 12px;
    background: rgba(239, 68, 68, .08);
    min-width: 260px;
}
.danger-box input {
    width: 100%;
    margin: 6px 0 10px;
}
.owner-card {
    margin-top: 18px;
}
