/* ========== LAYOUT ========== */
#mc-main {
    margin-left: 64px;
    padding-top: 56px;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

@media (max-width: 1023px) {
    #mc-main {
        margin-left: 0 !important;
    }
    #mc-header {
        left: 0 !important;
    }
    /* Sidebar hidden by default on mobile, shown via JS removing -translate-x-full */
    #mc-sidebar.-translate-x-full {
        transform: translateX(-100%) !important;
    }
}

/* ========== SCROLLBAR ========== */
.mc-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.mc-scroll::-webkit-scrollbar-track { background: transparent; }
.mc-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
.mc-scroll::-webkit-scrollbar-thumb:hover { background: #555; }

html:not(.dark) .mc-scroll::-webkit-scrollbar-thumb { background: #ccc; }
html:not(.dark) .mc-scroll::-webkit-scrollbar-thumb:hover { background: #aaa; }

* { scrollbar-width: thin; scrollbar-color: #333 transparent; }
html:not(.dark) * { scrollbar-color: #ccc transparent; }

/* ========== TABULAR NUMS ========== */
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ========== REVEAL ANIMATION ========== */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== ACTIVITY ENTER ========== */
.activity-enter {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== SORTABLE (KANBAN) ========== */
.sortable-ghost { opacity: 0.25; }
.sortable-chosen { box-shadow: 0 0 0 2px rgba(45, 204, 255, 0.3); border-radius: 8px; }

/* ========== TYPING INDICATOR ========== */
.typing-dot {
    animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ========== TIMELINE PULSE ========== */
.pulse-glow {
    animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(45, 204, 255, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(45, 204, 255, 0); }
}

/* ========== STATUS GLOW ========== */
.glow-normal { box-shadow: 0 0 6px rgba(86, 240, 0, 0.4); }
.glow-critical { box-shadow: 0 0 6px rgba(255, 56, 56, 0.4); }
.glow-standby { box-shadow: 0 0 6px rgba(45, 204, 255, 0.4); }
.glow-serious { box-shadow: 0 0 6px rgba(255, 179, 2, 0.4); }
.glow-caution { box-shadow: 0 0 6px rgba(252, 232, 58, 0.4); }

/* ========== TOGGLE SWITCH ========== */
.mc-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #333;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
html:not(.dark) .mc-toggle {
    background: #d4d4d4;
}
.mc-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.mc-toggle.active {
    background: #56F000;
}
.mc-toggle.active::after {
    transform: translateX(16px);
}

/* ========== HEARTBEAT PULSE ========== */
.heartbeat-pulse {
    animation: heartbeatPulse 2s infinite;
}
@keyframes heartbeatPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    25% { transform: scale(1.15); opacity: 0.8; }
    50% { transform: scale(1); opacity: 1; }
    75% { transform: scale(1.1); opacity: 0.85; }
}

/* ========== MODAL OVERLAY ========== */
.mc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}
.mc-modal-overlay[hidden] { display: none; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mc-modal {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.dark .mc-modal {
    background: #111111;
    border-color: #1e1e1e;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== FORM INPUTS ========== */
.mc-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    background: #f5f5f5;
    color: #171717;
    outline: none;
    transition: border-color 0.15s;
}
.mc-input:focus {
    border-color: rgba(45, 204, 255, 0.5);
}
.dark .mc-input {
    background: #0a0a0a;
    border-color: #1e1e1e;
    color: #f5f5f5;
}
.dark .mc-input:focus {
    border-color: rgba(45, 204, 255, 0.5);
}

.mc-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

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

/* ========== SLIDE PANEL (task detail) ========== */
.mc-slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
    background: #fff;
    border-left: 1px solid #e5e5e5;
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}
.dark .mc-slide-panel {
    background: #111111;
    border-color: #1e1e1e;
}
.mc-slide-panel.open {
    transform: translateX(0);
}

/* ========== TASK DETAIL MODAL ========== */
.task-detail-modal {
    position: relative;
    animation: modalSlideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (max-width: 768px) {
    .task-detail-modal {
        width: 95vw !important;
        max-height: 90vh !important;
    }
}

/* ========== ICON PICKER ========== */
.icon-picker-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.icon-picker-item:hover {
    background: #f5f5f5;
}
.dark .icon-picker-item:hover {
    background: #1a1a1a;
}
.icon-picker-item.selected {
    border-color: #2DCCFF;
    background: rgba(45, 204, 255, 0.1);
}

/* ========== COLOR PICKER ========== */
.color-picker-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.color-picker-item.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px #2DCCFF;
}

/* ========== CHAT LAYOUT ========== */
.chat-sidebar {
    width: 240px;
    flex-shrink: 0;
}
@media (max-width: 767px) {
    .chat-sidebar {
        width: 100%;
    }
}

/* ========== CONFIRM DIALOG ========== */
.mc-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ========== ROLE BADGES ========== */
.role-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 16px;
    white-space: nowrap;
}
.role-badge-ceo {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}
.role-badge-head {
    background: rgba(45, 204, 255, 0.12);
    color: #2DCCFF;
}
.role-badge-agent {
    background: rgba(164, 171, 182, 0.12);
    color: #A4ABB6;
}

/* ========== DEPARTMENT HEADER ROW ========== */
.dept-header-row td {
    padding: 8px 16px 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #737373;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
html:not(.dark) .dept-header-row td {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

/* ========== BOARD CHAT PANEL ========== */
.mc-board-chat {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100vw;
    background: #fff;
    border-left: 1px solid #e5e5e5;
    z-index: 85;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.dark .mc-board-chat {
    background: #111111;
    border-color: #1e1e1e;
}
.mc-board-chat.open {
    transform: translateX(0);
}
@media (max-width: 767px) {
    .mc-board-chat {
        width: 100vw;
        z-index: 95;
    }
}

/* Board chat messages */
.bc-message {
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.15s;
}
.bc-message:hover {
    background: #f5f5f5;
}
.dark .bc-message:hover {
    background: #1a1a1a;
}
.bc-message-user {
    background: rgba(45, 204, 255, 0.06);
    border: 1px solid rgba(45, 204, 255, 0.1);
}
.dark .bc-message-user {
    background: rgba(45, 204, 255, 0.06);
}

/* @mention highlight */
.bc-mention {
    color: #2DCCFF;
    font-weight: 500;
}

/* Board chat toggle button */
.bc-toggle-btn {
    position: relative;
}
.bc-unread-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2DCCFF;
    animation: pulseGlow 2s infinite;
}

/* ========== AGENT ICON CONTAINER ========== */
.agent-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
