/* ============ MOBILE LAYOUT (< 768px) ============ */
@media (max-width: 768px) {
    /* Hide desktop layout */
    .topbar { display: none !important; }
    .heartbeat-bar { display: none !important; }
    .board-container { display: none !important; }
    .page-header { display: none !important; }
    
    /* Show mobile layout */
    .mobile-layout { display: flex !important; }
    
    /* App container */
    .app {
        flex-direction: column;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    /* Pages need different handling on mobile */
    .page {
        flex-direction: column !important;
    }
    
    #page-tasks.active {
        display: flex !important;
    }
}

/* Mobile layout structure */
.mobile-layout {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Mobile Header */
.mobile-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-shrink: 0;
}

.mobile-header-logo {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #000;
}

.mobile-header-title {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
}

.mobile-header-agents {
    display: flex;
    gap: 4px;
}

.mobile-agent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.mobile-agent-dot.active {
    background: var(--success);
    animation: pulse 1.5s infinite;
}

@keyframes pulse { 
    0%, 100% { opacity: 1; } 
    50% { opacity: 0.4; } 
}

.mobile-header-menu {
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Column Tabs */
.mobile-column-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.mobile-column-tabs::-webkit-scrollbar { 
    display: none; 
}

.mobile-column-tab {
    flex: 1;
    min-width: 70px;
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    cursor: pointer;
}

.mobile-column-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.mobile-tab-count {
    display: inline-block;
    min-width: 18px;
    padding: 2px 6px;
    background: var(--bg-hover);
    border-radius: 10px;
    font-size: 10px;
    margin-left: 4px;
}

/* Task List Container (swipeable) */
.mobile-task-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.mobile-task-wrapper {
    display: flex;
    height: 100%;
    transition: transform 0.3s ease;
}

.mobile-task-list {
    flex: 0 0 100%;
    height: 100%;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Mobile Task Card */
.mobile-task-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    position: relative;
    transition: all 0.15s;
}

.mobile-task-card:active {
    transform: scale(0.98);
    background: var(--bg-hover);
}

.mobile-task-card.working {
    border-color: transparent;
}

.mobile-task-card.working::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 12px;
    padding: 2px;
    background: conic-gradient(from 0deg, var(--accent) var(--progress, 0%), var(--border) var(--progress, 0%));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: --progress 0.4s ease;
}

.mobile-task-title {
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 12px;
    line-height: 1.4;
    padding-right: 30px;
}

.mobile-task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-task-agent {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-agent-avatar {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    background: var(--purple);
}

.mobile-agent-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.mobile-task-priority {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 500;
}

.mobile-task-priority.high { 
    background: rgba(239, 68, 68, 0.15); 
    color: var(--error); 
}
.mobile-task-priority.medium { 
    background: rgba(245, 158, 11, 0.15); 
    color: #f59e0b; 
}
.mobile-task-priority.low { 
    background: rgba(113, 113, 122, 0.15); 
    color: var(--text-tertiary); 
}

.mobile-review-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: rgba(249, 115, 22, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--orange);
}

.mobile-review-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--orange);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

/* Add Task Button */
.mobile-add-task {
    padding: 16px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    color: var(--text-tertiary);
    font-size: 14px;
    text-align: center;
    transition: all 0.15s;
    cursor: pointer;
}

.mobile-add-task:active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 212, 170, 0.05);
}

/* Activity Bottom Sheet */
.mobile-activity-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% - 50px));
    transition: transform 0.3s ease;
    max-height: 60%;
    z-index: 100;
}

.mobile-activity-sheet.open {
    transform: translateY(0);
}

.mobile-activity-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    gap: 8px;
    cursor: pointer;
}

.mobile-activity-bar {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.mobile-activity-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mobile-activity-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.mobile-activity-list {
    padding: 0 16px 16px;
    overflow-y: auto;
    max-height: calc(60vh - 50px);
}

.mobile-activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.mobile-activity-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    background: var(--purple);
}

.mobile-activity-content {
    flex: 1;
}

.mobile-activity-msg {
    font-size: 13px;
    color: var(--text-secondary);
}

.mobile-activity-msg strong {
    color: var(--text-primary);
}

.mobile-activity-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* Mobile Menu Drawer */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg-secondary);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 201;
    display: flex;
    flex-direction: column;
}

.mobile-menu-overlay.open .mobile-menu-drawer {
    transform: translateX(0);
}

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

.mobile-menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-avatar {
    width: 40px;
    height: 40px;
    background: var(--purple);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
}

.mobile-menu-close {
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.mobile-menu-nav {
    flex: 1;
    padding: 16px;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.15s;
}

.mobile-menu-item:active,
.mobile-menu-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mobile-menu-item svg {
    width: 20px;
    height: 20px;
}

.mobile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.mobile-menu-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.mobile-menu-usage {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-hover);
    border-radius: 8px;
    font-size: 14px;
}

.mobile-menu-usage-label {
    color: var(--text-tertiary);
}

.mobile-menu-usage-value {
    font-weight: 600;
    color: var(--accent);
}

/* Empty state */
.mobile-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    text-align: center;
}

.mobile-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.mobile-empty-text {
    font-size: 14px;
}
