/* ============================================================
   Shared Detail Panel & Component Styles
   Used by: RFIs, Documents, Submittals, Meetings, Financial
   ============================================================ */

/* ── Detail Panel Layout ── */
.detail-panel {
    display: none;
    flex-direction: column;
    height: 100%;
    background: #f8f9fa;
}

.detail-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #fff;
}

.detail-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    color: #495057;
}
.detail-back-btn:hover { color: #212529; }

.detail-title {
    margin: 0;
    font-size: 15px;
    flex: 1;
    color: #212529;
}

.detail-header-actions {
    display: flex;
    gap: 6px;
}

.detail-action-btn {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #212529;
}
.detail-action-btn:hover { background: #e7f3ff; }

/* ── Tab Bar ── */
.detail-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #dee2e6;
    padding: 0 16px;
    background: #fff;
}

.detail-tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 2px solid transparent;
    color: #6c757d;
}
.detail-tab-btn:hover { color: #495057; }
.detail-tab-btn.active {
    border-bottom-color: #2563eb;
    color: #212529;
    font-weight: 600;
}

.detail-tab-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

/* ── Stat Grid (detail view headers) ── */
.detail-stats { display: grid; gap: 10px; margin-top: 12px; }
.detail-stat { text-align: center; padding: 8px; background: #f8f9fa; border-radius: 4px; border: 1px solid #dee2e6; }
.detail-stat-label { font-size: 10px; color: #6c757d; text-transform: uppercase; letter-spacing: .3px; }
.detail-stat-value { font-size: 15px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; color: #212529; }
.stat-green { color: #10b981; } .stat-red { color: #ef4444; }
.stat-amber { color: #f59e0b; } .stat-blue { color: #2563eb; } .stat-purple { color: #7c3aed; }

/* ── Alert Banners ── */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 12px; display: flex; align-items: center; gap: 8px; }
.alert-amber { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.alert-red { background: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }
.alert-green { background: #dcfce7; color: #166534; border: 1px solid #10b981; }
.alert-blue { background: #dbeafe; color: #1e40af; border: 1px solid #2563eb; }
.alert-icon { font-size: 16px; }

/* ── KPI Cards (above grids) ── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid #dee2e6; border-radius: 6px; padding: 12px 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.kpi-label { font-size: 10.5px; color: #6c757d; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.kpi-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: #212529; }
.kpi-value.green { color: #10b981; } .kpi-value.red { color: #ef4444; }
.kpi-value.amber { color: #f59e0b; } .kpi-value.blue { color: #2563eb; }
.kpi-value.purple { color: #7c3aed; }

/* ── Status Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10.5px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #10b981; }
.badge-red { background: #fee2e2; color: #ef4444; }
.badge-amber { background: #fef3c7; color: #f59e0b; }
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-gray { background: #f8f9fa; color: #6c757d; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-teal { background: #ccfbf1; color: #0d9488; }

/* ── Type Tags ── */
.tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; }
.tag-sc { background: #fed7aa; color: #9a3412; }
.tag-po { background: #dbeafe; color: #1e40af; }
.tag-cco { background: #fef3c7; color: #f59e0b; }
.tag-pco { background: #dcfce7; color: #10b981; }

/* ── Conditional Cell Formatting ── */
.cell-green { color: #10b981; font-weight: 600; }
.cell-red { color: #ef4444; font-weight: 600; }
.cell-amber { color: #f59e0b; }
.cell-purple { color: #7c3aed; }
.cell-muted { color: #6c757d; }
.cell-bold { font-weight: 700; }
.cell-link { color: #2563eb; cursor: pointer; text-decoration: underline; }
.editable { background: #fffbeb; }
.editable:hover { background: #fef9c3; cursor: cell; }
.row-overbilled td { background: #fee2e2; }
.totals-row td { background: #f8f9fa; font-weight: 700; border-top: 2px solid #6c757d; }

/* ── SOV Sub-Grid ── */
.sov-wrapper { margin-top: 8px; }
.sov-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sov-total { margin-left: auto; font-size: 12px; font-weight: 600; color: #495057; }

/* ── Context Menu ── */
.ctx-menu { position: fixed; background: #fff; border: 1px solid #dee2e6; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); padding: 4px 0; z-index: 999; min-width: 180px; }
.ctx-item { padding: 6px 14px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: #495057; }
.ctx-item:hover { background: #e7f3ff; }
.ctx-item.danger { color: #ef4444; }

/* ── History Timeline ── */
.history-item { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #e9ecef; font-size: 12px; }
.history-date { color: #6c757d; min-width: 100px; }
.history-user { font-weight: 600; min-width: 80px; color: #212529; }
.history-action { color: #495057; }

/* ── Review Comments Box ── */
.review-box { background: #fff; border: 1px solid #dee2e6; border-radius: 6px; padding: 12px; margin-bottom: 12px; }
.review-box textarea { width: 100%; border: 1px solid #dee2e6; border-radius: 4px; padding: 8px; font-size: 12px; resize: vertical; margin-top: 6px; }

/* ── Retainage Panel ── */
.retainage-panel { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 12px 16px; margin-top: 12px; }
.retainage-rule { display: flex; align-items: center; gap: 8px; font-size: 11.5px; padding: 3px 0; color: #495057; }
.retainage-rule.active { font-weight: 600; color: #212529; }
