/* ═══════════════════════════════════════════════════════════════════════════
   Loki Dashboard — SCNX-style Dark Theme
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-hover: #1f2937;
    --bg-active: #7b2fbe22;
    --border: #30363d;
    --border-light: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #7b2fbe;
    --accent-hover: #9333ea;
    --accent-bg: #7b2fbe22;
    --discord-blue: #5865F2;
    --success: #3fb950;
    --warning: #d29922;
    --error: #f85149;
    --sidebar-width: 260px;
    --radius: 8px;
    --radius-lg: 12px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

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

/* ─── App Layout ────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.bot-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.bot-info {
    display: flex;
    flex-direction: column;
}

.bot-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

.bot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--error); }

.sidebar-section {
    padding: 12px 8px;
}

.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 4px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.guild-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.guild-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.guild-item:hover { background: var(--bg-hover); }

.guild-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.guild-name {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.logout-btn {
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}
.logout-btn:hover { color: var(--error); }

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 16px 20px;
}

/* ─── Stats Grid ────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stats-grid-sm {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ─── Dashboard Grid ────────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

/* ─── Server Items ──────────────────────────────────────────────────────── */
.server-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.server-item:last-child { border-bottom: none; }

.server-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.server-name {
    font-weight: 600;
    font-size: 14px;
}

.server-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

/* ─── Log Viewer ────────────────────────────────────────────────────────── */
.log-viewer {
    max-height: 400px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 12px;
}

.log-line {
    padding: 2px 0;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
}
.log-error { color: var(--error); }
.log-warn { color: var(--warning); }
.log-info { color: var(--text-secondary); }

/* ─── Channels Layout ───────────────────────────────────────────────────── */
.channels-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.channel-tree .card-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.channel-category {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 16px 8px 4px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 16px;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.1s;
}
.channel-item.clickable { cursor: pointer; }
.channel-item.clickable:hover { background: var(--bg-hover); color: var(--text-primary); }
.channel-item.active { background: var(--accent-bg); color: var(--accent); }
.channel-item.voice { color: var(--text-muted); }

.channel-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.channel-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Messages ──────────────────────────────────────────────────────────── */
.channel-preview {
    display: flex;
    flex-direction: column;
}

.channel-preview .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
    padding-right: 8px;
}

.message-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}
.message-item:last-child { border-bottom: none; }

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.bot-badge {
    background: var(--discord-blue);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
}

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

.message-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    word-break: break-word;
}
.message-content code {
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 13px;
}

.message-embed {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-left: 4px solid var(--discord-blue);
    border-radius: 4px;
    max-width: 520px;
}

.embed-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.embed-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.embed-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.embed-field {
    flex: 0 0 100%;
}
.embed-field.inline { flex: 0 0 calc(33% - 8px); }

.embed-field-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.embed-field-value {
    font-size: 13px;
    color: var(--text-primary);
}

.embed-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    margin-top: 8px;
}

.message-attachment-img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 4px;
    margin-top: 8px;
}

.message-attachment-file {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.message-input-bar {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

.message-input-bar .text-input {
    flex: 1;
}

/* ─── Editor Layout ─────────────────────────────────────────────────────── */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    flex: 1;
}

@media (max-width: 1200px) {
    .editor-layout { grid-template-columns: 1fr; }
}

.embed-editor {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.embed-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 13px;
}

.field-editor {
    margin-bottom: 8px;
}

.field-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.field-row .text-input { flex: 1; }

.discord-preview {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 200px;
}

/* ─── Config Grid ───────────────────────────────────────────────────────── */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 1200px) {
    .config-grid { grid-template-columns: 1fr; }
}

.control-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ─── Memory Layout ─────────────────────────────────────────────────────── */
.memory-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    flex: 1;
}

@media (max-width: 1200px) {
    .memory-layout { grid-template-columns: 1fr; }
}

.user-list-card .card-body {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.user-item:hover { background: var(--bg-hover); }
.user-item.active { background: var(--accent-bg); }

.user-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.user-item-name {
    font-weight: 600;
    font-size: 14px;
}

.user-item-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.user-detail-card .card-body {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.profile-value {
    font-size: 14px;
    color: var(--text-primary);
}

.profile-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 20px 0 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.facts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fact-tag {
    background: var(--accent-bg);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.convo-message {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}
.convo-message.bot {
    border-left: 3px solid var(--accent);
}
.convo-message.user {
    border-left: 3px solid var(--discord-blue);
}

.convo-speaker {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
}

.convo-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
}

.convo-content {
    font-size: 13px;
    color: var(--text-primary);
    margin-top: 4px;
    line-height: 1.4;
}

/* ─── Form Elements ─────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-label-sm {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.text-input, .select-input, .textarea-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
}
.text-input:focus, .select-input:focus, .textarea-input:focus {
    border-color: var(--accent);
}

.textarea-input {
    resize: vertical;
    min-height: 80px;
}

.select-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.color-input {
    width: 48px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
    padding: 2px;
}

.char-count {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-muted);
    float: right;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.toggle-label input { display: none; }

.toggle-switch {
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}
.toggle-label input:checked + .toggle-switch {
    background: var(--accent);
}
.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(18px);
}

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

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn:hover { background: var(--bg-hover); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: white;
}
.btn-success:hover { opacity: 0.9; }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ─── Utilities ─────────────────────────────────────────────────────────── */
.loading-placeholder {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 14px;
}

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

/* ─── Toast Notifications ───────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: white;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 400px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.info { background: var(--discord-blue); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* MODERATION PANEL STYLES */

.mod-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid #2a2d35;
    overflow-x: auto;
}

.mod-tab {
    padding: 10px 18px;
    background: none;
    border: none;
    color: #8e9297;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}

.mod-tab:hover { color: #dcddde; }
.mod-tab.active { color: #7c5cfc; border-bottom-color: #7c5cfc; }

.mod-panel { padding: 0 24px; }
.mod-panel.hidden { display: none; }

.panel-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-header h2 { margin: 0; font-size: 18px; color: #fff; }
.panel-desc { color: #8e9297; font-size: 13px; margin: 0; }

.cases-list { display: flex; flex-direction: column; gap: 12px; }

.case-card {
    background: #1e2024;
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid #8e9297;
}
.case-card.pending { border-left-color: #FFA500; }
.case-card.banned { border-left-color: #EF4444; }
.case-card.warned { border-left-color: #F59E0B; }
.case-card.muted { border-left-color: #3B82F6; }
.case-card.dismissed { border-left-color: #6B7280; }

.case-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.case-id { font-weight: 700; color: #fff; font-size: 14px; }
.case-time { color: #6B7280; font-size: 12px; margin-left: auto; }

.case-body { font-size: 13px; color: #b5bac1; }
.case-body > div { margin-bottom: 4px; }
.case-body code { background: #2a2d35; padding: 2px 6px; border-radius: 3px; font-size: 12px; }

.case-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #2a2d35; }

[class^='badge-'] {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-scam { background: #EF444433; color: #EF4444; }
.badge-phishing { background: #F59E0B33; color: #F59E0B; }
.badge-spam { background: #3B82F633; color: #3B82F6; }
.badge-slur { background: #8B5CF633; color: #8B5CF6; }
.badge-custom { background: #6B728033; color: #9CA3AF; }
.badge-pending { background: #FFA50033; color: #FFA500; }
.badge-banned { background: #EF444433; color: #EF4444; }
.badge-warned { background: #F59E0B33; color: #F59E0B; }
.badge-muted { background: #3B82F633; color: #3B82F6; }
.badge-dismissed { background: #6B728033; color: #9CA3AF; }
.badge-admin { background: #7C5CFC33; color: #7C5CFC; }
.badge-moderator { background: #22C55E33; color: #22C55E; }
.badge-ban { background: #EF444433; color: #EF4444; }
.badge-warn { background: #F59E0B33; color: #F59E0B; }
.badge-mute { background: #3B82F633; color: #3B82F6; }

.category-filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.cat-btn {
    padding: 6px 14px;
    background: #2a2d35;
    border: none;
    border-radius: 6px;
    color: #8e9297;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.cat-btn:hover { background: #36393f; color: #dcddde; }
.cat-btn.active { background: #7c5cfc; color: #fff; }

.watchlist-grid { display: flex; flex-direction: column; gap: 8px; }

.watchlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #1e2024;
    border-radius: 6px;
}
.watchlist-item .wl-pattern { flex: 1; }
.watchlist-item code { background: #2a2d35; padding: 3px 8px; border-radius: 4px; color: #e2e8f0; font-size: 13px; }
.wl-severity { color: #8e9297; font-size: 12px; text-transform: uppercase; }

.add-form { margin-bottom: 16px; padding: 16px; background: #1e2024; border-radius: 8px; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-input, .form-select {
    padding: 8px 12px;
    background: #2a2d35;
    border: 1px solid #36393f;
    border-radius: 6px;
    color: #dcddde;
    font-size: 13px;
}
.form-input { flex: 1; min-width: 150px; }
.form-select { min-width: 100px; }

.guild-selector { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.guild-selector label { color: #8e9297; font-size: 13px; }

.channel-toggles { display: flex; flex-direction: column; gap: 4px; }

.channel-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #1e2024;
    border-radius: 6px;
}
.channel-name { color: #b5bac1; font-size: 14px; }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #4f545c; border-radius: 24px; transition: 0.3s;
}
.toggle-slider:before {
    position: absolute; content: ''; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: 0.3s;
}
input:checked + .toggle-slider { background: #7c5cfc; }
input:checked + .toggle-slider:before { transform: translateX(20px); }

.allowed-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #1e2024;
    border-radius: 6px;
    margin-bottom: 4px;
}
.au-name { color: #dcddde; font-weight: 600; flex: 1; }
.au-id { color: #6B7280; font-size: 12px; font-family: monospace; }

.instruction-card {
    background: #1e2024;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 8px;
}
.inst-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.inst-id { font-weight: 700; color: #fff; }
.inst-type { color: #8e9297; font-size: 12px; }
.inst-body { font-size: 13px; color: #b5bac1; }
.inst-body > div { margin-bottom: 3px; }

.settings-form { max-width: 500px; }
.setting-group { margin-bottom: 20px; }
.setting-group label { display: block; color: #dcddde; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.setting-group .form-select { width: 100%; margin-bottom: 8px; }

.btn-icon { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; font-size: 14px; transition: all 0.2s; }
.btn-danger-icon { color: #EF4444; }
.btn-danger-icon:hover { background: #EF444422; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-success { background: #22C55E; color: #fff; }
.btn-success:hover { background: #16A34A; }
.btn-danger { background: #EF4444; color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: #F59E0B; color: #000; }
.btn-warning:hover { background: #D97706; }
.btn-info { background: #3B82F6; color: #fff; }
.btn-info:hover { background: #2563EB; }

.empty-state { color: #6B7280; text-align: center; padding: 40px; font-size: 14px; }

/* ─── Global Server Selector ─────────────────────────────────────────────── */

.global-server-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1a1d21;
    border-bottom: 1px solid #2a2d31;
    padding: 12px 24px;
    margin: -24px -24px 24px -24px;
}

.server-selector-container {
    position: relative;
    display: inline-block;
}

.server-selector-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #2a2d31;
    border: 1px solid #3a3d41;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 250px;
}

.server-selector-btn:hover {
    background: #32353a;
    border-color: #7c5cfc;
}

.server-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

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

.server-name {
    flex: 1;
    color: #dcddde;
    font-weight: 600;
    font-size: 14px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    flex-shrink: 0;
    color: #8e9297;
    transition: transform 0.2s;
}

.server-selector-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

.server-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 300px;
    max-height: 400px;
    background: #2a2d31;
    border: 1px solid #3a3d41;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 1000;
}

.server-dropdown-header {
    padding: 12px 16px;
    background: #1e2024;
    border-bottom: 1px solid #3a3d41;
    color: #8e9297;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.server-dropdown-list {
    max-height: 350px;
    overflow-y: auto;
}

.server-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.server-dropdown-item:hover {
    background: #32353a;
}

.server-dropdown-item.selected {
    background: #7c5cfc22;
}

.server-dropdown-item.selected .server-name {
    color: #7c5cfc;
}

.server-dropdown-item .server-icon-wrapper {
    width: 40px;
    height: 40px;
}

.server-dropdown-item .server-name {
    flex: 1;
    color: #dcddde;
    font-weight: 500;
    font-size: 14px;
}

/* ─── Live Messages Page ─────────────────────────────────────────────────── */

.live-messages-container {
    display: flex;
    height: calc(100vh - 200px);
    background: #1e2024;
    border-radius: 8px;
    overflow: hidden;
}

.channel-list {
    width: 240px;
    background: #2a2d31;
    border-right: 1px solid #3a3d41;
    overflow-y: auto;
}

.channel-list-header {
    padding: 16px;
    background: #1e2024;
    border-bottom: 1px solid #3a3d41;
    color: #dcddde;
    font-weight: 600;
    font-size: 14px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s;
    color: #8e9297;
    font-size: 14px;
}

.channel-item:hover {
    background: #32353a;
    color: #dcddde;
}

.channel-item.active {
    background: #7c5cfc22;
    color: #7c5cfc;
}

.channel-icon {
    width: 20px;
    height: 20px;
    color: #6B7280;
}

.messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.messages-header {
    padding: 16px 24px;
    background: #1e2024;
    border-bottom: 1px solid #3a3d41;
    display: flex;
    align-items: center;
    gap: 12px;
}

.messages-header h2 {
    margin: 0;
    color: #dcddde;
    font-size: 16px;
    font-weight: 600;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.message-item {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    transition: background 0.2s;
}

.message-item:hover {
    background: #2a2d3122;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.message-content-wrapper {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.message-author {
    color: #dcddde;
    font-weight: 600;
    font-size: 14px;
}

.message-timestamp {
    color: #6B7280;
    font-size: 12px;
}

.message-text {
    color: #b5bac1;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.no-messages {
    text-align: center;
    color: #6B7280;
    padding: 40px;
    font-size: 14px;
}
