/* ========== Proteus Light + Dark Theme Variables ========== */

/* Light mode (default for PM pages) */
:root {
    --bg: #ffffff;
    --surface: #f8fafc;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-dim: #475569;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ea580c;
}

/* Dark mode */
html.dark-mode {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #334155;
    --border: #334155;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f97316;
}

/* Apply variables to base elements */
html.dark-mode body { background: var(--bg); color: var(--text); }
html.dark-mode .site-header { background: var(--surface); border-bottom-color: var(--border); }
html.dark-mode .project-card,
html.dark-mode .intake-card,
html.dark-mode .ov-card,
html.dark-mode .cycle-row,
html.dark-mode .kcard,
html.dark-mode .wbs-node,
html.dark-mode .gate-row { background: var(--surface); border-color: var(--border); color: var(--text); }
html.dark-mode .kcol { background: var(--surface-2); }
html.dark-mode .chip { background: var(--surface-2); color: var(--text-dim); }
html.dark-mode select, html.dark-mode input, html.dark-mode textarea {
    background: var(--surface); border-color: var(--border); color: var(--text);
}
html.dark-mode .slideover-panel { background: var(--surface); }
html.dark-mode .slideover-header,
html.dark-mode .slideover-footer { border-color: var(--border); }
html.dark-mode .modal-dialog { background: var(--surface); }
html.dark-mode .modal-header, .modal-footer { border-color: var(--border); }
html.dark-mode .pk-dialog { background: var(--surface); }
html.dark-mode .pk-input { background: var(--surface); color: var(--text); border-color: var(--border); }
html.dark-mode .pk-item.selected { background: var(--surface-2); }
html.dark-mode .qa-dialog { background: var(--surface); }
html.dark-mode .qa-input { background: var(--surface-2); color: var(--text); }
html.dark-mode .bulk-toolbar { background: var(--surface); border-color: var(--border); }
html.dark-mode .risk-table { background: var(--surface); border-color: var(--border); }
html.dark-mode .risk-table th { background: var(--surface-2); color: var(--muted); }
html.dark-mode .risk-table td { border-color: var(--border); color: var(--text); }
html.dark-mode .empty-state { background: var(--surface); border-color: var(--border); color: var(--muted); }
html.dark-mode .activity-day-label { border-color: var(--border); }
html.dark-mode .activity-item { border-color: var(--surface-2); }
html.dark-mode mark { background: #854d0e; color: white; }
html.dark-mode a { color: var(--primary); }
html.dark-mode .header-nav a { color: var(--muted); }
html.dark-mode .header-nav a.active { color: var(--text); border-bottom-color: var(--primary); }
html.dark-mode .btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
html.dark-mode .btn-primary { background: var(--primary); }

/* Theme toggle button */
#theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 100ms;
}
#theme-toggle:hover { background: var(--surface); }

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

@media (max-width: 768px) {
    .portfolio-toolbar { flex-direction: column; align-items: stretch; }
    .portfolio-filters { flex-wrap: wrap; }
    .portfolio-grid { grid-template-columns: 1fr; }

    .kanban { grid-template-columns: 1fr !important; }
    .kcol { min-height: 100px; }

    .slideover-panel { width: 100vw; }

    .project-tabs { overflow-x: auto; gap: 0.75rem; }
    .project-tabs a { font-size: 0.85rem; }

    .sf-row, .sf-row-2, .sf-row-3 { flex-direction: column; }

    .project-head { flex-direction: column; }
    .proj-facts { grid-template-columns: repeat(2, auto); }

    .gate-row { grid-template-columns: 50px 1fr; gap: 0.5rem; }
    .gate-readiness { font-size: 0.75rem; }

    .risk-matrix { width: 250px; height: 250px; }

    .header-nav { display: none; }
    .header-nav.mobile-open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg, white); border-bottom: 1px solid var(--border); padding: 0.75rem 1.5rem; z-index: 100; }

    .activity-header { flex-direction: column; }
    .intake-header { flex-direction: column; }

    .pk-dialog { width: 95vw; }
    .qa-dialog { width: 95vw; }

    .cycle-row { grid-template-columns: 1fr; }
    .wbs-node { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .portfolio-main, .project-main, .activity-main, .intake-main { padding: 1rem; }
    h1 { font-size: 1.5rem; }
    .pcard-stats { grid-template-columns: repeat(2, 1fr); }
}
