:root {
    /* Light Theme Variables */
    --bg-body: #f4f4f9;
    --bg-sidebar: #34495e;
    --bg-header: #2c3e50;
    --bg-panel: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-inverse: #ecf0f1;
    --border: #ecf0f1;
    --accent: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #c0392b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Main Layout styles are handled in index.html body grid */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--text-inverse);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

nav a {
    display: block;
    padding: 10px 12px;
    color: #bdc3c7; /* Muted text for dark sidebar */
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

nav a:hover, nav a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--accent);
}

.user-profile {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-inverse);
}

.avatar {
    width: 32px; height: 32px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 50%;
}

/* Main Content */
.main-content {
    padding: 2rem;
    overflow-y: auto;
}

/* Module mounting point */
#app-content {
    overflow: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Cards */
.card {
    background-color: var(--bg-panel);
    border: none;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-header { display: flex; justify-content: space-between; margin-bottom: 1rem; }

.badge { 
    font-size: 0.75rem; 
    font-weight: bold; 
    padding: 2px 8px; 
    border-radius: 4px; 
    background: #ecf0f1; 
    color: var(--text-secondary);
}
.type-asset .badge { background: #e1ecf4; color: #39739d; }
.type-rfi .badge { background: #fff3cd; color: #856404; }
.type-project .badge { background: #d4edda; color: #155724; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 1rem; }
.tag { 
    font-size: 0.75rem; 
    background: #f8f9fa; 
    padding: 2px 8px; 
    border-radius: 4px; 
    color: var(--text-secondary); 
    border: 1px solid var(--border); 
}

.btn-primary { background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; }
.btn-primary:hover { opacity: 0.9; }

/* ═══════════════════════════════════════════════════════════════
   UNIFIED MODULE HEADER BAR
   Shared across: Schedules, Cost, Submittals, RFIs, Assets, Checklists, Issues
   ═══════════════════════════════════════════════════════════════ */
.module-header-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    height: 42px;
}
.module-header-bar .header-search {
    flex: 0 1 50%;
    min-width: 200px;
    margin-right: auto;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    height: 42px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.module-header-bar .header-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}
.module-header-bar .header-btn {
    white-space: nowrap;
    height: 42px;
    padding: 0 18px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-sizing: border-box;
}
.module-header-bar .header-btn i { width: 16px; height: 16px; }
.module-header-bar .header-btn-add {
    background: var(--bg-header);
    color: white;
    border: none;
}
.module-header-bar .header-btn-add:hover { opacity: 0.9; }
.module-header-bar .header-btn-secondary {
    background: #f8f9fc;
    color: #2c3e50;
    border: 1px solid #ddd;
}
.module-header-bar .header-btn-secondary:hover { background: #eef0f4; }

/* Module container */
.module-container {
    /* uses default block layout, width fills parent */
}
/* Sticky table headers inside scrolling list containers */
.module-registry-scroll thead th,
.module-container [id$="-list"] thead th,
#doc-registry thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f9fa;
}

/* Tetris Premium Data Table */
.tetris-table-container {
    width: 100%;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.tetris-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.tetris-table th {
    background: #f8f9fa;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 15px;
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.tetris-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f1f1;
    color: var(--text-primary);
}

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

.tetris-table tr:hover {
    background-color: #fcfcfd;
    cursor: pointer;
}

.tetris-table .status-cell {
    width: 100px;
}

.tetris-table .name-cell {
    /* plain — no bold, no accent override */
}

/* Responsive Table */
.module-registry-scroll {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: auto;
}

/* Document Module — Tree Items */
.doc-tree-item {
    transition: background-color 0.15s ease;
}
.doc-tree-item:hover {
    background-color: #f0f4f8 !important;
}
.doc-tree-item.active {
    background-color: #e8f0fe !important;
    color: var(--accent);
    font-weight: 600;
}

/* Document Module — Context Menu */
.ctx-item:hover {
    background-color: #f0f4f8;
}
.doc-tree-root:hover {
    background-color: #f8f9fa;
}

/* ═══════════════════════════════════════════════════════════════
   PROGRAM DASHBOARD — Tab Buttons & Data Tables
   ═══════════════════════════════════════════════════════════════ */

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: var(--text-primary);
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    background: #f8f9fa;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 2px solid #e9ecef;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-align: left;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f5;
}
.data-table tr:hover {
    background-color: #f8f9fa;
}
.data-table tr:last-child td {
    border-bottom: none;
}

/* Tag Color Variants */
.tag.red { background: #fce4ec; color: #c62828; border-color: #ef9a9a; }
.tag.blue { background: #e3f2fd; color: #1565c0; border-color: #90caf9; }
.tag.green { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }

/* ═══════════════════════════════════════════════════════════════
   TIER 3 MODAL OVERLAY — Preserves T.I.J.A. Copilot visibility
   The overlay spans only the Main Canvas area, never covering
   the Nav Shelf or T.I.J.A. panel on the left.
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 60px;                 /* below header */
    left: calc(60px + var(--tija-width, 400px)); /* after nav + tija */
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 50;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    animation: fadeIn 0.15s ease-out;
}
.modal-overlay.fullscreen {
    left: 0;  /* rare: full-screen on narrow layouts */
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 960px;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease-out;
}
.modal-content.wide { max-width: 1200px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    border-radius: 12px 12px 0 0;
}
.modal-header h2 { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.modal-close-btn {
    background: none; border: none; font-size: 1.4rem; cursor: pointer;
    color: var(--text-secondary); padding: 4px 8px; border-radius: 6px;
}
.modal-close-btn:hover { background: #f1f3f5; color: var(--text-primary); }

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}
.modal-body.split-pane {
    display: flex;
    gap: 0;
    padding: 0;
}
.modal-body .pane-sidebar {
    width: 220px;
    min-width: 220px;
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    background: #fafbfc;
    position: sticky;
    top: 60px;
    height: calc(100vh - 200px);
}
.modal-body .pane-main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ── Human-to-Human Chat Textbox (bottom of Tier 3 modals) ── */
.modal-human-chat {
    border-top: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fafbfc;
    border-radius: 0 0 12px 12px;
    position: sticky;
    bottom: 0;
}
.modal-human-chat input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}
.modal-human-chat input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(52,152,219,0.15); }
.modal-human-chat button {
    background: var(--accent); color: #fff; border: none;
    padding: 10px 18px; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.modal-human-chat button:hover { opacity: 0.9; }
.modal-human-chat.readonly input { background: #f1f3f5; color: var(--text-secondary); cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════
   UNIVERSAL PROGRAM HEADER (Search + Quick Pills + Project Filter)
   Used across all 5 program-level views.
   ═══════════════════════════════════════════════════════════════ */
.program-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.program-header .search-bar {
    flex: 1;
    min-width: 200px;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}
.program-header .search-bar:focus { border-color: var(--accent); }
.program-header .quick-pills {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.program-header .quick-pill {
    padding: 4px 12px;
    border-radius: 16px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.program-header .quick-pill:hover { background: #f0f4f8; border-color: var(--accent); }
.program-header .quick-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.program-header .project-filter {
    padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 0.85rem; min-width: 180px;
}

/* ═══════════════════════════════════════════════════════════════
   TELEPORT NAVIGATION — Project Name hyperlinks + Return button
   ═══════════════════════════════════════════════════════════════ */
.teleport-link {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}
.teleport-link:hover { color: #2176ae; text-decoration: none; }
.return-to-program-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 12px;
}
.return-to-program-btn:hover { background: var(--accent); color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   RBAC — Graceful Degradation (grey out, never hide)
   ═══════════════════════════════════════════════════════════════ */
.rbac-disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(0.6);
}
.rbac-guest-hidden {
    opacity: 0.35;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   DOCUMENT MODULE — Tile/Grid View
   ═══════════════════════════════════════════════════════════════ */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    align-items: start;
}
.doc-tile {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.doc-tile:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }
.doc-tile.expanded { outline: 2px solid #4a90e2; box-shadow: 0 4px 16px rgba(74,144,226,0.15); }
.doc-tile .doc-icon { font-size: 2rem; margin-bottom: 8px; }
.doc-tile .doc-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; color: var(--text-primary); }
.doc-tile .doc-meta { font-size: 0.75rem; color: var(--text-secondary); }
.doc-tile .doc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.doc-tile-hover-detail {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    padding: 12px;
    display: none;
    z-index: 5;
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
    font-size: 0.8rem;
}
.doc-tile:hover .doc-tile-hover-detail { display: block; }

/* ── Tile Wrapper — keeps Tier 2 inline with its tile ── */
.doc-tile-wrapper {
    /* Default: acts as a normal grid item */
}
.doc-tile-wrapper:has(.doc-tile.expanded) {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    align-items: start;
    background: #fafbfc;
    border-radius: 10px;
    padding: 0;
}
/* Fallback for browsers without :has() — expanded inline still renders */
.doc-grid > .doc-tile-wrapper > .inline-summary {
    margin-top: 0;
    grid-column: 2;
}

/* ═══════════════════════════════════════════════════════════════
   ASSET MODULE — Master List (Program Manager view)
   ═══════════════════════════════════════════════════════════════ */
.asset-master-list .project-col { color: var(--accent); font-weight: 600; }
.asset-teleport-btns { display: flex; gap: 8px; margin-top: 12px; }
.asset-teleport-btns button {
    padding: 6px 14px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}
.asset-teleport-btns button:hover { background: var(--accent); color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   COST MODULE — Waterfall + S-Curve + Origin Map Mini-DAG
   ═══════════════════════════════════════════════════════════════ */
.cost-waterfall { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding: 16px 0; }
.cost-waterfall .bar {
    width: 60px; border-radius: 6px 6px 0 0; position: relative;
    transition: height 0.4s ease;
}
.cost-waterfall .bar.budget  { background: transparent; border: 2px dashed #95a5a6; }
.cost-waterfall .bar.committed { background: #2c3e50; }
.cost-waterfall .bar.actual   { background: #27ae60; }
.cost-waterfall .bar.pending  { background: repeating-linear-gradient(45deg, #f39c12, #f39c12 4px, #fdf2d4 4px, #fdf2d4 8px); }
.cost-waterfall .bar-label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: var(--text-secondary); white-space: nowrap; }
.cost-forecast-marker {
    position: relative; width: 20px; height: 20px;
}
.cost-forecast-marker::after {
    content: '◆'; color: var(--accent); font-size: 1.2rem;
    position: absolute; top: -6px;
}

.s-curve-container { width: 100%; height: 250px; position: relative; margin: 20px 0; }
.s-curve-container canvas { width: 100%; height: 100%; }

.origin-map-dag { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; }
.origin-map-node {
    padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
    background: #e8f0fe; color: var(--accent); cursor: pointer; border: 1px solid transparent;
    transition: all 0.15s;
}
.origin-map-node:hover { border-color: var(--accent); background: #d4e4fd; }
.origin-map-arrow { color: var(--text-secondary); font-size: 0.7rem; }

/* ═══════════════════════════════════════════════════════════════
   SCHEDULE MODULE — Scrubber + P6 Import + T.I.J.A. layer
   ═══════════════════════════════════════════════════════════════ */
.schedule-scrubber {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.schedule-scrubber input[type="range"] { flex: 1; }
.schedule-scrubber .scrubber-date { font-weight: 600; font-size: 0.9rem; min-width: 100px; }
.p6-import-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; background: var(--accent); color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.p6-import-btn:hover { opacity: 0.9; }

/* ═══════════════════════════════════════════════════════════════
   CHECKLIST MODULE — Quality Matrix
   ═══════════════════════════════════════════════════════════════ */
.quality-matrix { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.quality-matrix th {
    background: #f8f9fa; padding: 10px 12px; border: 1px solid var(--border);
    font-weight: 600; color: var(--text-secondary); text-transform: uppercase;
    font-size: 0.7rem; letter-spacing: 0.04em;
    position: sticky; top: 0; z-index: 1;
}
.quality-matrix td {
    padding: 8px 12px; border: 1px solid #f1f3f5; text-align: center; vertical-align: middle;
}
.quality-matrix .y-axis-header { text-align: left; font-weight: 600; color: var(--text-primary); background: #fafbfc; }
.quality-matrix .y-axis-child { text-align: left; padding-left: 28px; font-size: 0.8rem; color: var(--text-secondary); }
.quality-matrix .cell-progress { color: var(--text-primary); font-weight: 500; }
.quality-matrix .cell-na { color: #bdc3c7; font-style: italic; }
.quality-matrix .cell-missing { color: var(--danger); font-weight: 700; }
.quality-matrix .progress-bar-bg {
    width: 80px; height: 6px; background: #ecf0f1; border-radius: 3px;
    display: inline-block; vertical-align: middle; margin-right: 4px;
}
.quality-matrix .progress-bar-fill {
    height: 100%; border-radius: 3px; background: var(--accent);
}
.y-axis-expandable { cursor: pointer; }
.y-axis-expandable::before { content: '▸ '; font-size: 0.7rem; }
.y-axis-expandable.expanded::before { content: '▾ '; }

/* ═══════════════════════════════════════════════════════════════
   COMMISSIONING PROGRAM — Checklist Library
   ═══════════════════════════════════════════════════════════════ */
.checklist-library-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.checklist-library-tab {
    padding: 10px 20px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
    color: var(--text-secondary); border-bottom: 3px solid transparent; margin-bottom: -2px;
    transition: all 0.15s;
}
.checklist-library-tab:hover { color: var(--text-primary); }
.checklist-library-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   TEMPLATES — Swim-lane layout grouped by module
   ═══════════════════════════════════════════════════════════════ */
.template-swim-lanes { display: flex; flex-direction: column; gap: 24px; }
.template-swim-lane { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.template-swim-lane-header {
    background: #f8f9fa; padding: 10px 16px; font-weight: 700; font-size: 0.85rem;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.template-swim-lane-items { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
.template-card {
    padding: 10px 16px; border: 1px solid #eee; border-radius: 8px;
    cursor: pointer; transition: all 0.15s; min-width: 160px;
}
.template-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.template-card.guest-disabled { opacity: 0.35; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   SIMULATION BANNER + OBSERVER MODE
   ═══════════════════════════════════════════════════════════════ */
#sim-banner {
    grid-column: 1 / -1;
    background: #e74c3c;
    color: #fff;
    text-align: center;
    padding: 6px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 11;
    letter-spacing: 0.5px;
}
body.sim-mode { grid-template-rows: 60px auto 1fr; }
body.sim-mode #sim-banner { grid-area: banner; }
body.sim-mode .btn-primary { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   INLINE ROW EXPANSION (Tier 2) — Reusable
   ═══════════════════════════════════════════════════════════════ */
.inline-expanded-row td { background: #fdfdfe; padding: 0 !important; border-bottom: 2px solid #e9ecef; }
.inline-summary {
    padding: 20px; color: #34495e; border-left: 4px solid var(--accent);
    font-size: 0.85rem; animation: slideDown 0.2s ease-out;
}
.inline-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════════════════
   UPLOAD TAGGING UI
   ═══════════════════════════════════════════════════════════════ */
.upload-tag-category { margin-bottom: 16px; }
.upload-tag-category h4 { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #f1f3f5; }
.upload-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.upload-tag-item {
    padding: 4px 12px; border-radius: 16px; font-size: 0.8rem; cursor: pointer;
    border: 1px solid #ddd; transition: all 0.15s;
}
.upload-tag-item.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.upload-tag-item.unselected { background: #fff; color: #bdc3c7; border-color: #eee; }

/* ═══════════════════════════════════════════════════════════════
   T.I.J.A. 3D KNOWLEDGE UNIVERSE (Phase 5)
   ═══════════════════════════════════════════════════════════════ */
.tija-3d-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #0a0e17;
}
.tija-3d-container canvas {
    display: block;
}
.tija-3d-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    background: rgba(20, 24, 35, 0.94);
    color: #e0e6ed;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    max-width: 260px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.tija-3d-legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(20, 24, 35, 0.85);
    color: #8899aa;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.75rem;
    display: flex;
    gap: 16px;
    pointer-events: none;
    z-index: 5;
}
.tija-3d-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tija-3d-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #556677;
    font-size: 0.9rem;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY — Spacing, Typography, Animation
   ═══════════════════════════════════════════════════════════════ */
.text-muted { color: var(--text-secondary); font-size: 0.85rem; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticky-top { position: sticky; top: 0; z-index: 10; background: inherit; }

/* ═══════════════════════════════════════════════════════════════
   PORTFOLIO MATRIX (Program Level Checklists — Tab B)
   ═══════════════════════════════════════════════════════════════ */
.quality-matrix { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
.quality-matrix th { padding: 10px 12px; border-bottom: 2px solid #dee2e6; white-space: nowrap; font-weight: 600; color: #2c3e50; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
.quality-matrix td { padding: 0; border: 1px solid #f0f0f0; }
.quality-matrix .y-axis-header { padding: 8px 14px; background: #fafbfc; font-weight: 600; color: #2c3e50; font-size: 0.82rem; }
.cell-heatmap { padding: 8px 10px; transition: transform 0.15s, box-shadow 0.15s; }
.cell-heatmap:hover { transform: scale(1.05); box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.cell-na { padding: 8px 10px; }

/* Task 9: Anomaly pulse animation */
@keyframes portfolioPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200, 90, 90, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(200, 90, 90, 0); }
}
.portfolio-anomaly-pulse { animation: portfolioPulse 2s ease-in-out 3; position: relative; }
.portfolio-anomaly-pulse::after { content: '⚠'; position: absolute; top: 2px; right: 4px; font-size: 0.65rem; }

/* Portfolio popover (Task 6) */
.portfolio-popover { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }