/* Triage tab — building data triage view */

.triage-layout {
    padding: 16px 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.triage-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.triage-toolbar .triage-filter-label {
    color: var(--text-dim);
    font-size: 13px;
    white-space: nowrap;
}

.triage-toolbar .triage-filter-select {
    width: auto;
    min-width: 160px;
    max-width: 220px;
}

.triage-toolbar .triage-status {
    color: var(--text-dim);
    font-size: 13px;
    margin-left: auto;   /* pushes itself + everything after it to the right */
}

.triage-toolbar .btn {
    margin-left: auto;   /* if status is empty, button still goes right */
}
.triage-toolbar .triage-status + .btn {
    margin-left: 12px;   /* when status is present, button sits next to it */
}

.triage-table-wrap {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border-dim, #2a2a35);
    border-radius: 6px;
    background: var(--panel-bg, #15151c);
}

.triage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.triage-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel-bg, #1c1c24);
    color: var(--text-dim);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-dim, #2a2a35);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.triage-table thead th:hover {
    color: var(--text-bright, #eee);
}

.triage-table thead th .sort-arrow {
    opacity: 0.3;
    margin-left: 4px;
    font-size: 10px;
}

.triage-table thead th.sorted .sort-arrow {
    opacity: 1;
}

.triage-table tbody tr {
    border-bottom: 1px solid #20202a;
}

.triage-table tbody tr:hover {
    background: #1d1d28;
}

.triage-table tbody td {
    padding: 8px 12px;
    color: var(--text-bright, #ddd);
    vertical-align: top;
}

.triage-table tbody td.muted {
    color: var(--text-dim);
    font-style: italic;
}

.triage-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.triage-status-badge.complete       { background: #1a3a25; color: #6fcf97; }
.triage-status-badge.missing-date   { background: #3a3a1a; color: #f2d97a; }
.triage-status-badge.missing-model  { background: #3a2a1a; color: #f2a76b; }
.triage-status-badge.missing-both   { background: #3a1a1a; color: #f27272; }

.triage-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 60px 20px;
}

.triage-empty .icon { font-size: 32px; margin-bottom: 8px; }

.triage-loading {
    text-align: center;
    color: var(--text-dim);
    padding: 60px 20px;
}

.triage-table tbody tr {
    cursor: pointer;
}

/* Detail modal */
.triage-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.triage-detail-overlay.open {
    display: flex;
}

.triage-detail-panel {
    background: var(--panel-bg, #15151c);
    border: 1px solid var(--border-dim, #2a2a35);
    border-radius: 8px;
    width: min(720px, 92vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.triage-detail-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-dim, #2a2a35);
    gap: 12px;
}

.triage-detail-header .title {
    font-size: 15px;
    color: var(--text-bright, #eee);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.triage-detail-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}

.triage-detail-close:hover { color: #fff; }

.triage-detail-body {
    padding: 14px 18px;
    overflow-y: auto;
    font-size: 13px;
}

.triage-detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 16px;
    padding: 6px 0;
    border-bottom: 1px solid #20202a;
}

.triage-detail-row:last-child {
    border-bottom: none;
}

.triage-detail-key {
    color: var(--text-dim);
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
    font-size: 12px;
    word-break: break-word;
}

.triage-detail-val {
    color: var(--text-bright, #ddd);
    word-break: break-word;
    white-space: pre-wrap;
}

.triage-detail-val.null {
    color: var(--text-dim);
    font-style: italic;
}

.triage-detail-val.complex {
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
    font-size: 11px;
    background: #0e0e14;
    border: 1px solid #20202a;
    border-radius: 4px;
    padding: 6px 8px;
    max-height: 200px;
    overflow-y: auto;
}
