/* The Awaab's Law triage form (Triage\) and its developer harness (Pages\TriageHarness.razor).
   Plain CSS on the shared --ss-* tokens from maintenance.css; no component library until the ExtJS
   styling is settled (WEB-05). Laid out to work at 1024px wide inside an iFrame (UI-A11). */

:root {
    --tri-danger: #b42318;
    --tri-danger-bg: #fdecea;
    --tri-warning: #8a5a00;
    --tri-warning-bg: #fff4d6;
    --tri-info: #1f5d99;
    --tri-info-bg: #e8f1fb;
    --tri-ok: #1e7b34;
    --tri-ok-bg: #e7f5ea;
    --tri-selected: #3f4757;
}

.tri-form {
    font-family: var(--ss-font);
    font-size: 14px;
    color: var(--ss-text);
    background: var(--ss-bg);
    min-height: 100%;
}

.tri-body {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 24px 48px;
}

.tri-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 8px 0 16px;
}

.tri-loading,
.tri-load-error {
    padding: 24px;
    font-family: var(--ss-font);
}

/* ---- sticky summary bar (UI-A07) ---- */

.tri-summary {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 14px;
    padding: 10px 24px;
    background: var(--ss-bg-panel);
    border-bottom: 1px solid var(--ss-border);
    font-family: var(--ss-font);
}

.tri-summary-caption {
    color: var(--ss-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tri-summary-label {
    font-weight: 600;
    font-size: 16px;
}

.tri-summary-target {
    font-size: 14px;
}

.tri-summary-stopped {
    color: #fff;
    background: var(--tri-danger);
    border-radius: 3px;
    padding: 1px 8px;
    font-weight: 600;
}

.tri-summary.tri-cat-emergency {
    background: var(--tri-danger-bg);
    border-bottom-color: var(--tri-danger);
}

.tri-summary.tri-cat-emergency .tri-summary-label {
    color: var(--tri-danger);
}

.tri-summary.tri-cat-significant {
    background: var(--tri-warning-bg);
    border-bottom-color: var(--tri-warning);
}

/* ---- sections and items ---- */

.tri-section {
    margin-bottom: 20px;
}

.tri-section > h2 {
    font-size: 1.05rem;
    font-weight: 600;
    padding-bottom: 6px;
    margin: 0 0 10px;
    border-bottom: 1px solid var(--ss-border-light);
}

.tri-item {
    padding: 8px 10px;
    margin: 0 0 6px;
    border-left: 3px solid transparent;
}

.tri-item.tri-invalid {
    border-left-color: var(--ss-invalid);
    background: #fdf3f1;
}

.tri-label {
    display: block;
    margin-bottom: 6px;
    line-height: 1.4;
}

.tri-required {
    color: var(--ss-invalid);
    margin-left: 2px;
}

.tri-error-text {
    color: var(--ss-invalid);
    font-size: 13px;
    margin-top: 4px;
}

.tri-group {
    border: 1px solid var(--ss-border-light);
    border-radius: 4px;
    padding: 8px 10px 4px;
}

.tri-group > legend {
    float: none;
    width: auto;
    font-size: 14px;
    line-height: 1.4;
    padding: 0 4px;
    margin: 0;
}

/* ---- inputs ---- */

.tri-input {
    font: inherit;
    padding: 6px 8px;
    border: 1px solid var(--ss-border);
    border-radius: 3px;
    background: #fff;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
}

.tri-input:focus {
    outline: 2px solid #7aa7d9;
    outline-offset: 0;
}

.tri-input[readonly],
.tri-input:disabled {
    background: var(--ss-bg-panel);
    color: #666;
}

.tri-invalid .tri-input {
    border-color: var(--ss-invalid);
}

/* Choice: large buttons in one row (WEB-06). */
.tri-choice {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tri-choice-btn {
    font: inherit;
    font-size: 15px;
    min-width: 96px;
    min-height: 44px;
    padding: 8px 18px;
    border: 1px solid var(--ss-border);
    border-radius: 4px;
    background: var(--ss-btn-bg);
    color: var(--ss-btn-fg);
    cursor: pointer;
}

.tri-choice-btn:hover:not(:disabled) {
    background: var(--ss-btn-bg-hover);
}

.tri-choice-btn.tri-selected {
    background: var(--tri-selected);
    border-color: var(--tri-selected);
    color: #fff;
}

.tri-choice-btn:disabled {
    cursor: default;
    opacity: .7;
}

.tri-number {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tri-input-number {
    max-width: 140px;
}

.tri-unit {
    max-width: 130px;
}

.tri-input-date {
    max-width: 240px;
}

.tri-unit-suffix {
    color: var(--ss-text-muted);
}

.tri-na,
.tri-checkbox,
.tri-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.tri-na input,
.tri-checkbox input,
.tri-radio input {
    width: 18px;
    height: 18px;
}

.tri-na {
    margin-left: 6px;
}

/* ---- scripts (UI-A05) ---- */

.tri-script {
    background: var(--tri-info-bg);
    border: 1px solid #bcd3ec;
    border-radius: 4px;
    padding: 10px 14px;
}

.tri-script p {
    margin: 0 0 8px;
    line-height: 1.45;
}

.tri-script-caption {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tri-info);
    margin-bottom: 6px;
    font-weight: 600;
}

.tri-script-confirm {
    font-weight: 600;
    margin-top: 4px;
}

.tri-timer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.tri-timer-display {
    font-variant-numeric: tabular-nums;
    font-size: 18px;
    font-weight: 600;
    min-width: 5ch;
}

.tri-timer-done {
    color: var(--tri-ok);
}

/* ---- warnings (UI-A06, WEB-07) ---- */

.tri-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 10px 10px;
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 4px solid;
    line-height: 1.4;
}

.tri-level-danger {
    background: var(--tri-danger-bg);
    border-color: var(--tri-danger);
    color: var(--tri-danger);
    font-weight: 600;
    font-size: 15px;
}

.tri-level-warning {
    background: var(--tri-warning-bg);
    border-color: #d99a00;
    color: var(--tri-warning);
}

.tri-level-info {
    background: var(--tri-info-bg);
    border-color: var(--tri-info);
    color: var(--tri-info);
}

.tri-warning-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--tri-danger);
    color: #fff;
    font-size: 13px;
}

/* ---- submit, errors, result ---- */

.tri-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.tri-btn {
    font: inherit;
    padding: 6px 14px;
    border: 1px solid var(--ss-border);
    border-radius: 3px;
    background: var(--ss-btn-bg);
    color: var(--ss-btn-fg);
    cursor: pointer;
}

.tri-btn:hover:not(:disabled) {
    background: var(--ss-btn-bg-hover);
}

.tri-btn:disabled {
    opacity: .55;
    cursor: default;
}

.tri-btn-primary {
    background: var(--ss-accent);
    border-color: var(--ss-accent);
    color: #fff;
    padding: 8px 22px;
    font-weight: 600;
}

.tri-btn-primary:hover:not(:disabled) {
    background: #2d3442;
}

.tri-errors {
    margin-top: 16px;
    padding: 10px 14px;
    border: 1px solid var(--ss-invalid);
    border-radius: 4px;
    background: #fdf3f1;
}

.tri-errors ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.tri-link {
    border: 0;
    padding: 0;
    background: none;
    font: inherit;
    color: #1f5d99;
    text-decoration: underline;
    cursor: pointer;
    text-align: left;
}

.tri-hint {
    color: var(--ss-text-muted);
}

.tri-result {
    margin-top: 20px;
    padding: 14px 18px;
    border: 1px solid var(--ss-border);
    border-top: 4px solid var(--ss-accent);
    border-radius: 4px;
}

.tri-result.tri-cat-emergency {
    border-top-color: var(--tri-danger);
}

.tri-result.tri-cat-significant {
    border-top-color: #d99a00;
}

.tri-result h2 {
    font-size: 1.15rem;
    margin: 0 0 10px;
}

.tri-result h3 {
    font-size: 1rem;
    margin: 14px 0 6px;
}

.tri-result-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    margin: 0 0 12px;
}

.tri-result-facts dt {
    color: var(--ss-text-muted);
    font-weight: normal;
}

.tri-result-facts dd {
    margin: 0;
}

.tri-result-outcome {
    font-weight: 600;
    font-size: 16px;
}

.tri-result .tri-warning {
    margin-left: 0;
}

.tri-jobs {
    margin: 0;
    padding-left: 20px;
}

.tri-notes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tri-notes {
    width: 100%;
    box-sizing: border-box;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    padding: 8px;
    border: 1px solid var(--ss-border);
    border-radius: 3px;
    background: var(--ss-bg-panel);
    resize: vertical;
}

.tri-job-action {
    border: 0;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
}

.tri-job-action legend {
    float: none;
    width: auto;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 12px 0 0;
}

.tri-complete {
    margin-top: 16px;
    padding: 8px 12px;
    background: var(--tri-ok-bg);
    color: var(--tri-ok);
    border-radius: 4px;
    font-weight: 600;
}

/* ---- the PDF report (Phase C, RUI-01/03) ---- */

.tri-report {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tri-report-pending {
    color: var(--tri-info);
}

.tri-report-failed {
    color: var(--tri-danger);
    font-weight: 600;
}

/* ---- developer harness (UI-A20 to UI-A24) ---- */

.tri-harness {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    height: 100%;
    font-family: var(--ss-font);
    font-size: 13px;
}

.tri-harness-form {
    overflow: auto;
    min-height: 0;
}

.tri-harness-panel {
    overflow: auto;
    min-height: 0;
    padding: 12px 16px 32px;
    background: var(--ss-bg-panel);
    border-left: 1px solid var(--ss-border);
}

.tri-harness-panel h2 {
    font-size: 1.05rem;
    margin: 0 0 12px;
}

.tri-harness-panel h3 {
    font-size: .95rem;
    margin: 0 0 6px;
}

.tri-harness-panel section {
    padding: 10px 0;
    border-top: 1px solid var(--ss-border);
}

.tri-harness-panel .tri-input {
    max-width: none;
    padding: 4px 6px;
}

.tri-harness-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.tri-harness-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 8px;
    align-items: center;
    margin-bottom: 8px;
}

.tri-harness-meta {
    color: #666;
    margin: 0 0 6px;
}

.tri-harness-errors {
    color: var(--tri-danger);
    padding-left: 18px;
}

.tri-harness-warnings {
    color: var(--tri-warning);
    padding-left: 18px;
}

.tri-harness-verdict {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 3px;
    margin-bottom: 6px;
}

.tri-harness-verdict.tri-pass {
    background: var(--tri-ok-bg);
    color: var(--tri-ok);
}

.tri-harness-verdict.tri-fail {
    background: var(--tri-danger-bg);
    color: var(--tri-danger);
}

.tri-harness-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.tri-harness-table th,
.tri-harness-table td {
    border: 1px solid var(--ss-border);
    padding: 3px 5px;
    vertical-align: top;
    text-align: left;
}

.tri-harness-table th:first-child,
.tri-harness-table td:first-child {
    width: 96px;
    word-break: break-word;
}

.tri-harness-table tr.tri-fail td {
    background: var(--tri-danger-bg);
}

.tri-harness-table pre,
.tri-json {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

.tri-json {
    max-height: 360px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--ss-border);
    padding: 6px;
}

.tri-harness-panel details {
    margin-top: 8px;
}

.tri-harness-panel summary {
    cursor: pointer;
    font-weight: 600;
}

/* Phase B (embedded): the closure reason reminder, the draft save indicator and the resume prompt. */
.tri-close-reason {
    margin: 0.75rem 0;
}

.tri-draft-status {
    font-size: 0.85rem;
    color: var(--ss-text-muted, #666);
}

.tri-draft-status.tri-draft-failed {
    color: var(--ss-danger, #b00020);
    font-weight: 600;
}

.tri-resume {
    margin: 1rem;
    padding: 1rem;
    border: 1px solid var(--ss-border, #ccc);
    border-radius: 4px;
}

.tri-resume .tri-actions {
    margin-top: 0.75rem;
}
