/* Servicio transfusional — alineado con inventario / design system Banchy */
.tx-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px 1.75rem 40px;
    box-sizing: border-box;
}

.tx-header { margin-bottom: 20px; }

.tx-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--border-radius-full);
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-xs);
    margin-bottom: 14px;
    transition: all var(--transition-fast);
}

.tx-back:hover {
    color: var(--primary);
    border-color: var(--primary-lighter);
}

.tx-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.tx-lead {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.tx-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.tx-kpi {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
}

.tx-kpi span {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.tx-kpi strong {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.tx-tabs-wrap { margin-bottom: 20px; }

.tx-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    box-shadow: var(--shadow-xs);
    overflow-x: auto;
    max-width: 100%;
    margin-bottom: 16px;
}

.tx-tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    padding: 10px 16px;
    border-radius: var(--border-radius-full);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tx-tab:hover {
    color: var(--text-primary);
    background: var(--surface-50);
}

.tx-tab.active {
    color: var(--text-white);
    background: var(--gradient-primary);
    box-shadow: var(--shadow-sm);
}

.tx-panel {
    display: none;
    animation: txFadeUp 0.25s ease;
}

.tx-panel.active { display: block; }

@keyframes txFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.tx-section {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 16px;
}

.tx-section-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0 0 16px;
}

.tx-section-title--spaced { margin-top: 8px; }

.tx-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
}

@media (min-width: 1100px) {
    .tx-form-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .tx-form-grid { grid-template-columns: 1fr; }
}

.tx-field--full { grid-column: 1 / -1; }

.tx-field--span2 { grid-column: 1 / -1; }

/* Paciente: nombre amplio + HC; fila ABO/Rh/nacimiento/edad */
.tx-form-grid--patient {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.tx-form-grid--patient-meta {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 16px;
}

@media (max-width: 900px) {
    .tx-form-grid--patient { grid-template-columns: 1fr; }
    .tx-form-grid--patient-meta { grid-template-columns: repeat(2, 1fr); }
}

/* Solicitud: bloques con título */
.tx-request-form {
    margin-top: 8px;
}

.tx-request-form--nested {
    margin-top: 16px;
}

.tx-request-block {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.tx-request-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tx-request-block-title {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.tx-form-grid--episode {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(10rem, 12rem);
    gap: 14px 16px;
}

@media (max-width: 768px) {
    .tx-form-grid--episode {
        grid-template-columns: 1fr;
    }
    .tx-form-grid--episode .tx-field--urgency {
        max-width: 16rem;
    }
}

.tx-component-units-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 5.75rem;
    gap: 16px;
    align-items: end;
}

@media (max-width: 480px) {
    .tx-component-units-row {
        grid-template-columns: 1fr 5.75rem;
    }
}

.tx-field--units input {
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding-left: 8px;
    padding-right: 8px;
}

.tx-field label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.tx-field input,
.tx-field select,
.tx-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface-glass-dark);
}

.tx-field textarea { min-height: 72px; resize: vertical; }

.tx-age-value {
    box-sizing: border-box;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    background: var(--surface-glass-dark);
    display: flex;
    align-items: center;
}

.tx-lookup-banner {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color);
    background: rgba(59, 130, 246, 0.08);
}

.tx-lookup-banner.tx-lookup-banner--new {
    background: rgba(34, 197, 94, 0.08);
}

.tx-advanced-block {
    margin-top: 16px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.tx-advanced-block summary {
    cursor: pointer;
    color: var(--text-primary);
}

.tx-sample-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color);
    background: rgba(234, 179, 8, 0.12);
    color: var(--text-primary);
}

.tx-sample-hint[hidden] {
    display: none !important;
}

.tx-sample-active {
    margin: 0 0 14px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.tx-sample-active-id {
    color: var(--text-secondary);
    font-size: 12px;
}

.tx-sample-workflow--disabled {
    opacity: 0.55;
    pointer-events: none;
    user-select: none;
}

.tx-sample-workflow--disabled .tx-sample-hint-inner {
    pointer-events: auto;
}

.tx-field--actions label {
    visibility: hidden;
}

.tx-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.tx-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 24px 0;
}

.tx-table-wrap { overflow-x: auto; margin-top: 12px; }

.tx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.tx-table th,
.tx-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

.tx-table th {
    background: var(--surface-50);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.tx-table--selectable tbody tr[data-request-id] {
    cursor: pointer;
}

.tx-table--selectable tbody tr[data-request-id]:hover {
    background: var(--surface-50);
}

.tx-table--selectable tbody tr.tx-row-selected {
    background: color-mix(in srgb, var(--primary-500, #2563eb) 12%, transparent);
}

.tx-msg { padding: 12px 14px; border-radius: var(--border-radius-md); margin-bottom: 14px; font-size: var(--font-size-sm); }
.tx-msg.ok { background: var(--success-light, #ecfdf5); color: var(--success-dark, #065f46); border: 1px solid rgba(129, 178, 154, 0.4); }
.tx-msg.err { background: var(--error-light, #fef2f2); color: var(--error-dark, #991b1b); border: 1px solid rgba(224, 122, 95, 0.35); }

.tx-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    background: var(--surface-100);
    color: var(--text-secondary);
}

.tx-badge.urgent { background: #fff3e0; color: #e65100; }
.tx-badge.emergency { background: #ffebee; color: #b71c1c; }

.tx-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 12px;
}

.tx-check-row input { width: auto; margin: 0; }

.tx-sample-row { cursor: pointer; }
.tx-sample-row:hover { background: var(--surface-hover, #f5f7fa); }
.tx-checklist { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; }
.tx-checklist li { padding: 6px 0; border-bottom: 1px solid var(--border-color, #e5e7eb); }
.tx-checklist li.ok { color: var(--success, #15803d); }
.tx-checklist li.fail { color: var(--danger, #b91c1c); }

.tx-subsection-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0 0 8px;
}

.tx-form-grid--sihevi-period {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    max-width: 320px;
    margin-bottom: 12px;
}

.tx-sihevi-summary {
    margin-top: 16px;
}

.tx-sihevi-summary .tx-kpi-row {
    margin-bottom: 0;
}

.tx-sihevi-disclaimer {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
}
