/* ============================================================================
   Zack AI Admin Dashboard - CSS
   Matches zackbot.ai website branding (cyan/dark navy)
   ============================================================================ */

/* CSS Variables */
:root {
    /* Base colors */
    --bg-primary: #0a1628;
    --bg-secondary: rgba(15, 22, 35, 0.9);
    --bg-tertiary: rgba(15, 22, 35, 0.6);

    /* Accent gradient */
    --gradient-primary: linear-gradient(135deg, #00d4ff, #00b8d9);
    --gradient-extended: linear-gradient(135deg, #00d4ff, #00b8d9, #00ffff);

    /* Text colors */
    --text-primary: #e4e4e7;
    --text-secondary: #a0b4c0;
    --text-muted: #6b7f8e;
    --text-accent: #7dd3fc;

    /* Status colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Border colors */
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-accent: rgba(0, 212, 255, 0.3);

    /* Shadows */
    --shadow-primary: 0 4px 20px rgba(0, 212, 255, 0.4);
    --shadow-large: 0 25px 80px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 38px;
}

/* Background Effects */
.bg-grid {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -3;
    pointer-events: none;
}

.bg-gradient {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 100% 50%, rgba(0, 184, 217, 0.1) 0%, transparent 40%),
                radial-gradient(ellipse at 0% 100%, rgba(0, 180, 216, 0.1) 0%, transparent 40%);
    z-index: -2;
    pointer-events: none;
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Typography */
.gradient-text {
    background: var(--gradient-extended);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.error-text { color: var(--error); margin-top: 12px; font-size: 14px; }

/* ============================================================================
   Navbar
   ============================================================================ */

.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 12px 0;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-title {
    font-weight: 700;
    font-size: 18px;
}

.nav-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Task Status Indicator */
.task-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.task-status-indicator:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-accent);
}

.task-status-indicator .indicator-idle,
.task-status-indicator .indicator-working {
    display: none;
    align-items: center;
    justify-content: center;
}

.task-status-indicator.idle .indicator-idle {
    display: flex;
    color: var(--text-muted);
}

.task-status-indicator.working .indicator-working {
    display: flex;
}

.task-status-indicator .indicator-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.task-status-indicator.idle .indicator-text {
    color: var(--text-muted);
}

.task-status-indicator.working .indicator-text {
    color: #67e8f9;
}

/* Spinner Animation */
.task-status-indicator .spinner {
    animation: spin 1s linear infinite;
}

.task-status-indicator .spinner circle {
    stroke-dasharray: 45, 100;
    stroke-dashoffset: 0;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
svg.spin { animation: spin 1s linear infinite; }

/* Pulse effect when working */
.task-status-indicator.working {
    animation: pulse-glow 2s ease-in-out infinite;
    border-color: rgba(167, 139, 250, 0.3);
    background: rgba(167, 139, 250, 0.08);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(167, 139, 250, 0);
    }
    50% {
        box-shadow: 0 0 12px 2px rgba(167, 139, 250, 0.3);
    }
}

.nav-tabs {
    display: flex;
    gap: 8px;
}

.nav-tab {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-icon {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-tab:hover .nav-icon,
.nav-tab.active .nav-icon {
    opacity: 1;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 212, 255, 0.1);
}

.nav-tab.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.btn-icon-small {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    color: var(--text-primary);
}

/* ============================================================================
   Utility / Notification Bar
   ============================================================================ */


/* ============================================================================
   Main Content
   ============================================================================ */

.main-content {
    margin-top: 72px;
    padding: 24px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    transition: margin-right 0.3s;
    container-type: inline-size;
    container-name: main;
}

.main-content.chat-open {
    margin-right: calc(var(--chat-width, 380px) + 20px);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    overflow-x: clip;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    overflow: visible;
    padding-top: 8px;
}

.tab-header-title {
    display: flex;
    align-items: baseline;
    gap: 14px;
}

.tab-header h1 {
    font-size: 28px;
    font-weight: 800;
}

.active-project-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.25);
    padding: 4px 14px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.filters {
    display: flex;
    gap: 12px;
    align-items: center;
    overflow: visible;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 212, 255, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-accent);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 11px;
    padding: 0 4px;
    text-decoration: underline;
    font-weight: 500;
}

.btn-link:hover {
    color: var(--accent-secondary, #818cf8);
}

.btn-xs {
    font-size: 11px;
    padding: 2px 6px;
}

/* ============================================================================
   Form Elements
   ============================================================================ */

.input, .select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    transition: all 0.2s;
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--border-accent);
    background: rgba(255, 255, 255, 0.08);
}

.select {
    cursor: pointer;
    width: auto;
    min-width: 150px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.select option {
    background: #1a1a2e;
    color: #f1f1f1;
    padding: 10px;
}

.select option:hover,
.select option:focus,
.select option:checked {
    background: #2d2d44;
    color: #ffffff;
}

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

.checkbox-label input {
    accent-color: #00d4ff;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ============================================================================
   Media Library
   ============================================================================ */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.media-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.media-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.media-thumbnail {
    width: 100%;
    height: 160px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.media-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumbnail .media-icon {
    font-size: 48px;
    opacity: 0.5;
}

/* File Type Thumbnails */
.file-thumbnail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 8px;
}

.file-thumbnail svg {
    opacity: 0.9;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.file-thumbnail .file-ext {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Video Thumbnail with Frame */
.video-thumb-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.video-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

.media-card:hover .video-play-overlay {
    opacity: 1;
}

.video-play-overlay svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

/* Fallback video thumbnail (icon-based) */
.video-thumbnail {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(0, 184, 217, 0.3));
}

.video-thumbnail svg {
    color: #f87171;
}

.video-thumbnail .file-ext {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* PDF Thumbnail */
.pdf-thumbnail {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.3));
}

.pdf-thumbnail svg {
    color: #f87171;
}

.pdf-thumbnail .file-ext {
    background: rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

/* LaTeX Template Thumbnail */
.latex-thumbnail {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.3));
}

.latex-thumbnail svg {
    color: #4ade80;
}

.latex-thumbnail .file-ext {
    background: rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

/* Other File Types */
.other-thumbnail {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 184, 217, 0.2));
}

.other-thumbnail svg {
    color: #7dd3fc;
}

.other-thumbnail .file-ext {
    background: rgba(0, 212, 255, 0.3);
    color: #c7d2fe;
}

/* Website Thumbnail */
.website-thumbnail {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.3));
}

.website-thumbnail svg {
    color: #4ade80;
}

.website-thumbnail .file-ext {
    background: rgba(34, 197, 94, 0.3);
    color: #86efac;
    text-transform: uppercase;
}

/* Document Thumbnail */
.document-thumbnail {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(37, 99, 235, 0.3));
}

.document-thumbnail svg {
    color: #60a5fa;
}

.document-thumbnail .file-ext {
    background: rgba(14, 165, 233, 0.4);
    color: #bfdbfe;
}

/* Website Preview in Modal */
.website-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.website-preview-icon {
    margin-bottom: 20px;
    color: #4ade80;
}

.website-preview h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.website-url {
    color: var(--text-accent);
    text-decoration: none;
    font-size: 16px;
    word-break: break-all;
}

.website-url:hover {
    text-decoration: underline;
}

.website-description {
    color: var(--text-secondary);
    margin-top: 16px;
    max-width: 500px;
    line-height: 1.6;
}

/* PDF Preview in Modal */
.pdf-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.pdf-preview-icon {
    margin-bottom: 20px;
    color: #ef4444;
}

.pdf-preview h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Audio Preview in Modal */
.audio-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.audio-icon {
    margin-bottom: 20px;
    color: #67e8f9;
}

.audio-preview h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    max-width: 500px;
    word-wrap: break-word;
}

.audio-preview audio {
    max-width: 500px;
    border-radius: 8px;
}

.audio-description {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 14px;
}

.audio-meta {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 6px;
}

.audio-meta strong {
    color: var(--text-primary);
}

/* Audio Thumbnail in Grid */
.audio-thumbnail {
    background: linear-gradient(135deg, #0891b2 0%, #67e8f9 100%);
}

.media-type-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.walkthrough-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #00d4ff, #00b8d9);
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.4);
}

.media-details {
    padding: 16px;
}

.media-name {
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.media-customer {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 212, 255, 0.15);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-accent);
    margin-top: 8px;
}

.media-path {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
}

/* Media Tag Pills */
.media-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.media-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-tag-pill.tag-color-0 { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.media-tag-pill.tag-color-1 { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.media-tag-pill.tag-color-2 { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.media-tag-pill.tag-color-3 { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.media-tag-pill.tag-color-4 { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.media-tag-pill.tag-color-5 { background: rgba(168, 85, 247, 0.2); color: #c4b5fd; }

/* Media Selection Checkbox */
.media-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.media-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.media-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    transition: all 0.2s;
}

.media-checkbox:hover .checkmark {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.7);
}

.media-checkbox input:checked ~ .checkmark {
    background: var(--gradient-primary);
    border-color: transparent;
}

.media-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.media-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.media-lock {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
    padding: 4px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
}

.media-lock:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.7);
}

.media-lock svg {
    width: 100%;
    height: 100%;
}

.media-card.locked .media-lock {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.2);
}

.media-card.locked .media-lock:hover {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.35);
}

.media-trash {
    position: absolute;
    top: 44px;
    right: 12px;
    z-index: 10;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
    padding: 4px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
}

.media-card:hover .media-trash {
    opacity: 1;
}

.media-trash:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.3);
}

.media-trash svg {
    width: 100%;
    height: 100%;
}

.media-create-post {
    position: absolute;
    top: 80px;
    right: 12px;
    z-index: 10;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
    padding: 4px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
}

.media-card:hover .media-create-post {
    opacity: 1;
}

.media-create-post:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.3);
}

.media-create-post svg {
    width: 100%;
    height: 100%;
}

.btn-create-post {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #00d4ff, #06b6d4);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    justify-content: center;
}

.btn-create-post:hover {
    background: linear-gradient(135deg, #4f46e5, #0891b2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
}

.media-card.locked .media-thumbnail {
    opacity: 0.6;
}

.media-checkbox.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.media-card {
    position: relative;
}

.media-card.selected {
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3);
}

/* Media Grid Mobile - Two columns */
@media (max-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .media-thumbnail {
        height: 100px;
    }
    .media-details {
        padding: 10px;
    }
    .media-name {
        font-size: 12px;
        margin-bottom: 4px;
    }
    .media-meta {
        font-size: 10px;
    }
    .media-customer {
        font-size: 10px;
        padding: 2px 8px;
        margin-top: 4px;
    }
    .media-path {
        font-size: 9px;
        margin-top: 2px;
    }
    .media-type-badge {
        font-size: 9px;
        padding: 2px 6px;
    }
}

/* Bulk Action Bar */
.bulk-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    animation: slideDown 0.2s ease;
    position: sticky;
    top: 80px;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: visible;
    flex-wrap: wrap;
    gap: 10px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bulk-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bulk-info #selected-count {
    font-weight: 600;
    color: var(--text-accent);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--text-primary);
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-actions .btn-small {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.bulk-actions .btn-danger {
    position: relative;
    overflow: visible;
}

.bulk-actions .select {
    min-width: 180px;
}

.bulk-tag-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bulk-tag-input .input {
    width: 120px;
    padding: 6px 10px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .bulk-action-bar {
        flex-direction: column;
        gap: 16px;
    }

    .bulk-info, .bulk-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .bulk-actions .select {
        min-width: 150px;
        flex: 1;
    }

    .bulk-tag-input .input {
        width: 100px;
    }
}

/* ============================================================================
   Project Switcher (Task Board)
   ============================================================================ */

.project-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.project-pill {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-pill:hover {
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.project-pill.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.pill-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.project-pill.active .pill-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Add Board pill */
.add-board-pill {
    border-style: dashed !important;
    border-color: var(--border-accent) !important;
    color: var(--text-accent) !important;
    background: transparent !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    padding: 6px 12px !important;
    min-width: 32px;
    justify-content: center;
}
.add-board-pill:hover {
    background: rgba(0, 212, 255, 0.1) !important;
    border-style: solid !important;
}

/* Board Selector — multiselect dropdown */
.board-selector {
    position: relative;
    display: inline-flex;
    align-self: center;
}
.board-selector-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.board-selector-btn:hover {
    border-color: var(--border-accent);
    color: var(--text-primary);
}
.board-selector-btn .bs-icon {
    font-size: 0.7rem;
    opacity: 0.6;
}
.board-selector-btn .bs-arrow {
    font-size: 9px;
    margin-left: 2px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.board-selector.bs-open .bs-arrow {
    transform: rotate(180deg);
}
.board-selector-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 6px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.15s ease;
}
.board-selector.bs-open .board-selector-panel {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bs-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
    width: 100%;
}
.bs-option:hover {
    background: rgba(255, 255, 255, 0.05);
}
.bs-check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    font-size: 10px;
    color: transparent;
}
.bs-option.bs-selected .bs-check {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
}
.bs-option .bs-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bs-option .bs-cnt {
    background: rgba(0, 212, 255, 0.2);
    color: var(--text-accent);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: auto;
    flex-shrink: 0;
}
.bs-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}
.bs-action {
    color: var(--text-accent) !important;
    font-weight: 600;
}

/* Add Board compact modal */
.modal-board-compact {
    max-width: 400px;
}

/* Mobile dropdown add board option */
.pdd-add-board {
    border-top: 1px solid var(--border-subtle);
    margin-top: 4px;
    padding-top: 12px !important;
    color: var(--text-accent) !important;
    font-weight: 600;
}

/* ============================================================================
   Kanban Board
   ============================================================================ */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    min-height: calc(100vh - 200px);
    overflow-x: hidden;
}

.blocked-column {
    border-color: rgba(239, 68, 68, 0.3);
}

.blocked-column .kanban-column-header {
    border-image: linear-gradient(135deg, #ef4444, #f97316) 1;
}

.blocked-column .column-count {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.kanban-column {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid;
    border-image: var(--gradient-primary) 1;
}

.column-title {
    font-weight: 700;
    font-size: 14px;
}

.column-count {
    background: rgba(0, 212, 255, 0.2);
    color: var(--text-accent);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.kanban-tasks {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100px;
    overflow-y: auto;
}

.kanban-tasks.drag-over {
    background: rgba(0, 212, 255, 0.1);
    border-radius: 12px;
}

.task-card {
    background: rgba(15, 22, 35, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
    cursor: grab;
    transition: all 0.2s;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.task-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.task-card.priority-1 { border-left: 3px solid var(--warning); }
.task-card.priority-2 { border-left: 3px solid var(--error); }

.task-card.pinned {
    background: rgba(30, 60, 40, 0.4);
    border-color: rgba(100, 200, 120, 0.3);
}

.task-card {
    position: relative;
}

.task-send-todo-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    opacity: 0.5;
}

.task-card:hover .task-send-todo-btn {
    opacity: 1;
}

.task-send-todo-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent);
}

.task-kill-btn {
    position: absolute;
    top: 8px;
    right: 44px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    transition: all 0.2s;
    opacity: 0.5;
}

.task-card:hover .task-kill-btn {
    opacity: 1;
}

.task-kill-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ff6b6b;
}

.task-pin-btn {
    position: absolute;
    top: 8px;
    right: 44px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    opacity: 0.5;
}

.task-card:hover .task-pin-btn {
    opacity: 1;
}

.task-pin-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.task-pin-btn.pinned {
    opacity: 1;
    color: var(--success);
    background: rgba(100, 200, 120, 0.15);
}

.task-pin-btn.pinned:hover {
    background: rgba(100, 200, 120, 0.25);
}

.done-toggle-btn {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.done-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.task-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    padding-right: 70px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-id {
    font-weight: 500;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-right: 4px;
}

.task-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.task-customer {
    color: var(--text-accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 60%;
}

.task-source {
    color: var(--text-muted);
    white-space: nowrap;
}

.task-source.telegram::before {
    content: '✈ ';
}

.task-pipeline-badge {
    font-size: 0.7rem;
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

#task-worker:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #8b5cf6;
}

.task-card-inner {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.task-worker-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 6px;
    min-height: 100%;
    border-radius: 3px;
    font-size: 0;
    font-weight: 700;
    color: white;
    line-height: 1;
    flex-shrink: 0;
}

.task-card-content {
    flex: 1;
    min-width: 0;
}

/* ============================================================================
   Worker Status Panel (Kanban)
   ============================================================================ */

/* Search + Worker dropdown row */
.task-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 4px;
}

.task-search-row .task-search-bar {
    margin: 0;
    flex: 1;
    min-width: 0;
}

/* Worker Dropdown */
.wsp-dropdown {
    position: relative;
    flex-shrink: 0;
}

.wsp-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.wsp-dropdown-btn:hover {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
}

.wsp-dropdown-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.wsp-dropdown.wsp-dd-open .wsp-dropdown-arrow {
    transform: rotate(180deg);
}

.wsp-summary-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}

.wsp-summary-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wsp-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 100;
    min-width: 340px;
    max-width: 520px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: wsp-dd-slide 0.15s ease-out;
}

@keyframes wsp-dd-slide {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.wsp-dropdown.wsp-dd-open .wsp-dropdown-panel {
    display: block;
}

.worker-status-panel {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.worker-status-panel:empty {
    display: none;
}

.wsp-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    font-size: 12px;
    transition: all 0.2s;
    max-width: 320px;
    overflow: hidden;
}

.wsp-badge.wsp-idle {
    opacity: 0.6;
}

.wsp-badge.wsp-working {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
}

.wsp-badge.wsp-stale {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

.wsp-badge.wsp-filtered {
    border-color: rgba(0, 212, 255, 0.8);
    background: rgba(0, 212, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3);
    opacity: 1 !important;
}

.wsp-badge:hover {
    opacity: 1 !important;
    transform: translateY(-1px);
}

/* Task Search Bar */
.task-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 400px;
}

.task-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.task-search-input {
    width: 100%;
    padding: 8px 36px 8px 36px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.task-search-input:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
}

.task-search-input::placeholder {
    color: var(--text-muted);
}

.task-search-clear {
    position: absolute;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.task-search-clear:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.task-search-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 16px 8px;
    opacity: 0.6;
}

.worker-filter-banner {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 6px 0;
    border-radius: 8px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    font-size: 12px;
    animation: wfb-slide-in 0.2s ease-out;
}

@keyframes wfb-slide-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.wfb-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.wfb-name {
    color: var(--text-primary);
    font-weight: 600;
}

.wfb-clear {
    margin-left: auto;
    background: none;
    border: 1px solid rgba(0, 212, 255, 0.4);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: all 0.15s;
}

.wfb-clear:hover {
    background: rgba(0, 212, 255, 0.2);
    color: var(--text-primary);
}

.wsp-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.wsp-name {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.wsp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wsp-dot-idle {
    background: #6b7280;
}

.wsp-dot-working {
    background: #f59e0b;
    animation: wsp-pulse 1.5s ease-in-out infinite;
}

.wsp-dot-stale {
    background: #ef4444;
    animation: wsp-blink 0.8s ease-in-out infinite;
}

@keyframes wsp-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

@keyframes wsp-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.wsp-task-preview {
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.wsp-working .wsp-task-preview {
    color: #f59e0b;
}

.wsp-stale .wsp-task-preview {
    color: #ef4444;
}

.wsp-queue-count {
    background: rgba(0, 212, 255, 0.3);
    color: var(--text-accent);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Legacy toggle (no longer used — dropdown replaces it) */
.wsp-toggle {
    display: none;
}

/* ---- Mobile Project Dropdown (replaces pills) ---- */
.project-dropdown {
    display: none;  /* hidden on desktop */
}

.project-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.project-dropdown-btn:active {
    background: var(--bg-secondary);
}

.project-dropdown-btn .pdd-arrow {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.project-dropdown.pdd-open .pdd-arrow {
    transform: rotate(180deg);
}

.project-dropdown-btn .pdd-count {
    background: rgba(0, 212, 255, 0.3);
    color: var(--text-accent);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.project-dropdown-list {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.project-dropdown.pdd-open .project-dropdown-list {
    display: flex;
}

.pdd-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    transition: background 0.15s;
}

.pdd-option:active {
    background: rgba(255, 255, 255, 0.05);
}

.pdd-option.pdd-active {
    background: rgba(0, 212, 255, 0.15);
    color: var(--text-accent);
    font-weight: 600;
}

.pdd-option .pdd-count {
    background: rgba(0, 212, 255, 0.2);
    color: var(--text-accent);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* ---- Mobile Worker Activity Bar (replaces toggle+badges) ---- */
.wsp-activity-bar {
    display: none;  /* hidden on desktop */
}

.wsp-activity-bar .wsp-activity-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    border: 1px solid transparent;
    background: transparent;
}

.wsp-activity-item.wsp-act-working {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.06);
    color: #f59e0b;
}

.wsp-activity-item.wsp-act-stale {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.06);
    color: #ef4444;
}

.wsp-activity-item .wsp-act-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wsp-act-working .wsp-act-dot {
    background: #f59e0b;
    animation: wsp-pulse 1.5s ease-in-out infinite;
}

.wsp-act-stale .wsp-act-dot {
    background: #ef4444;
    animation: wsp-blink 0.8s ease-in-out infinite;
}

.wsp-activity-item .wsp-act-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.wsp-activity-item .wsp-act-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Mobile: project dropdown + worker activity bar */
@media (max-width: 768px) {
    /* Hide pill switcher, show dropdown */
    .project-switcher {
        display: none !important;
    }
    .project-dropdown {
        display: block;
        margin-bottom: 6px;
    }

    /* Hide worker dropdown on mobile, show activity bar instead */
    .wsp-dropdown {
        display: none !important;
    }
    .wsp-activity-bar {
        display: flex;
        gap: 4px;
        flex-wrap: wrap;
        margin-bottom: 6px;
    }
    /* Hide activity bar entirely when empty (no active workers) */
    .wsp-activity-bar:empty {
        display: none;
    }

    /* --- Compact Task Board header on mobile --- */
    #tab-tasks .tab-header {
        margin-bottom: 8px;
        padding-top: 4px;
    }
    #tab-tasks .tab-header h1 {
        font-size: 20px;
    }
    /* Hide redundant project label — dropdown shows active project */
    .active-project-label {
        display: none !important;
    }
}

/* ============================================================================
   Log Viewer
   ============================================================================ */

.terminal-window {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: var(--shadow-large);
    overflow: hidden;
}

.terminal-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #eab308; }
.dot-green { background: #22c55e; }

.terminal-title {
    flex: 1;
    font-size: 13px;
    color: var(--text-muted);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--success);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Crawler activity indicator */
.crawler-current-activity {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 6px 12px;
    background: var(--surface-elevated);
    border-radius: 20px;
}

.activity-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.activity-indicator.activity-crawling {
    background: #22c55e;
}

.activity-indicator.activity-sleeping {
    background: #f59e0b;
    animation: pulse 3s infinite;
}

.activity-indicator.activity-idle {
    background: #6b7280;
    animation: none;
}

.activity-indicator.activity-starting {
    background: #0ea5e9;
}

.activity-indicator.activity-unknown {
    background: #6b7280;
    animation: none;
}

.activity-text {
    font-weight: 500;
    color: var(--text-primary);
}

.activity-domain {
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Enrichment Status */
#enrichment-status {
    margin-top: 16px;
    padding: 16px;
    background: rgba(15, 22, 35, 0.6);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

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

.enrichment-daemon-status {
    font-weight: 600;
    color: var(--text-primary);
}

.enrichment-current-site {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 8px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enrichment-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.enrichment-stat {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    align-items: center;
    gap: 8px;
}

.enrichment-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.enrichment-value {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

.enrichment-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    min-width: 100px;
}

.enrichment-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.enrichment-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    width: 40px;
    text-align: right;
}

.enrichment-queue {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.log-viewer {
    height: calc(100vh - 280px);
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 48px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.log-entry {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    display: flex;
    gap: 12px;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

.log-time {
    color: var(--text-muted);
    white-space: nowrap;
}

.log-category {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.log-category.task { background: rgba(0, 212, 255, 0.2); color: #7dd3fc; }
.log-category.chat { background: rgba(0, 184, 217, 0.2); color: #a5f3fc; }
.log-category.telegram { background: rgba(14, 165, 233, 0.2); color: #93c5fd; }
.log-category.system { background: rgba(161, 161, 170, 0.2); color: #a1a1aa; }
.log-category.error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.log-category.claude { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; }
.log-category.tool { background: rgba(34, 197, 94, 0.2); color: #86efac; }

.log-message {
    flex: 1;
    word-break: break-word;
}

/* ============================================================================
   Chat Panel
   ============================================================================ */

.chat-panel {
    position: fixed;
    right: 0;
    top: 65px;
    bottom: 38px;
    width: var(--chat-width, 380px);
    background: rgba(15, 22, 35, 0.95);
    border-left: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    z-index: 900;
    transform: translateX(100%);
    transition: transform 0.3s;
    overflow: hidden;
}

.chat-panel.visible {
    transform: translateX(0);
}

.chat-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: ew-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.2s;
}

.chat-resize-handle:hover,
.chat-resize-handle.dragging {
    background: var(--accent-primary);
}

.chat-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    gap: 8px;
    min-height: 48px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Worker Tabs */
.worker-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
}
.worker-tabs::-webkit-scrollbar { display: none; }

.worker-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
    position: relative;
}
.worker-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.worker-tab.active {
    background: var(--active-worker-tint, var(--bg-secondary));
    border-color: var(--active-worker-border, var(--border-subtle));
    color: var(--text-primary);
}
.worker-tab-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.worker-tab-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Worker busy indicator */
.worker-busy-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    position: absolute;
    top: 2px;
    right: 2px;
    animation: worker-pulse 1.5s ease-in-out infinite;
}
@keyframes worker-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

/* Broadcast button & popover */
.chat-send-group {
    display: flex;
    gap: 4px;
    align-items: stretch;
}
.btn-broadcast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 0 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}
.btn-broadcast:hover {
    background: var(--bg-tertiary, #2a2a35);
    color: var(--text-primary);
    border-color: var(--accent);
}

.broadcast-popover {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 1000;
}
.broadcast-popover-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.broadcast-worker-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.broadcast-worker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
.broadcast-worker-item input[type="checkbox"] {
    accent-color: var(--accent);
}
.broadcast-worker-item .worker-tab-icon {
    width: 18px;
    height: 18px;
    font-size: 10px;
}

#chat-close {
    background: #dc3545;
    color: #fff;
    border-radius: 6px;
}

#chat-close:hover {
    background: #c82333;
    color: #fff;
}

.chat-model-select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.chat-model-select:hover {
    border-color: var(--accent);
}

.chat-model-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    color: var(--text-primary);
    background: var(--active-worker-bg, transparent);
    transition: background 0.3s ease;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Bubble Container */
.chat-bubble {
    display: flex;
    gap: 10px;
    max-width: 90%;
    flex-shrink: 0;
}

.chat-bubble-user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.chat-bubble-assistant {
    flex-direction: row;
    margin-right: auto;
}

/* Avatar */
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.chat-bubble-user .chat-avatar {
    background: linear-gradient(135deg, #00d4ff, #00b8d9);
    color: white;
}

.chat-bubble-assistant .chat-avatar {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: white;
}

/* Message Bubble */
.message {
    max-width: 100%;
    min-width: 0;
    position: relative;
    color: var(--text-primary);
    flex: 1;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.chat-bubble-user .message-bubble {
    background: linear-gradient(135deg, #00d4ff, #06b6d4);
    color: white;
    border-bottom-right-radius: 6px;
}

.chat-bubble-assistant .message-bubble {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom-left-radius: 6px;
    color: var(--text-primary);
}

/* Thinking indicator */
.thinking-bubble {
    animation: thinking-pulse-bg 2s ease-in-out infinite;
}
@keyframes thinking-pulse-bg {
    0%, 100% { border-color: rgba(255, 255, 255, 0.12); }
    50% { border-color: #00d4ff; }
}
.thinking-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.thinking-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}
.thinking-elapsed {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.thinking-dots {
    display: flex;
    gap: 4px;
    padding: 2px 0;
}
.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00d4ff;
    opacity: 0.4;
    animation: thinking-bounce 1.4s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
    0%, 80%, 100% { opacity: 0.4; transform: scale(1); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* Source badge */
.message-source {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-source.telegram { color: #0088cc; }
.message-source.admin { color: #00b8d9; }

.chat-bubble-user .message-source {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.8);
}

/* Message content with markdown support */
.message-content {
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    color: inherit;
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 4px;
    font-size: 12px;
    color: #00d9ff;
    text-decoration: none;
    transition: all 0.2s;
}

.attachment-chip:hover {
    background: rgba(0, 217, 255, 0.2);
    border-color: #00d9ff;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

/* Code styling in chat */
.message-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.chat-bubble-user .message-content code {
    background: rgba(255, 255, 255, 0.2);
}

.message-content pre {
    margin: 10px 0;
    padding: 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.message-content pre::-webkit-scrollbar {
    height: 4px;
}

.message-content pre::-webkit-scrollbar-track {
    background: transparent;
}

.message-content pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.chat-bubble-user .message-content pre {
    background: rgba(0, 0, 0, 0.3);
}

.message-content pre code {
    padding: 0;
    background: none;
    font-size: 12px;
    line-height: 1.5;
}

/* Links in chat */
.message-content a {
    color: #60a5fa;
    text-decoration: underline;
}

.chat-bubble-user .message-content a {
    color: #bfdbfe;
}

/* Blockquotes */
.message-content blockquote {
    margin: 8px 0;
    padding: 8px 12px;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 6px 6px 0;
}

/* Time stamp */
.message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-bubble-user .message-time {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.6);
}

/* Attachment Staging Area */
.attachment-staging {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(20, 20, 30, 0.6);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.attachment-staging.hidden {
    display: none;
}

.attachment-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s;
    max-width: 250px;
}

.attachment-pill:hover {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.5);
}

.attachment-pill-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.attachment-pill-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.attachment-pill-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attachment-pill-remove:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* Chat board selector */
.chat-board-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(10, 22, 40, 0.6);
    flex-shrink: 0;
}
.chat-board-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.chat-board-select {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.chat-board-select:focus {
    outline: none;
    border-color: var(--border-accent);
}
.chat-board-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}
.chat-board-select.board-active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.12);
}

.chat-input-container {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(10, 22, 40, 0.8);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    flex-wrap: wrap;
}

.chat-input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    overflow: hidden;
}

.chat-input:focus {
    outline: none;
    border-color: var(--border-accent);
}

.chat-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-clear-chat {
    background: rgba(239, 68, 68, 0.85);
    border: none;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.btn-clear-chat:hover {
    background: rgba(239, 68, 68, 1);
}

.btn-send {
    padding: 12px 20px;
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================================
   Modals
   ============================================================================ */

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

.modal-large {
    max-width: 900px;
    max-height: 80vh;
    overflow: auto;
}

.modal-content h2 {
    font-size: 24px;
    margin-bottom: 24px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.login-modal {
    text-align: center;
}

.login-modal .logo-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
}

.login-modal h2 {
    margin-bottom: 8px;
}

.login-modal p {
    margin-bottom: 24px;
}

.login-modal .input {
    margin-bottom: 16px;
}

.login-modal .btn-primary {
    width: 100%;
}

.login-modal .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--text-muted);
}

.login-modal .error-text {
    min-height: 20px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.login-shake {
    animation: shake 0.4s ease-in-out;
}

/* Media Preview */
.media-info {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
}

#media-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

#media-preview img,
#media-preview video {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
}

#media-preview iframe {
    width: 100%;
    height: 60vh;
    border: none;
    border-radius: 8px;
}

.document-preview {
    width: 100%;
    height: 60vh;
    overflow-y: auto;
    padding: 24px 32px;
    background: var(--bg-primary);
    border-radius: 8px;
    text-align: left;
    line-height: 1.7;
}

.document-preview h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 24px 0 16px 0;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.document-preview h2 {
    font-size: 22px;
    font-weight: 600;
    margin: 20px 0 12px 0;
    color: var(--text-primary);
}

.document-preview h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 16px 0 8px 0;
    color: var(--text-secondary);
}

.document-preview p {
    margin: 12px 0;
    color: var(--text-secondary);
}

.document-preview ul {
    margin: 12px 0;
    padding-left: 24px;
}

.document-preview li {
    margin: 6px 0;
    color: var(--text-secondary);
}

.document-preview code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.document-preview strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================================================
   Loading & Animations
   ============================================================================ */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

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

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

/* ============================================================================
   Responsive
   ============================================================================ */

@container main (max-width: 1000px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container main (max-width: 550px) {
    .kanban-board {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Mobile-only elements (hidden on desktop) */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    span.mobile-only {
        display: inline-block;
    }

    .nav-tabs {
        display: none;
    }

    /* --- Navbar: prevent overflow on mobile --- */
    .nav-container {
        padding: 0 12px;
        gap: 8px;
    }

    .nav-brand {
        gap: 8px;
        min-width: 0;
        flex-shrink: 1;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        border-radius: 50%;
    }

    .nav-subtitle {
        display: none;
    }

    .nav-title {
        font-size: 15px;
    }

    .task-status-indicator {
        display: none;
    }

    .nav-actions {
        gap: 6px;
        flex-shrink: 0;
    }

    .nav-actions .btn-icon {
        width: 36px;
        height: 36px;
    }

    .nav-actions .btn-icon svg {
        width: 18px;
        height: 18px;
    }

    .nav-actions-separator {
        width: 1px;
        height: 20px;
        background: var(--border-subtle);
        margin: 0 2px;
        align-self: center;
    }

    .chat-panel {
        width: 100% !important;
        top: 0;
        bottom: 38px;
        z-index: 1100;
        border-left: none;
    }

    .chat-resize-handle {
        display: none;
    }

    .main-content.chat-open {
        margin-right: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-content h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions-right {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .form-actions-right button,
    .form-actions .btn-danger {
        width: 100%;
        text-align: center;
    }

    .form-actions .btn-danger {
        order: 10;
    }

    /* Mobile Navigation Dropdown */
    .mobile-nav {
        position: fixed;
        top: 65px;
        left: 0;
        right: 0;
        background: rgba(15, 22, 35, 0.98);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-subtle);
        padding: 12px;
        z-index: 999;
        display: flex;
        flex-direction: column;
        gap: 8px;
        animation: slideDown 0.2s ease;
    }

    .mobile-nav.hidden {
        display: none;
    }

    .mobile-nav-item {
        width: 100%;
        padding: 14px 20px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        color: var(--text-secondary);
        font-weight: 500;
        font-size: 15px;
        text-align: left;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 10px;
        transition: all 0.2s;
    }

    .mobile-nav-item:hover {
        background: rgba(0, 212, 255, 0.1);
        color: var(--text-primary);
    }

    /* Bigger touch targets for pin, redo & kill buttons on task cards */
    .task-pin-btn,
    .task-send-todo-btn,
    .task-kill-btn {
        width: 40px;
        height: 40px;
        opacity: 1;
        border-radius: 10px;
    }

    .task-pin-btn svg,
    .task-send-todo-btn svg,
    .task-kill-btn svg {
        width: 18px;
        height: 18px;
    }

    .task-send-todo-btn {
        right: 6px;
        top: 6px;
    }

    .task-kill-btn {
        right: 54px;
        top: 6px;
    }

    .task-pin-btn {
        right: 54px;
        top: 6px;
    }

    .task-title {
        padding-right: 104px;
    }

    .mobile-nav-item.active {
        background: var(--gradient-primary);
        color: white;
        border-color: transparent;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Adjust main content when mobile nav is open */
    .main-content {
        padding: 12px;
    }

    .tab-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    #tab-tasks .tab-header {
        flex-direction: row;
        align-items: center;
    }

    .tab-header-title {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tab-header h1 {
        font-size: 22px;
    }

    .active-project-label {
        font-size: 14px;
        padding: 3px 10px;
    }

    .filters {
        width: 100%;
        flex-wrap: wrap;
    }

    .filters .select {
        flex: 1;
        min-width: 120px;
    }

    .filters .btn-primary,
    .filters .btn-secondary {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Prospects table: horizontal scroll */
    #tab-prospects .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #tab-prospects .data-table {
        min-width: 600px;
    }

    /* Crawler status panel tweaks */
    .crawler-status-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .crawler-current-activity {
        font-size: 12px;
    }
}

/* Mobile: single column kanban (matches mobile nav breakpoint) */
@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ============================================================================
   Contacts
   ============================================================================ */

/* Import button in header */
.import-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.import-btn:hover {
    background: rgba(0, 212, 255, 0.2);
}

/* Dropzone overlay (appears on drag) */
.dropzone-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 22, 40, 0.95);
    border: 3px dashed var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.2s;
}

.dropzone-overlay.drag-active {
    border-color: #00b8d9;
    background: rgba(0, 184, 217, 0.15);
}

.dropzone-content {
    text-align: center;
}

.dropzone-content svg {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.dropzone-content p {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* Import progress bar */
.import-progress {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.import-progress .progress-bar {
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
    animation: progressPulse 1.5s infinite;
}

.import-progress .progress-text {
    margin-top: 8px;
    color: var(--text-accent);
    font-size: 0.85rem;
}

@keyframes progressPulse {
    0%, 100% { opacity: 0.6; width: 30%; }
    50% { opacity: 1; width: 70%; }
}

/* Contacts Table */
.table-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: rgba(0, 0, 0, 0.3);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table tbody tr {
    transition: all 0.2s;
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: rgba(0, 212, 255, 0.1);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 14px;
}

.data-table td:last-child {
    text-align: right;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.contact-name {
    font-weight: 600;
}

.contact-email a,
.contact-phone a {
    color: var(--text-accent);
    text-decoration: none;
}

.contact-email a:hover,
.contact-phone a:hover {
    text-decoration: underline;
}

.customer-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 212, 255, 0.15);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-accent);
}

.contact-actions {
    white-space: nowrap;
}

.contact-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

/* Contact Modal */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-actions-right {
    display: flex;
    gap: 12px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.task-response-content {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Task modal — fullscreen 2-column layout */
.modal-task-wide {
    max-width: 95vw;
    width: 95vw;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
}

.modal-task-wide h2 {
    flex-shrink: 0;
}

.modal-task-wide #task-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.task-modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.task-modal-left {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.task-modal-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
}

.task-modal-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.task-modal-meta .form-group {
    margin-bottom: 0;
}

.task-desc-textarea {
    min-height: 150px;
    flex: 1;
    resize: vertical;
}

.modal-task-wide .form-actions {
    flex-shrink: 0;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* Collapsible AI response */
.task-response-collapse {
    margin-top: 0;
}

.task-response-toggle {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 13px;
}

.task-response-toggle::-webkit-details-marker {
    display: none;
}

.task-response-toggle::before {
    content: '\25B6';
    font-size: 10px;
    transition: transform 0.2s;
}

details.task-response-collapse[open] > .task-response-toggle::before {
    transform: rotate(90deg);
}

.task-response-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.task-response-collapse .task-response-content {
    margin-top: 10px;
}

@media (max-width: 768px) {
    .modal-task-wide {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        padding: 0;
        overflow: hidden;
    }
    .modal-task-wide h2 {
        padding: 12px 16px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        margin: 0;
        font-size: 18px;
        border-bottom: 1px solid var(--border-subtle);
    }
    .modal-task-wide #task-form {
        padding: 0;
        overflow: hidden;
    }
    .task-modal-columns {
        grid-template-columns: 1fr;
        gap: 0;
        overflow-y: auto;
        padding: 12px 16px;
        -webkit-overflow-scrolling: touch;
    }
    .task-modal-left .form-group:first-child {
        margin-bottom: 8px;
    }
    .task-modal-meta {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 8px;
    }
    .task-modal-meta .form-group label {
        font-size: 12px;
        margin-bottom: 2px;
    }
    .task-modal-meta .input,
    .task-modal-meta .select {
        padding: 8px 10px;
        font-size: 13px;
    }
    .task-modal-right {
        gap: 8px;
    }
    .task-desc-textarea {
        min-height: 100px;
        max-height: 200px;
    }
    .modal-task-wide .form-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-subtle);
        padding: 10px 12px;
        margin-top: 0;
        z-index: 10;
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: stretch;
    }
    .modal-task-wide .form-actions .btn-danger {
        order: 0 !important;
        width: auto !important;
    }
    .modal-task-wide .form-actions .form-actions-right {
        flex-direction: row !important;
        width: auto !important;
        flex: 1;
        gap: 6px;
        justify-content: flex-end;
    }
    .modal-task-wide .form-actions .form-actions-right button,
    .modal-task-wide .form-actions .btn-danger {
        width: auto !important;
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 8px;
    }
    /* Add bottom padding so content isn't hidden behind fixed buttons */
    .task-modal-columns::after {
        content: '';
        display: block;
        height: 70px;
        flex-shrink: 0;
    }
}

.btn-success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
}

/* Search input in filters */
.filters .input {
    width: 200px;
    min-width: 150px;
}

/* Contact category in logs */
.log-category.contact {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

/* Responsive for contacts */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }

    .contact-stats {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .filters .input {
        width: 100%;
    }
}

/* ============================================================================
   Email Log Styles
   ============================================================================ */

.email-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 0;
}

.email-card {
    background: rgba(15, 22, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.email-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateX(4px);
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.email-to {
    font-weight: 600;
    color: var(--text-primary);
}

.email-date {
    font-size: 12px;
    color: var(--text-muted);
}

.email-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.email-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.email-opened {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.email-not-opened {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

.email-untracked {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    font-style: italic;
}

/* Task contact display */
.task-contact {
    font-size: 12px;
    color: var(--text-accent);
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    min-width: 0;
}

.contact-icon {
    font-size: 14px;
}

/* ============================================================================
   Media Contact Linking
   ============================================================================ */

.media-contact-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-top: 8px;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 6px;
    font-size: 12px;
    color: #86efac;
}

.media-contact-badge .contact-icon {
    font-size: 12px;
}

.media-contact-selector {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.media-contact-selector label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.contact-selector-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.contact-selector-row .select {
    flex: 1;
    min-width: 200px;
}

.btn-unlink {
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-unlink:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Media Tag Manager (Preview Modal) */
.media-tag-manager {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.media-tag-manager label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.media-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.media-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
}

.media-tag-chip.tag-color-0 { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.media-tag-chip.tag-color-1 { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.media-tag-chip.tag-color-2 { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.media-tag-chip.tag-color-3 { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.media-tag-chip.tag-color-4 { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.media-tag-chip.tag-color-5 { background: rgba(168, 85, 247, 0.2); color: #c4b5fd; }

.media-tag-chip .tag-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 14px;
    line-height: 1;
    transition: opacity 0.2s;
}

.media-tag-chip .tag-remove:hover {
    opacity: 1;
}

.tag-add-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tag-add-row .input {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
}

.tag-add-row .btn-small {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
}

/* ============================================================================
   Prospects Page
   ============================================================================ */

/* Crawler Status Panel */
.crawler-status-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.crawler-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.crawler-status-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.crawler-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.crawler-stat {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.crawler-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-accent);
}

.crawler-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.crawler-activity {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.crawler-activity-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.crawler-log {
    max-height: 200px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.crawler-log-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.crawler-log-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.crawler-log-status {
    width: 32px;
    text-align: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.crawler-log-status.status-ok {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.crawler-log-status.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.crawler-log-domain {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

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

.crawler-daily {
    font-size: 13px;
}

.crawler-daily-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.crawler-daily-date {
    color: var(--text-secondary);
}

.crawler-daily-count {
    color: var(--text-accent);
    font-weight: 500;
}

@media (max-width: 768px) {
    .crawler-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .crawler-activity {
        grid-template-columns: 1fr;
    }
}

.prospect-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--border-accent);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

.prospect-domain a {
    color: var(--text-accent);
    text-decoration: none;
    font-weight: 500;
}

.prospect-domain a:hover {
    text-decoration: underline;
}

.cms-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 184, 217, 0.15);
    border-radius: 20px;
    font-size: 11px;
    color: #a5f3fc;
}

.tech-badge {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(0, 212, 255, 0.15);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-accent);
    margin: 2px;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.status-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.status-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
}

.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.prospect-row {
    cursor: pointer;
}

.prospect-row:hover {
    background: rgba(0, 212, 255, 0.1);
}

/* Prospect Modal */
.prospect-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 24px 0;
}

.prospect-detail-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
}

.prospect-detail-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.prospect-detail-section p {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.prospect-detail-section p strong {
    color: var(--text-primary);
}

.prospect-detail-section ul {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.prospect-detail-section li {
    font-size: 13px;
    padding: 4px 0;
}

.prospect-detail-section a {
    color: var(--text-accent);
    text-decoration: none;
}

.prospect-detail-section a:hover {
    text-decoration: underline;
}

.social-links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.social-link-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff !important;
    text-decoration: none !important;
    background: var(--bg-tertiary);
    transition: opacity 0.15s;
}

.social-link-badge:hover {
    opacity: 0.85;
    text-decoration: none !important;
}

.social-facebook { background: #1877F2; }
.social-twitter { background: #1DA1F2; }
.social-instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.social-linkedin { background: #0A66C2; }
.social-youtube { background: #FF0000; }
.social-tiktok { background: #010101; }
.social-pinterest { background: #E60023; }

.prospect-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* Responsive */
@media (max-width: 1200px) {
    .prospect-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .prospect-stats {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 24px;
    }

    .prospect-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Screenshot and PageSpeed styles */
.prospect-screenshot-section {
    grid-column: 1 / -1;
}

.prospect-screenshot-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    transition: transform 0.2s ease;
}

.prospect-screenshot-img:hover {
    transform: scale(1.02);
}

.screenshot-indicator {
    opacity: 0.5;
    font-size: 12px;
}

.responsive-badge {
    font-size: 12px;
    margin-left: 4px;
}

.responsive-yes {
    opacity: 0.7;
}

.responsive-no {
    opacity: 0.5;
}

.privacy-badge {
    font-size: 12px;
    margin-left: 4px;
}

.privacy-yes {
    opacity: 0.7;
}

.privacy-no {
    opacity: 0.5;
}

.pagespeed-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pagespeed-metrics .metric {
    background: rgba(0, 212, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.tech-badge {
    display: inline-block;
    background: rgba(0, 212, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin: 2px;
    color: var(--text-secondary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border-radius: 0 0 12px 12px;
    border-top: 1px solid var(--border-subtle);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    min-width: 36px;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.pagination-btn.active {
    background: var(--text-accent);
    border-color: var(--text-accent);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 6px 8px;
    color: var(--text-muted);
}

/* ============================================================================
   Prospect Tags & Navigation
   ============================================================================ */

.prospect-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.prospect-modal-title {
    flex: 1;
}

.prospect-modal-title h2 {
    margin-bottom: 0;
}

/* Nav bar beneath screenshot */
.prospect-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.prospect-position {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.prospect-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    height: 48px;
    padding: 0 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
}

.prospect-nav-btn:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.prospect-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.prospect-tags-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tags-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.prospect-tag-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.tag-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--text-primary);
}

.tag-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

/* Tag colors by type */
.tag-btn[data-tag="Needs New Site"].active {
    background: linear-gradient(135deg, #dc2626, #f97316);
}

.tag-btn[data-tag="Needs Fixes"].active {
    background: linear-gradient(135deg, #f97316, #eab308);
}

.tag-btn[data-tag="SEO"].active {
    background: linear-gradient(135deg, #00d4ff, #0ea5e9);
}

.tag-btn[data-tag="Good Prospect"].active {
    background: linear-gradient(135deg, #22c55e, #10b981);
}

.tag-btn[data-tag="Not Interested"].active {
    background: linear-gradient(135deg, #71717a, #52525b);
}

.tag-btn[data-tag="Contacted"].active {
    background: linear-gradient(135deg, #00b8d9, #00ffff);
}

/* Mini tags in table */
.prospect-tags-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.prospect-tag-mini {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    background: rgba(0, 212, 255, 0.2);
    color: var(--text-accent);
}

/* Tag color variants in mini */
.prospect-tag-mini:nth-child(1) { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.prospect-tag-mini:nth-child(2) { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.prospect-tag-mini:nth-child(3) { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.prospect-tag-mini:nth-child(4) { background: rgba(0, 184, 217, 0.2); color: #a5f3fc; }

/* ============================================================================
   Prospect Modal - Mobile Fixes
   ============================================================================ */

@media (max-width: 768px) {
    /* Make modal content fit viewport */
    #prospect-modal .modal-content {
        width: 95%;
        max-width: none;
        padding: 16px;
        max-height: 90vh;
    }

    /* Domain title - truncate long URLs */
    .prospect-modal-title h2 {
        font-size: 16px;
        word-break: break-all;
        overflow-wrap: anywhere;
    }

    /* Large tap-friendly nav buttons on mobile */
    .prospect-nav-btn {
        height: 56px;
        padding: 0 16px;
        font-size: 15px;
        min-width: 0;
        flex: 1;
        border-radius: 12px;
    }

    .prospect-nav-bar {
        gap: 8px;
        margin-top: 12px;
    }

    /* Close button positioning */
    #prospect-modal .modal-close {
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 10;
    }

    /* Screenshot section - full width */
    .prospect-screenshot-section {
        grid-column: 1 / -1;
    }

    .prospect-screenshot-img {
        width: 100%;
        max-height: none;
        height: auto;
    }

    /* Detail grid - single column on mobile */
    .prospect-detail-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Tags section - wrap properly */
    .prospect-tags-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .prospect-tag-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .tag-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Actions at bottom */
    .prospect-actions {
        flex-direction: column;
        gap: 8px;
    }

    .prospect-actions .btn-primary,
    .prospect-actions .btn-secondary {
        width: 100%;
        text-align: center;
    }
}


/* ============================================================================
   Email Slide-out Panel
   ============================================================================ */


/* Chat toggle green border */
#chat-toggle {
    border: 2px solid #22c55e;
}
#chat-toggle:hover {
    border-color: #4ade80;
}

/* Email icon badge */
.btn-icon {
    position: relative;
}

.email-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Email panel */
.email-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
}

.email-panel.visible {
    transform: translateX(0);
}

.email-panel.expanded {
    width: 100%;
}

.email-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.email-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.email-panel-title svg {
    color: var(--text-accent);
}

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

/* Resize handle */
.email-panel-resize {
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    transition: background 0.2s;
    z-index: 10;
}

.email-panel-resize:hover,
.email-panel-resize.resizing {
    background: var(--gradient-primary);
}

/* Panel content */
.email-panel-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.email-panel-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Loading state */
.email-panel-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Placeholder state */
.email-panel-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.email-panel-placeholder svg {
    color: var(--text-muted);
    opacity: 0.5;
}

.email-panel-placeholder h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin: 0;
}

.email-panel-placeholder p {
    max-width: 300px;
    line-height: 1.6;
}

/* Main content adjustment when email panel open */
.main-content.email-open {
    display: none;
}

.main-content.email-expanded {
    display: none;
}

/* Responsive */
@media (max-width: 1200px) {
    .email-panel {
        width: 100%;
    }

    .main-content.email-open {
        display: none;
    }
}

@media (max-width: 768px) {
    .email-panel {
        width: 100%;
    }

    .main-content.email-open {
        display: none;
    }

    .email-panel-resize {
        display: none;
    }
}

/* ============================================================================
   Settings Modal
   ============================================================================ */

.modal-content-wide {
    max-width: 500px;
}

.settings-modal {
    max-width: 100%;
    width: 98vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.settings-header h2 svg {
    color: var(--text-accent);
}

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

.settings-close:hover {
    color: var(--text-primary);
}

.settings-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.settings-sidebar {
    width: 200px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--border-subtle);
    padding: 1rem 0;
    flex-shrink: 0;
    overflow-y: auto;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-nav-item:hover {
    color: var(--text-primary);
    background: rgba(0, 212, 255, 0.1);
}

.settings-nav-item.active {
    color: var(--text-accent);
    background: rgba(0, 212, 255, 0.15);
    border-left: 3px solid var(--text-accent);
}

.settings-nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.settings-nav-item.active svg {
    opacity: 1;
}

.settings-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    min-height: 0;
}

.settings-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-muted);
}

.settings-form h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.75rem;
}

.settings-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.setting-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-label label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.setting-status {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
}

.setting-status.status-env {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.setting-status.status-override {
    background: rgba(0, 212, 255, 0.15);
    color: var(--text-accent);
}

.setting-status.status-empty {
    background: rgba(113, 113, 122, 0.15);
    color: var(--text-muted);
}

.setting-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.setting-input {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.setting-input.saving {
    opacity: 0.6;
}

.setting-toggle-visibility,
.setting-clear {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.setting-toggle-visibility:hover {
    color: var(--text-primary);
}

.setting-clear:hover {
    color: var(--error);
}

.setting-masked-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
}

.settings-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
}

.settings-footer-info {
    font-size: 0.85rem;
}

.btn-sm {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
}

/* Mobile responsiveness for settings */
@media (max-width: 768px) {
    .settings-modal {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .settings-header {
        padding: 0.75rem 1rem;
    }

    .settings-header h2 {
        font-size: 1.15rem;
    }

    .settings-layout {
        flex-direction: column;
    }

    /* Icon-only compact tab bar on mobile */
    .settings-sidebar {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        overflow-x: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: 0;
        background: rgba(0, 0, 0, 0.25);
        flex-shrink: 0;
    }

    .settings-nav-item {
        flex: 1;
        justify-content: center;
        padding: 0.6rem 0.25rem;
        gap: 0;
        white-space: nowrap;
        border-left: none;
        position: relative;
        min-width: 0;
    }

    /* Hide text labels, show only icons on mobile */
    .settings-nav-item span,
    .settings-nav-item .nav-label {
        display: none;
    }

    /* Hide text nodes directly inside nav items */
    .settings-nav-item {
        font-size: 0;
    }

    .settings-nav-item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .settings-nav-item.active {
        border-left: none;
        border-bottom: 2px solid var(--text-accent);
        background: rgba(0, 212, 255, 0.2);
    }

    .settings-nav-item:hover {
        background: rgba(0, 212, 255, 0.15);
    }

    /* Active category label shown above content area */
    .settings-content::before {
        content: attr(data-active-label);
        display: block;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-accent);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border-subtle);
        margin-bottom: 0.75rem;
    }

    .settings-content {
        padding: 1rem;
    }

    .settings-footer {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .settings-footer-info {
        font-size: 0.75rem;
    }

    /* Tighten up setting fields on mobile */
    .setting-input-row {
        flex-wrap: wrap;
    }

    .setting-input-row .btn-sm {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem !important;
    }

    /* ---- Workers settings: card layout on mobile ---- */
    .workers-table-desktop { display: none !important; }
    .workers-cards-mobile { display: flex !important; }

    /* Worker edit modal: full-screen on mobile */
    .worker-modal-overlay {
        align-items: flex-end !important;
    }
    .worker-modal-panel {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh !important;
        border-radius: 16px 16px 0 0 !important;
        padding: 16px !important;
    }
    .worker-modal-panel h3 {
        font-size: 1.1rem !important;
    }
    .worker-modal-row {
        flex-direction: column !important;
    }
    .worker-modal-row > div {
        flex: 1 1 100% !important;
    }
}

/* ============================================================================
   Workers Settings
   ============================================================================ */

/* Workers table (desktop) */
.workers-table {
    table-layout: fixed;
}

.workers-table tbody tr {
    cursor: pointer;
}

.workers-table td:first-child {
    text-align: center;
    width: 50px;
}

.worker-table-name {
    font-weight: 600;
    color: var(--text-primary);
}

.worker-default-badge {
    font-size: 10px;
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.12);
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.worker-topic-badge {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 6px;
}

.worker-model-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: capitalize;
}

.worker-model-pill.model-opus {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.worker-model-pill.model-sonnet {
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent-cyan);
}

.worker-model-pill.model-haiku {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

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

.worker-no-role {
    color: var(--text-muted);
    font-style: italic;
}

.worker-actions-cell {
    white-space: nowrap;
}

.btn-danger-subtle {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-subtle:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Mobile card layout (hidden on desktop) */
.workers-cards-mobile {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.worker-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.worker-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.worker-card-name .badge-default {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
}

.worker-card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.worker-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Worker modal (base styles) */
.worker-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.worker-modal-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
    width: 480px;
    max-width: 95vw;
    max-height: 80vh;
    overflow-y: auto;
}

.worker-modal-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.worker-modal-fields label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.worker-modal-row {
    display: flex;
    gap: 12px;
}

.worker-modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ============================================================================
   Trash
   ============================================================================ */

/* Trash badge (amber/orange) */
.trash-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    animation: badge-pulse 2s infinite;
}

/* Trash modal header */
.trash-modal-count {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.trash-modal-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Trash list */
.trash-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.trash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    gap: 1rem;
}

.trash-empty svg {
    opacity: 0.3;
}

.trash-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
}

.trash-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.trash-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00b8d9;
    cursor: pointer;
}

.trash-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.trash-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trash-filename {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trash-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.trash-path {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.6;
}

/* ============================================================================
   Upload Modal
   ============================================================================ */

.upload-dropzone {
    border: 2px dashed var(--border-subtle);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 16px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.05);
}

.upload-dropzone.has-files {
    padding: 16px;
    border-style: solid;
    border-color: var(--accent-primary);
    opacity: 0.6;
}

.upload-dropzone.has-files p:first-of-type {
    display: none;
}

.upload-dropzone p {
    margin: 8px 0 0;
    color: var(--text-secondary);
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted) !important;
}

.upload-options {
    margin-bottom: 16px;
}

.upload-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.upload-file-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.upload-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

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

.upload-file-icon {
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.upload-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.upload-file-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-progress {
    margin-bottom: 16px;
}

.upload-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.upload-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.3s;
    width: 0%;
}

#upload-progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

/* ============================================================================
   Code-Server (VS Code) Panel - slides from LEFT
   ============================================================================ */

.code-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.3);
}

.code-panel.visible {
    transform: translateX(0);
}

.code-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.code-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.code-panel-title svg {
    color: #007acc;
}

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

.code-panel-resize {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    transition: background 0.2s;
    z-index: 10;
}

.code-panel-resize:hover,
.code-panel-resize.resizing {
    background: var(--gradient-primary);
}

.code-panel-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.code-panel-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #1e1e1e;
}

.code-panel-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.code-panel-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.code-file-panel {
    width: 280px;
    min-width: 280px;
    background: #0d1117;
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-file-panel.hidden {
    display: none;
}

.code-file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-secondary);
}

.code-file-path-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-family: monospace;
    font-size: 11px;
}

.code-file-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.code-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: background 0.1s;
    position: relative;
}

.code-file-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.code-file-item .file-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 13px;
}

.code-file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.code-file-item .file-size {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.code-file-item .file-delete {
    display: none;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.code-file-item:hover .file-delete {
    display: block;
}

.code-file-item .file-delete:hover {
    background: #ef444430;
}

.code-file-item.is-dir .file-name {
    color: var(--text-primary);
    font-weight: 500;
}

.main-content.code-open {
    display: none;
}

/* Footer bar code button */
.log-footer-code {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
    margin-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding-left: 10px;
}

.log-footer-code:hover {
    color: #007acc;
    background: rgba(0, 122, 204, 0.1);
}

.log-footer-code.active {
    color: #007acc;
}

/* ============================================================================
   Fixed Activity Log Footer Bar
   ============================================================================ */

.log-footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 212, 255, 0.2);
    padding: 0 16px;
    height: 38px;
    display: flex;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.log-footer-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.log-footer-indicator {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.log-footer-indicator .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: logPulse 2s ease-in-out infinite;
}

@keyframes logPulse {
    0%, 100% { opacity: 0.4; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { opacity: 1; box-shadow: 0 0 8px 2px rgba(34, 197, 94, 0.3); }
}

.log-footer-bar.log-new .log-footer-indicator .pulse-dot {
    animation: logFlash 0.6s ease-out;
    background: #818cf8;
}

@keyframes logFlash {
    0% { transform: scale(1.8); background: #818cf8; box-shadow: 0 0 12px 4px rgba(129, 140, 248, 0.5); }
    100% { transform: scale(1); background: #22c55e; box-shadow: none; }
}

.log-footer-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.log-footer-time {
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.log-footer-category {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(161, 161, 170, 0.2);
    color: #a1a1aa;
}

.log-footer-category.task { background: rgba(0, 212, 255, 0.2); color: #7dd3fc; }
.log-footer-category.chat { background: rgba(0, 184, 217, 0.2); color: #a5f3fc; }
.log-footer-category.telegram { background: rgba(14, 165, 233, 0.2); color: #93c5fd; }
.log-footer-category.system { background: rgba(161, 161, 170, 0.2); color: #a1a1aa; }
.log-footer-category.error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.log-footer-category.claude { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; }
.log-footer-category.tool { background: rgba(34, 197, 94, 0.2); color: #86efac; }

.log-footer-message {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.log-footer-disk {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    color: var(--text-muted);
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.log-footer-disk svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.disk-bar-wrapper {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.disk-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: #22c55e;
    transition: width 0.6s ease, background 0.6s ease;
    width: 0%;
}

.disk-bar-fill.disk-warn {
    background: #eab308;
}

.disk-bar-fill.disk-critical {
    background: #ef4444;
}

.disk-label {
    font-size: 11px;
    white-space: nowrap;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .log-footer-disk,
    .log-footer-time {
        display: none;
    }
}

.log-footer-expand {
    background: rgba(0, 212, 255, 0.25);
    border: none;
    color: #7dd3fc;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}

.log-footer-expand:hover {
    color: #fff;
    background: rgba(0, 212, 255, 0.4);
}

/* ============================================================================
   Footer Navigation Panel
   ============================================================================ */

.footer-nav-panel {
    position: fixed;
    top: 0;
    bottom: 38px;
    left: 0;
    right: 0;
    z-index: 1050;
    background: rgba(15, 15, 25, 0.97);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 212, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    padding-top: max(32px, calc(65px + env(safe-area-inset-top, 0px)));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: footerNavFadeIn 0.2s ease;
}

.footer-nav-panel.hidden {
    display: none;
}

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

.footer-nav-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 100%;
}

.footer-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    justify-content: center;
}

.footer-nav-item:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--text-primary);
}

.footer-nav-item.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.footer-nav-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.footer-nav-item:hover svg,
.footer-nav-item.active svg {
    opacity: 1;
}

#footer-nav-btn.active {
    color: #7dd3fc;
    background: rgba(0, 212, 255, 0.15);
}

/* Mobile tweaks */
@media (max-width: 768px) {
    .footer-nav-panel {
        padding: 24px 16px;
        padding-top: max(24px, calc(65px + env(safe-area-inset-top, 0px)));
    }

    .footer-nav-items {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        max-width: 100%;
    }

    .footer-nav-item {
        padding: 12px 10px;
    }

    .footer-nav-item svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================================================================
   Notifications
   ============================================================================ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 400px;
    pointer-events: auto;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.notification-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.notification-info {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #7dd3fc;
}

/* ============================================================================
   Dev Projects
   ============================================================================ */

.dev-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: calc(100vh - 140px);
}

.dev-sidebar {
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-subtle);
    border-radius: 16px 0 0 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.dev-sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

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

.project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
    border: 1px solid transparent;
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.project-item.selected {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.3);
}

.project-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
    color: white;
}

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

.project-item-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.project-item-url {
    margin-top: 2px;
}

.project-item-url a {
    font-size: 10px;
    color: #60a5fa;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.project-item-url a:hover {
    opacity: 1;
    text-decoration: underline;
}

.project-type-badge {
    display: inline-block;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.project-type-node { background: rgba(104, 160, 99, 0.2); color: #68a063; }
.project-type-wordpress { background: rgba(33, 117, 155, 0.2); color: #5bb8db; }
.project-type-static { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.project-type-php { background: rgba(119, 123, 180, 0.2); color: #9b9ede; }
.project-type-python { background: rgba(55, 118, 171, 0.2); color: #6aadde; }

.dev-main {
    padding: 24px;
    overflow-y: auto;
}

.dev-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    text-align: center;
    gap: 12px;
}

.dev-empty-state h2 {
    margin: 0;
    font-size: 20px;
}

.dev-empty-state p {
    margin: 0;
    color: var(--text-muted);
}

.dev-project-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dev-project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.dev-project-info h1 {
    margin: 0 0 4px 0;
    font-size: 24px;
}

.dev-project-info p {
    margin: 0;
    font-size: 14px;
}

.dev-project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.dev-project-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.dev-project-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.server-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.server-indicator.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}
.server-indicator.offline {
    background: #6b7280;
}
.server-indicator.starting {
    background: #f59e0b;
    animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#dev-server-btn.server-online {
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.dev-git-output {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 16px;
    max-height: 200px;
    overflow-y: auto;
}

.dev-git-output pre {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

.dev-env-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.dev-env-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.dev-env-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.dev-env-actions {
    display: flex;
    gap: 6px;
}

.dev-env-vars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dev-env-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dev-env-row input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 6px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.dev-env-row input.env-key {
    width: 200px;
    font-weight: 600;
}

.dev-env-row input.env-value {
    flex: 1;
}

.dev-env-row .env-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    line-height: 1;
    border-radius: 4px;
}

.dev-env-row .env-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.dev-env-panel small {
    display: block;
    margin-top: 8px;
}

/* Health Dashboard (DP-009) */
.dev-health-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}
.dev-health-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.dev-health-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}
.health-overall-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.health-overall-badge.healthy { background: #22c55e22; color: #22c55e; border: 1px solid #22c55e44; }
.health-overall-badge.degraded { background: #f59e0b22; color: #f59e0b; border: 1px solid #f59e0b44; }
.health-overall-badge.down { background: #ef444422; color: #ef4444; border: 1px solid #ef444444; }
.health-overall-badge.not_configured { background: #6b728022; color: #6b7280; border: 1px solid #6b728044; }

.dev-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}
.health-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.health-card-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.health-card-value {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.health-dot.green { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.health-dot.red { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.health-dot.yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.health-dot.gray { background: #6b7280; }

/* Sidebar health indicator */
.project-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: auto;
}
.project-health-dot.healthy { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.4); }
.project-health-dot.degraded { background: #f59e0b; box-shadow: 0 0 4px rgba(245,158,11,0.4); }
.project-health-dot.down { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.4); animation: pulse-dot 2s ease-in-out infinite; }
.project-health-dot.not_configured { background: #6b7280; }

/* Health warning banner */
.health-warning-banner {
    background: #f59e0b11;
    border: 1px solid #f59e0b33;
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #f59e0b;
    font-weight: 500;
}
.health-warning-banner.error {
    background: #ef444411;
    border-color: #ef444433;
    color: #ef4444;
}

/* Sub-Servers Panel */
/* Project Memory Panel (ZK-001) */
.dev-memory-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.dev-memory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.dev-memory-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dev-memory-count {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 1px 8px;
    border-radius: 10px;
}

.dev-memory-body {
    margin-top: 12px;
}

.dev-memory-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

.dev-memory-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.dev-memory-file:hover {
    border-color: var(--accent);
}

.dev-memory-file.selected {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-secondary));
}

.dev-memory-file input[type="checkbox"] {
    margin: 0;
    accent-color: var(--accent);
}

.dev-memory-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dev-memory-file-tokens {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

.dev-memory-actions {
    display: flex;
    justify-content: flex-end;
}

.dev-servers-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.dev-servers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.dev-servers-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.dev-servers-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

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

.dev-server-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.dev-server-card:hover {
    border-color: var(--accent);
}

.dev-server-card .server-indicator {
    flex-shrink: 0;
}

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

.dev-server-info .server-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.dev-server-info .server-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dev-server-info .server-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.server-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 212, 255, 0.15);
    color: #818cf8;
}

.systemd-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    margin-left: 4px;
    vertical-align: middle;
}

.server-type-badge.backend {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

.server-type-badge.api {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.server-type-badge.worker {
    background: rgba(0, 184, 217, 0.15);
    color: #67e8f9;
}

.dev-server-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.dev-server-actions button {
    padding: 4px 8px;
    font-size: 11px;
}

.deploy-notes {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2px;
}

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

.dev-kanban-header h2 {
    margin: 0;
    font-size: 18px;
}

.dev-kanban {
    min-height: 300px;
}

/* Small button variant */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .dev-layout {
        grid-template-columns: 1fr;
    }

    .dev-sidebar {
        border-radius: 16px;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    /* When a project is selected, collapse sidebar to save space */
    .dev-sidebar.collapsed-mobile {
        max-height: 52px;
        overflow: hidden;
        cursor: pointer;
        transition: max-height 0.3s ease;
    }

    .dev-sidebar.collapsed-mobile .project-list {
        display: none;
    }

    .dev-sidebar.collapsed-mobile .dev-sidebar-header::after {
        content: '\25BC';
        font-size: 10px;
        color: var(--text-muted);
        margin-left: 6px;
    }

    .dev-sidebar.expanded-mobile {
        max-height: none;
        transition: max-height 0.3s ease;
    }

    .dev-sidebar.expanded-mobile .dev-sidebar-header::after {
        content: '\25B2';
        font-size: 10px;
        color: var(--text-muted);
        margin-left: 6px;
    }

    .dev-main {
        padding: 14px;
    }

    .dev-project-header {
        flex-direction: column;
        gap: 10px;
    }

    .dev-project-info h1 {
        font-size: 18px;
    }

    .dev-project-meta {
        gap: 5px;
        flex-direction: column;
    }

    .dev-project-meta span,
    .dev-project-meta a {
        font-size: 11px;
        padding: 2px 6px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .dev-project-actions {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
        width: 100%;
    }

    .dev-project-actions .btn-sm {
        width: 100%;
        padding: 10px 6px;
        font-size: 12px;
        text-align: center;
    }

    .dev-servers-panel,
    .dev-env-panel {
        padding: 12px;
    }

    .dev-servers-header,
    .dev-env-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Server cards: stack vertically on mobile */
    .dev-server-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }

    /* Top row: indicator + badge + name inline */
    .dev-server-card .dev-server-info {
        width: 100%;
    }

    .dev-server-card .server-meta {
        flex-direction: column;
        gap: 2px;
    }

    .dev-server-card .server-meta span {
        word-break: break-all;
    }

    /* Action buttons: full-width grid matching project buttons style */
    .dev-server-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 6px;
    }

    .dev-server-actions button {
        width: 100%;
        padding: 8px 4px;
        font-size: 12px;
        text-align: center;
    }

    /* Env vars: stack key/value vertically */
    .dev-env-row {
        flex-direction: column;
        gap: 6px;
    }

    .dev-env-row input.env-key {
        width: 100%;
    }

    .dev-env-row input.env-value {
        width: 100%;
    }

    .dev-env-row .env-delete-btn {
        align-self: flex-end;
    }

    /* Env header actions: wrap on narrow screens */
    .dev-env-actions {
        flex-wrap: wrap;
    }

    .dev-kanban-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dev-kanban-header h2 {
        font-size: 16px;
    }
}

/* ============================================================================
   Backlinks
   ============================================================================ */

/* Continuous Crawler Control */
.crawler-control-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}

.crawler-control-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.crawler-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crawler-title h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.crawler-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crawler-interval-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.crawler-interval-select {
    width: auto;
    min-width: 90px;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #c82333;
}

.status-badge.status-inactive {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

.status-badge.status-running {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.crawler-log-tail {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
}

.backlink-actions-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.backlink-actions-panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.backlink-action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.backlink-action-buttons button {
    display: flex;
    align-items: center;
    gap: 6px;
}

.backlink-action-status {
    margin-top: 12px;
    font-size: 0.85rem;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.priority-high {
    color: #ff6b6b;
    font-weight: 700;
}

.priority-med {
    color: var(--text-accent);
    font-weight: 600;
}

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

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.detail-item {
    font-size: 0.85rem;
    line-height: 1.6;
}

.detail-item strong {
    color: var(--text-secondary);
    margin-right: 4px;
}

.status-info {
    background: rgba(56, 178, 255, 0.15);
    color: #38b2ff;
}

/* ============================================================================
   Social Calendar
   ============================================================================ */

/* Brand Cards */

.platform-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    color: white;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.platform-badge-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: white;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Calendar Navigation */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.calendar-nav h2 {
    min-width: 180px;
    text-align: center;
    font-size: 18px;
    margin: 0;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* Calendar Grid */
.calendar-grid {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: rgba(0, 212, 255, 0.08);
    border-bottom: 1px solid var(--border-subtle);
}

.calendar-day-label {
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-cells {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
    min-height: 100px;
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    padding: 4px 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.calendar-cell:nth-child(7n) {
    border-right: none;
}

.calendar-cell:hover {
    background: rgba(0, 212, 255, 0.04);
}

.calendar-cell.empty {
    background: rgba(0, 0, 0, 0.15);
    cursor: default;
}

.calendar-cell.today {
    background: rgba(0, 212, 255, 0.06);
}

.calendar-date {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.calendar-date.today {
    color: #7dd3fc;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calendar-posts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-post {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(0, 212, 255, 0.1);
    cursor: pointer;
    transition: background 0.15s;
    overflow: hidden;
}

.calendar-post:hover {
    background: rgba(0, 212, 255, 0.2);
}

.post-time {
    font-size: 10px;
    color: var(--text-accent);
    font-weight: 600;
    white-space: nowrap;
}

.post-platforms-inline {
    display: flex;
    gap: 2px;
}

.post-platforms-inline .post-platform {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 7px;
    font-weight: 700;
    text-transform: uppercase;
}

.post-platform.published {
    opacity: 1;
}

.post-platform.error {
    opacity: 0.6;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

.post-platform.pending {
    opacity: 0.7;
}

.calendar-more {
    font-size: 10px;
    color: var(--text-muted);
    padding: 1px 4px;
}

/* View Toggle */
.calendar-view-toggle {
    display: flex;
    gap: 2px;
    margin-left: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 2px;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.view-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 212, 255, 0.08);
}

.view-btn.active {
    background: var(--gradient-primary);
    color: white;
    background: linear-gradient(135deg, #00d4ff, #06b6d4);
}

/* Week View */
.week-view {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
}

.week-view.hidden {
    display: none;
}

.week-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: rgba(0, 212, 255, 0.08);
    border-bottom: 1px solid var(--border-subtle);
}

.week-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px 8px;
    gap: 2px;
}

.week-day-header.today {
    background: rgba(0, 212, 255, 0.06);
}

.week-day-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.week-day-num {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

.week-day-num.today {
    color: white;
    background: linear-gradient(135deg, #00d4ff, #06b6d4);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.week-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 400px;
}

.week-day-col {
    border-right: 1px solid var(--border-subtle);
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 400px;
}

.week-day-col:last-child {
    border-right: none;
}

.week-day-col:hover {
    background: rgba(0, 212, 255, 0.03);
}

.week-day-col.today {
    background: rgba(0, 212, 255, 0.04);
}

.week-empty-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    color: var(--text-muted);
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.15s;
}

.week-day-col:hover .week-empty-hint {
    opacity: 0.5;
}

/* Week Post Cards */
.week-post-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s;
}

.week-post-card:hover {
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.week-post-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.week-post-thumb img,
.week-post-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.week-post-video-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.week-post-info {
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.week-post-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.week-post-time {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-accent);
}

.week-post-brand {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(0, 212, 255, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

.week-post-text {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.week-post-platforms {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.week-post-platforms .post-platform {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Platform Checkboxes in Post Modal */
.platform-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.platform-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
    font-size: 13px;
    color: var(--text-secondary);
}

.platform-checkbox:hover {
    border-color: var(--border-accent);
}

.platform-checkbox input:checked + .platform-badge-lg {
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.platform-checkbox input {
    display: none;
}

.platform-checkbox:has(input:checked) {
    border-color: rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.08);
    color: var(--text-primary);
}

.post-textarea {
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
}

/* Platform Options Section */
.platform-options-section {
    margin-top: -4px;
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-secondary);
    overflow: hidden;
}
.platform-options-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
    transition: color 0.2s;
}
.platform-options-header:hover {
    color: var(--text-primary);
}
.platform-options-body {
    padding: 0 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.platform-options-body.collapsed {
    display: none;
}
.plat-opts {
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
}
.plat-opts-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.plat-opts-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.plat-opts-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.plat-opts-row label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 80px;
    flex-shrink: 0;
}
.plat-opts-row .input,
.plat-opts-row .select {
    flex: 1;
    min-width: 0;
}
.input-sm, .select-sm {
    font-size: 12px !important;
    padding: 4px 8px !important;
    height: auto !important;
}
.plat-opts-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}
.toggle-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #00d4ff;
}

@media (max-width: 768px) {
    .plat-opts-row {
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
    }
    .plat-opts-row label {
        min-width: unset;
    }
    .plat-opts-toggles {
        gap: 6px 10px;
    }
}

.char-count {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Autolist Legend */
.autolist-legend {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    margin-bottom: 12px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.manual {
    background: rgba(0, 212, 255, 0.7);
}

.legend-dot.autolist {
    background: rgba(245, 158, 11, 0.8);
}

.legend-dot.draft {
    background: rgba(107, 114, 128, 0.6);
}

/* Post Source Badges (Month View) */
.post-source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.post-source-badge.autolist {
    background: rgba(245, 158, 11, 0.85);
}

.post-source-badge.draft {
    background: rgba(107, 114, 128, 0.6);
}

/* Post Source Tags (Week View) */
.week-post-source {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.week-post-source.autolist {
    background: rgba(245, 158, 11, 0.15);
    color: rgb(217, 119, 6);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.week-post-source.draft {
    background: rgba(107, 114, 128, 0.15);
    color: rgb(156, 163, 175);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Post type badges (Reel/Story) */
.week-post-type {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.week-post-type.reel {
    background: rgba(139, 92, 246, 0.15);
    color: rgb(167, 139, 250);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.week-post-type.story {
    background: rgba(236, 72, 153, 0.15);
    color: rgb(244, 114, 182);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

/* Autolist post card border accent */
.week-post-card.autolist-post {
    border-left: 3px solid rgba(245, 158, 11, 0.6);
}

.week-post-card.draft-post {
    border-left: 3px solid rgba(107, 114, 128, 0.4);
    opacity: 0.75;
}

/* Post Detail Source Badge */
.post-detail-source {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.post-detail-source.autolist {
    background: rgba(245, 158, 11, 0.15);
    color: rgb(217, 119, 6);
}

.post-detail-source.draft {
    background: rgba(107, 114, 128, 0.15);
    color: rgb(156, 163, 175);
}

.post-detail-source.manual {
    background: rgba(0, 212, 255, 0.1);
    color: rgb(129, 140, 248);
}

/* Autolist slot info in detail modal */
.autolist-slot-info {
    padding: 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    margin: 12px 0;
}

.autolist-slot-info p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 8px;
}

.autolist-slot-info p:last-child {
    margin-bottom: 0;
}

.autolist-slot-info strong {
    color: rgb(217, 119, 6);
}

/* Autolist placeholder thumbnail in week view */
.week-post-thumb.autolist-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.15) 100%);
    color: rgba(245, 158, 11, 0.6);
    border-bottom: 1px solid rgba(245, 158, 11, 0.15);
}

.week-post-thumb.autolist-placeholder span {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Autolist hint text in week view cards */
.week-post-text.autolist-hint {
    font-style: italic;
    color: var(--text-muted);
    font-size: 10px;
}

/* Month view autolist post indicator */
.calendar-post.autolist {
    border-left: 2px solid rgba(245, 158, 11, 0.6);
}

/* Post Detail Modal */
.post-detail-body {
    padding: 8px 0;
}

.post-detail-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.post-detail-time {
    font-size: 14px;
    color: var(--text-accent);
    font-weight: 600;
}

.post-detail-brand {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

.post-detail-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 16px;
    white-space: pre-wrap;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.post-detail-media {
    margin-bottom: 16px;
}

.post-media-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
}

.post-detail-providers {
    margin-bottom: 16px;
}

.post-detail-providers h3 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.provider-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--bg-tertiary);
}

.provider-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.status-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-tag.status-published {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.status-tag.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.status-tag.status-pending {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.provider-link {
    font-size: 12px;
    color: var(--text-accent);
    text-decoration: none;
}

.provider-link:hover {
    text-decoration: underline;
}

.post-detail-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

/* Calendar responsive */
@media (max-width: 768px) {
    .calendar-cell {
        min-height: 60px;
        padding: 2px 3px;
    }

    .calendar-date {
        font-size: 11px;
    }

    .calendar-post {
        padding: 1px 2px;
    }

    .post-time {
        font-size: 8px;
    }

    .post-platforms-inline .post-platform {
        width: 12px;
        height: 12px;
        font-size: 6px;
    }

    /* Mobile week view: 3 day columns */
    .week-header-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .week-body {
        grid-template-columns: repeat(3, 1fr);
    }

    .week-day-col {
        min-height: 250px;
        padding: 6px;
    }

    .week-day-num {
        font-size: 16px;
    }

    .week-post-brand {
        display: none;
    }

    .week-post-platforms .post-platform {
        width: 14px;
        height: 14px;
        font-size: 6px;
    }
}

/* ============================================================================
   Post Modal - Two Column Layout with Phone Preview
   ============================================================================ */

.modal-xl {
    max-width: 1100px;
    max-height: 90vh;
    overflow: auto;
}

.post-modal-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.post-modal-form {
    flex: 1;
    min-width: 0;
}

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

.post-modal-preview {
    flex: 0 0 300px;
    position: sticky;
    top: 0;
}

/* Preview platform tabs */
.preview-platform-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.preview-tab {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.preview-tab:hover {
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.preview-tab.active {
    background: var(--gradient-primary);
    background: linear-gradient(135deg, #00d4ff, #00b8d9);
    color: white;
    border-color: transparent;
}

/* Calendar Sub-navigation */
.calendar-subnav {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.subnav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.subnav-tab:hover {
    color: var(--text-primary);
}

.subnav-tab.active {
    color: var(--text-accent);
    border-bottom-color: var(--text-accent);
}

.subnav-badge {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.calview-panel {
    /* Default visible */
}

.calendar-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

/* Autolists Grid */
.autolists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.autolist-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.autolist-card:hover {
    border-color: var(--text-accent);
    transform: translateY(-1px);
}

.autolist-card.paused {
    opacity: 0.6;
}

.autolist-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.autolist-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.autolist-card-status {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.autolist-card-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.autolist-card-status.paused {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.autolist-card-brand {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.autolist-card-platforms {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.autolist-card-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.autolist-card-schedule {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Autolist Detail Modal */
#autolist-detail-modal .modal-content,
#autolist-item-modal .modal-content {
    max-height: 85vh;
    overflow-y: auto;
}

.autolist-detail-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.autolist-meta-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.autolist-actions-bar {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.autolist-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.autolist-items-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.autolist-items-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.autolist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: grab;
    transition: all 0.15s;
}

.autolist-item:hover {
    border-color: var(--text-accent);
}

.autolist-item.drag-over {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.08);
}

.autolist-item-handle {
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
}

.autolist-item-order {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 24px;
    flex-shrink: 0;
}

.autolist-item-thumb {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.autolist-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.autolist-item-text {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.autolist-item-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.autolist-item-status.pending {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
}

.autolist-item-status.approved {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.autolist-item-status.skipped {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.autolist-item-type {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.autolist-item-type.reel {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.autolist-item-type.story {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.autolist-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Schedule slots in autolist form */
.schedule-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.schedule-slot {
    display: flex;
    gap: 8px;
    align-items: center;
}

.schedule-slot .select {
    width: auto;
    min-width: 120px;
}

.schedule-slot .input {
    width: auto;
    min-width: 100px;
}

.btn-danger-sm {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Approvals */
.approvals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.approval-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    border-left: 3px solid #f59e0b;
}

.approval-card-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.approval-brand {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.approval-list {
    font-size: 12px;
    color: var(--text-accent);
    background: rgba(0, 212, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.approval-platforms {
    display: flex;
    gap: 4px;
}

.approval-card-body {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.approval-thumb {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.approval-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 80px;
    overflow: hidden;
}

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

/* Stacked modals (opened from within another modal) */
#autolist-item-modal,
#autolist-modal,
#media-picker-modal {
    z-index: 2100;
}

/* Modal sizes */
.modal-lg {
    max-width: 700px;
}

.modal-md {
    max-width: 500px;
}

.modal-sm {
    max-width: 380px;
}

/* Phone Frame */
.phone-frame {
    width: 280px;
    background: #000;
    border-radius: 36px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 0 2px #333;
    position: relative;
}

.phone-notch {
    width: 100px;
    height: 24px;
    background: #000;
    border-radius: 0 0 16px 16px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.phone-screen {
    background: #fff;
    border-radius: 28px;
    overflow: hidden;
    min-height: 480px;
    max-height: 520px;
    display: flex;
    flex-direction: column;
}

.phone-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #000;
    background: #fff;
    z-index: 5;
}

.phone-time {
    font-size: 12px;
    font-weight: 700;
}

.phone-icons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.phone-signal, .phone-wifi, .phone-battery {
    display: block;
    background: #000;
    border-radius: 1px;
}

.phone-signal {
    width: 14px;
    height: 8px;
    background: linear-gradient(to right, #000 25%, #000 25%, #000 50%, #000 50%, #000 75%, #000 75%);
    border-radius: 1px;
    clip-path: polygon(0 100%, 25% 60%, 50% 40%, 75% 20%, 100% 0%, 100% 100%);
}

.phone-wifi {
    width: 12px;
    height: 10px;
    border: 2px solid #000;
    border-radius: 50% 50% 0 0;
    border-bottom: none;
    position: relative;
}

.phone-battery {
    width: 18px;
    height: 9px;
    border: 1.5px solid #000;
    border-radius: 2px;
    position: relative;
}

.phone-battery::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 2px;
    width: 2px;
    height: 4px;
    background: #000;
    border-radius: 0 1px 1px 0;
}

/* Phone Preview Content */
.phone-preview-content {
    flex: 1;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Facebook Preview Style */
.fb-preview {
    background: #fff;
}

.fb-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.fb-preview-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #00d4ff, #00b8d9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.fb-preview-name {
    font-weight: 600;
    font-size: 13px;
    color: #050505;
    line-height: 1.2;
}

.fb-preview-meta {
    font-size: 11px;
    color: #65676b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fb-preview-text {
    padding: 0 12px 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #050505;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
}

.fb-preview-media {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    background: #f0f2f5;
}

.fb-preview-media img,
.fb-preview-media video {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    display: block;
}

/* Video play button overlay for phone previews */
.media-video-wrap {
    position: relative;
}

.media-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
}

.media-play-btn:hover {
    background: rgba(0,0,0,0.7);
}

.media-play-btn svg {
    margin-left: 4px;
}

.fb-preview-actions {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #e4e6eb;
    padding: 6px 0;
    margin: 0 12px;
}

.fb-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #65676b;
    padding: 6px 0;
}

.fb-action-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Instagram Preview Style */
.ig-preview {
    background: #fff;
}

.ig-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #efefef;
}

.ig-preview-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.ig-preview-name {
    font-weight: 600;
    font-size: 12px;
    color: #262626;
    flex: 1;
}

.ig-preview-dots {
    color: #262626;
    font-size: 14px;
    letter-spacing: 2px;
}

.ig-preview-media {
    width: 100%;
    aspect-ratio: 1;
    max-height: 260px;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ig-preview-media img,
.ig-preview-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ig-preview-media .ig-no-media {
    color: #c7c7c7;
    font-size: 12px;
}

.ig-preview-icons {
    display: flex;
    gap: 12px;
    padding: 8px 12px 4px;
    align-items: center;
}

.ig-icon {
    width: 20px;
    height: 20px;
}

.ig-preview-likes {
    font-size: 12px;
    font-weight: 600;
    color: #262626;
    padding: 0 12px 4px;
}

.ig-preview-caption {
    padding: 0 12px 10px;
    font-size: 12px;
    color: #262626;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
}

.ig-preview-caption strong {
    font-weight: 600;
}

/* Twitter/X Preview Style */
.x-preview {
    background: #000;
    color: #e7e9ea;
}

.x-preview-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px 0;
}

.x-preview-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff, #00b8d9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.x-preview-names {
    flex: 1;
}

.x-preview-display {
    font-weight: 700;
    font-size: 13px;
    color: #e7e9ea;
}

.x-preview-handle {
    font-size: 12px;
    color: #71767b;
}

.x-preview-text {
    padding: 6px 12px 10px 58px;
    font-size: 13px;
    line-height: 1.4;
    color: #e7e9ea;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.x-preview-media {
    margin: 0 12px 8px 58px;
    border-radius: 12px;
    overflow: hidden;
    max-height: 200px;
    background: #16181c;
}

.x-preview-media img,
.x-preview-media video {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    display: block;
}

.x-preview-actions {
    display: flex;
    justify-content: space-between;
    padding: 4px 12px 10px 58px;
    max-width: 300px;
}

.x-action {
    font-size: 11px;
    color: #71767b;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* LinkedIn Preview Style */
.li-preview {
    background: #fff;
}

.li-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}

.li-preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0a66c2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.li-preview-info {
    flex: 1;
}

.li-preview-name {
    font-weight: 600;
    font-size: 13px;
    color: rgba(0,0,0,0.9);
    line-height: 1.2;
}

.li-preview-title {
    font-size: 11px;
    color: rgba(0,0,0,0.6);
    line-height: 1.2;
}

.li-preview-meta {
    font-size: 10px;
    color: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    gap: 3px;
}

.li-preview-text {
    padding: 0 12px 10px;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(0,0,0,0.9);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
}

.li-preview-media {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    background: #f3f2ef;
}

.li-preview-media img,
.li-preview-media video {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    display: block;
}

.li-preview-actions {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #e0e0e0;
    padding: 8px 12px;
}

.li-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(0,0,0,0.6);
}

/* Responsive - Stack on mobile */
@media (max-width: 900px) {
    .modal-xl {
        max-width: 95%;
        max-height: 85vh;
    }

    .post-modal-layout {
        flex-direction: column;
    }

    .post-modal-preview {
        flex: none;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Hide phone preview in detail modal on mobile — info already shows everything */
    #post-detail-modal .post-modal-preview {
        display: none;
    }

    .post-detail-meta {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }

    .post-detail-text {
        max-height: 120px;
        padding: 10px;
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 12px;
    }

    .post-detail-media {
        margin-bottom: 12px;
    }

    .post-media-preview {
        max-height: 180px;
    }

    .post-detail-providers {
        margin-bottom: 10px;
    }

    .post-detail-providers h3 {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .provider-status {
        padding: 6px 10px;
    }

    .post-detail-actions {
        padding-top: 10px;
    }

    .post-detail-actions .btn-secondary,
    .post-detail-actions .btn-danger {
        padding: 8px 16px;
        font-size: 13px;
    }

    .autolist-slot-info {
        padding: 12px;
        margin: 8px 0;
    }

    .autolist-slot-info p {
        font-size: 12px;
    }

    .phone-frame {
        width: 260px;
    }
}

/* ============================================================================
   Memory Matrix (Settings > Memory)
   ============================================================================ */

.mm-container {
    padding: 0;
}

.mm-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.mm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.mm-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-primary);
}

.mm-table th,
.mm-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.mm-file-header {
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 160px;
}

.mm-worker-header {
    text-align: center;
    min-width: 80px;
}

.mm-worker-name {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.mm-file-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mm-file-name {
    color: var(--text-primary);
    font-weight: 500;
}

.mm-file-desc {
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.mm-file-desc:hover {
    border-color: var(--border-accent);
    background: rgba(0, 212, 255, 0.05);
}

.mm-desc-empty {
    color: var(--text-muted);
    opacity: 0.5;
    font-style: italic;
}

.mm-desc-empty:hover {
    opacity: 1;
}

.mm-desc-input {
    font-size: 11px;
    padding: 1px 4px;
    border: 1px solid var(--border-accent);
    border-radius: 3px;
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 180px;
    outline: none;
}

.mm-file-tokens {
    color: var(--text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.mm-cell {
    text-align: center;
    vertical-align: middle;
}

.mm-cb {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00d4ff;
}

.mm-totals-row {
    background: rgba(0, 212, 255, 0.05);
}

.mm-total-cell {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-accent);
    font-size: 12px;
}

/* Category header row (ZK-002) */
.mm-cat-header {
    background: rgba(255, 255, 255, 0.03);
}

.mm-cat-cell {
    padding: 6px 12px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.mm-cat-icon {
    font-size: 14px;
}

.mm-cat-label {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.mm-cat-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.mm-cat-select {
    width: 28px;
    height: 22px;
    font-size: 13px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 2px;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.mm-cat-select:hover,
.mm-cat-select:focus {
    border-color: var(--border-accent);
    background: var(--bg-tertiary);
    width: auto;
    min-width: 120px;
    appearance: auto;
    -webkit-appearance: auto;
    text-align: left;
    padding: 0 4px;
}

.mm-legend {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.mm-legend code {
    font-size: 10px;
    background: rgba(255,255,255,0.05);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Mobile: stack the matrix */
@media (max-width: 640px) {
    .mm-worker-name {
        display: none;
    }
    .mm-worker-header {
        min-width: 48px;
    }
    .mm-file-header {
        min-width: 120px;
    }
    .mm-table th,
    .mm-table td {
        padding: 6px 8px;
    }
}

/* ============================================================================
   Extensions Management
   ============================================================================ */

.extensions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.ext-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s;
}

.ext-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.ext-card.ext-disabled {
    opacity: 0.6;
}

.ext-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.ext-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 184, 217, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #67e8f9;
    flex-shrink: 0;
}

.ext-card-title {
    flex: 1;
    min-width: 0;
}

.ext-card-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.ext-version {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.ext-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ext-status-loaded {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.ext-status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.ext-status-disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ext-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px;
    line-height: 1.5;
}

.ext-author {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 12px;
    font-style: italic;
}

.ext-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.ext-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.ext-stats svg {
    color: var(--text-accent);
    opacity: 0.7;
}

.ext-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ext-actions .ext-toggle {
    margin-right: auto;
}

/* Toggle Switch */
.ext-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.ext-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ext-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ext-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s;
}

.ext-toggle input:checked + .ext-toggle-slider {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.4);
}

.ext-toggle input:checked + .ext-toggle-slider::before {
    transform: translateX(20px);
    background: #00d4ff;
}

/* Top Nav Toggle */
.ext-topnav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
}

.ext-topnav-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ext-topnav-slider {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ext-topnav-slider::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s;
}

.ext-topnav-toggle input:checked + .ext-topnav-slider {
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.4);
}

.ext-topnav-toggle input:checked + .ext-topnav-slider::before {
    transform: translateX(14px);
    background: #a855f7;
}

.ext-topnav-toggle input:disabled + .ext-topnav-slider {
    opacity: 0.3;
    cursor: not-allowed;
}

.ext-topnav-toggle input:disabled ~ .ext-topnav-label {
    opacity: 0.3;
}

.ext-topnav-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Empty state */
.ext-card .empty-state {
    text-align: center;
    padding: 40px;
}

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

    .ext-actions {
        flex-wrap: wrap;
    }

    .ext-stats {
        gap: 8px;
    }
}

/* Extension Env Panel */
.ext-env-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.ext-env-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.ext-env-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.ext-env-header .btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
}

.ext-env-header .btn-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

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

.ext-env-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.ext-env-row input[type="text"],
.ext-env-row input[type="password"] {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.ext-env-row input[type="text"]:focus,
.ext-env-row input[type="password"]:focus {
    border-color: var(--border-accent);
    outline: none;
}

.ext-env-row .env-key {
    width: 40%;
    flex: none;
}

.ext-env-row .env-val {
    flex: 1;
}

.ext-env-row .btn-env-secret {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

.ext-env-row .btn-env-secret.active {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

.ext-env-row .btn-env-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    flex-shrink: 0;
}

.ext-env-row .btn-env-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.ext-env-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
}

.ext-env-footer .btn-add-env {
    background: none;
    border: 1px dashed var(--border-subtle);
    border-radius: 8px;
    padding: 6px 14px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
}

.ext-env-footer .btn-add-env:hover {
    border-color: var(--border-accent);
    color: var(--text-accent);
}

.ext-env-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================================================
   Worker Memory Cards (Settings)
   ============================================================================ */

.wm-container {
    max-width: 900px;
}

.wm-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wm-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
}

.wm-card:hover {
    border-color: var(--accent);
}

.wm-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wm-card-title {
    flex: 1;
    min-width: 0;
}

.wm-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.wm-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.wm-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.wm-clear-btn {
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 10px;
    transition: all 0.2s;
}

.wm-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.wm-card-preview,
.wm-card-full {
    margin-top: 12px;
    position: relative;
}

.wm-preview-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.wm-expand-btn {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.wm-expand-btn:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .wm-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wm-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Worker Memory Clear Confirmation Dialog */
.wm-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.wm-confirm-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
}

/* ---- Provision Modal (DP-007) ---- */

.provision-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.provision-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.provision-option:hover {
    background: var(--bg-tertiary);
}

.provision-option input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.provision-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 400px;
    overflow-y: auto;
}

.provision-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    transition: background 0.2s, opacity 0.2s;
    background: var(--bg-tertiary);
}

.provision-step.running {
    background: rgba(0, 212, 255, 0.08);
    border-left: 3px solid var(--accent);
}

.provision-step.done {
    opacity: 0.85;
}

.provision-step.error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

.provision-step.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
}

.provision-step.skipped {
    opacity: 0.5;
}

.provision-step-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    margin-top: 1px;
}

.provision-step-icon .spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.provision-step-name {
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
    font-size: 12px;
}

.provision-step-detail {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
    word-break: break-word;
    font-family: 'JetBrains Mono', monospace;
}

.provision-result {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

.provision-result.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.provision-result.success a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.provision-result.failure {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Teardown modal (DP-008) */
.teardown-preview-info {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.teardown-preview-info .preview-item {
    display: flex;
    gap: 8px;
    align-items: baseline;
}
.teardown-preview-info .preview-label {
    color: var(--text-muted);
    min-width: 100px;
    flex-shrink: 0;
}
.teardown-danger-opt {
    color: #ef4444 !important;
}
.teardown-danger-opt input[type="checkbox"] {
    accent-color: #ef4444;
}
.teardown-confirm {
    margin-left: 32px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: rgba(239, 68, 68, 0.06);
    border-radius: 6px;
    border-left: 3px solid #ef4444;
}
.teardown-confirm label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.teardown-confirm .form-input {
    width: 100%;
    font-size: 12px;
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
}
.teardown-confirm small {
    display: block;
    margin-top: 4px;
    font-size: 10px;
}

/* ── Small input/select variants ── */
.select-sm, .input-sm {
    padding: 6px 10px;
    font-size: 13px;
    height: auto;
}

/* ── Media Picker (post creation) ── */
.media-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    border: 2px dashed var(--border-subtle);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.media-picker-btn:hover {
    border-color: var(--border-accent);
    background: rgba(56, 189, 248, 0.05);
}
.media-picker-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}
.media-picker-preview img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.media-picker-preview-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-secondary);
}
.media-picker-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}
.media-picker-remove:hover {
    color: #f87171;
}
.media-picker-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.media-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 4px;
}
.media-picker-item {
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-tertiary);
}
.media-picker-item:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.media-picker-item .picker-thumb {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.3);
}
.media-picker-item .picker-name {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-picker-item .picker-video-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}
.media-picker-item .picker-thumb-wrap {
    position: relative;
}

@media (max-width: 768px) {
    .media-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

/* Modal Overlay (shared) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.modal-close:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: #ef4444; }

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================================
   Squads — Visual Squad Builder
   ============================================================================ */

/* Grid of squad cards */
.squads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.squad-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    border: 2px dashed var(--border-primary);
    border-radius: 16px;
    background: rgba(99, 102, 241, 0.03);
}

/* Squad Card */
.squad-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid var(--squad-color, #6366f1);
}
.squad-card:hover {
    border-color: var(--squad-color, #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.squad-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.squad-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.squad-card-info {
    flex: 1;
    min-width: 0;
}
.squad-card-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.squad-card-info p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.squad-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.squad-card:hover .squad-card-actions { opacity: 1; }

.btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-icon-sm:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.btn-danger-icon:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: #ef4444; }

.squad-card-stats {
    display: flex;
    gap: 16px;
}
.squad-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.squad-stat svg { opacity: 0.6; }

/* Squad Detail Modal */
.squad-detail-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.25s ease;
}

.squad-detail-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid;
}
.squad-detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.squad-detail-title h2 { margin: 0; font-size: 20px; color: var(--text-primary); }
.squad-detail-title p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
.squad-detail-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.squad-detail-body { padding: 20px 24px; }
.squad-detail-section { margin-bottom: 20px; }
.squad-detail-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
}

.squad-members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.squad-member-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-primary);
    border-radius: 20px;
}
.squad-member-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.squad-member-name { font-size: 13px; color: var(--text-primary); }

.squad-topic-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.squad-topic-chip {
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    color: #a5b4fc;
    font-family: monospace;
}

.squad-task-stats {
    display: flex;
    gap: 20px;
}
.squad-task-stat { text-align: center; }
.squad-task-count { font-size: 24px; font-weight: 700; color: var(--text-primary); display: block; }
.squad-task-label { font-size: 11px; color: var(--text-secondary); }

.squad-detail-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Squad Builder Modal */
.squad-builder-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.25s ease;
}

.squad-builder-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-primary);
}
.squad-builder-header h2 { margin: 0; font-size: 20px; color: var(--text-primary); }

.squad-builder-body { padding: 20px 24px; }

.squad-builder-config {
    margin-bottom: 20px;
}
.squad-builder-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.squad-field { display: flex; flex-direction: column; gap: 4px; }
.squad-field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

/* Drag-and-drop panels */
.squad-builder-panels {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: stretch;
}

.squad-builder-panel {
    flex: 1;
}
.squad-builder-panel h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px;
}

.squad-builder-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 4px;
    flex-shrink: 0;
}

.squad-worker-pool {
    min-height: 120px;
    border: 2px dashed var(--border-primary);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
    transition: all 0.2s;
}
.squad-worker-pool.drag-over {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.05);
}
.squad-members-pool {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
}

.squad-pool-empty {
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 24px 12px;
}

/* Worker chip in builder */
.squad-worker-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    cursor: grab;
    transition: all 0.15s;
    user-select: none;
}
.squad-worker-chip:hover {
    border-color: var(--border-accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.squad-worker-chip.dragging {
    opacity: 0.4;
    cursor: grabbing;
}
.squad-worker-chip.squad-worker-assigned {
    border-left: 3px solid;
    border-left-color: var(--border-accent, #6366f1);
}

.squad-worker-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}
.squad-worker-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Topic file selector in builder */
.squad-builder-topics {
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.1);
}
.squad-topic-selector {
    max-height: 200px;
    overflow-y: auto;
}
.squad-topic-category {
    margin-bottom: 12px;
}
.squad-topic-cat-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.squad-topic-cat-files {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.squad-topic-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 12px;
}
.squad-topic-option:hover { background: rgba(255,255,255,0.03); }
.squad-topic-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #6366f1;
}
.squad-topic-name { color: var(--text-primary); font-family: monospace; font-size: 11px; }
.squad-topic-tokens { color: var(--text-secondary); font-size: 10px; }

.squad-builder-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .squads-grid { grid-template-columns: 1fr; }
    .squad-builder-panels { flex-direction: column; }
    .squad-builder-arrow {
        flex-direction: row;
        transform: rotate(90deg);
        padding: 8px 0;
    }
    .squad-builder-row { flex-wrap: wrap; }
}

/* ============================================================================
   Worker Handoff Protocol (ZK-005)
   ============================================================================ */

.btn-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-warning:hover {
    background: rgba(245, 158, 11, 0.3);
    border-color: rgba(245, 158, 11, 0.5);
}

.handoff-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--warning);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
}

.handoff-task-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.handoff-task-info strong {
    color: var(--text-primary);
}

.handoff-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}
.handoff-checkbox-row input[type="checkbox"] {
    accent-color: var(--warning);
}

/* Handoff history list in task modal */
.handoff-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}
.handoff-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    font-size: 13px;
}
.handoff-entry-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.handoff-entry-body {
    flex: 1;
    min-width: 0;
}
.handoff-entry-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.handoff-entry-worker {
    font-weight: 600;
    color: var(--text-primary);
}
.handoff-entry-arrow {
    color: var(--text-muted);
}
.handoff-entry-time {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: auto;
}
.handoff-entry-reason {
    color: var(--text-secondary);
    margin-top: 4px;
}
.handoff-status {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.handoff-status.pending { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.handoff-status.accepted { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.handoff-status.completed { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.handoff-status.rejected { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

/* Pending handoffs banner at top of task board */
.handoff-pending-banner {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.handoff-pending-banner h4 {
    color: #f59e0b;
    margin: 0 0 8px;
    font-size: 13px;
}
.handoff-pending-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}
.handoff-pending-item:last-child { margin-bottom: 0; }
.handoff-pending-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}
.handoff-pending-actions button {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
.handoff-accept-btn {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}
.handoff-accept-btn:hover { background: rgba(16, 185, 129, 0.3); }
.handoff-reject-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.handoff-reject-btn:hover { background: rgba(239, 68, 68, 0.25); }

/* ============================================================================
   Pipelines — Visual Pipeline Designer (ZK-007)
   ============================================================================ */

.pipelines-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}
.pipeline-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    border: 2px dashed var(--border-subtle);
    border-radius: 16px;
    background: rgba(139, 92, 246, 0.03);
}
.pipeline-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--pipeline-color, #8b5cf6);
    border-radius: 10px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.2s;
}
.pipeline-card:hover {
    border-color: var(--pipeline-color, #8b5cf6);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.pipeline-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pipeline-card-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.pipeline-card-info {
    flex: 1;
    min-width: 0;
}
.pipeline-card-info h3 {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pipeline-card-info p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pipeline-card-bottom {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pipeline-card-stats {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pipeline-stat {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 7px;
    border-radius: 5px;
    white-space: nowrap;
}
.pipeline-stat-active {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}
.pipeline-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.pipeline-card:hover .pipeline-card-actions { opacity: 1; }

/* Mini flow nodes (card preview & task indicator) */
.pf-mini-flow {
    display: flex;
    align-items: center;
    gap: 3px;
}
.pf-mini-node {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    color: var(--text-muted);
}
.pf-mini-pending { border-color: rgba(255,255,255,0.2); }
.pf-mini-completed { background: #10b981; border-color: #10b981; color: #fff; }
.pf-mini-active { background: #8b5cf6; border-color: #8b5cf6; color: #fff; box-shadow: 0 0 6px rgba(139,92,246,0.4); }
.pf-mini-skipped { border-color: #ef4444; background: rgba(239,68,68,0.2); }
.pf-mini-conn {
    width: 8px; height: 2px;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
}

/* Pipeline Runs */
.pipeline-runs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.pipeline-runs-tabs {
    display: flex;
    gap: 4px;
}
.pipeline-runs-tab {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.pipeline-runs-tab:hover { background: rgba(255,255,255,0.05); }
.pipeline-runs-tab.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
    color: #8b5cf6;
}
.pipeline-runs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pipeline-run-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.pipeline-run-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.pipeline-run-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pipeline-run-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.pipeline-run-info {
    flex: 1;
    min-width: 0;
}
.pipeline-run-info strong {
    display: block;
    color: var(--text-primary);
    font-size: 13px;
}
.pipeline-run-task {
    font-size: 12px;
    color: var(--text-secondary);
}
.pipeline-run-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}
.pipeline-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}
.pipeline-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4);
    border-radius: 2px;
    transition: width 0.3s;
}
.pipeline-progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pipeline-run-stage {
    font-size: 12px;
    color: var(--accent);
    white-space: nowrap;
}
.pipeline-run-stage-completed { color: var(--success); }
.pipeline-run-stage-cancelled { color: var(--error); }

/* Grouped Pipeline Run Cards */
.prg-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
    overflow: hidden;
}
.prg-card:hover { border-color: var(--accent); }
.prg-card.prg-expanded { border-color: rgba(139, 92, 246, 0.4); }
.prg-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.prg-card-header:hover { background: rgba(255,255,255,0.02); }
.prg-card-info {
    flex: 1;
    min-width: 0;
}
.prg-card-info strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.9rem;
}
.prg-card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.prg-project-tag {
    display: inline-block;
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 2px;
    vertical-align: middle;
}
.prg-card-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
    min-width: 110px;
    justify-content: flex-end;
}
.prg-progress-ring {
    width: 44px;
    height: 44px;
    position: relative;
}
.prg-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.prg-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.08);
    stroke-width: 3;
}
.prg-ring-fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s ease;
}
.prg-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
}
.prg-card-counts {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 42px;
}
.prg-count {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.prg-count-done { color: #10b981; }
.prg-count-active { color: #f59e0b; }
.prg-count-human { color: #f97316; }
.prg-human-badge {
    font-size: 10px;
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    white-space: nowrap;
    animation: human-pulse 2s ease-in-out infinite;
}
@keyframes human-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.prg-chevron {
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.prg-expanded .prg-chevron { transform: rotate(180deg); }

/* Task rows inside grouped card */
.prg-card-tasks {
    border-top: 1px solid var(--border);
    padding: 4px 0;
    max-height: 320px;
    overflow-y: auto;
}
.prg-task-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 46px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.8rem;
}
.prg-task-row:hover { background: rgba(255,255,255,0.03); }
.prg-task-id {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    width: 48px;
}
.prg-task-title {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prg-task-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.prg-task-stages {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
.prg-task-stage {
    font-size: 11px;
    color: var(--accent);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}
.prg-task-stage-completed { color: var(--success); }
.prg-task-stage-cancelled { color: var(--error); }

/* Visual Flow Canvas */
.pf-canvas {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    padding: 12px 4px;
    scrollbar-width: thin;
}
.pf-node {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    min-width: 150px;
    max-width: 200px;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}
.pf-node-completed {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}
.pf-node-active {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}
.pf-node-skipped {
    opacity: 0.5;
    border-color: #ef4444;
}
.pf-node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.pf-node-num {
    width: 22px; height: 22px;
    background: var(--node-color, #8b5cf6);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 700;
}
.pf-node-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.pf-dot-completed { background: #10b981; }
.pf-dot-active { background: #8b5cf6; box-shadow: 0 0 6px rgba(139,92,246,0.5); animation: pfPulse 2s infinite; }
.pf-dot-skipped { background: #ef4444; }
.pf-dot-pending { background: rgba(255,255,255,0.2); }
@keyframes pfPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.pf-node-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-node-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pf-node-assignee {
    font-size: 11px;
    color: var(--text-secondary);
}
.pf-auto-badge {
    font-size: 9px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 4px;
    display: inline-block;
}
.pf-human-badge {
    font-size: 9px;
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 4px;
    display: inline-block;
    font-weight: 600;
}
.pf-human-badge-idle {
    opacity: 0.6;
}
.pf-node-active .pf-human-badge {
    animation: human-pulse 2s ease-in-out infinite;
}
.btn-handoff {
    background: linear-gradient(135deg, #f97316, #ea580c) !important;
    border-color: #ea580c !important;
}
.pf-node-timing {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.pf-node-notes {
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
    padding: 4px 6px;
    border-radius: 4px;
    margin-top: 4px;
    font-style: italic;
}
.pf-connector {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0 2px;
}

/* Pipeline Detail Modal */
.pipeline-detail-modal, .pipeline-run-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
}
.pipeline-detail-header, .pipeline-run-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 2px solid var(--border);
}
.pipeline-detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pipeline-detail-title h2 { margin: 0; font-size: 20px; color: var(--text-primary); }
.pipeline-detail-title p { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
.pipeline-detail-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.pipeline-detail-body { padding: 20px 24px; }

/* Run mini (in detail modal) */
.pipeline-run-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: border-color 0.15s;
}
.pipeline-run-mini:hover { border-color: var(--accent); }
.pipeline-run-stage-badge {
    font-size: 11px;
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Run detail */
.pipeline-run-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}
.pipeline-run-modal-header p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.pipeline-run-status {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.pipeline-run-status-active { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.pipeline-run-status-completed { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.pipeline-run-status-cancelled { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.pipeline-run-progress-bar-section {
    padding: 16px 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.pipeline-run-flow-section {
    padding: 8px 24px 16px;
}
.pipeline-run-actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    align-items: center;
    justify-content: flex-end;
}
.pf-advance-section {
    display: flex;
    gap: 8px;
    flex: 1;
    align-items: center;
}
.btn-danger-text { color: #ef4444 !important; }

/* Pipeline builder */
.pipeline-builder-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.pipeline-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}
.pipeline-builder-header h2 { margin: 0; font-size: 18px; color: var(--text-primary); }
.pipeline-builder-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}
.pipeline-builder-config { margin-bottom: 16px; }
.pipeline-builder-row {
    display: flex;
    gap: 8px;
}
.pipeline-builder-preview {
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}
.pipeline-builder-stages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.pipeline-builder-stages-header h3 { margin: 0; color: var(--text-primary); font-size: 15px; }
.pipeline-builder-stages {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pipeline-builder-stage {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    transition: all 0.2s;
}
.pipeline-builder-stage:hover {
    border-color: rgba(139, 92, 246, 0.3);
}
.pipeline-builder-stage.dragging {
    opacity: 0.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.pipeline-builder-stage-main {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pipeline-builder-stage-grip {
    cursor: grab;
    color: var(--text-secondary);
    font-size: 16px;
    user-select: none;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.pipeline-builder-stage-num {
    width: 22px; height: 22px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.pipeline-builder-stage .input {
    font-size: 13px;
    padding: 6px 8px;
}
.pipeline-builder-stage .pipeline-stage-name { flex: 1; min-width: 100px; }
.pipeline-builder-stage .pipeline-stage-desc { flex: 1; min-width: 80px; }
.pipeline-builder-stage .pipeline-stage-assignee { min-width: 130px; }
.pipeline-auto-label {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}
/* Worker Instructions toggle button */
.pipeline-toggle-instructions {
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color 0.2s;
}
.pipeline-toggle-instructions:hover { color: var(--accent); }
.pipeline-toggle-instructions.has-instructions { color: var(--accent); }
/* Worker Instructions panel */
.pipeline-stage-instructions {
    margin-top: 8px;
    padding: 10px 12px 10px 52px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pipeline-stage-instructions.hidden { display: none; }
.psi-empty {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    padding: 4px 0;
}
.psi-worker { display: flex; flex-direction: column; gap: 4px; }
.psi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.psi-textarea {
    min-height: 48px;
    resize: vertical;
    font-size: 12px;
    line-height: 1.5;
}
/* Run detail instructions */
.pipeline-run-instructions-section {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}
.pf-run-instruction {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
}
.pf-run-instruction-active {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.05);
}
.pf-run-instruction-worker {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pf-run-instruction-text {
    font-size: 13px;
    color: var(--text-primary);
    margin-top: 4px;
    white-space: pre-wrap;
}
/* Visual flow instruction badge */
.pf-node-instr-badge {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}
/* Human Input Section (pipeline run detail) */
.pf-human-input-section {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}
.pf-human-input-card {
    background: rgba(249, 115, 22, 0.06);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: 10px;
    padding: 16px 20px;
}
.pf-human-input-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.pf-human-input-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #f97316;
}
.pf-human-input-brief {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.pf-human-input-instructions {
    background: rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
}
.pf-human-input-instructions-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.pf-human-textarea {
    width: 100%;
    min-height: 120px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.pf-human-textarea:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}
.pf-human-textarea::placeholder {
    color: var(--text-muted);
}
.pf-human-input-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
/* Previous Stage Input (shown to next stage) */
.pf-prev-input-section {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
}
.pf-prev-input-card {
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
}
.pf-prev-input-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}
.pf-prev-input-from {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.pf-prev-input-text {
    font-size: 13px;
    color: var(--text-primary);
    white-space: pre-wrap;
    line-height: 1.5;
}

.pipeline-builder-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Pipeline builder — mobile responsive */
@media (max-width: 768px) {
    .pipeline-builder-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    .pipeline-builder-header { padding: 12px 16px; }
    .pipeline-builder-body { padding: 14px 16px; }
    .pipeline-builder-footer { padding: 12px 16px; }
    .pipeline-builder-row {
        flex-wrap: wrap;
    }
    .pipeline-builder-row input#pb-name { flex: 1; min-width: 0; }
    .pipeline-builder-stage-main {
        flex-wrap: wrap;
        gap: 6px;
    }
    .pipeline-builder-stage .pipeline-stage-name {
        flex: 1 1 auto;
        min-width: 0;
        order: 1;
    }
    .pipeline-builder-stage .pipeline-stage-desc {
        display: none;
    }
    .pipeline-builder-stage .pipeline-stage-assignee {
        min-width: 0;
        flex: 1 1 auto;
        order: 2;
    }
    .pipeline-builder-stage-grip { order: 0; width: 16px; }
    .pipeline-builder-stage-num { order: 0; }
    .pipeline-auto-label { order: 3; }
    .pipeline-toggle-instructions { order: 4; }
    .pipeline-remove-stage { order: 5; }
    .pipeline-stage-instructions { padding: 10px 12px 10px 12px; }
    .pipeline-builder-preview { padding: 8px; overflow-x: auto; }
}

/* Task Picker Modal — Enhanced Multi-Select */
.task-picker-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.2s ease;
}
.task-picker-modal.tp-enhanced {
    max-width: 720px;
    max-height: 85vh;
}
.task-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.task-picker-header h2 { margin: 0; font-size: 16px; color: var(--text-primary); }
.tp-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: block; }
.tp-filters {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tp-filters-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.tp-search-wrap { flex: 1; }
.tp-search-wrap .input { width: 100%; }
.tp-board-select {
    min-width: 150px;
    font-size: 13px;
}
.tp-status-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.tp-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    transition: all 0.15s;
}
.tp-pill:hover { border-color: var(--text-secondary); color: var(--text-secondary); }
.tp-pill.active { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border-color: rgba(139, 92, 246, 0.3); }
.tp-pill.active[data-status="todo"] { background: rgba(0, 212, 255, 0.1); color: #00d4ff; border-color: rgba(0, 212, 255, 0.3); }
.tp-pill.active[data-status="in_progress"] { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border-color: rgba(139, 92, 246, 0.3); }
.tp-pill.active[data-status="backlog"] { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); border-color: rgba(255, 255, 255, 0.15); }
.tp-pill.active[data-status="blocked"] { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.tp-pill.active[data-status="done"] { background: rgba(16, 185, 129, 0.1); color: #10b981; border-color: rgba(16, 185, 129, 0.3); }
.tp-select-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-muted);
}
.tp-select-all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.tp-result-count { color: var(--text-muted); }
.task-picker-results {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    min-height: 120px;
}
.task-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.task-picker-item:hover {
    background: rgba(139, 92, 246, 0.08);
}
.task-picker-item.tp-selected {
    background: rgba(139, 92, 246, 0.12);
    border-left: 2px solid #8b5cf6;
}
.tp-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #8b5cf6;
    cursor: pointer;
    flex-shrink: 0;
}
.task-picker-id {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 44px;
    flex-shrink: 0;
}
.tp-task-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.task-picker-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tp-task-meta {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tp-memory-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: help;
}
.tp-task-worker {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.task-picker-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.task-picker-status-todo { background: rgba(0, 212, 255, 0.1); color: #00d4ff; }
.task-picker-status-in_progress { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.task-picker-status-backlog { background: var(--bg-tertiary); color: var(--text-muted); }
.task-picker-status-blocked { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.task-picker-status-done { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.tp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 0 0 16px 16px;
}
.tp-footer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}
.tp-clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
}
.tp-clear-btn:hover { color: var(--error); }
.tp-run-btn {
    padding: 8px 20px !important;
    font-weight: 600;
}
@media (max-width: 768px) {
    .task-picker-modal.tp-enhanced { max-width: 95%; max-height: 90vh; }
    .tp-filters-row { flex-direction: column; }
    .tp-board-select { min-width: 100%; }
    .tp-task-worker { display: none; }
}

/* Task pipeline indicator */
.task-pipeline-indicator {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}
.task-pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-primary);
}
.pipeline-flow-mini {
    display: flex;
    align-items: center;
    gap: 3px;
    margin: 6px 0;
}

/* ============================================================================
   GSC Actions
   ============================================================================ */

.gsc-stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.gsc-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 20px;
    flex: 1;
    min-width: 140px;
    text-align: center;
}
.gsc-stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.gsc-stat-card .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}
.gsc-stat-card.pending .stat-value { color: #f59e0b; }
.gsc-stat-card.in-progress .stat-value { color: #3b82f6; }
.gsc-stat-card.completed .stat-value { color: #10b981; }
.gsc-stat-card.critical .stat-value { color: #ef4444; }

.gsc-actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.gsc-action-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: border-color 0.2s;
}
.gsc-action-card:hover {
    border-color: var(--accent-primary);
}
.gsc-action-card.completed {
    opacity: 0.6;
}
.gsc-action-priority {
    width: 4px;
    min-height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
    align-self: stretch;
}
.gsc-action-priority.critical { background: #ef4444; }
.gsc-action-priority.high { background: #f59e0b; }
.gsc-action-priority.medium { background: #3b82f6; }
.gsc-action-priority.low { background: #6b7280; }

.gsc-action-body {
    flex: 1;
    min-width: 0;
}
.gsc-action-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.gsc-action-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.gsc-action-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.gsc-action-badge.cat { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.gsc-action-badge.domain { background: rgba(0, 212, 255, 0.12); color: #22d3ee; }
.gsc-action-badge.pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.gsc-action-badge.in_progress { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.gsc-action-badge.completed { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.gsc-action-badge.dismissed { background: rgba(107, 114, 128, 0.15); color: #6b7280; }

.gsc-action-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 6px;
    white-space: pre-line;
}
.gsc-action-meta {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}
.gsc-action-actions {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    flex-shrink: 0;
}
.gsc-action-actions button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.gsc-action-actions button:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.gsc-action-actions button.btn-create-task {
    border-color: #10b981;
    color: #10b981;
}
.gsc-action-actions button.btn-create-task:hover {
    background: rgba(16, 185, 129, 0.1);
}
.gsc-action-outcome {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.08);
    border-left: 3px solid #10b981;
    border-radius: 0 6px 6px 0;
    font-size: 12px;
    color: var(--text-secondary);
}
.gsc-action-task-link {
    color: #22d3ee;
    text-decoration: none;
    font-size: 11px;
    cursor: pointer;
}
.gsc-action-task-link:hover { text-decoration: underline; }

/* GSC Create Task Modal */
.gsc-task-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.gsc-task-modal {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    width: 420px;
    max-width: 90vw;
}
.gsc-task-modal h3 {
    margin: 0 0 16px;
    color: var(--text-primary);
    font-size: 16px;
}
.gsc-task-modal label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    margin-top: 12px;
}
.gsc-task-modal select,
.gsc-task-modal input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}
.gsc-task-modal .modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .gsc-stats-bar { gap: 8px; }
    .gsc-stat-card { min-width: 100px; padding: 10px 14px; }
    .gsc-stat-card .stat-value { font-size: 22px; }
    .gsc-action-card { flex-direction: column; padding: 12px 14px; }
    .gsc-action-actions { width: 100%; justify-content: flex-end; }
}

