/* ============================================================
   DCL Mission Control — Dark Neumorphic Design System
   Full responsive: desktop, tablet, phone
   ============================================================ */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #141425;
    --bg-gradient: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;
    --neu-raised: 4px 4px 8px #06060c, -4px -4px 8px #2a2a4e;
    --neu-depressed: inset 3px 3px 6px #06060c, inset -3px -3px 6px #2a2a4e;
    --neu-depressed-deep: inset 5px 5px 10px #06060c, inset -5px -5px 10px #2a2a4e;
    --neu-flat: none;
    --accent-green: #00d4aa;
    --accent-amber: #f0b429;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --sidebar-width: 240px;
}

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

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.nav-label, .section-title, .panel-title, .stat-value,
.modal-header h3, .tab-btn, .section-label {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── App Shell ──────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Mobile hamburger ───────────────────────────── */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn:active { box-shadow: var(--neu-depressed); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.visible { display: block; }

/* ── Sidebar ────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 15, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    flex-shrink: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.brand-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.15));
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px 20px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 20px;
}

.sidebar-brand .logo-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    box-shadow: var(--neu-raised);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}
.sidebar-brand .logo-container:hover { box-shadow: 6px 6px 12px #06060c, -6px -6px 12px #2a2a4e; }
.sidebar-brand .logo-container:active { box-shadow: var(--neu-depressed); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.nav-section { margin-bottom: 16px; }

.nav-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0 8px 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease, color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.nav-btn:hover { background: var(--bg-secondary); color: var(--text-primary); box-shadow: var(--neu-depressed); }
.nav-btn:active { box-shadow: var(--neu-depressed-deep); transform: scale(0.97); }
.nav-btn.active { background: var(--bg-secondary); color: var(--accent-blue); box-shadow: var(--neu-depressed-deep); }

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--glass-border); display: flex; flex-direction: column; gap: 8px; }

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 8px rgba(0, 212, 170, 0.6); }

/* ── Main Content ───────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    gap: 12px;
}

.top-bar-left { display: flex; align-items: center; gap: 12px; }

.page-title { font-size: 20px; font-weight: 600; white-space: nowrap; }

.top-actions { display: flex; gap: 8px; flex-shrink: 0; }

.tab-content { display: none; flex: 1; overflow-y: auto; padding: 20px; -webkit-overflow-scrolling: touch; }
.tab-content.active { display: block; }
/* ── Glass Panel ─────────────────────────────────── */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--neu-raised);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.glass-panel:hover { border-color: rgba(255, 255, 255, 0.10); }
.glass-panel.dragging { opacity: 0.6; transform: rotate(2deg) scale(1.02); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4); }
.glass-panel.drag-over { border-color: var(--accent-blue); box-shadow: 0 0 20px rgba(59, 130, 246, 0.15); }

/* ── Buttons ────────────────────────────────────── */
.btn-neumorphic {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: none;
    transition: box-shadow 0.2s ease, transform 0.15s ease, color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.btn-neumorphic:hover { color: var(--text-primary); box-shadow: var(--neu-depressed); }
.btn-neumorphic:active, .btn-neumorphic.depressed { box-shadow: var(--neu-depressed-deep); transform: scale(0.97); }
.btn-neumorphic.btn-primary { color: var(--accent-blue); }
.btn-neumorphic.btn-primary:hover { box-shadow: inset 3px 3px 6px #060a1e, inset -3px -3px 6px #1e2a52; }
.btn-neumorphic.btn-primary:active { box-shadow: inset 5px 5px 10px #060a1e, inset -5px -5px 10px #1e2a52; transform: scale(0.97); }
.btn-neumorphic.btn-danger { color: var(--accent-red); }
.btn-neumorphic.btn-danger:hover { box-shadow: inset 3px 3px 6px #1a0808, inset -3px -3px 6px #3e1a1a; }
.btn-neumorphic.btn-danger:active { box-shadow: inset 5px 5px 10px #1a0808, inset -5px -5px 10px #3e1a1a; transform: scale(0.97); }
.btn-neumorphic.btn-close { padding: 6px 10px; font-size: 16px; }
.btn-neumorphic.btn-sm { padding: 4px 8px !important; font-size: 11px !important; }
.btn-neumorphic.btn-success { color: var(--accent-green); }

/* ── Card Grid ──────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-description { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; }

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-secondary);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3), inset -2px -2px 5px rgba(255, 255, 255, 0.08);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3), inset -2px -2px 5px rgba(255, 255, 255, 0.08);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}
.status-badge.planning { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); border-color: rgba(139, 92, 246, 0.1); }
.status-badge.active   { background: rgba(0, 212, 170, 0.1);  color: var(--accent-green);  border-color: rgba(0, 212, 170, 0.1); }
.status-badge.blocked  { background: rgba(239, 68, 68, 0.1);  color: var(--accent-red);    border-color: rgba(239, 68, 68, 0.1); }
.status-badge.complete { background: rgba(59, 130, 246, 0.1);  color: var(--accent-blue);   border-color: rgba(59, 130, 246, 0.1); }
.status-badge.archived, .status-badge.idle { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); border-color: rgba(100, 116, 139, 0.1); }
.status-badge.success  { background: rgba(0, 212, 170, 0.1);  color: var(--accent-green);  border-color: rgba(0, 212, 170, 0.1); }
.status-badge.failure  { background: rgba(239, 68, 68, 0.1);  color: var(--accent-red);    border-color: rgba(239, 68, 68, 0.1); }
.status-badge.timeout  { background: rgba(240, 180, 41, 0.1); color: var(--accent-amber);  border-color: rgba(240, 180, 41, 0.1); }
.status-badge.running  { background: rgba(59, 130, 246, 0.1);  color: var(--accent-blue);   border-color: rgba(59, 130, 246, 0.1); }
.status-badge.skipped  { background: rgba(100, 116, 139, 0.1); color: var(--text-muted);    border-color: rgba(100, 116, 139, 0.1); }
.status-badge.enabled  { background: rgba(0, 212, 170, 0.1);  color: var(--accent-green);  border-color: rgba(0, 212, 170, 0.1); }
.status-badge.disabled { background: rgba(100, 116, 139, 0.1); color: var(--text-muted);    border-color: rgba(100, 116, 139, 0.1); }

/* Progress bar */
.progress-bar { width: 100%; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; margin-top: 14px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent-blue), var(--accent-green)); transition: width 0.5s ease; }
.progress-mini { flex: 1; height: 4px; background: rgba(0,0,0,0.2); border-radius: 2px; overflow: hidden; box-shadow: inset 1px 1px 3px rgba(0,0,0,0.4), inset -1px -1px 3px rgba(255,255,255,0.06); }
.progress-mini .fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
/* ── Kanban Board ────────────────────────────────── */
.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    height: calc(100vh - 130px);
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.kanban-column {
    min-width: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.column-header {
    padding: 12px 14px;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    box-shadow: var(--neu-depressed);
}

.column-body {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
    -webkit-overflow-scrolling: touch;
}
.column-body.drag-over { background: rgba(59, 130, 246, 0.05); border: 2px dashed rgba(59, 130, 246, 0.2); border-radius: var(--radius-md); }

.task-card {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--neu-depressed);
    cursor: grab;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
}
.task-card:active { cursor: grabbing; }
.task-card:hover { box-shadow: var(--neu-depressed-deep); }
.task-card.dragging { opacity: 0.5; transform: scale(0.98); box-shadow: var(--neu-raised); }
.task-card.highlight-pulse { animation: taskPulse 1.5s ease; }

.task-title { font-weight: 500; margin-bottom: 6px; }
.task-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-muted); }

.task-project-pill {
    display: inline-block;
    max-width: 60%;
    padding: 2px 8px;
    font-size: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2), inset -1px -1px 3px rgba(255, 255, 255, 0.04);
}

.task-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    min-height: 18px;
}

.task-card-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.task-number {
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.dispatch-icon {
    font-size: 12px;
    cursor: default;
}
.dispatch-dispatched { color: var(--accent-blue); }
.dispatch-completed { color: var(--accent-green); }
.dispatch-failed { color: var(--accent-red); }
.dispatch-pending { color: var(--accent-amber); }

.task-dispatch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-md);
    box-shadow: var(--neu-depressed);
    flex-wrap: wrap;
}

.task-ref-badge {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-amber);
    letter-spacing: 0.04em;
}

.btn-execute {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px !important;
    min-height: 38px;
    font-size: 13px !important;
    font-weight: 600;
    transition: box-shadow 0.2s ease, transform 0.15s ease, color 0.2s ease;
}
.btn-execute:disabled { cursor: not-allowed; }

.priority-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.priority-1 { background: var(--accent-red); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.priority-2 { background: var(--accent-amber); }
.priority-3 { background: var(--accent-blue); }
.priority-4 { background: var(--accent-purple); }
.priority-5 { background: var(--text-muted); }

@keyframes taskPulse {
    0%   { box-shadow: inset 4px 4px 8px #0a0a14, inset -4px -4px 8px #1e1e38, 0 0 0 0 rgba(59,130,246,0.5); }
    30%  { box-shadow: inset 4px 4px 8px #0a0a14, inset -4px -4px 8px #1e1e38, 0 0 0 4px rgba(59,130,246,0.3); }
    100% { box-shadow: inset 4px 4px 8px #0a0a14, inset -4px -4px 8px #1e1e38, 0 0 0 0 rgba(59,130,246,0); }
}

/* ── Timeline ───────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { display: flex; gap: 14px; align-items: flex-start; padding: 12px 16px; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.timeline-dot.pass { background: var(--accent-green); }
.timeline-dot.fail { background: var(--accent-red); box-shadow: 0 0 8px rgba(239,68,68,0.4); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.timeline-detail { font-size: 12px; color: var(--text-secondary); word-break: break-word; }
.timeline-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ── Modal ──────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 16px;
}
.modal-overlay.visible { display: flex; }

.modal-panel {
    width: 580px;
    max-width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: none;
    box-shadow: var(--neu-depressed-deep);
    -webkit-overflow-scrolling: touch;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; }
.modal-header h3 { font-size: 16px; font-weight: 600; min-width: 0; word-break: break-word; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* Modal Tabs */
.modal-tabs { display: flex; gap: 4px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--glass-border); flex-wrap: wrap; }

.modal-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.modal-tab:hover { color: var(--text-primary); background: var(--bg-secondary); box-shadow: var(--neu-depressed); }
.modal-tab.active { color: var(--accent-blue); background: var(--bg-secondary); box-shadow: var(--neu-depressed-deep); }
.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }

/* ── Tooltips ───────────────────────────────────── */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 9px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2), inset -1px -1px 3px rgba(255, 255, 255, 0.05);
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
}

.tooltip-popup {
    position: fixed;
    z-index: 9999;
    max-width: 300px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--neu-raised), 0 8px 32px rgba(0, 0, 0, 0.4);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
    animation: tooltipFade 0.15s ease;
}
@keyframes tooltipFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
/* ── File List ───────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 4px; }

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3), inset -2px -2px 5px rgba(255, 255, 255, 0.06);
    transition: box-shadow 0.2s ease, background 0.15s ease;
    font-size: 12px;
}
.file-item:hover { background: rgba(0, 0, 0, 0.14); box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.35), inset -3px -3px 6px rgba(255, 255, 255, 0.06); }
.file-item.missing { opacity: 0.5; }
.file-icon { font-size: 14px; }
.file-name { flex: 1; color: var(--text-primary); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file-size { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

.file-editor {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: var(--neu-depressed-deep);
    resize: vertical;
}
.file-editor:focus { outline: none; box-shadow: var(--neu-depressed-deep), 0 0 0 2px rgba(59, 130, 246, 0.15); }

.file-item-wrap { margin-bottom: 2px; }
.file-editor-slot:not(:empty) { padding: 4px 0 8px; }

/* Skill Items */
.skill-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3), inset -2px -2px 5px rgba(255, 255, 255, 0.06);
    margin-bottom: 6px;
}
.skill-icon { font-size: 16px; }
.skill-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.skill-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.skill-source { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Agent Stats Panel */
.agent-stats-panel { padding: 16px 20px; }
.agent-stats-panel .detail-field { padding: 3px 0; font-size: 12px; }

/* Form fields */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    box-shadow: var(--neu-depressed);
    transition: box-shadow 0.2s ease;
    -webkit-appearance: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    box-shadow: var(--neu-depressed-deep), 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { cursor: pointer; }

/* Toggle switch for cron enable/disable */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-secondary);
    border-radius: 24px;
    box-shadow: var(--neu-depressed);
    transition: background 0.2s ease;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}
.toggle-switch input:checked + .toggle-slider { background: rgba(0, 212, 170, 0.2); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--accent-green); }

.placeholder-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: var(--text-muted);
    font-size: 13px;
}
/* ── Projects Table ──────────────────────────────── */
.projects-layout { display: flex; gap: 16px; height: 100%; }

.projects-table-panel { flex: 1; overflow: auto; padding: 0; -webkit-overflow-scrolling: touch; }

.projects-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.projects-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-secondary);
    padding: 12px 14px;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}
.projects-table tbody tr {
    cursor: pointer;
    transition: box-shadow 0.2s ease, background 0.15s ease;
}
.projects-table tbody tr:hover { background: rgba(0, 0, 0, 0.15); box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3), inset -2px -2px 5px rgba(255,255,255,0.06); }
.projects-table tbody tr.selected { background: rgba(0, 0, 0, 0.2); border-left: 3px solid var(--accent-blue); box-shadow: inset 3px 3px 6px rgba(0,0,0,0.35), inset -3px -3px 6px rgba(255,255,255,0.06); }
.projects-table td { padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); vertical-align: middle; }
.table-placeholder { text-align: center; color: var(--text-muted); padding: 40px 16px !important; }

.project-name-cell { display: flex; flex-direction: column; gap: 2px; }
.project-name-cell .name { font-weight: 600; color: var(--text-primary); }
.project-name-cell .desc { font-size: 11px; color: var(--text-muted); max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress-cell { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.progress-cell .pct { font-size: 12px; font-weight: 600; color: var(--text-secondary); min-width: 36px; text-align: right; }

.task-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3), inset -2px -2px 5px rgba(255,255,255,0.08);
}

.row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.projects-table tbody tr:hover .row-actions { opacity: 1; }

.btn-row {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    transition: box-shadow 0.2s ease, transform 0.15s ease, color 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn-row:hover { background: var(--bg-secondary); color: var(--text-primary); box-shadow: var(--neu-depressed); }
.btn-row:active { box-shadow: var(--neu-depressed-deep); transform: scale(0.97); }
.btn-row.danger:hover { color: var(--accent-red); box-shadow: inset 3px 3px 6px #1a0808, inset -3px -3px 6px #3e1a1a; }

/* ── Project Detail Panel ───────────────────────── */
.project-detail-panel { width: 380px; flex-shrink: 0; overflow-y: auto; padding: 20px; -webkit-overflow-scrolling: touch; }

.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--glass-border); gap: 8px; }
.detail-header h3 { font-family: 'Montserrat', sans-serif; font-size: 16px; font-weight: 600; min-width: 0; word-break: break-word; }

.detail-section { margin-bottom: 20px; }
.section-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.detail-field { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.03); gap: 8px; }
.detail-field .label { color: var(--text-muted); white-space: nowrap; }
.detail-field .value { color: var(--text-primary); font-weight: 500; text-align: right; min-width: 0; word-break: break-word; }

.detail-progress { margin: 12px 0; }
.detail-progress .bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.detail-progress .bar .fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }

.detail-tasks-list { list-style: none; padding: 0; }
.detail-tasks-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3), inset -2px -2px 5px rgba(255,255,255,0.06);
    margin-bottom: 6px;
    transition: box-shadow 0.2s ease, background 0.15s ease;
}
.detail-tasks-list li:hover { background: rgba(0,0,0,0.18); box-shadow: inset 3px 3px 6px rgba(0,0,0,0.35), inset -3px -3px 6px rgba(255,255,255,0.06); }
.detail-tasks-list li:hover span:first-child + span { color: var(--accent-blue) !important; }
.task-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.detail-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
/* ── Cron Jobs Table (DCL-005) ───────────────────── */
.cron-layout { display: flex; flex-direction: column; gap: 16px; }

.cron-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.cron-controls select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    box-shadow: var(--neu-depressed);
    -webkit-appearance: none;
    cursor: pointer;
}

.cron-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cron-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-secondary);
    padding: 12px 14px;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}
.cron-table tbody tr {
    transition: box-shadow 0.2s ease, background 0.15s ease;
}
.cron-table tbody tr:hover { background: rgba(0,0,0,0.15); box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3), inset -2px -2px 5px rgba(255,255,255,0.06); }
.cron-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.cron-table td.cron-actions { white-space: nowrap; }

.cron-name { font-weight: 600; color: var(--text-primary); display: block; }
.cron-schedule { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.cron-agent { font-size: 12px; color: var(--text-secondary); }

.run-history-inline {
    display: flex;
    gap: 3px;
    align-items: center;
}
.run-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    cursor: default;
}
.run-dot.success { background: var(--accent-green); }
.run-dot.failure { background: var(--accent-red); box-shadow: 0 0 4px rgba(239,68,68,0.4); }
.run-dot.timeout { background: var(--accent-amber); }
.run-dot.skipped { background: var(--text-muted); }

/* ── Heartbeat Panel (DCL-005) ──────────────────── */
.heartbeat-layout { display: flex; flex-direction: column; gap: 16px; }

.heartbeat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.heartbeat-controls select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    box-shadow: var(--neu-depressed);
    -webkit-appearance: none;
    cursor: pointer;
}

.heartbeat-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.heartbeat-stat {
    background: rgba(0,0,0,0.12);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--neu-depressed);
    text-align: center;
}
.heartbeat-stat .stat-num {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    display: block;
}
.heartbeat-stat .stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }
/* ── RESPONSIVE: Tablet (768-1024) ──────────────── */
@media (max-width: 1024px) {
    :root { --sidebar-width: 200px; }
    .top-bar { padding: 14px 16px; }
    .tab-content { padding: 16px; }
    .project-detail-panel { width: 320px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
    .kanban-column { min-width: 220px; }
    .modal-panel { width: 90vw; max-width: 560px; }
    .heartbeat-summary { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

/* ── RESPONSIVE: Phone landscape / small tablet (max 768px) ── */
@media (max-width: 768px) {
    body { overflow: auto; }
    .app-shell { flex-direction: column; height: auto; min-height: 100vh; }

    /* Sidebar becomes offscreen drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-100%);
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }

    .mobile-menu-btn { display: block; }

    .main-content { overflow: visible; }
    .top-bar { padding: 12px 16px; }
    .page-title { font-size: 17px; }
    .tab-content { padding: 14px 12px; overflow: visible; }

    /* Projects: stack table + detail */
    .projects-layout { flex-direction: column; height: auto; }
    .project-detail-panel { width: 100%; order: -1; }
    .projects-table-panel { max-height: 60vh; overflow: auto; }

    /* Hide low-value columns on mobile */
    .projects-table .col-owner,
    .projects-table .col-tasks,
    .projects-table .col-actions { display: none; }

    /* Row actions always visible on touch */
    .row-actions { opacity: 1; }

    /* Kanban: horizontal scroll */
    .kanban-board { height: auto; min-height: 60vh; }
    .kanban-column { min-width: 260px; max-height: 50vh; }

    /* Agent cards single column */
    .card-grid { grid-template-columns: 1fr; }

    /* Cron table responsive */
    .cron-table .col-schedule,
    .cron-table .col-next-run { display: none; }

    /* Timeline: stack time below */
    .timeline-item { flex-wrap: wrap; padding: 10px 12px; }
    .timeline-time { width: 100%; margin-top: 4px; padding-left: 24px; }

    /* Modal full-width */
    .modal-overlay { padding: 8px; align-items: flex-end; }
    .modal-panel { width: 100%; max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

    .agent-stats-panel { padding: 12px; }

    /* Heartbeat summary grid */
    .heartbeat-summary { grid-template-columns: repeat(2, 1fr); }
}

/* ── RESPONSIVE: Phone portrait (max 480px) ─────── */
@media (max-width: 480px) {
    .top-bar { padding: 10px 12px; }
    .page-title { font-size: 15px; }
    .top-actions { gap: 4px; }
    .btn-neumorphic { padding: 6px 12px; font-size: 12px; }
    .tab-content { padding: 10px 8px; }
    .glass-panel { padding: 14px; border-radius: var(--radius-md); }

    .projects-table td, .projects-table th { padding: 10px 8px; font-size: 12px; }
    .project-name-cell .desc { display: none; }
    .projects-table .col-progress { display: none; }

    .kanban-column { min-width: 240px; }
    .column-header { padding: 10px 12px; font-size: 10px; }
    .task-card { padding: 10px 12px; font-size: 12px; }

    .cron-table td, .cron-table th { padding: 8px 8px; font-size: 12px; }
    .cron-table .col-agent,
    .cron-table .col-runs { display: none; }

    .heartbeat-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
    .heartbeat-stat { padding: 10px; }
    .heartbeat-stat .stat-num { font-size: 20px; }

    .modal-header h3 { font-size: 14px; }
    .modal-tabs { gap: 2px; }
    .modal-tab { padding: 6px 10px; font-size: 11px; }

    .task-dispatch-header { padding: 8px 10px; gap: 8px; }
    .task-ref-badge { font-size: 11px; }
    .btn-execute { padding: 6px 12px !important; font-size: 11px !important; min-height: 34px; }
    .task-project-pill { max-width: 50%; font-size: 9px; }
    .task-number { font-size: 9px; }

    .detail-field { font-size: 12px; }
    .detail-header h3 { font-size: 14px; }
}

/* ── RESPONSIVE: Tiny phones (max 360px) ────────── */
@media (max-width: 360px) {
    .sidebar.open { width: 100vw; }
    .kanban-column { min-width: 220px; }
    .heartbeat-summary { grid-template-columns: 1fr; }
    .btn-neumorphic { padding: 6px 10px; font-size: 11px; }
}

/* ── Touch device improvements ──────────────────── */
@media (hover: none) and (pointer: coarse) {
    .nav-btn { padding: 12px 14px; }
    .task-card { padding: 14px 16px; }
    .btn-neumorphic { padding: 10px 18px; min-height: 44px; }
    .btn-row { padding: 8px 12px; min-height: 36px; }
    .row-actions { opacity: 1; }
    .file-item { padding: 12px 14px; }
    .toggle-switch { width: 52px; height: 28px; }
    .toggle-slider::before { width: 22px; height: 22px; }
    .toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
    .tooltip-trigger { display: none; }
}

/* ── Cloud & Compute ────────────────────────────── */
.metric-card {
    background: rgba(0,0,0,0.12);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3), inset -2px -2px 5px rgba(255,255,255,0.06);
}
.metric-header {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.metric-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    word-break: break-word;
}

.resource-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.resource-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}
.resource-table td {
    padding: 8px 12px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.resource-table tr:hover {
    background: rgba(255,255,255,0.02);
}

.compute-controls select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    box-shadow: var(--neu-depressed);
}

/* EC2 state badges */
.status-badge.running { background: rgba(0,255,128,0.12); color: var(--accent-green); }
.status-badge.stopped { background: rgba(255,80,80,0.12); color: var(--accent-red); }
.status-badge.terminated { background: rgba(128,128,128,0.12); color: var(--text-muted); }
.status-badge.pending { background: rgba(255,193,7,0.12); color: var(--accent-amber); }
.status-badge.stopping { background: rgba(255,193,7,0.12); color: var(--accent-amber); }
.status-badge.available { background: rgba(0,255,128,0.12); color: var(--accent-green); }

/* Remote Desktop */
.remote-layout iframe {
    background: #000;
    min-height: 400px;
}

@media (max-width: 768px) {
    .metric-value { font-size: 15px; }
    .resource-table { font-size: 11px; }
    .resource-table th, .resource-table td { padding: 6px 8px; }
    .remote-layout { height: calc(100vh - 120px) !important; }
}

@media (max-width: 480px) {
    .resource-table th:nth-child(n+5), .resource-table td:nth-child(n+5) { display: none; }
}

/* ── Safe area (notch devices) ──────────────────── */
@supports (padding: max(0px)) {
    .sidebar { padding-left: max(12px, env(safe-area-inset-left)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
    .tab-content { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
    .modal-panel { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

/* ── User Status (Sidebar Footer) ───────────────── */
.user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.12);
    box-shadow: var(--neu-depressed);
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.3), inset -2px -2px 4px rgba(255,255,255,0.06);
}
.user-avatar.signed-in { background: rgba(0, 212, 170, 0.12); color: var(--accent-green); }
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
