/* Discord-like dark theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #202225;
    color: #dcddde;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
}

/* Loading screen */
.loading-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #202225;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 24px;
    animation: logo-bounce 0.6s ease;
}

@keyframes logo-bounce {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #36393f;
    border-top-color: #5865f2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.loading-text {
    color: #72767d;
    font-size: 13px;
    font-weight: 500;
}

/* New messages divider */
.new-divider {
    display: flex;
    align-items: center;
    margin: 4px 16px;
    padding-top: 4px;
}

.new-divider::before {
    content: '';
    flex: 1;
    height: 1px;
    background: #ed4245;
}

.new-divider span {
    color: #ed4245;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0 8px;
}

.new-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ed4245;
}

.app {
    display: flex;
    height: 100vh;
}

/* Server bar */
.server-bar {
    width: 72px;
    min-width: 72px;
    background: #202225;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 8px;
}

.server-icons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.server-bar-divider {
    width: 32px;
    height: 2px;
    background: #36393f;
    border-radius: 1px;
    margin: 4px 0;
}

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #36393f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #dcddde;
    cursor: pointer;
    margin-bottom: 8px;
    transition: border-radius 0.15s, background 0.15s;
}

.server-icon:hover {
    border-radius: 16px;
    background: #5865f2;
}

.server-icon.active {
    border-radius: 16px;
    background: #5865f2;
}

.server-icon.add-server {
    background: #36393f;
    color: #23a55a;
    border-radius: 50%;
}

.server-icon.add-server:hover {
    background: #23a55a;
    color: #fff;
    border-radius: 16px;
}

/* Channel sidebar */
.channel-sidebar {
    width: 240px;
    min-width: 240px;
    background: #2f3136;
    display: flex;
    flex-direction: column;
}

.server-header {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 16px;
    font-weight: 600;
    font-size: 15px;
    color: #fff;
    border-bottom: 1px solid #202225;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.1s;
}

.server-header:hover {
    background: #32353b;
}

.server-header svg {
    color: #b9bbbe;
    transition: color 0.1s;
}

.server-header:hover svg {
    color: #fff;
}

.server-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-action-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #b9bbbe;
    border-radius: 4px;
    cursor: pointer;
}

.header-action-btn:hover {
    background: #36393f;
    color: #fff;
}

.header-action-btn.leave-btn:hover {
    color: #ed4245;
}

.no-server {
    padding: 40px 16px;
    text-align: center;
    color: #72767d;
    font-size: 14px;
}

.add-channel-btn {
    background: transparent;
    border: none;
    color: #b9bbbe;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background 0.1s, color 0.1s;
}

.add-channel-btn:hover {
    background: #36393f;
    color: #dcddde;
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.channel-category {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #8e9297;
    padding: 16px 8px 4px;
    letter-spacing: 0.5px;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin: 1px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: #8e9297;
    transition: background 0.1s, color 0.1s;
    position: relative;
}

.channel-item:hover {
    background: #35373c;
    color: #dcddde;
}

.channel-item.active {
    background: #393c43;
    color: #fff;
}

.channel-edit-btn {
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #8e9297;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s, color 0.1s;
    flex-shrink: 0;
}

.channel-item:hover .channel-edit-btn {
    opacity: 1;
}

.channel-edit-btn:hover {
    color: #fff;
}

.channel-item.active {
    background: #4f545c29;
    color: #fff;
}

.channel-item .hash {
    margin-right: 6px;
    font-size: 18px;
    opacity: 0.7;
}

.channel-item .badge {
    margin-left: auto;
    background: #ed4245;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 8px;
    padding: 0 5px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.channel-item .badge.visible {
    display: flex;
    animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.channel-item:has(.badge.visible) .channel-name-text {
    color: #fff;
    font-weight: 600;
}

.channel-item:has(.badge.visible):not(.active) {
    background: #404249;
    color: #fff;
}

.user-bar {
    height: 52px;
    background: #292b2f;
    display: flex;
    align-items: center;
    padding: 0 8px;
    flex-shrink: 0;
}

.settings-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #b9bbbe;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background 0.1s;
}

.settings-btn:hover {
    background: #36393f;
    color: #dcddde;
}

/* Chat area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #36393f;
    min-width: 0;
    position: relative;
}

.chat-header {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    background: #36393f;
    border-bottom: 1px solid #202225;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    min-width: 0;
}

.header-hash-icon {
    color: #80848e;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.chat-header .channel-name {
    font-weight: 600;
    color: #fff;
    font-size: 15px;
    margin: 0;
    white-space: nowrap;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: #4f545c;
    margin: 0 8px;
    flex-shrink: 0;
}

.chat-header .channel-desc {
    color: #80848e;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toolbar right side */
.header-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.toolbar-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b9bbbe;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s, color 0.1s;
}

.toolbar-icon:hover {
    background: #4f545c52;
    color: #dcddde;
}

.toolbar-icon svg {
    pointer-events: none;
}

.toolbar-icon.clear-btn:hover {
    color: #ed4245;
}

/* Search bar in toolbar */
.header-toolbar .search-bar {
    position: relative;
    display: flex;
    align-items: center;
    width: 144px;
    height: 24px;
    margin-left: 8px;
    transition: width 0.2s ease;
}

.header-toolbar .search-bar:focus-within {
    width: 220px;
}

.header-toolbar .search-bar input {
    width: 100%;
    height: 24px;
    background: #202225;
    border: none;
    border-radius: 4px;
    padding: 0 28px 0 28px;
    color: #dcddde;
    font-size: 13px;
    outline: none;
    transition: background 0.1s;
}

.header-toolbar .search-bar input::placeholder {
    color: #72767d;
}

.header-toolbar .search-bar input:focus {
    background: #18191c;
}

.search-icon-wrapper {
    position: absolute;
    right: 4px;
    top: 0;
    height: 24px;
    display: flex;
    align-items: center;
}

.header-toolbar .search-icon {
    color: #72767d;
    pointer-events: none;
    position: absolute;
    right: 0;
    transition: color 0.1s;
}

.header-toolbar .search-bar:focus-within .search-icon {
    color: #5865f2;
}

.header-toolbar .search-clear {
    color: #b9bbbe;
    cursor: pointer;
    position: absolute;
    right: 0;
    display: none;
}

.header-toolbar .search-clear.visible {
    display: block;
}

.header-toolbar .search-clear:hover {
    color: #dcddde;
}

/* Search results panel */
.search-panel {
    position: absolute;
    top: 48px;
    right: 0;
    bottom: 0;
    width: 400px;
    min-width: 320px;
    background: #2f3136;
    border-left: 1px solid #202225;
    display: none;
    flex-direction: column;
    z-index: 50;
    box-shadow: -4px 0 12px rgba(0,0,0,0.3);
}

.search-panel.visible {
    display: flex;
    animation: panel-slide-in 0.2s ease;
}

@keyframes panel-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.search-panel-header {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 16px;
    background: #2f3136;
    border-bottom: 1px solid #202225;
    flex-shrink: 0;
}

.search-results-count {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.search-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-filter-btn {
    background: transparent;
    border: none;
    color: #b9bbbe;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.1s, color 0.1s;
}

.search-filter-btn:hover {
    background: #36393f;
    color: #dcddde;
}

.search-filter-btn.active {
    background: #404249;
    color: #fff;
}

.search-close {
    background: transparent;
    border: none;
    color: #b9bbbe;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.search-close:hover {
    color: #dcddde;
}

/* Filters/Sort dropdown */
.filters-dropdown {
    display: none;
    position: absolute;
    top: 48px;
    right: 8px;
    width: 280px;
    background: #2f3136;
    border: 1px solid #202225;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    z-index: 60;
    max-height: 400px;
    overflow-y: auto;
}

.filters-dropdown.visible {
    display: block;
    animation: dropdown-fade 0.15s ease;
}

@keyframes dropdown-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #36393f;
}

.filter-item:hover {
    background: #36393f;
}

.filter-item:last-child {
    border-bottom: none;
}

.filter-item.selected {
    background: #404249;
}

.filter-item svg {
    color: #8e9297;
    flex-shrink: 0;
}

.filter-title {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

.filter-sublabel {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 2px;
}

.filter-prefix {
    color: #b9bbbe;
    font-size: 12px;
    font-weight: 600;
}

.filter-value {
    color: #72767d;
    font-size: 12px;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.search-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.search-group-header svg {
    color: #8e9297;
}

.search-group-header .parent-channel {
    color: #8e9297;
    font-size: 11px;
    font-weight: 400;
    margin-left: 4px;
}

.search-result-item {
    padding: 12px 16px;
    margin: 8px 12px;
    background: #2f3136;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    border: 1px solid #202225;
    border-radius: 4px;
}

.search-result-item:hover {
    background: #36393f;
    border-color: #4f545c;
}

.search-result-item:hover .embed {
    border-left-color: #5865f2;
}

.search-result-item .msg-avatar {
    width: 40px;
    height: 40px;
}

.search-result-item .embed {
    max-width: 100%;
}

.search-result-item .sr-jump {
    color: #00aff4;
    font-size: 11px;
    margin-top: 4px;
    text-align: right;
    display: none;
}

.search-result-item:hover .sr-jump {
    display: block;
}

.search-no-results {
    text-align: center;
    color: #72767d;
    padding: 40px 16px;
    font-size: 13px;
}

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

.no-channel {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #8e9297;
    font-size: 16px;
}

/* New Messages Bar */
.new-messages-bar {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    transform: translateY(-100px);
    background: #5865f2;
    border-radius: 0 0 0 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    display: flex;
    align-items: stretch;
    z-index: 100;
    transition: transform 0.2s ease;
    width: 100%;
}

.new-messages-bar.visible {
    transform: translateY(0);
}

.new-messages-jump {
    background: transparent;
    border: none;
    color: #fff;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    flex: 1;
    text-align: left;
    transition: background 0.1s;
}

.new-messages-jump:hover {
    background: rgba(255,255,255,0.1);
}

.new-messages-mark {
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.1s;
    white-space: nowrap;
}

.new-messages-mark:hover {
    background: rgba(255,255,255,0.1);
}

/* Message */
.msg {
    padding: 2px 16px 2px 16px;
    margin-top: 2px;
    transition: background 0.1s;
    position: relative;
}

.msg:hover {
    background: #32353b;
}

/* Flash highlight when jumping to new messages */
.msg.msg-flash {
    animation: msg-flash-anim 2s ease;
}

@keyframes msg-flash-anim {
    0% { background: rgba(88, 101, 242, 0.3); }
    30% { background: rgba(88, 101, 242, 0.15); }
    100% { background: transparent; }
}

/* Unread indicator — yellow line, only on unread messages */
.msg.msg-unread {
    background: rgba(250, 166, 26, 0.05);
}

.msg.msg-unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #faa61a;
}

/* Mention highlight (permanent, but no yellow line) */
.msg.mention .msg-username {
    color: #faa61a;
}

.msg-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

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

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

.msg-username {
    font-weight: 600;
    color: #fff;
    font-size: 15px;
}

.msg-username.mention-color {
    color: #faa61a;
}

.msg-tag {
    font-size: 10px;
    font-weight: 500;
    color: #fff;
    background: #5865f2;
    border-radius: 3px;
    padding: 1px 4px;
    vertical-align: middle;
}

.msg-time {
    font-size: 11px;
    color: #72767d;
}

.msg-text {
    color: #dcddde;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.msg-text .mention {
    background: rgba(250, 166, 26, 0.1);
    color: #faa61a;
    border-radius: 3px;
    padding: 0 2px;
}

/* Embed */
.embed {
    margin-top: 8px;
    border-left: 4px solid #2f3136;
    background: #2f3136;
    border-radius: 0 4px 4px 0;
    padding: 8px 16px 16px 12px;
    max-width: 520px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    position: relative;
}

.embed-content {
    grid-column: 1;
    min-width: 0;
}

.embed-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #fff;
}

.embed-title a {
    color: #00aff4;
    text-decoration: none;
}

.embed-title a:hover {
    text-decoration: underline;
}

.embed-description {
    color: #dcddde;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.embed-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.embed-field-full {
    grid-column: 1 / -1;
}

.embed-field {
    min-width: 0;
}

.embed-field-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    margin-bottom: 2px;
}

.embed-field-value {
    font-size: 13px;
    color: #dcddde;
    line-height: 1.3;
    word-wrap: break-word;
    white-space: normal;
}

.embed-field-value code {
    background: #202225;
    border-radius: 3px;
    padding: 1px 3px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
}

.embed-field-value pre {
    background: #202225;
    border: 1px solid #18191c;
    border-radius: 4px;
    padding: 8px;
    margin-top: 4px;
    overflow-x: visible;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: #b9bbbe;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

.code-block-wrapper {
    position: relative;
    margin-top: 0;
}

.copy-code-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #2f3136;
    border: 1px solid #202225;
    border-radius: 4px;
    color: #b9bbbe;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    z-index: 2;
}

.code-block-wrapper:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: #4f545c;
    color: #fff;
}

.copy-code-btn.copied {
    opacity: 1;
    color: #3ba55d;
}

.code-block-wrapper pre {
    background: #202225;
    border: 1px solid #18191c;
    border-radius: 4px;
    padding: 6px 8px;
    margin-top: 0;
    overflow-x: visible;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: #b9bbbe;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    line-height: 1.3;
}

/* Inline code copy button (Username, Password, etc) */
.inline-code-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.inline-code-wrapper code {
    background: #202225;
    border-radius: 3px;
    padding: 1px 4px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    color: #dcddde;
}

.inline-copy-btn {
    background: transparent;
    border: none;
    color: #b9bbbe;
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    margin-left: 2px;
}

.embed-field:hover .inline-copy-btn {
    opacity: 1;
}

.inline-copy-btn:hover {
    color: #fff;
}

.inline-copy-btn.copied {
    opacity: 1;
    color: #3ba55d;
}

.embed-thumbnail {
    grid-column: 2;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.embed-footer {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: #72767d;
}

.embed-footer-text {
    color: #72767d;
}

.embed-footer-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.embed-attachments {
    grid-column: 1 / -1;
    margin-top: 8px;
}

.embed-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #202225;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 13px;
}

.embed-attachment a {
    color: #00aff4;
    text-decoration: none;
}

.embed-attachment a:hover {
    text-decoration: underline;
}

.embed-attachment-size {
    color: #72767d;
    font-size: 11px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

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

.modal {
    background: #36393f;
    border-radius: 8px;
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #202225;
}

.modal-header h2 {
    font-size: 18px;
    color: #fff;
}

.modal-close {
    background: transparent;
    border: none;
    color: #b9bbbe;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #dcddde;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.webhook-item {
    margin-bottom: 12px;
}

.webhook-item label {
    display: block;
    font-size: 12px;
    color: #8e9297;
    margin-bottom: 4px;
    font-weight: 600;
}

.webhook-item .url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.webhook-item input {
    flex: 1;
    background: #202225;
    border: 1px solid #202225;
    border-radius: 4px;
    padding: 8px 12px;
    color: #dcddde;
    font-size: 13px;
    font-family: monospace;
    outline: none;
}

.webhook-item input:focus {
    border-color: #5865f2;
}

.webhook-item button {
    background: #5865f2;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.webhook-item button:hover {
    background: #4752c4;
}

.loading {
    text-align: center;
    color: #72767d;
    padding: 20px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #202225;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #18191c;
}

/* ===== Member sidebar ===== */
.member-sidebar {
    width: 240px;
    min-width: 240px;
    background: #2f3136;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.member-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.member-group-header {
    color: #8e9297;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 16px 8px 4px;
    letter-spacing: 0.3px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
}

.member-item:hover {
    background: #36393f;
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.member-name {
    color: #b9bbbe;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-item:hover .member-name {
    color: #fff;
}

.owner-crown {
    color: #f0b232;
    flex-shrink: 0;
}

/* ===== Auth page (login/register) ===== */
.auth-page {
    position: fixed;
    inset: 0;
    background: #36393f;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-container {
    width: 480px;
    max-width: 90vw;
    background: #36393f;
    padding: 32px;
    text-align: center;
}

.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.auth-container h2 {
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-container p {
    color: #b9bbbe;
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-error {
    color: #ed4245;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

.auth-error.visible {
    display: block;
}

.auth-label {
    display: block;
    text-align: left;
    color: #b9bbbe;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin: 12px 0 8px;
}

.auth-required {
    color: #ed4245;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    background: #202225;
    border: 1px solid #202225;
    border-radius: 4px;
    color: #fff;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: #5865f2;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: #5865f2;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 24px;
    transition: background 0.15s;
}

.auth-btn:hover {
    background: #4752c4;
}

.auth-toggle {
    color: #b9bbbe;
    font-size: 14px;
    margin-top: 16px;
}

.auth-toggle a {
    color: #5865f2;
    text-decoration: none;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* ===== User bar ===== */
.user-bar {
    height: 52px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    background: #292b2f;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #b9bbbe;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: #36393f;
    color: #ed4245;
}

/* ===== Create server options ===== */
.create-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #2f3136;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}

.create-option:hover {
    border-color: #5865f2;
}

.create-option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #72767d;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
    transition: border-color 0.15s;
}

.create-option-radio.active {
    border-color: #5865f2;
}

.create-option-radio.active::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 10px;
    height: 10px;
    background: #5865f2;
    border-radius: 50%;
}

.create-option-title {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.create-option-desc {
    color: #b9bbbe;
    font-size: 13px;
    margin-top: 4px;
}

/* ===== Invite modal ===== */
.invite-code-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #202225;
    border-radius: 4px;
    padding: 10px 12px;
}

.invite-code-box span {
    flex: 1;
    color: #dcddde;
    font-size: 15px;
    font-family: monospace;
    word-break: break-all;
}

.copy-invite-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2f3136;
    border: none;
    color: #b9bbbe;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.copy-invite-btn:hover {
    background: #36393f;
    color: #fff;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #57f287;
    color: #202225;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    z-index: 30000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: #ed4245;
    color: #fff;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #b9bbbe;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    background: #202225;
    border: 1px solid #202225;
    border-radius: 4px;
    padding: 10px 12px;
    color: #dcddde;
    font-size: 14px;
    outline: none;
    transition: border-color 0.1s;
}

.form-group input:focus {
    border-color: #5865f2;
}

.form-group input::placeholder {
    color: #72767d;
}

.form-hint {
    color: #72767d;
    font-size: 11px;
    margin-top: 4px;
}

.create-btn {
    width: 100%;
    background: #5865f2;
    border: none;
    border-radius: 4px;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.1s;
}

.create-btn:hover {
    background: #4752c4;
}

/* Search popover (filter suggestions) */
.search-popover {
    display: none;
    position: absolute;
    top: 32px;
    right: 0;
    width: 280px;
    background: #2f3136;
    border: 1px solid #202225;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    z-index: 200;
    padding: 0;
}

.search-popover.visible {
    display: block;
}

.search-popover-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #72767d;
    padding: 8px 12px 4px;
    letter-spacing: 0.5px;
}

.search-popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.search-popover-item:hover {
    background: #36393f;
}

.search-popover-item svg {
    color: #b9bbbe;
    flex-shrink: 0;
}

.sp-title {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

.sp-sublabel {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 2px;
}

.sp-prefix {
    color: #b9bbbe;
    font-size: 12px;
    font-weight: 600;
}

.sp-value {
    color: #72767d;
    font-size: 12px;
}
