:root {
            --rimu: #A855F7;
            --rimu-strong: #7E22CE;
            --bg: #09070D;
            --panel: rgba(18, 11, 24, 0.94);
            --panel-2: rgba(11, 7, 16, 0.96);
            --text: #FAF7FF;
            --muted: #B9A8C7;
            --line: rgba(168, 85, 247, 0.18);
            --danger: #FF6B7A;
            --success: #76E0B2;
            --warning: #FFD166;
            --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
        }

        * { box-sizing: border-box; }

        body {
            margin: 0;
            min-height: 100vh;
            background:
                radial-gradient(circle at 12% 7%, rgba(192, 132, 252, 0.48), transparent 30%),
                radial-gradient(circle at 86% 9%, rgba(168, 85, 247, 0.34), transparent 30%),
                radial-gradient(circle at 50% 34%, rgba(126, 34, 206, 0.15), transparent 38%),
                linear-gradient(135deg, #08060B 0%, #14091C 48%, #050407 100%);
            color: var(--text);
            font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        }

        body[data-dashboard-tab="audit-logs"],
        body[data-dashboard-tab="errors"] {
            background:
                radial-gradient(circle at 14% 8%, rgba(192, 132, 252, 0.22), transparent 24%),
                radial-gradient(circle at 86% 14%, rgba(126, 34, 206, 0.16), transparent 28%),
                linear-gradient(135deg, #08060B 0%, #120A19 55%, #050407 100%);
        }

        a { color: var(--rimu); }

        .page {
            width: min(1320px, calc(100% - 32px));
            margin: 0 auto;
            padding: 34px 0 48px;
        }

        .nav {
            position: relative;
            z-index: 500;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            min-height: 64px;
            margin-bottom: 24px;
            padding: 8px 10px;
            border: 1px solid var(--line);
            border-radius: 18px;
            background: rgba(10, 6, 14, 0.82);
            box-shadow: 0 16px 46px rgba(0, 0, 0, 0.34);
            backdrop-filter: blur(18px);
        }

        .nav-left {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 4px 6px;
            color: var(--text);
            text-decoration: none;
            flex: 0 0 auto;
        }

        .orb {
            width: 42px;
            height: 42px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
        }

        .orb img {
            width: 42px;
            height: 42px;
            display: block;
            object-fit: contain;
        }

        .brand-title {
            margin: 0;
            font-size: 1.08rem;
            font-weight: 950;
            letter-spacing: 0.11em;
        }

        .nav-divider {
            width: 1px;
            height: 28px;
            background: var(--line);
            flex: 0 0 auto;
        }

        .pill {
            border: 1px solid var(--line);
            background: rgba(168, 85, 247, 0.08);
            border-radius: 999px;
            padding: 9px 14px;
            color: var(--muted);
            font-size: 0.9rem;
        }

        .server-switcher,
        .account {
            position: relative;
            z-index: 510;
        }

        .server-switcher-button,
        .account-button {
            display: flex;
            align-items: center;
            gap: 9px;
            min-height: 44px;
            border: 1px solid transparent;
            border-radius: 12px;
            padding: 7px 10px;
            color: var(--text);
            background: transparent;
            cursor: pointer;
            font: inherit;
            font-weight: 800;
            transition: background 0.16s ease, border-color 0.16s ease;
        }

        .server-switcher-button:hover,
        .account-button:hover,
        .server-switcher.open .server-switcher-button,
        .account.open .account-button {
            border-color: var(--line);
            background: rgba(168, 85, 247, 0.10);
        }

        .server-switcher-button {
            max-width: min(360px, 42vw);
        }

        .server-switcher-name,
        .account-button span:nth-child(2) {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .server-switcher-icon,
        .account-button img {
            width: 30px;
            height: 30px;
            border-radius: 9px;
            flex: 0 0 auto;
            object-fit: cover;
            background: rgba(168, 85, 247, 0.13);
        }

        .server-switcher-icon {
            display: grid;
            place-items: center;
            color: var(--text);
            font-size: 0.8rem;
            font-weight: 900;
            overflow: hidden;
        }

        .server-switcher-icon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .menu-caret {
            color: var(--muted);
            font-size: 0.8rem;
            transition: transform 0.16s ease;
        }

        .server-switcher.open .menu-caret,
        .account.open .menu-caret {
            transform: rotate(180deg);
        }

        .top-menu {
            position: absolute;
            top: calc(100% + 8px);
            min-width: 220px;
            max-width: min(360px, calc(100vw - 32px));
            display: none;
            padding: 8px;
            border: 1px solid var(--line);
            border-radius: 14px;
            background: rgba(10, 6, 14, 0.985);
            box-shadow: 0 20px 54px rgba(0, 0, 0, 0.50);
            backdrop-filter: blur(18px);
            z-index: 600;
        }

        .server-switcher .top-menu { left: 0; }
        .account .top-menu { right: 0; }
        .server-switcher.open .top-menu,
        .account.open .top-menu { display: grid; gap: 3px; }

        .top-menu a,
        .top-menu button {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 10px;
            min-height: 42px;
            padding: 9px 10px;
            border: 0;
            border-radius: 10px;
            color: var(--text);
            background: transparent;
            text-decoration: none;
            text-align: left;
            cursor: pointer;
            font: inherit;
            font-weight: 800;
        }

        .top-menu a:hover,
        .top-menu button:hover,
        .top-menu a.active {
            background: rgba(168, 85, 247, 0.13);
        }

        .server-menu-item-icon {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            display: grid;
            place-items: center;
            flex: 0 0 auto;
            overflow: hidden;
            background: rgba(168, 85, 247, 0.13);
            font-size: 0.78rem;
            font-weight: 900;
        }

        .server-menu-item-icon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .server-menu-item-name {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .hero {
            min-height: 62vh;
            display: grid;
            place-items: center;
        }

        .login-card {
            width: min(620px, 100%);
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 28px;
            padding: 42px;
            text-align: center;
            box-shadow: var(--shadow);
            backdrop-filter: blur(18px);
        }

        .login-card h1 {
            margin: 0 0 12px;
            font-size: clamp(2rem, 6vw, 4rem);
            line-height: 0.95;
        }

        .login-card p {
            margin: 0 auto 28px;
            max-width: 490px;
            color: var(--muted);
            line-height: 1.65;
        }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            border: 1px solid rgba(192, 132, 252, 0.26);
            border-radius: 16px;
            padding: 13px 18px;
            min-height: 48px;
            cursor: pointer;
            color: #FFFFFF;
            background: linear-gradient(135deg, #9333EA 0%, #7E22CE 55%, #581C87 100%);
            font-weight: 800;
            text-decoration: none;
            box-shadow: 0 14px 34px rgba(126, 34, 206, 0.28);
        }

        .btn:hover { transform: translateY(-1px); }

        .btn-secondary {
            color: var(--text);
            background: rgba(168, 85, 247, 0.10);
            border: 1px solid var(--line);
            box-shadow: none;
        }

        .btn-danger {
            background: linear-gradient(135deg, #DC2626 0%, #B91C1C 55%, #7F1D1D 100%);
            border-color: rgba(248, 113, 113, 0.42);
            box-shadow: 0 14px 34px rgba(220, 38, 38, 0.24);
        }

        .danger-action {
            grid-column: 1 / -1;
            display: grid;
            gap: 8px;
        }

        .danger-action .btn {
            width: 100%;
        }

        .top-grid {
            display: grid;
            grid-template-columns: 1.2fr 0.8fr;
            gap: 18px;
            align-items: stretch;
            margin-bottom: 18px;
        }

        .server-home {
            display: grid;
            gap: 14px;
        }

        .server-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 12px;
        }

        .server-choice {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 12px;
            min-height: 58px;
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 14px 16px;
            color: var(--text);
            background: rgba(168, 85, 247, 0.08);
            text-decoration: none;
            font-weight: 850;
        }

        .server-icon {
            width: 34px;
            height: 34px;
            border-radius: 10px;
            display: grid;
            place-items: center;
            flex: 0 0 auto;
            background: rgba(168, 85, 247, 0.16);
            color: var(--text);
            font-weight: 900;
            overflow: hidden;
        }

        .server-icon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .server-name {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .server-open {
            margin-left: auto;
            color: var(--muted);
            font-size: 0.85rem;
        }

        .server-choice:hover { border-color: rgba(168, 85, 247, 0.42); background: rgba(168, 85, 247, 0.13); }


        .card {
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 24px;
            padding: 24px;
            box-shadow: var(--shadow);
            backdrop-filter: blur(18px);
        }

        .card.compact { padding: 18px; }

        .card h2, .card h3 {
            margin: 0 0 8px;
        }

        .muted {
            margin: 0;
            color: var(--muted);
            line-height: 1.55;
        }

        .server-row {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 14px;
            align-items: end;
            margin-top: 20px;
        }

        form {
            display: grid;
            gap: 18px;
        }

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

        .levelling-settings-bubble {
            grid-column: 1 / -1;
        }

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

        .section {
            background: var(--panel-2);
            border: 1px solid var(--line);
            border-radius: 22px;
            padding: 20px;
        }

        /* Keep the tab content full-width while preserving its opaque section surface. */
        #dashboard-shell > form > .tab-panel > section.section {
            width: 100%;
            max-width: none;
            margin: 0;
        }

        #dashboard-shell > form > .tab-panel > section.section > .settings-grid,
        #dashboard-shell > form > .tab-panel > section.section > .settings-list {
            width: 100%;
            max-width: none;
        }

        .section .section,
        .embedded-section,
        .automod-card,
        .message-bubble,
        .section .item-row {
            background: rgba(168, 85, 247, 0.06);
        }

        .settings-list {
            display: grid;
            gap: 18px;
        }

        .settings-block {
            display: grid;
            gap: 12px;
            padding-bottom: 18px;
            border-bottom: 1px solid rgba(168, 85, 247, 0.16);
        }

        .settings-block:last-child {
            padding-bottom: 0;
            border-bottom: 0;
        }

        .settings-bubble {
            display: grid;
            gap: 12px;
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 14px;
            background: rgba(168, 85, 247, 0.06);
        }

        .settings-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 12px;
            align-items: end;
        }

        .settings-row .btn {
            align-self: end;
            white-space: nowrap;
        }

        .subtabbar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin: -14px 0 16px;
            padding-left: 8px;
        }

        .subtab-button {
            border: 1px solid var(--line);
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.04);
            color: var(--muted);
            padding: 8px 12px;
            font-weight: 900;
            cursor: pointer;
        }

        .subtab-button.active {
            border-color: rgba(168, 85, 247, 0.55);
            background: rgba(168, 85, 247, 0.18);
            color: #FFFFFF;
        }

        .log-settings-panel {
            display: none;
            gap: 10px;
        }

        [data-log-settings-panel].log-settings-panel.active {
            display: grid;
        }

        .log-settings-category-head {
            padding: 4px 2px 8px;
            border-bottom: 1px solid rgba(168, 85, 247, 0.16);
        }

        .log-settings-category-head .toggle {
            padding: 0;
            border: 0;
            background: transparent;
        }

        .log-settings-bulk-row,
        .log-settings-row {
            display: grid;
            grid-template-columns: minmax(150px, 0.42fr) minmax(220px, 0.58fr);
            gap: 10px;
            align-items: center;
            min-height: 38px;
            padding: 6px 8px;
            border: 1px solid rgba(168, 85, 247, 0.13);
            border-radius: 10px;
            background: rgba(8, 5, 11, 0.34);
        }

        .log-settings-bulk-row {
            grid-template-columns: auto minmax(220px, 320px) auto;
            justify-content: start;
        }

        .log-settings-channel-bubble {
            display: grid;
            gap: 9px;
            border: 1px solid rgba(168, 85, 247, 0.22);
            border-radius: 14px;
            padding: 10px;
            background: rgba(168, 85, 247, 0.08);
        }

        .log-settings-row-list {
            display: grid;
            gap: 7px;
        }

        .log-settings-label {
            color: var(--text);
            font-size: 0.86rem;
            font-weight: 850;
            line-height: 1.2;
        }

        .log-settings-row .multiselect,
        .log-settings-bulk-row .multiselect {
            min-width: 0;
        }

        .log-settings-row .multiselect__tags,
        .log-settings-bulk-row .multiselect__tags {
            min-height: 44px;
            max-height: 44px;
            align-items: center;
            border-radius: 14px;
            padding: 6px 38px 6px 10px;
        }

        .log-settings-row .multiselect__value,
        .log-settings-row .multiselect__single,
        .log-settings-bulk-row .multiselect__value,
        .log-settings-bulk-row .multiselect__single {
            font-size: 0.84rem;
            line-height: 1.15;
        }

        .log-settings-row .multiselect__select,
        .log-settings-bulk-row .multiselect__select {
            right: 11px;
            width: 10px;
            height: 10px;
        }

        .log-settings-row .multiselect__option,
        .log-settings-bulk-row .multiselect__option {
            min-height: 32px;
            padding: 6px 9px;
            font-size: 0.84rem;
        }

        .log-settings-compact-button {
            width: auto;
            min-height: 32px;
            padding: 7px 12px;
            white-space: nowrap;
        }

        .required-mark {
            color: var(--rimu);
            font-weight: 950;
        }

        .compact-settings-bubble {
            grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
            align-items: center;
        }

        .compact-settings-bubble .muted {
            grid-column: 1 / -1;
        }

        .compact-settings-controls {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 10px;
            align-items: center;
        }

        .case-filter-details {
            display: grid;
            gap: 8px;
        }

        .case-filter-details summary {
            width: fit-content;
            color: #FFFFFF;
            font-weight: 950;
            cursor: pointer;
        }

        .case-filter-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px 12px;
            margin-top: 8px;
        }

        .case-filter-grid .wide {
            grid-column: 1 / -1;
        }

        .case-filter-grid .field {
            display: grid;
            align-content: start;
            grid-template-rows: 18px 44px;
            margin-top: 0;
        }

        .case-filter-grid .multiselect {
            align-self: start;
        }

        .case-filter-grid .field label {
            min-height: 18px;
            line-height: 18px;
        }

        .case-filter-grid .multiselect__tags {
            min-height: 44px;
            max-height: 44px;
            align-items: center;
            padding-top: 6px;
            padding-bottom: 6px;
        }

        .case-chip-row {
            display: flex;
            align-items: center;
            gap: 34px;
            flex-wrap: wrap;
            padding: 2px 0;
        }

        .case-chip-group,
        .case-date-range {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .case-chip-label {
            color: var(--muted);
            font-size: 0.84rem;
            font-weight: 900;
        }

        .case-chip-group label {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: var(--text);
            font-weight: 850;
            margin: 0;
        }

        .case-chip-group input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: #EAB308;
            border-radius: 6px;
        }

        .case-date-range {
            display: grid;
            grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
            flex-wrap: nowrap;
            white-space: nowrap;
            overflow: hidden;
            width: 100%;
            padding-bottom: 0;
        }

        .case-date-range .case-chip-label {
            flex: 0 0 auto;
            color: var(--text);
        }

        .case-date-range input {
            width: 100%;
            min-width: 0;
            flex: 1 1 auto;
            padding-left: 9px;
            padding-right: 9px;
        }

        .case-date-range span:not(.case-chip-label) {
            flex: 0 0 auto;
        }

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

        .section-title {
            margin: 0;
            font-size: 1.1rem;
        }

        .section-desc {
            margin: 4px 0 0;
            color: var(--muted);
            font-size: 0.9rem;
            line-height: 1.45;
        }

        label {
            display: block;
            margin: 0 0 8px;
            color: var(--muted);
            font-weight: 700;
            font-size: 0.88rem;
        }

        select, input[type="text"], input[type="number"], input[type="datetime-local"], input[type="file"], textarea {
            width: 100%;
            min-height: 44px;
            border: 1px solid var(--line);
            border-radius: 14px;
            padding: 11px 12px;
            color: var(--text);
            background: rgba(8, 5, 11, 0.72);
            outline: none;
        }

        select:focus, input:focus, textarea:focus {
            border-color: var(--rimu);
            box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.12);
        }

        select.select-native { display: none !important; }

        .multiselect {
            position: relative;
            width: 100%;
            min-width: 0;
            color: var(--text);
        }

        .multiselect.is-open { z-index: 80; }
        .multiselect.no-search .multiselect__tags { cursor: pointer; }
        .multiselect.no-search .multiselect__input { display: none; }

        .multiselect__select {
            position: absolute;
            right: 12px;
            top: 50%;
            width: 12px;
            height: 12px;
            pointer-events: none;
            border-right: 2px solid var(--muted);
            border-bottom: 2px solid var(--muted);
            transform: translateY(-70%) rotate(45deg);
            transition: transform 0.16s ease, border-color 0.16s ease;
        }

        .multiselect.is-open .multiselect__select {
            border-color: var(--rimu);
            transform: translateY(-30%) rotate(225deg);
        }

        .multiselect__tags {
            position: relative;
            display: flex;
            align-items: flex-start;
            gap: 6px;
            min-height: 44px;
            width: 100%;
            border: 1px solid var(--line);
            border-radius: 14px;
            padding: 6px 38px 6px 10px;
            background: rgba(8, 5, 11, 0.72);
            cursor: text;
            transition: border-color 0.16s ease, box-shadow 0.16s ease;
        }

        .multiselect:not(.multiselect--multiple) .multiselect__tags {
            align-items: center;
            min-height: 44px;
            max-height: 44px;
            padding-top: 6px;
            padding-bottom: 6px;
        }

        .multiselect:not(.multiselect--multiple) .multiselect__value {
            flex-wrap: nowrap;
        }

        .multiselect:not(.multiselect--multiple) .multiselect__single {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .multiselect.is-open .multiselect__tags,
        .multiselect__tags:focus-within {
            border-color: var(--rimu);
            box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.12);
        }

        .multiselect.has-warning .multiselect__tags {
            border-color: rgba(255, 209, 102, 0.72);
            box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.09);
        }

        .multiselect.is-invalid .multiselect__tags {
            border-color: rgba(255, 107, 122, 0.82);
            box-shadow: 0 0 0 3px rgba(255, 107, 122, 0.11);
        }

        select[multiple] + .multiselect .multiselect__tags {
            flex-wrap: wrap;
        }

        select[multiple] + .multiselect .multiselect__value {
            flex: 1 1 100%;
        }

        select[multiple] + .multiselect .multiselect__input {
            flex: 1 1 120px;
        }

        .multiselect__value {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 7px;
            min-width: 0;
            max-width: 100%;
            color: var(--text);
            font-size: 0.92rem;
            font-weight: 650;
            line-height: 1.2;
        }

        .multiselect__single {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .multiselect__placeholder {
            color: rgba(185, 194, 221, 0.72);
            font-weight: 600;
        }

        .multiselect__tag {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
            max-width: min(220px, 100%);
            padding: 5px 8px;
            border: 1px solid rgba(168, 85, 247, 0.20);
            border-radius: 999px;
            background: rgba(168, 85, 247, 0.11);
            color: var(--text);
            font-size: 0.82rem;
            font-weight: 800;
        }

        .multiselect__tag span:last-child {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .multiselect__input {
            flex: 1 1 80px;
            min-width: 42px;
            min-height: 0;
            border: 0;
            outline: 0;
            padding: 0;
            color: var(--text);
            background: transparent;
            font: inherit;
        }

        .multiselect__input::placeholder { color: transparent; }
        .multiselect.is-open .multiselect__input::placeholder { color: rgba(185, 194, 221, 0.62); }

        .multiselect__content-wrapper {
            position: absolute;
            left: 0;
            right: 0;
            top: calc(100% + 6px);
            max-height: 300px;
            overflow: auto;
            border: 1px solid var(--line);
            border-radius: 14px;
            background: rgba(12, 7, 17, 0.98);
            box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
            backdrop-filter: blur(16px);
            display: none;
        }

        .multiselect.is-open .multiselect__content-wrapper { display: block; }

        .multiselect__content {
            display: grid;
            gap: 2px;
            list-style: none;
            margin: 0;
            padding: 6px;
        }

        .multiselect__element { min-width: 0; }

        .multiselect__option {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            min-height: 38px;
            padding: 8px 10px;
            border-radius: 10px;
            color: var(--text);
            cursor: pointer;
            user-select: none;
        }

        .multiselect__option:hover,
        .multiselect__option--highlight {
            background: rgba(168, 85, 247, 0.13);
        }

        .multiselect__option--selected {
            background: rgba(168, 85, 247, 0.18);
            color: #FFFFFF;
        }

        .multiselect__option--disabled {
            cursor: default;
            color: rgba(185, 194, 221, 0.68);
            background: transparent;
            font-size: 0.76rem;
            font-weight: 900;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

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

        .option__title {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 0.9rem;
            font-weight: 700;
        }

        .option__meta {
            color: rgba(185, 194, 221, 0.72);
            font-size: 0.78rem;
            white-space: nowrap;
        }

        .option__icon {
            width: 18px;
            height: 18px;
            flex: 0 0 auto;
            display: inline-grid;
            place-items: center;
            color: rgb(114, 118, 125);
            font-weight: 900;
            font-size: 0.92rem;
        }

        .option__icon img {
            width: 18px;
            height: 18px;
            object-fit: contain;
        }

        textarea {
            min-height: 118px;
            resize: vertical;
            line-height: 1.45;
        }

        .field { margin-top: 13px; }
        .field:first-child { margin-top: 0; }

        .role-selection-feedback {
            display: grid;
            gap: 4px;
            margin: 8px 2px 0;
            font-size: 0.79rem;
            line-height: 1.35;
        }

        .role-selection-feedback .warning { color: var(--warning); }
        .role-selection-feedback .error { color: var(--danger); }

        .tabbar {
            display: flex;
            gap: 8px;
            padding: 8px;
            margin: -6px 0 18px;
            border: 1px solid var(--line);
            border-radius: 18px;
            background: rgba(8, 5, 11, 0.42);
            overflow-x: auto;
        }

        .tab-button {
            border: 1px solid transparent;
            border-radius: 12px;
            padding: 10px 14px;
            color: var(--muted);
            background: transparent;
            cursor: pointer;
            font-weight: 800;
            white-space: nowrap;
        }

        .tab-button.active {
            color: #0A0610;
            background: var(--rimu);
        }

        .tab-panel { display: none; }
        .tab-panel.active { display: block; }

        .filter-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 14px;
            align-items: end;
        }

        .filter-grid .field {
            margin-top: 0;
            display: flex;
            flex-direction: column;
        }

        .filter-grid .field label {
            min-height: 18px;
        }

        .filter-grid .multiselect__tags {
            min-height: 42px;
            align-items: center;
            padding-top: 5px;
            padding-bottom: 5px;
        }

        .filter-grid .multiselect__value,
        .filter-grid .multiselect__single {
            white-space: normal;
            overflow: visible;
            text-overflow: clip;
            line-height: 1.28;
        }

        .filter-grid .multiselect:not(.multiselect--multiple) .multiselect__value,
        .filter-grid .multiselect:not(.multiselect--multiple) .multiselect__single {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.2;
        }

        .log-actions {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 16px;
        }

        .log-results {
            display: grid;
            gap: 12px;
            margin-top: 18px;
        }

        .log-row {
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 14px;
            background: rgba(8, 5, 11, 0.52);
        }

        .log-row.audit-row {
            cursor: pointer;
            transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
        }

        .log-row.message-log-row {
            cursor: pointer;
            transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
        }

        .log-row.audit-row:hover,
        .log-row.message-log-row:hover {
            border-color: rgba(168, 85, 247, 0.42);
            background: rgba(168, 85, 247, 0.08);
            transform: translateY(-1px);
        }

        .log-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 8px;
            color: var(--muted);
            font-size: 0.82rem;
            font-weight: 750;
        }

        .log-content {
            margin: 0;
            color: var(--text);
            line-height: 1.45;
            white-space: pre-wrap;
            overflow-wrap: anywhere;
        }

        .audit-content {
            display: grid;
            gap: 8px;
            white-space: normal;
        }

        .audit-category {
            margin-top: 6px;
            color: #FFFFFF;
            font-weight: 950;
        }

        .audit-change {
            padding-left: 14px;
            color: var(--text);
            border-left: 2px solid rgba(168, 85, 247, 0.38);
            line-height: 1.45;
        }

        .audit-summary {
            display: grid;
            gap: 10px;
        }

        .audit-summary-title {
            color: var(--text);
            font-weight: 950;
        }

        .audit-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .audit-tab-chip {
            padding: 5px 9px;
            border: 1px solid rgba(168, 85, 247, 0.24);
            border-radius: 999px;
            background: rgba(168, 85, 247, 0.10);
            color: var(--text);
            font-size: 0.82rem;
            font-weight: 850;
        }

        .audit-view-hint {
            color: var(--muted);
            font-size: 0.82rem;
            font-weight: 750;
        }

        .audit-detail-scroll {
            max-height: min(62vh, 620px);
            overflow: auto;
            display: grid;
            gap: 14px;
            padding-right: 4px;
        }

        .audit-detail-section {
            border: 1px solid var(--line);
            border-radius: 14px;
            padding: 12px;
            background: rgba(8, 5, 11, 0.42);
            display: grid;
            gap: 12px;
        }

        .audit-detail-title {
            color: #FFFFFF;
            font-weight: 950;
        }

        .audit-change-group {
            display: grid;
            gap: 0;
            overflow: hidden;
            border: 1px solid rgba(168, 85, 247, 0.12);
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.02);
        }

        .audit-change-table-head,
        .audit-detail-change {
            display: grid;
            grid-template-columns: minmax(170px, 1fr) minmax(140px, 1fr) 28px minmax(140px, 1fr);
            gap: 10px;
            align-items: start;
        }

        .audit-change-table-head {
            padding: 7px 10px;
            background: rgba(255, 255, 255, 0.04);
            color: var(--muted);
            font-size: 0.78rem;
            font-weight: 900;
            text-transform: uppercase;
        }

        .audit-detail-change {
            padding: 9px 10px;
            border-top: 1px solid rgba(168, 85, 247, 0.10);
            color: var(--text);
            line-height: 1.45;
        }

        .audit-change-label {
            color: #FFFFFF;
            font-weight: 850;
            overflow-wrap: anywhere;
        }

        .audit-change-value {
            color: var(--text);
            overflow-wrap: anywhere;
        }

        .audit-change-arrow {
            color: var(--muted);
            text-align: center;
            font-weight: 950;
        }

        .audit-list-change {
            display: grid;
            grid-template-columns: minmax(170px, 1fr) minmax(0, 3fr);
            gap: 8px;
            align-items: center;
            padding: 10px;
            border-top: 1px solid rgba(168, 85, 247, 0.10);
            color: var(--text);
        }

        .audit-delta-stack {
            display: grid;
            gap: 6px;
            align-content: center;
            justify-content: start;
        }

        .audit-delta-row {
            display: flex;
            flex-wrap: wrap;
            gap: 7px;
            justify-content: flex-start;
        }

        .audit-delta {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            max-width: 100%;
            padding: 5px 8px;
            border-radius: 999px;
            font-size: 0.82rem;
            font-weight: 800;
            overflow-wrap: anywhere;
        }

        .audit-delta strong {
            font-size: 0.72rem;
            text-transform: uppercase;
            letter-spacing: 0;
        }

        .audit-delta.added {
            border: 1px solid rgba(34, 197, 94, 0.32);
            background: rgba(34, 197, 94, 0.13);
            color: #BBF7D0;
        }

        .audit-delta.removed {
            border: 1px solid rgba(248, 113, 113, 0.34);
            background: rgba(248, 113, 113, 0.13);
            color: #FECACA;
        }

        .audit-embedded-group {
            display: grid;
            gap: 8px;
            padding-top: 2px;
        }

        .audit-embedded-title {
            color: #FFFFFF;
            font-size: 0.92rem;
            font-weight: 950;
        }

        .audit-text-detail {
            padding: 10px 12px;
            border: 1px solid rgba(168, 85, 247, 0.12);
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.03);
            color: var(--text);
            line-height: 1.5;
            white-space: pre-wrap;
        }

        .case-table {
            display: grid;
            gap: 0;
            overflow: auto;
            border: 1px solid rgba(168, 85, 247, 0.14);
            border-radius: 12px;
        }

        .case-table-row {
            display: grid;
            grid-template-columns: 54px 72px 92px minmax(160px, 1.15fr) minmax(260px, 1.9fr) minmax(160px, 1.1fr) 84px 110px;
            gap: 10px;
            align-items: center;
            min-width: 980px;
            padding: 10px 12px;
            border-top: 1px solid rgba(168, 85, 247, 0.10);
            background: rgba(255, 255, 255, 0.02);
            text-align: left;
            color: var(--text);
        }

        .case-table-row:first-child {
            border-top: 0;
        }

        .case-table-head {
            background: rgba(255, 255, 255, 0.055);
            color: var(--muted);
            font-size: 0.76rem;
            font-weight: 950;
            text-transform: uppercase;
        }

        .case-sort-button {
            display: inline-flex;
            width: fit-content;
            max-width: 100%;
            align-items: center;
            gap: 5px;
            padding: 0;
            border: 0;
            background: transparent;
            color: inherit;
            font: inherit;
            text-transform: inherit;
            cursor: pointer;
        }

        .case-sort-button:hover,
        .case-sort-button.active {
            color: #FFFFFF;
        }

        .case-sort-button::after {
            content: "";
            width: 0;
            height: 0;
            border-left: 4px solid transparent;
            border-right: 4px solid transparent;
            opacity: 0.35;
        }

        .case-sort-button.active.asc::after {
            border-bottom: 6px solid currentColor;
            opacity: 1;
        }

        .case-sort-button.active.desc::after {
            border-top: 6px solid currentColor;
            opacity: 1;
        }

        button.case-table-row {
            border-left: 0;
            border-right: 0;
            border-bottom: 0;
            cursor: pointer;
            font: inherit;
        }

        button.case-table-row:hover {
            background: rgba(168, 85, 247, 0.10);
        }

        .guild-log-table .case-table-row {
            grid-template-columns: 54px minmax(130px, 1fr) 130px minmax(240px, 2fr) 64px 150px;
            min-width: 900px;
        }

        .guild-log-overview {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .log-search-subpanel {
            display: none;
        }

        .log-search-subpanel.active {
            display: block;
        }

        .guild-log-link {
            color: var(--rimu);
            font-weight: 850;
            text-decoration: none;
        }

        .guild-log-link:hover {
            text-decoration: underline;
        }

        .guild-log-detail-code {
            display: block;
            border: 0;
            border-radius: 0;
            margin: 0;
            padding: 0;
            color: var(--text);
            background: transparent;
            font: inherit;
            white-space: pre-wrap;
            overflow-wrap: anywhere;
        }

        .guild-log-detail-link {
            color: #F0ABFC;
            font-weight: 800;
            text-decoration: none;
        }

        .guild-log-detail-link:hover {
            text-decoration: underline;
        }

        .guild-log-colour-swatch {
            display: inline-block;
            width: 42px;
            height: 16px;
            border: 1px solid rgba(255, 255, 255, 0.28);
            border-radius: 4px;
            margin: 0 4px;
            vertical-align: -3px;
            box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.20);
        }

        .log-thumbnail {
            display: inline-block;
            width: auto;
            max-width: 150px;
            max-height: 150px;
            border-radius: 4px;
            margin: 4px 5px 4px 0;
            object-fit: cover;
            vertical-align: top;
        }

        .case-state {
            font-weight: 950;
            color: #BBF7D0;
        }

        .case-state.closed {
            color: #FECACA;
        }

        .user-pill {
            display: grid;
            grid-template-columns: 30px minmax(0, 1fr);
            gap: 8px;
            align-items: center;
            min-width: 0;
        }

        .user-avatar {
            width: 30px;
            height: 30px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.10);
            overflow: hidden;
        }

        .user-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .user-pill > span:last-child {
            display: grid;
            min-width: 0;
        }

        .user-main,
        .user-sub,
        .case-cell-main,
        .case-cell-sub {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .user-main,
        .case-cell-main {
            color: #FFFFFF;
            font-weight: 850;
        }

        .user-sub,
        .case-cell-sub {
            color: var(--muted);
            font-size: 0.78rem;
        }

        .case-detail-grid {
            display: grid;
            gap: 14px;
        }

        .case-detail-bubble {
            border: 1px solid var(--line);
            border-radius: 14px;
            padding: 14px;
            background: rgba(168, 85, 247, 0.06);
        }

        .case-detail-list {
            display: grid;
            grid-template-columns: minmax(130px, 0.35fr) minmax(0, 1fr);
            margin-top: 12px;
        }

        .case-detail-list dt {
            color: var(--muted);
            font-weight: 850;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            padding: 9px 0;
        }

        .case-detail-list dd {
            margin: 0;
            color: var(--text);
            overflow-wrap: anywhere;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            padding: 9px 0;
        }

        .case-detail-list dt:first-of-type,
        .case-detail-list dd:first-of-type {
            border-top: 0;
            padding-top: 0;
        }

        .case-detail-list dt.guild-log-change-title {
            grid-column: 1 / -1;
            color: #F0ABFC;
            padding-bottom: 6px;
        }

        .case-detail-list dd.guild-log-change-value {
            grid-column: 1 / -1;
            border-top: 0;
            padding-top: 0;
        }

        .case-detail-list dd.guild-log-change-value .audit-change-group {
            margin-top: 4px;
        }

        @media (max-width: 760px) {
            .audit-change-table-head {
                display: none;
            }

            .audit-detail-change,
            .audit-list-change {
                grid-template-columns: 1fr;
                gap: 4px;
            }

            .audit-change-arrow {
                text-align: left;
            }
        }

        .log-empty {
            border: 1px dashed var(--line);
            border-radius: 16px;
            padding: 18px;
            color: var(--muted);
            text-align: center;
        }

        .item-list {
            display: grid;
            gap: 10px;
            margin-top: 12px;
        }

        .item-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
            gap: 10px;
            align-items: end;
            padding: 12px;
            border: 1px solid var(--line);
            border-radius: 16px;
            background: rgba(8, 5, 11, 0.46);
        }

        .item-row.wide {
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
        }

        .item-row.ordered-scope-row {
            grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) minmax(130px, 0.45fr) auto;
            align-items: end;
        }

        .ordered-scope-index {
            align-self: center;
            display: grid;
            place-items: center;
            width: 32px;
            height: 32px;
            border-radius: 10px;
            color: #0A0610;
            background: var(--rimu);
            font-size: 0.82rem;
            font-weight: 950;
        }

        .ordered-scope-controls {
            display: flex;
            gap: 6px;
            align-items: center;
        }

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

        .item-row.command-rule-row,
        .item-row.command-rule-row.wide {
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: start;
        }

        .item-row.command-rule-row > div {
            grid-column: 1;
        }

        .item-row.command-rule-row .icon-btn {
            grid-column: 2;
            grid-row: 1;
        }

        .item-row.message-row,
        .item-row.rate-rule-row,
        .item-row.reaction-role-row {
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
        }

        .related-role-toggle {
            min-height: 44px;
            padding: 0;
            border-top: 0;
        }

        .item-title-button {
            width: 100%;
            min-height: 44px;
            border: 0;
            padding: 0;
            color: var(--text);
            background: transparent;
            cursor: pointer;
            font: inherit;
            font-weight: 900;
            text-align: left;
            overflow-wrap: anywhere;
        }

        .item-title-button:hover {
            color: #FFFFFF;
        }

        .item-row.message-row .icon-btn {
            width: 38px;
            min-width: 38px;
            min-height: 38px;
            border-radius: 10px;
        }

        .rate-rule-main {
            display: grid;
            gap: 4px;
            min-width: 0;
            text-align: left;
        }

        .rate-rule-name {
            color: var(--text);
            font-size: 1rem;
            font-weight: 900;
        }

        .rate-rule-meta {
            color: var(--muted);
            font-size: 0.82rem;
            line-height: 1.35;
        }

        .icon-btn {
            min-width: 44px;
            min-height: 44px;
            border: 1px solid var(--line);
            border-radius: 12px;
            color: var(--text);
            background: rgba(168, 85, 247, 0.10);
            cursor: pointer;
            font-weight: 900;
        }

        .modal-overlay {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: rgba(3, 1, 5, 0.72);
            z-index: 5000;
        }

        .modal-overlay.active { display: flex; }

        .modal-panel {
            width: min(760px, 100%);
            max-height: min(86vh, 820px);
            overflow: auto;
            border: 1px solid var(--line);
            border-radius: 22px;
            background: rgba(18, 23, 39, 0.98);
            box-shadow: var(--shadow);
            padding: 20px;
        }

        .modal-panel.ordered-policy-modal {
            width: min(1040px, 100%);
        }

        .modal-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 14px;
        }

        .modal-head h3 { margin: 0; }

        .reaction-role-modal-shell {
            width: min(760px, 100%);
            display: grid;
            gap: 10px;
        }

        .reaction-role-modal-shell .modal-panel {
            width: 100%;
            max-height: min(80vh, 760px);
        }

        .reaction-role-modal .multiselect:not(.multiselect--multiple) .multiselect__tags {
            min-height: 44px;
            max-height: 44px;
            align-items: center;
            padding-top: 6px;
            padding-bottom: 6px;
        }

        .reaction-role-modal .multiselect:not(.multiselect--multiple) .multiselect__value {
            flex-wrap: nowrap;
        }

        .reaction-role-modal .multiselect__input {
            min-height: 0;
        }

        .reaction-role-modal-footer {
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 10px;
            background: rgba(18, 23, 39, 0.98);
            box-shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
        }

        .reaction-role-modal-footer .btn {
            width: 100%;
            margin: 0;
        }

        .modal-two-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 14px;
            margin-top: 14px;
        }

        .modal-two-grid .field,
        .automod-grid .field {
            margin-top: 0;
        }

        .role-scroll {
            max-height: 360px;
            overflow: auto;
            padding-right: 4px;
        }

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

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

        .level-reward-controls {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .automod-card {
            border: 1px solid var(--line);
            border-radius: 16px;
            padding: 14px;
            background: rgba(168, 85, 247, 0.06);
        }

        .automod-card h4 {
            margin: 0 0 12px;
            font-size: 0.98rem;
        }

        .rule-exceptions {
            margin-top: 14px;
            border-top: 1px solid var(--line);
            padding-top: 12px;
        }

        .rule-exceptions summary {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            color: var(--muted);
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 850;
            user-select: none;
        }

        .rule-exceptions summary::after {
            content: "+";
            color: var(--rimu);
            font-size: 1.05rem;
            font-weight: 900;
        }

        .rule-exceptions[open] summary::after { content: "−"; }

        .rule-exceptions-note {
            margin: 8px 0 0;
            color: var(--muted);
            font-size: 0.82rem;
            line-height: 1.4;
        }

        .replacement-list {
            margin: 14px 0 0;
            display: grid;
            gap: 4px;
            color: var(--muted);
            font-size: 0.88rem;
            line-height: 1.4;
        }

        .message-bubble {
            margin-top: 16px;
            padding: 16px;
            border: 1px solid var(--line);
            border-radius: 18px;
            background: rgba(168, 85, 247, 0.06);
        }

        .message-list-row {
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
        }

        .message-summary {
            min-width: 0;
            border: 0;
            padding: 0;
            color: var(--text);
            background: transparent;
            cursor: pointer;
            font: inherit;
            font-weight: 800;
            text-align: left;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .builder-tabs,
        .builder-subtabs {
            position: relative;
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 6px;
            padding: 6px;
            border: 1px solid var(--line);
            border-radius: 14px;
            background: rgba(8, 5, 11, 0.58);
        }

        .builder-tab,
        .builder-subtab {
            min-height: 38px;
            border: 0;
            border-radius: 10px;
            color: var(--muted);
            background: transparent;
            cursor: pointer;
            font: inherit;
            font-weight: 850;
        }

        .builder-tab.active,
        .builder-subtab.active {
            color: #0A0610;
            background: var(--rimu);
        }

        .builder-subtabs {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            margin-top: 14px;
        }

        .builder-pane { display: none; margin-top: 14px; }
        .builder-pane.active { display: block; }

        .role-subpanel { display: none; }
        .role-subpanel.active { display: block; }

        .permission-subpanel { display: none; }
        .permission-subpanel.active { display: block; }

        .levelling-subpanel { display: none; }
        .levelling-subpanel.active { display: block; }

        .discord-shell {
            border: 1px solid rgba(88, 101, 242, 0.18);
            border-radius: 14px;
            overflow: hidden;
            background: #313338;
        }

        .discord-shell.theme-light { background: #FFFFFF; color: #060607; }
        .discord-shell.theme-ash { background: #2B2D31; color: #F2F3F5; }
        .discord-shell.theme-dark { background: #313338; color: #F2F3F5; }
        .discord-shell.theme-midnight { background: #111214; color: #F2F3F5; }

        .discord-message {
            display: grid;
            grid-template-columns: 40px minmax(0, 1fr);
            gap: 12px;
            padding: 18px;
        }

        .discord-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: grid;
            place-items: center;
            overflow: hidden;
            background: #5865F2;
            color: #FFFFFF;
            font-weight: 900;
        }

        .discord-avatar.has-image {
            background: transparent;
        }

        .discord-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .discord-author {
            display: flex;
            align-items: center;
            gap: 8px;
            min-height: 20px;
            color: inherit;
            font-weight: 850;
        }

        .bot-tag {
            border-radius: 4px;
            padding: 1px 4px;
            color: #FFFFFF;
            background: #5865F2;
            font-size: 0.62rem;
            font-weight: 900;
        }

        .discord-timestamp {
            color: #949BA4;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .discord-reply-preview {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            margin-bottom: 5px;
            color: #B5BAC1;
            font-size: 0.84rem;
        }

        .discord-reply-preview::before {
            content: "";
            width: 18px;
            height: 10px;
            border-top: 2px solid #4E5058;
            border-left: 2px solid #4E5058;
            border-radius: 6px 0 0 0;
            flex: 0 0 auto;
        }

        .discord-reply-author {
            color: #DBDEE1;
            font-weight: 850;
            white-space: nowrap;
        }

        .discord-reply-content {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .discord-message-main {
            position: relative;
            min-width: 0;
        }

        .discord-message.deleted .discord-preview-text {
            color: #FCA5A5;
        }

        .discord-message-stamp {
            display: inline-block;
            margin-left: 6px;
            color: #949BA4;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .discord-message-stamp.deleted {
            color: #FCA5A5;
        }

        .discord-attachments {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 8px;
        }

        .discord-attachment {
            display: inline-grid;
            gap: 5px;
            max-width: 220px;
            color: #00A8FC;
            font-size: 0.82rem;
            font-weight: 800;
            text-decoration: none;
        }

        .discord-attachment:hover {
            text-decoration: underline;
        }

        .discord-attachment img {
            max-width: 220px;
            max-height: 180px;
            border-radius: 8px;
            object-fit: cover;
        }

        .discord-edited-chain {
            display: grid;
            gap: 10px;
            margin: 0 18px 18px 70px;
            padding-left: 12px;
            border-left: 2px solid rgba(148, 155, 164, 0.28);
        }

        .discord-edited-label {
            color: #B5BAC1;
            font-size: 0.78rem;
            font-weight: 900;
            text-transform: uppercase;
        }

        .discord-edited-chain .discord-message {
            padding: 0;
            grid-template-columns: minmax(0, 1fr);
        }

        .discord-edited-chain .discord-avatar {
            display: none;
        }

        .discord-editor-input,
        .discord-editor-textarea {
            width: 100%;
            min-height: 28px;
            border: 1px solid transparent;
            border-radius: 6px;
            padding: 4px 6px;
            color: inherit;
            background: rgba(255, 255, 255, 0.08);
            font: inherit;
            line-height: 1.35;
            resize: vertical;
        }

        .discord-editor-autogrow {
            overflow-y: hidden;
            resize: none;
        }

        .discord-editor-title {
            min-height: 32px;
            font-weight: 850;
        }

        .discord-editor-description {
            min-height: 56px;
        }

        .theme-light .discord-editor-input,
        .theme-light .discord-editor-textarea {
            background: rgba(79, 84, 92, 0.08);
        }

        .discord-editor-input:focus,
        .discord-editor-textarea:focus {
            border-color: #5865F2;
            outline: 0;
        }

        .discord-embed {
            display: grid;
            grid-template-columns: 4px minmax(0, 1fr);
            gap: 0;
            max-width: 560px;
            margin-top: 8px;
            overflow: hidden;
            border-radius: 4px;
            background: #2B2D31;
        }

        .theme-light .discord-embed { background: #F2F3F5; }
        .theme-midnight .discord-embed { background: #1E1F22; }

        .discord-embed-border {
            background: var(--embed-color, #A855F7);
        }

        .discord-embed-body {
            display: grid;
            gap: 8px;
            padding: 12px;
        }

        .discord-embed-layout {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 12px;
            align-items: start;
        }

        .discord-embed-main {
            display: grid;
            gap: 8px;
            min-width: 0;
        }

        .discord-embed-author {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            font-size: 0.88rem;
            font-weight: 850;
        }

        .discord-embed-author img {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            object-fit: cover;
            flex: 0 0 auto;
        }

        .discord-embed-thumbnail {
            width: 80px;
            max-height: 80px;
            border-radius: 4px;
            object-fit: cover;
        }

        .discord-embed-image {
            display: block;
            width: 100%;
            max-width: 520px;
            max-height: 320px;
            border-radius: 4px;
            object-fit: contain;
        }

        .discord-preview-text {
            margin: 4px 0 0;
            white-space: pre-wrap;
            overflow-wrap: anywhere;
            line-height: 1.42;
        }

        .discord-preview-title {
            color: #00A8FC;
            font-weight: 850;
        }

        .discord-preview-description,
        .discord-preview-footer {
            white-space: pre-wrap;
            overflow-wrap: anywhere;
            line-height: 1.4;
        }

        .discord-preview-footer {
            color: #B5BAC1;
            font-size: 0.78rem;
        }

        .discord-preview-footer {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .discord-preview-footer img {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            object-fit: cover;
        }

        .discord-preview-link {
            color: #00A8FC;
            text-decoration: none;
        }

        .discord-preview-link:hover {
            text-decoration: underline;
        }

        .discord-mention {
            border-radius: 3px;
            padding: 0 2px;
            color: #DBDEE1;
            background: rgba(88, 101, 242, 0.42);
            font-weight: 650;
        }

        .theme-light .discord-mention {
            color: #5865F2;
            background: rgba(88, 101, 242, 0.16);
        }

        .builder-options {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 14px;
            align-items: end;
            margin-top: 14px;
        }

        .builder-raw {
            min-height: 360px;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
            font-size: 0.82rem;
        }

        .variables-link {
            display: inline-flex;
            margin-top: 14px;
            color: var(--rimu);
            font-weight: 850;
            background: transparent;
            border: 0;
            padding: 0;
            cursor: pointer;
            font: inherit;
        }

        .toggle {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            padding: 12px 0;
            border-top: 1px solid rgba(168, 85, 247, 0.10);
        }

        .toggle:first-child { border-top: 0; padding-top: 0; }
        .toggle span { color: var(--text); font-weight: 650; }
        .toggle small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }

        .switch {
            position: relative;
            width: 54px;
            height: 30px;
            flex: 0 0 auto;
        }

        .switch input { display: none; }

        .slider {
            position: absolute;
            inset: 0;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.14);
            border: 1px solid var(--line);
            transition: 0.2s ease;
        }

        .slider::before {
            content: "";
            position: absolute;
            width: 22px;
            height: 22px;
            left: 3px;
            top: 3px;
            border-radius: 50%;
            background: white;
            transition: 0.2s ease;
        }

        .switch input:checked + .slider {
            background: var(--rimu);
        }

        .switch input:checked + .slider::before {
            transform: translateX(24px);
            background: #0A0610;
        }

        .badge {
            display: inline-flex;
            align-items: center;
            border-radius: 999px;
            padding: 6px 10px;
            color: #0A0610;
            background: var(--rimu);
            font-size: 0.75rem;
            font-weight: 900;
        }

        .status-card {
            display: grid;
            gap: 14px;
        }

        .stat {
            padding: 14px;
            border-radius: 18px;
            border: 1px solid var(--line);
            background: rgba(8, 5, 11, 0.52);
        }

        .stat b { display: block; font-size: 1.25rem; margin-bottom: 3px; }
        .stat span { color: var(--muted); font-size: 0.88rem; }

        .actions {
            position: sticky;
            bottom: 0;
            padding: 16px 0 0;
            background: linear-gradient(to top, rgba(8, 5, 11, 0.96) 0%, rgba(8, 5, 11, 0) 100%);
        }

        .actions-inner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            background: rgba(15, 9, 20, 0.92);
            border: 1px solid var(--line);
            border-radius: 22px;
            padding: 14px;
            backdrop-filter: blur(14px);
        }

        .save-feedback {
            display: grid;
            gap: 6px;
            min-width: 0;
        }

        .save-feedback p { margin: 0; }

        .settings-validation {
            max-width: 780px;
            color: var(--danger);
            font-size: 0.84rem;
            font-weight: 750;
            line-height: 1.4;
        }

        .settings-validation.warning { color: var(--warning); }
        .settings-validation.success { color: var(--success); }

        .flash {
            margin-bottom: 18px;
            padding: 14px 16px;
            border-radius: 18px;
            border: 1px solid rgba(118, 224, 178, 0.35);
            background: rgba(118, 224, 178, 0.12);
            color: #D9FFEF;
            font-weight: 750;
        }

        .hidden { display: none !important; }

        @media (max-width: 850px) {
            .nav { gap: 8px; padding: 7px; }
            .nav-left { gap: 6px; min-width: 0; }
            .brand-title { display: none; }
            .nav-divider { height: 24px; }
            .server-switcher-button { max-width: 44vw; padding-inline: 8px; }
            .account-button { max-width: 38vw; padding-inline: 8px; }
            .account-button img { display: none; }
            .top-menu { min-width: min(260px, calc(100vw - 24px)); }
            .server-switcher .top-menu { left: -54px; }
            .top-grid, .settings-grid, .server-row, .filter-grid, .automod-grid, .builder-options, .item-row, .item-row.wide { grid-template-columns: 1fr; }
            .item-row.message-row, .item-row.rate-rule-row, .item-row.message-list-row { grid-template-columns: minmax(0, 1fr) auto; }
            .page { width: min(100% - 24px, 1320px); padding-top: 20px; }
            .login-card, .card { border-radius: 20px; padding: 22px; }
            .actions-inner, .log-actions { align-items: stretch; flex-direction: column; }
            .btn { width: 100%; }
            .log-settings-row { grid-template-columns: minmax(96px, 0.45fr) minmax(0, 1fr); }
            .log-settings-bulk-row { grid-template-columns: auto minmax(0, 1fr) auto; }
            .log-settings-panel .btn { width: auto; }
        }

/* Final dashboard surface rules */
body { min-width: 320px; }
#dashboard-shell { width: 100%; }
#dashboard-shell > form { width: 100%; }
#dashboard-shell > form > .tab-panel { width: 100%; }
#dashboard-shell > form > .tab-panel > section.section { width: 100%; }
