@font-face {
    font-family: "Interfoam";
    src: url("interfoam.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-darkest: #1a1a1a;
    --bg-dark: #222222;
    --bg-mid: #2a2a2a;
    --bg-light: #333333;
    --bg-lighter: #3d3d3d;
    --bg-hover: #404040;
    --bg-active: #4a4a4a;
    --border: #3a3a3a;
    --border-light: #4a4a4a;
    --text-primary: #d4d4d4;
    --text-secondary: #999999;
    --text-muted: #666666;
    --accent: #b5b5b5;
    --accent-hover: #cccccc;
    --accent-soft: rgba(200, 200, 200, 0.08);
    --danger: #cc4444;
    --success: #6b8e23;
    --bevel-light: #4a4a4a;
    --bevel-dark: #1a1a1a;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --transition: 100ms ease;
    --sidebar-width: 220px;
}

body {
    font-family: "Interfoam", Tahoma, Verdana, Arial, sans-serif;
    background: var(--bg-darkest);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 13px;
}

/* ---- Login Page ---- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #1e1e1e;
}
.login-box {
    background: var(--bg-mid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 380px;
}
.login-box h2 {
    color: var(--text-primary);
    font-size: 18px;
    text-align: center;
    margin-bottom: 4px;
    font-weight: 600;
}
.login-box p.subtitle {
    color: var(--text-secondary);
    text-align: center;
    font-size: 12px;
    margin-bottom: 20px;
}
.login-box label {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
.login-box input[type="text"],
.login-box input[type="password"],
.login-box input[type="url"] {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 14px;
    outline: none;
    font-family: inherit;
}
.login-box input:focus {
    border-color: var(--text-secondary);
}
.login-box button {
    width: 100%;
    padding: 8px;
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    font-family: inherit;
}
.login-box button:hover {
    background: var(--bg-hover);
}
.login-box button:active {
    background: var(--bg-active);
}
.login-box .toggle {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}
.login-box .toggle a {
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: underline;
}
.login-box .error-msg {
    color: var(--danger);
    font-size: 12px;
    margin-bottom: 10px;
    display: none;
    padding: 6px 10px;
    background: rgba(204, 68, 68, 0.1);
    border: 1px solid rgba(204, 68, 68, 0.3);
    border-radius: var(--radius-sm);
}
.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.color-row input[type="color"] {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: none;
    cursor: pointer;
    padding: 2px;
}
.color-row .hex-preview {
    color: var(--text-muted);
    font-size: 12px;
    font-family: "SF Mono", "Consolas", monospace;
}

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

/* Channel sidebar */
.channel-sidebar {
    width: var(--sidebar-width);
    min-width: 160px;
    max-width: 400px;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    position: relative;
}
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 50;
    transition: background 200ms;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: var(--text-muted);
}
.channel-header {
    height: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-mid);
    border-bottom: 1px solid var(--border);
}
.channel-header img {
    height: 22px;
    width: auto;
}
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.channel-category {
    padding: 12px 8px 2px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.channel-category .category-chevron {
    font-size: 10px;
    margin-right: 4px;
    transition: transform 200ms ease;
    display: inline-block;
    font-style: normal;
}
.channel-category .category-chevron.collapsed {
    transform: rotate(0deg);
}
.channel-category .category-chevron.expanded {
    transform: rotate(90deg);
}
.channel-category .add-btn {
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
    background: none;
    border: none;
    line-height: 1;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.channel-category .add-btn:hover {
    color: var(--text-primary);
}
.channel-items-container {
    overflow: hidden;
    transition: max-height 200ms ease;
}
.channel-items-container.collapsed {
    max-height: 0 !important;
}
.channel-item {
    display: flex;
    align-items: center;
    padding: 4px 8px 4px 10px;
    margin: 1px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
    gap: 4px;
    transition:
        background var(--transition),
        color var(--transition);
    overflow: hidden;
    min-height: 26px;
    box-sizing: border-box;
}
.channel-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.channel-item.active {
    background: var(--bg-active);
    color: #fff;
}
.channel-item .hash {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.4;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.channel-item .channel-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
/* Channel drag */
.channel-item[draggable="true"] {
    cursor: grab;
}
.channel-item.dragging {
    opacity: 0.3;
}
.channel-item.drag-over {
    border-top: 2px solid var(--accent);
    margin-top: -1px;
}
/* Channel pop-out & pin button */
.channel-item .popout-btn,
.channel-item .pin-ch-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    padding: 2px;
    margin-left: auto;
    flex-shrink: 0;
}
.channel-item .pin-ch-btn {
    margin-left: 0;
}
.channel-item:hover .popout-btn,
.channel-item:hover .pin-ch-btn {
    display: inline;
}
.channel-item .popout-btn:hover,
.channel-item .pin-ch-btn:hover {
    color: var(--text-primary);
}

/* Board icon */
.channel-item .board-icon {
    font-size: 12px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.4;
}

/* User panel */
.user-panel {
    height: 44px;
    background: var(--bg-darkest);
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 6px;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
}
.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--text-secondary);
}
.user-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-info {
    flex: 1;
    min-width: 0;
}
.user-info .name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-info .status {
    font-size: 10px;
    color: var(--success);
}
.user-panel-btns {
    display: flex;
    gap: 2px;
}
.logout-btn,
.buddies-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: all var(--transition);
}
.logout-btn:hover,
.buddies-btn:hover {
    color: var(--text-primary);
}

/* Chat area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 90vw;
    background: var(--bg-darkest);
}
.chat-header {
    height: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-mid);
    color: var(--text-primary);
}
.chat-header .hash {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 400;
}
.chat-header .channel-name {
    font-weight: 600;
    font-size: 13px;
}
.chat-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
}
.pin-btn,
.popout-chat-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    transition: all var(--transition);
    position: relative;
}
.pin-btn:hover,
.popout-chat-btn:hover {
    color: var(--text-primary);
}
.pin-count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    min-width: 12px;
    height: 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
}
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Message */
.message {
    display: flex;
    gap: 10px;
    padding: 3px 32px 3px 12px;
    position: relative;
    transition: background var(--transition);
}
.message:hover {
    background: rgba(255, 255, 255, 0.02);
}
.message.pinned {
    border-left: 2px solid var(--accent);
    padding-left: 10px;
}
.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
    overflow: hidden;
    cursor: pointer;
    color: var(--text-muted);
}
.msg-avatar:hover {
    opacity: 0.8;
}
.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.msg-body {
    flex: 1;
    min-width: 0;
}
.msg-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.msg-author {
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.msg-author:hover {
    text-decoration: underline;
    opacity: 0.85;
}
.msg-time {
    font-size: 10px;
    color: var(--text-muted);
}
.msg-content {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
    margin-top: 1px;
}
.msg-content .inline-emote {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin: 0 1px;
}
/* Mention styling */
.msg-content .mention-user {
    background: #3a5a8c;
    color: #fff;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
}
.msg-content .mention-user:hover {
    background: #4a6a9c;
}
.msg-content .mention-channel {
    background: #5a5a6a;
    color: #fff;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
}
.msg-content .mention-channel:hover {
    background: #6a6a7a;
}
.msg-content .mention-post {
    background: #3a6a3a;
    color: #fff;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
}
.msg-content .mention-post:hover {
    background: #4a7a4a;
}
.msg-reply {
    font-size: 12px;
    color: var(--text-muted);
    padding: 1px 0 3px;
    border-left: 2px solid var(--border-light);
    padding-left: 8px;
    margin-bottom: 2px;
    opacity: 0.7;
}
.msg-reactions {
    display: flex;
    gap: 3px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1px 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
}
.reaction:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}
.reaction img {
    width: 14px;
    height: 14px;
}

/* System / welcome messages */
.message.system-message {
    padding: 8px 16px;
    gap: 10px;
    background: rgba(107, 142, 35, 0.06);
    border-left: 2px solid var(--success);
    margin: 4px 8px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.message.system-message .msg-avatar {
    width: 22px;
    height: 22px;
    font-size: 12px;
    background: var(--success);
    color: #fff;
    flex-shrink: 0;
}
.message.system-message .msg-content {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: normal;
    line-height: 1.4;
}

/* 3-dot menu */
.msg-actions-trigger {
    position: absolute;
    top: 0;
    right: 4px;
    display: none;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 1px 6px;
    color: var(--text-muted);
    font-size: 13px;
    z-index: 10;
}
.message:hover .msg-actions-trigger {
    display: flex;
}
.msg-actions-trigger:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.msg-actions {
    position: absolute;
    top: 0;
    right: 4px;
    display: none;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 20;
}
.msg-actions.open {
    display: block;
}
.msg-action-item {
    padding: 5px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}
.msg-action-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Message input area */
.chat-input-wrapper {
    padding: 0 12px 16px;
    flex-shrink: 0;
}
.send-btn {
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 10px;
    margin: 3px;
    font-family: inherit;
}
.send-btn:hover {
    background: var(--bg-hover);
}
.send-btn:active {
    background: var(--bg-active);
}
.typing-indicator {
    font-size: 11px;
    color: var(--text-muted);
    padding: 1px 0 4px;
    height: 18px;
    overflow: hidden;
}
.typing-indicator .typing-dots {
    display: inline-block;
    animation: typingPulse 1.4s infinite;
}
@keyframes typingPulse {
    0%,
    80%,
    100% {
        opacity: 0.3;
    }
    40% {
        opacity: 1;
    }
}
.reply-bar {
    background: var(--bg-light);
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    display: none;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.reply-bar.active {
    display: flex;
}
.reply-bar .close-reply {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
}
.reply-bar .close-reply:hover {
    color: var(--text-primary);
}
.chat-input {
    display: flex;
    align-items: center;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 4px 0 10px;
}
.chat-input:focus-within {
    border-color: var(--text-muted);
}
.reply-bar.active + .chat-input {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.chat-input input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 0;
    outline: none;
    font-family: inherit;
}
.chat-input input::placeholder {
    color: var(--text-muted);
}
.emote-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 2px;
}
.emote-btn:hover {
    color: var(--text-primary);
}

/* Mention autocomplete */
.mention-autocomplete {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    max-height: 180px;
    overflow-y: auto;
    display: none;
    z-index: 120;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.5);
}
.mention-autocomplete.open {
    display: block;
}
.mention-item {
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.mention-item:hover,
.mention-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.mention-item .mention-icon {
    font-size: 11px;
    opacity: 0.5;
    width: 14px;
    text-align: center;
}

/* Emote picker */
.emote-picker {
    position: absolute;
    bottom: 60px;
    right: 24px;
    width: 320px;
    max-height: 340px;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    display: none;
    flex-direction: column;
    z-index: 100;
}
.emote-picker.open {
    display: flex;
}
.emote-picker-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.emote-picker-header span {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.emote-picker-header .add-emote-btn {
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    cursor: pointer;
    font-family: inherit;
}
.emote-picker-header .add-emote-btn:hover {
    background: var(--bg-hover);
}
.emote-picker-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 4px;
    gap: 1px;
    flex-shrink: 0;
}
.emote-picker-tab {
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.emote-picker-tab:hover {
    color: var(--text-secondary);
}
.emote-picker-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}
.emote-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    padding: 6px;
    overflow-y: auto;
    flex: 1;
}
.emote-grid-item {
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 20px;
    transition: background var(--transition);
}
.emote-grid-item:hover {
    background: var(--bg-hover);
}
.emote-grid-item img {
    max-width: 24px;
    max-height: 24px;
}
.emote-grid-item .emote-label {
    display: none;
    position: absolute;
    bottom: -20px;
    background: var(--bg-darkest);
    color: var(--text-primary);
    font-size: 10px;
    padding: 2px 6px;
    white-space: nowrap;
    z-index: 101;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.emote-grid-item:hover .emote-label {
    display: block;
}

/* No channel selected */
.no-channel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
}

/* User profile (inside WindowManager window) */
.profile-popover-content {
    display: flex;
    flex-direction: column;
}
.profile-banner {
    height: 50px;
}
.profile-body {
    padding: 0 12px 12px;
}
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--bg-dark);
    margin-top: -28px;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    overflow: hidden;
    color: var(--text-muted);
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-name {
    font-size: 16px;
    font-weight: 700;
    margin-top: 6px;
}
.profile-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}
.profile-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
.profile-bio {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}
.profile-section-content {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
}
.profile-section-content .profile-item {
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
    font-size: 11px;
}
.profile-pin-btn {
    width: 100%;
    padding: 6px;
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 11px;
    border-radius: var(--radius-sm);
    margin-top: 4px;
}
.profile-pin-btn:hover {
    background: var(--bg-hover);
}

/* Pinned messages panel */
.pins-panel {
    position: absolute;
    top: 40px;
    right: 12px;
    width: 380px;
    max-height: 420px;
    background: var(--bg-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    z-index: 150;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.pins-panel.open {
    display: flex;
}
.pins-panel-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
}
.pins-panel-body {
    overflow-y: auto;
    padding: 6px;
    flex: 1;
}
.pinned-msg {
    padding: 8px 10px;
    margin-bottom: 2px;
    transition: background var(--transition);
}
.pinned-msg:hover {
    background: var(--bg-hover);
}
.pinned-msg-author {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}
.pinned-msg-content {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
}
.pinned-msg-unpin {
    font-size: 10px;
    color: var(--danger);
    cursor: pointer;
    margin-top: 2px;
    display: inline-block;
    opacity: 0;
    transition: opacity var(--transition);
}
.pinned-msg:hover .pinned-msg-unpin {
    opacity: 1;
}

/* ---- Source-Style Windows ---- */
.aol-window {
    position: fixed;
    min-width: 280px;
    min-height: 160px;
    background: var(--bg-mid);
    border: 1px solid var(--border-light);
    border-radius: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    z-index: 400;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    transition: height 150ms ease;
}
.aol-window.minimized {
    height: 28px !important;
    min-height: 28px;
    overflow: hidden;
    resize: none;
}
.aol-title-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px 0 8px;
    height: 28px;
    background: var(--bg-light);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.aol-title-text {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aol-minimize-btn,
.aol-close-btn {
    width: 18px;
    height: 18px;
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    border-radius: 0;
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.aol-minimize-btn:hover {
    background: #3a5a8c;
    color: #fff;
}
.aol-close-btn:hover {
    background: var(--danger);
    color: #fff;
}
.aol-window-content {
    flex: 1;
    overflow: auto;
    padding: 0;
    min-height: 0;
}

/* ---- Board ---- */
.board-view {
    padding: 10px;
    background: var(--bg-darkest);
    flex: 1;
    overflow-y: auto;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    font-size: 12px;
}
.board-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.board-header h3 {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}
.board-new-post-btn {
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
}
.board-new-post-btn:hover {
    background: var(--bg-hover);
}
.board-post {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-left: 2px solid var(--text-muted);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    padding: 6px 8px;
}
.board-post-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.board-post-number {
    color: var(--danger);
    font-weight: 700;
    cursor: pointer;
}
.board-post-number:hover {
    text-decoration: underline;
}
.board-post-author {
    color: var(--success);
    font-weight: 700;
}
.board-post-time {
    color: var(--text-muted);
}
.board-post-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}
.board-post-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    padding: 1px 4px;
    font-family: inherit;
}
.board-post-actions button:hover {
    color: var(--text-primary);
}
.board-post-content {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}
.board-post-content .greentext {
    color: #789922;
}
.board-post-content .quote-link {
    color: var(--danger);
    cursor: pointer;
    text-decoration: underline;
}
.board-post-replies {
    margin-left: 16px;
    border-left: 1px solid var(--border);
    padding-left: 8px;
}
.board-post.reply {
    background: var(--bg-mid);
    border-left-color: var(--border-light);
}
.board-post .collapse-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 0 3px;
    font-family: inherit;
}
.board-post .collapse-btn:hover {
    color: var(--text-primary);
}
.board-post-collapsed .board-post-content,
.board-post-collapsed .board-post-replies {
    display: none;
}
.board-new-post-form {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    margin-bottom: 8px;
}
.board-new-post-form textarea {
    width: 100%;
    min-height: 60px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    padding: 6px;
    resize: vertical;
    outline: none;
    font-family: inherit;
}
.board-new-post-form textarea:focus {
    border-color: var(--text-muted);
}
.board-new-post-form button {
    margin-top: 6px;
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* Buddy list */
.buddy-list {
    padding: 6px;
}
.buddy-list-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 6px 6px 3px;
    letter-spacing: 0.04em;
}
.buddy-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    cursor: pointer;
    transition: background var(--transition);
}
.buddy-item:hover {
    background: var(--bg-hover);
}
.buddy-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--text-muted);
}
.buddy-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.buddy-name {
    font-size: 12px;
    font-weight: 500;
}
.buddy-bio {
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* Status bar */
.status-bar {
    background: var(--bg-dark);
    /*display: flex;*/
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    color: var(--text-muted);
    gap: 8px;
    flex-shrink: 0;
    height: 100vh;
    border-left: 1px solid #373737;
}
.status-bar-left {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: 10px;
}
.status-bar-minimized {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.status-bar-win-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    padding: 1px 8px;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-bar-win-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.status-bar-win-tab .win-tab-close {
    font-size: 8px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
}
.status-bar-win-tab .win-tab-close:hover {
    color: var(--danger);
}
.status-bar-users {
    /*display: flex;*/
    align-items: center;
    gap: 6px;
    overflow: hidden;
    flex-shrink: 1;
    min-width: 0;
    margin-left: auto;
}
.status-bar-user {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
}
.status-bar-user:hover {
    color: var(--text-secondary);
}
.status-bar-user .sb-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-bar-user .sb-dot.online {
    background: var(--success);
}
.status-bar-user .sb-dot.offline {
    background: var(--text-muted);
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    flex-shrink: 0;
}
.status-dot.offline {
    background: var(--danger);
}

/* Loading spinner - 3x3 grid */
.loading-grid {
    display: grid;
    grid-template-columns: 1ch 1ch 1ch;
    grid-template-rows: 1em 1em 1em;
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 16px;
    color: var(--text-muted);
    gap: 0;
    line-height: 1;
    text-align: center;
    justify-content: center;
}
.loading-grid .spinner-cell {
    width: 1ch;
    height: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spinChar 3.4s linear infinite;
}
@keyframes spinChar {
    0% {
        content: "|";
    }
    5.88% {
        content: "/";
    }
    11.76% {
        content: "-";
    }
    41.18% {
        content: "-";
    }
    47.06% {
        content: "\\";
    }
    52.94% {
        content: "|";
    }
    58.82% {
        content: "/";
    }
    64.71% {
        content: "-";
    }
    94.12% {
        content: "-";
    }
    100% {
        content: "\\";
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: var(--bg-mid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 380px;
}
.modal h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 14px;
    font-weight: 600;
}
.modal label {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
.modal input,
.modal textarea {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 12px;
    outline: none;
    font-family: inherit;
}
.modal input:focus,
.modal textarea:focus {
    border-color: var(--text-muted);
}
.modal-btns {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}
.modal-btns button {
    padding: 6px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.modal-btns .cancel-btn {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.modal-btns .cancel-btn:hover {
    color: var(--text-primary);
}
.modal-btns .confirm-btn {
    background: var(--bg-lighter);
    color: var(--text-primary);
}
.modal-btns .confirm-btn:hover {
    background: var(--bg-hover);
}

/* Loading container centering */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 60px;
}

/* Pop-out window input */
.aol-window .popout-input-wrapper {
    padding: 6px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.aol-window .popout-input-wrapper .chat-input {
    display: flex;
    align-items: center;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 4px 0 10px;
}
.aol-window .popout-input-wrapper .chat-input:focus-within {
    border-color: var(--text-muted);
}
.aol-window .popout-input-wrapper .chat-input input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 0;
    outline: none;
    font-family: inherit;
}
.aol-window .popout-input-wrapper .chat-input input::placeholder {
    color: var(--text-muted);
}

/* Pins bar */
.pins-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 12px;
    background: var(--bg-mid);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    min-height: 0;
}
.pins-bar:empty {
    display: none;
}
.pins-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.pins-bar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.pins-bar-item .pin-icon {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 10px;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.pins-bar-item .pin-label {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pins-bar-item .pin-unpin {
    font-size: 8px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 1px;
    margin-left: 2px;
}
.pins-bar-item .pin-unpin:hover {
    color: var(--danger);
}
.pin-icon.pin-message {
    background: #8a6030;
}
.pin-icon.pin-channel {
    background: #5a5a6a;
}
.pin-icon.pin-board {
    background: #3a6a3a;
}
.pin-icon.pin-user {
    background: #3a5a8c;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}
