html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
body {
    background-color: #F0F2F5;
}

.card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.table {
    background-color: #FFFFFF;
}

.navbar-brand {
    font-size: 1.3rem;
    letter-spacing: -0.02em;
}

footer {
    background-color: #F0F2F5;
}
/* TORX Brand Colors */
.btn-primary {
    background-color: #FF6B2B;
    border-color: #FF6B2B;
    color: #FFFFFF;
}

    .btn-primary:hover {
        background-color: #E55A1F;
        border-color: #E55A1F;
        color: #FFFFFF;
    }

    .btn-primary:focus,
    .btn-primary:active {
        background-color: #E55A1F;
        border-color: #E55A1F;
        color: #FFFFFF;
    }

.table-dark {
    background-color: #0A0C0F;
}

.navbar.bg-dark {
    background-color: #0A0C0F !important;
}
.navbar-dark .navbar-nav .nav-link {
    color: #FFFFFF;
}

    .navbar-dark .navbar-nav .nav-link:hover {
        color: #FF6B2B;
    }

    .navbar-dark .navbar-nav .nav-link:focus {
        color: #FF6B2B;
    }
.dropdown-menu-dark .dropdown-item {
    color: #FFFFFF;
}

    .dropdown-menu-dark .dropdown-item:hover {
        color: #FF6B2B;
        background-color: rgba(255, 107, 43, 0.15);
    }

/* Form label styling */
.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 4px;
}

textarea {
    white-space: pre-wrap;
}

.preserve-lines {
    white-space: pre-wrap;
}

/* Input text slightly smaller */
.form-control, .form-select {
    font-size: 0.9rem;
}

/* ── DARK MODE ── */
html.dark-mode body {
    background-color: #1A1D23;
}

body.dark-mode {
    background-color: #1A1D23;
    color: #E0E0E0;
}

    body.dark-mode .card {
        background-color: #22262F !important;
        border-color: rgba(255,255,255,0.08) !important;
        color: #E0E0E0;
    }

    body.dark-mode .card-body {
        background-color: #22262F !important;
    }

    body.dark-mode .card-header.bg-dark {
        background-color: #13151A !important;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    body.dark-mode .table {
        background-color: #22262F !important;
        color: #E0E0E0;
        border-color: rgba(255,255,255,0.08);
    }

        body.dark-mode .table td,
        body.dark-mode .table th {
            border-color: rgba(255,255,255,0.08);
            color: #E0E0E0;
            background-color: #22262F;
        }

    body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
        background-color: #272B34 !important;
        color: #E0E0E0;
    }

    body.dark-mode .table-striped > tbody > tr:nth-of-type(even) > * {
        background-color: #22262F !important;
        color: #E0E0E0;
    }

    body.dark-mode .table-hover > tbody > tr:hover > * {
        background-color: rgba(255,107,43,0.1) !important;
        color: #E0E0E0;
    }

    body.dark-mode .table-dark {
        background-color: #13151A !important;
    }

        body.dark-mode .table-dark th {
            background-color: #13151A !important;
            color: #E0E0E0;
        }

    body.dark-mode .form-control,
    body.dark-mode .form-select {
        background-color: #2C3140 !important;
        border-color: rgba(255,255,255,0.15);
        color: #E0E0E0 !important;
    }

        body.dark-mode .form-control:focus,
        body.dark-mode .form-select:focus {
            background-color: #2C3140 !important;
            border-color: #FF6B2B;
            color: #E0E0E0 !important;
            box-shadow: 0 0 0 0.2rem rgba(255,107,43,0.25);
        }

        body.dark-mode .form-control::placeholder {
            color: rgba(224,224,224,0.3);
        }

    body.dark-mode .breadcrumb {
        background-color: transparent;
    }

    body.dark-mode .breadcrumb-item a {
        color: #FF6B2B;
    }

    body.dark-mode .breadcrumb-item.active {
        color: #8A96A3;
    }

    body.dark-mode .breadcrumb-item + .breadcrumb-item::before {
        color: #8A96A3;
    }

    body.dark-mode .text-muted {
        color: #8A96A3 !important;
    }

    body.dark-mode .alert-info {
        background-color: rgba(0,194,168,0.12);
        border-color: rgba(0,194,168,0.25);
        color: #00C2A8;
    }

    body.dark-mode .alert-warning {
        background-color: rgba(255,107,43,0.12);
        border-color: rgba(255,107,43,0.25);
        color: #FF6B2B;
    }

    body.dark-mode .alert-danger {
        background-color: rgba(230,57,70,0.12);
        border-color: rgba(230,57,70,0.25);
        color: #E63946;
    }

    body.dark-mode .alert-success {
        background-color: rgba(0,194,168,0.12);
        border-color: rgba(0,194,168,0.25);
        color: #00C2A8;
    }

    body.dark-mode .modal-content {
        background-color: #22262F !important;
        border-color: rgba(255,255,255,0.08);
        color: #E0E0E0;
    }

    body.dark-mode .modal-header {
        border-bottom-color: rgba(255,255,255,0.08);
    }

    body.dark-mode .modal-footer {
        border-top-color: rgba(255,255,255,0.08);
    }

    body.dark-mode .modal-body {
        background-color: #22262F !important;
    }

    body.dark-mode .dropdown-menu {
        background-color: #22262F;
        border-color: rgba(255,255,255,0.08);
    }

    body.dark-mode .dropdown-item {
        color: #E0E0E0;
    }

        body.dark-mode .dropdown-item:hover {
            background-color: rgba(255,107,43,0.15);
            color: #FF6B2B;
        }

    body.dark-mode .table-secondary {
        --bs-table-bg: #2C3140 !important;
        color: #E0E0E0 !important;
    }

        body.dark-mode .table-secondary td,
        body.dark-mode .table-secondary th {
            background-color: #2C3140 !important;
            color: #E0E0E0 !important;
        }

    body.dark-mode .btn-outline-secondary {
        color: #8A96A3;
        border-color: #8A96A3;
    }

        body.dark-mode .btn-outline-secondary:hover {
            background-color: #8A96A3;
            color: #1A1D23;
        }

    body.dark-mode h1,
    body.dark-mode h2,
    body.dark-mode h3,
    body.dark-mode h4,
    body.dark-mode h5 {
        color: #E0E0E0;
    }

    body.dark-mode .fw-semibold {
        color: #E0E0E0;
    }

    body.dark-mode .table-warning,
    body.dark-mode .table-warning > td,
    body.dark-mode .table-warning > th {
        background-color: rgba(255,107,43,0.15) !important;
        color: #E0E0E0 !important;
    }

    body.dark-mode .table-success,
    body.dark-mode .table-success > td,
    body.dark-mode .table-success > th {
        background-color: rgba(0,194,168,0.15) !important;
        color: #E0E0E0 !important;
    }

    body.dark-mode .table-danger,
    body.dark-mode .table-danger > td,
    body.dark-mode .table-danger > th {
        background-color: rgba(230,57,70,0.15) !important;
        color: #E0E0E0 !important;
    }

    body.dark-mode .border-bottom {
        border-color: rgba(255,255,255,0.08) !important;
    }

    body.dark-mode .border-end {
        border-color: rgba(255,255,255,0.08) !important;
    }

    body.dark-mode strong {
        color: #E0E0E0;
    }

    body.dark-mode .pfmeaInfo,
    body.dark-mode #pfmeaInfo {
        background-color: #2C3140 !important;
        color: #E0E0E0;
    }

    body.dark-mode footer {
        background-color: #1A1D23 !important;
        color: #8A96A3;
    }

        body.dark-mode footer a {
            color: #FF6B2B;
        }

    body.dark-mode .table-dark,
    body.dark-mode .table-dark th,
    body.dark-mode .table thead.table-dark th {
        background-color: #2C3140 !important;
        color: #E0E0E0 !important;
        border-color: rgba(255,255,255,0.08) !important;
    }
    body.dark-mode .table-success,
    body.dark-mode .table-success > td,
    body.dark-mode .table-success > th,
    body.dark-mode tr.table-success > td,
    body.dark-mode tr.table-success > th {
        background-color: rgba(0,194,168,0.12) !important;
        color: #E0E0E0 !important;
        --bs-table-bg: rgba(0,194,168,0.12) !important;
        --bs-table-striped-bg: rgba(0,194,168,0.12) !important;
    }

    body.dark-mode .table-warning,
    body.dark-mode .table-warning > td,
    body.dark-mode .table-warning > th,
    body.dark-mode tr.table-warning > td,
    body.dark-mode tr.table-warning > th {
        background-color: rgba(255,107,43,0.12) !important;
        color: #E0E0E0 !important;
        --bs-table-bg: rgba(255,107,43,0.12) !important;
        --bs-table-striped-bg: rgba(255,107,43,0.12) !important;
    }



    .pfmea-step4-header {
        background-color: #fff3cd !important;
        color: #555 !important;
    }

    .pfmea-step5-header {
        background-color: #d1ecf1 !important;
        color: #555 !important;
    }

    body.dark-mode .pfmea-step4-header {
        background-color: rgba(255,193,7,0.2) !important;
        color: #E0E0E0 !important;
    }

    body.dark-mode .pfmea-step5-header {
        background-color: rgba(13,202,240,0.2) !important;
        color: #E0E0E0 !important;
    }


/* ══════════════════════════════════════════════
   TORX UI/UX — Work Elements
   Pegar al final de site.css
   ══════════════════════════════════════════════ */

/* ── Context strip ── */
.torx-context-strip {
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 9px 14px;
    font-size: 0.82rem;
}

.torx-context-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.torx-context-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999;
    font-weight: 600;
    white-space: nowrap;
}

.torx-context-value {
    font-weight: 600;
    color: #1a1d23;
}

.torx-context-divider {
    width: 1px;
    height: 16px;
    background: #dee2e6;
    margin: 0 14px;
    flex-shrink: 0;
}

/* ── Group header ── */
.torx-group-header {
    border-top: 2px solid #dee2e6;
}

    .torx-group-header td {
        background-color: #f8f9fa !important;
    }

.torx-group-columns {
    display: flex;
    align-items: flex-start;
    width: fit-content;
}

.torx-group-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: fit-content;
    min-width: 160px;
    max-width: 420px;
}

.torx-group-sep {
    width: 1px;
    background: #dee2e6;
    align-self: stretch;
    margin: 0 12px;
    flex-shrink: 0;
}

.torx-group-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #999;
    font-weight: 600;
    margin-bottom: 2px;
}

.torx-group-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1d23;
    line-height: 1.3;
    margin-bottom: 4px;
}

.torx-group-function-label {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999;
    font-weight: 600;
}

/* Function pills — fit-content width, NOT full width */
.torx-function-pill {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 4px;
    line-height: 1.4;
}

.torx-function-pill--blue {
    background-color: rgba(13, 110, 253, 0.08);
    color: #0a58ca;
    border: 1px solid rgba(13, 110, 253, 0.2);
}

.torx-function-pill--orange {
    background-color: rgba(255, 107, 43, 0.1);
    color: #c45015;
    border: 1px solid rgba(255, 107, 43, 0.25);
}

/* ── Column headers repeated per group ── */
.torx-col-headers th {
    background-color: #f0f2f5 !important;
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.02em;
    border-top: 1px solid #dee2e6;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* ── Delete discreto ── */
.torx-delete-btn {
    color: #dc3545 !important;
    font-size: 0.78rem;
    padding: 0.2rem 0.4rem;
    opacity: 0.55;
    text-decoration: none;
}

    .torx-delete-btn:hover {
        opacity: 1;
        text-decoration: underline;
        color: #dc3545 !important;
    }

/* ── M Category badges — 6M Ishikawa colors ── */
.torx-mcategory-badge {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
}

    .torx-mcategory-badge[data-cat="Man"] {
        background-color: rgba(251, 191, 36, 0.15);
        color: #92680a;
        border-color: rgba(251, 191, 36, 0.35);
    }

    .torx-mcategory-badge[data-cat="Material"] {
        background-color: rgba(34, 197, 94, 0.12);
        color: #166534;
        border-color: rgba(34, 197, 94, 0.3);
    }

    .torx-mcategory-badge[data-cat="Machine"] {
        background-color: rgba(59, 130, 246, 0.12);
        color: #1e40af;
        border-color: rgba(59, 130, 246, 0.3);
    }

    .torx-mcategory-badge[data-cat="Method"] {
        background-color: rgba(139, 92, 246, 0.12);
        color: #5b21b6;
        border-color: rgba(139, 92, 246, 0.3);
    }

    .torx-mcategory-badge[data-cat="Measurement"] {
        background-color: rgba(0, 194, 168, 0.12);
        color: #0a7a68;
        border-color: rgba(0, 194, 168, 0.3);
    }

    .torx-mcategory-badge[data-cat="Environment"] {
        background-color: rgba(255, 107, 43, 0.1);
        color: #c45015;
        border-color: rgba(255, 107, 43, 0.25);
    }

/* ── Empty state ── */
.torx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
}

.torx-empty-icon {
    font-size: 2rem;
    color: #ced4da;
    margin-bottom: 12px;
    line-height: 1;
}

.torx-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.torx-empty-sub {
    font-size: 0.85rem;
    color: #6c757d;
    max-width: 340px;
    line-height: 1.5;
}

/* ══ DARK MODE ══ */
body.dark-mode .torx-context-strip {
    background-color: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-context-value {
    color: #E0E0E0;
}

body.dark-mode .torx-context-label {
    color: #6A7484;
}

body.dark-mode .torx-context-divider {
    background: rgba(255,255,255,0.1);
}

body.dark-mode .torx-group-header td {
    background-color: #2C3140 !important;
}

body.dark-mode .torx-group-sep {
    background: rgba(255,255,255,0.08);
}

body.dark-mode .torx-group-name {
    color: #E0E0E0;
}

body.dark-mode .torx-group-label,
body.dark-mode .torx-group-function-label {
    color: #6A7484;
}

body.dark-mode .torx-function-pill--blue {
    background-color: rgba(13, 110, 253, 0.15);
    color: #6ea8fe;
    border-color: rgba(13, 110, 253, 0.3);
}

body.dark-mode .torx-function-pill--orange {
    background-color: rgba(255, 107, 43, 0.15);
    color: #FF8C55;
    border-color: rgba(255, 107, 43, 0.3);
}

body.dark-mode .torx-col-headers th {
    background-color: #252932 !important;
    color: #8A96A3;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-mcategory-badge[data-cat="Man"] {
    background-color: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

body.dark-mode .torx-mcategory-badge[data-cat="Material"] {
    background-color: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

body.dark-mode .torx-mcategory-badge[data-cat="Machine"] {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.3);
}

body.dark-mode .torx-mcategory-badge[data-cat="Method"] {
    background-color: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.3);
}

body.dark-mode .torx-mcategory-badge[data-cat="Measurement"] {
    background-color: rgba(0, 194, 168, 0.15);
    color: #00C2A8;
    border-color: rgba(0, 194, 168, 0.3);
}

body.dark-mode .torx-mcategory-badge[data-cat="Environment"] {
    background-color: rgba(255, 107, 43, 0.15);
    color: #FF8C55;
    border-color: rgba(255, 107, 43, 0.3);
}

body.dark-mode .torx-empty-state {
    background-color: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-empty-icon {
    color: #3A404D;
}

body.dark-mode .torx-empty-title {
    color: #C0C8D4;
}

body.dark-mode .torx-empty-sub {
    color: #8A96A3;
}

/* ══════════════════════════════════════════════
   TORX UI/UX — Dashboard
   ══════════════════════════════════════════════ */

/* ── KPI Cards ── */
.torx-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.torx-kpi-card {
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    overflow: hidden;
}

.torx-kpi-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.torx-kpi-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #9e9e9b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.torx-kpi-value {
    font-size: 1.75rem;
    font-weight: 300;
    font-family: 'DM Mono', monospace;
    color: #1a1d23;
    line-height: 1;
}

.torx-kpi-sub {
    font-size: 0.72rem;
    color: #9e9e9b;
}

/* ── Filter bar ── */
.torx-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.torx-filter-label {
    font-size: 0.72rem;
    color: #9e9e9b;
    margin-right: 2px;
}

.torx-filter-btn {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    border: 0.5px solid rgba(0,0,0,0.15);
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all .12s;
    font-family: inherit;
}

    .torx-filter-btn:hover {
        background: #f0f2f5;
    }

    .torx-filter-btn.active {
        background: #1a1d23;
        color: #fff;
        border-color: #1a1d23;
    }

.torx-filter-safety {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
    margin-left: 4px;
}

    .torx-filter-safety.active {
        background: #dc2626;
        color: #fff;
        border-color: #dc2626;
    }

.torx-search-input {
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: 6px;
    border: 0.5px solid rgba(0,0,0,0.15);
    background: #fff;
    color: #1a1d23;
    outline: none;
    width: 200px;
    font-family: inherit;
}

    .torx-search-input::placeholder {
        color: #9e9e9b;
    }

    .torx-search-input:focus {
        border-color: #FF6B2B;
    }

/* ── Table wrap ── */
.torx-table-wrap {
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    overflow: hidden;
}

.torx-th {
    background: #ebebea;
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b7280;
    padding: 8px 14px;
    text-align: left;
    border-bottom: 0.5px solid rgba(0,0,0,0.12);
    border-right: 0.5px solid rgba(0,0,0,0.07);
    white-space: nowrap;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

    .torx-th:last-child {
        border-right: none;
    }

.torx-proj-row {
    border-bottom: 0.5px solid rgba(0,0,0,0.07);
    transition: background .1s;
}

    .torx-proj-row:last-child {
        border-bottom: none;
    }

    .torx-proj-row:hover {
        background: #fafaf8;
    }

.torx-td {
    padding: 11px 14px;
    vertical-align: middle;
    border-right: 0.5px solid rgba(0,0,0,0.07);
    color: #1a1d23;
}

    .torx-td:last-child {
        border-right: none;
    }

/* ── Status badges ── */
.torx-status {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.torx-st-draft {
    background: #f3f4f6;
    color: #6b7280;
    border: 0.5px solid #d1d5db;
}

.torx-st-underreview {
    background: #fffbeb;
    color: #92400e;
    border: 0.5px solid #fcd34d;
}

.torx-st-approved {
    background: #eff6ff;
    color: #1e40af;
    border: 0.5px solid #93c5fd;
}

.torx-st-released {
    background: #f0fdf4;
    color: #166534;
    border: 0.5px solid #86efac;
}

/* ── Safety badge ── */
.torx-safety-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    background: #fee2e2;
    color: #991b1b;
    border: 0.5px solid #fca5a5;
}

/* ── Model year ── */
.torx-model-year {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #6b7280;
}

/* ── Activity dots ── */
.torx-dot-recent,
.torx-dot-medium,
.torx-dot-old {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.torx-dot-recent {
    background: #10b981;
}

.torx-dot-medium {
    background: #f59e0b;
}

.torx-dot-old {
    background: #d1d5db;
}

/* ── Table footer ── */
.torx-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 0.5px solid rgba(0,0,0,0.07);
    background: #fafaf8;
}

.torx-legend {
    display: flex;
    align-items: center;
    gap: 16px;
}

.torx-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: #9e9e9b;
}

.torx-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ══ DARK MODE — Dashboard ══ */
body.dark-mode .torx-kpi-card {
    background: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-kpi-value {
    color: #E0E0E0;
}

body.dark-mode .torx-kpi-label,
body.dark-mode .torx-kpi-sub {
    color: #6A7484;
}

body.dark-mode .torx-filter-btn {
    background: #22262F;
    border-color: rgba(255,255,255,0.12);
    color: #8A96A3;
}

    body.dark-mode .torx-filter-btn:hover {
        background: #2C3140;
    }

    body.dark-mode .torx-filter-btn.active {
        background: #E0E0E0;
        color: #1a1d23;
        border-color: #E0E0E0;
    }

body.dark-mode .torx-search-input {
    background: #22262F;
    border-color: rgba(255,255,255,0.12);
    color: #E0E0E0;
}

body.dark-mode .torx-table-wrap {
    background: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-th {
    background: #252932;
    color: #8A96A3;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-proj-row:hover {
    background: rgba(255,107,43,0.05);
}

body.dark-mode .torx-proj-row {
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-td {
    color: #E0E0E0;
    border-color: rgba(255,255,255,0.06);
}

    body.dark-mode .torx-td div[style*="font-weight:500"] {
        color: #E0E0E0 !important;
    }

body.dark-mode .torx-table-footer {
    background: #1e2229;
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-st-draft {
    background: rgba(107,114,128,0.15);
    color: #9ca3af;
    border-color: rgba(107,114,128,0.3);
}

body.dark-mode .torx-st-underreview {
    background: rgba(245,158,11,0.12);
    color: #fcd34d;
    border-color: rgba(245,158,11,0.3);
}

body.dark-mode .torx-st-approved {
    background: rgba(59,130,246,0.12);
    color: #93c5fd;
    border-color: rgba(59,130,246,0.3);
}

body.dark-mode .torx-st-released {
    background: rgba(16,185,129,0.12);
    color: #6ee7b7;
    border-color: rgba(16,185,129,0.3);
}

body.dark-mode .torx-safety-badge {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.3);
}

body.dark-mode .torx-model-year {
    color: #6A7484;
}

body.dark-mode .torx-dot-old {
    background: #3A404D;
}

/* ══════════════════════════════════════════════
   TORX UI/UX — Process Stations
   ══════════════════════════════════════════════ */

.torx-parts-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #6b7280;
    background: #f0f2f5;
    border: 0.5px solid rgba(0,0,0,0.12);
    padding: 3px 10px;
    border-radius: 20px;
}

/* ── Split table layout ── */
.torx-stations-outer {
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    overflow: hidden;
}

.torx-stations-scroll {
    display: flex;
    overflow: hidden;
}

/* LEFT fixed columns */
.torx-stations-left {
    flex-shrink: 0;
    border-right: 1.5px solid rgba(0,0,0,0.12);
    z-index: 2;
    background: #fff;
}

    .torx-stations-left table {
        border-collapse: collapse;
        font-size: 0.78rem;
    }

    .torx-stations-left thead th {
        background: #ebebea;
        font-size: 0.68rem;
        font-weight: 600;
        color: #6b7280;
        padding: 8px 12px;
        text-align: left;
        border-bottom: 0.5px solid rgba(0,0,0,0.12);
        border-right: 0.5px solid rgba(0,0,0,0.07);
        white-space: nowrap;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        height: 52px;
        vertical-align: bottom;
    }

        .torx-stations-left thead th:last-child {
            border-right: none;
        }

    .torx-stations-left tbody td {
        padding: 11px 12px;
        border-bottom: 0.5px solid rgba(0,0,0,0.07);
        border-right: 0.5px solid rgba(0,0,0,0.07);
        vertical-align: middle;
        height: 52px;
    }

        .torx-stations-left tbody td:last-child {
            border-right: none;
        }

    .torx-stations-left tbody tr:last-child td {
        border-bottom: none;
    }

    .torx-stations-left tbody tr:hover td {
        background: #fafaf8;
    }

/* RIGHT scrollable */
.torx-stations-right {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
}

    .torx-stations-right table {
        border-collapse: collapse;
        font-size: 0.78rem;
        height: 100%;
        width: 100%;
    }

/* Parts header row — dark background */
.torx-parts-header-row th {
    background: #1e2a3a;
    padding: 0;
    border-right: 0.5px solid rgba(255,255,255,0.1);
    border-bottom: 0.5px solid rgba(255,255,255,0.15);
    height: 52px;
    vertical-align: middle;
}

.torx-part-header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    gap: 2px;
    min-width: 80px;
}

.torx-part-code {
    font-size: 0.65rem;
    font-weight: 500;
    font-family: 'DM Mono', monospace;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.torx-part-name {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    text-align: center;
}

.torx-actions-th {
    background: #ebebea !important;
    border-bottom: 0.5px solid rgba(0,0,0,0.12) !important;
    border-right: none !important;
    width: 100%;
}

.torx-actions-th-inner {
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b7280;
    padding: 8px 12px;
    text-align: right;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Data cells right */
.torx-stations-right tbody td {
    padding: 0;
    border-bottom: 0.5px solid rgba(0,0,0,0.07);
    border-right: 0.5px solid rgba(0,0,0,0.07);
    vertical-align: middle;
    text-align: center;
    height: 52px;
}

.torx-stations-right tbody tr:last-child td {
    border-bottom: none;
}

.torx-stations-right tbody tr:hover td {
    background: #fafaf8;
}

.torx-actions-td {
    text-align: right !important;
    padding: 0 12px !important;
    border-right: none !important;
    white-space: nowrap;
    width: 100%;
}

/* Checkboxes */
.torx-check-cell {
    cursor: pointer;
}

    .torx-check-cell:hover {
        background: #f0fdf4 !important;
    }

.torx-check-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.torx-check-yes {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: #10b981;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: auto;
}

.torx-check-no {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1.5px solid rgba(0,0,0,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    background: transparent;
}

/* Station info cells */
.torx-order-num {
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
}

.torx-station-num {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #6b7280;
    white-space: nowrap;
}

.torx-station-name {
    font-weight: 600;
    color: #1a1d23;
    white-space: nowrap;
}

.torx-station-desc {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Row actions */
.torx-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

/* ══ DARK MODE — Process Stations ══ */
body.dark-mode .torx-stations-outer {
    background: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-stations-left {
    background: #22262F;
    border-color: rgba(255,255,255,0.1);
}

    body.dark-mode .torx-stations-left thead th {
        background: #252932;
        color: #8A96A3;
        border-color: rgba(255,255,255,0.08);
    }

    body.dark-mode .torx-stations-left tbody td {
        border-color: rgba(255,255,255,0.06);
        color: #E0E0E0;
    }

    body.dark-mode .torx-stations-left tbody tr:hover td {
        background: rgba(255,107,43,0.05);
    }

body.dark-mode .torx-parts-header-row th {
    background: #131920;
}

body.dark-mode .torx-actions-th {
    background: #252932 !important;
    border-color: rgba(255,255,255,0.08) !important;
}

body.dark-mode .torx-actions-th-inner {
    color: #8A96A3;
}

body.dark-mode .torx-stations-right tbody td {
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-stations-right tbody tr:hover td {
    background: rgba(255,107,43,0.05);
}

body.dark-mode .torx-check-no {
    border-color: rgba(255,255,255,0.2);
}

body.dark-mode .torx-station-name {
    color: #E0E0E0;
}

body.dark-mode .torx-station-num,
body.dark-mode .torx-order-num,
body.dark-mode .torx-station-desc {
    color: #8A96A3;
}

body.dark-mode .torx-parts-count {
    background: #2C3140;
    border-color: rgba(255,255,255,0.08);
    color: #8A96A3;
}

/* ══════════════════════════════════════════════
   TORX UI/UX — PFMEA Items Index
   ══════════════════════════════════════════════ */

/* ── Context strip ── */
.torx-pfmea-context {
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    overflow: hidden;
}

.torx-ctx-row {
    display: flex;
    border-bottom: 0.5px solid rgba(0,0,0,0.08);
}

.torx-ctx-cell {
    flex: 1;
    padding: 9px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 0.5px solid rgba(0,0,0,0.08);
}

    .torx-ctx-cell:last-child {
        border-right: none;
    }

.torx-ctx-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #9e9e9b;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.torx-ctx-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1a1d23;
}

.torx-ctx-fn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 0.5px solid rgba(0,0,0,0.07);
}

.torx-ctx-fn-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #9e9e9b;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    flex-shrink: 0;
}

.torx-ctx-fn-pill {
    font-size: 0.72rem;
    color: #0a58ca;
    background: rgba(13,110,253,0.08);
    border: 1px solid rgba(13,110,253,0.2);
    border-radius: 4px;
    padding: 2px 8px;
    line-height: 1.4;
}

.torx-ctx-fn-pill--orange {
    color: #c45015;
    background: rgba(255,107,43,0.1);
    border-color: rgba(255,107,43,0.25);
}

/* ── Two-level table headers ── */
.torx-pfmea-group-row th {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 5px 10px;
    text-align: center;
    border-right: 0.5px solid rgba(255,255,255,0.12);
    border-bottom: 0.5px solid rgba(255,255,255,0.12);
}

.torx-grp-analysis {
    background: #1e2a3a;
    color: rgba(255,255,255,0.55);
}

.torx-grp-prevention {
    background: #1a2e22;
    color: rgba(255,255,255,0.55);
}

.torx-grp-detection {
    background: #1a2432;
    color: rgba(255,255,255,0.55);
}

.torx-grp-flags {
    background: #2a1e38;
    color: rgba(255,255,255,0.55);
}

.torx-grp-empty {
    background: #1a1a18;
    border-right: none !important;
}

.torx-pfmea-cols th {
    background: #ebebea;
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b7280;
    padding: 7px 10px;
    text-align: left;
    border-right: 0.5px solid rgba(0,0,0,0.08);
    border-bottom: 0.5px solid rgba(0,0,0,0.12);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ── Data rows ── */
.torx-pfmea-row {
    border-bottom: 0.5px solid rgba(0,0,0,0.07);
    transition: background .1s;
}

    .torx-pfmea-row:hover {
        background: #fafaf8;
    }

    .torx-pfmea-row td {
        padding: 10px 10px;
        vertical-align: top;
        border-right: 0.5px solid rgba(0,0,0,0.07);
        line-height: 1.5;
        color: #1a1d23;
        font-size: 0.78rem;
    }

.torx-muted {
    color: #6b7280 !important;
}

/* Highlight rows */
.torx-highlight-warning td {
    background-color: rgba(255,193,7,0.1) !important;
}

.torx-highlight-danger td {
    background-color: rgba(220,53,69,0.08) !important;
}

.torx-highlight-success td {
    background-color: rgba(25,135,84,0.08) !important;
}

.torx-highlight-info td {
    background-color: rgba(13,202,240,0.08) !important;
}

/* ── Severity ── */
.torx-sev {
    font-family: 'DM Mono', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-block;
    width: 24px;
    text-align: center;
    color: #6b7280;
}

.torx-sev-critical {
    color: #dc2626;
}

.torx-sev-high {
    color: #d97706;
}

/* ── AP badge ── */
.torx-ap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
}

.torx-ap-sm {
    width: 20px;
    height: 20px;
    font-size: 0.62rem;
}

.torx-ap-h {
    background: #ef4444;
    color: #fff;
}

.torx-ap-m {
    background: #f59e0b;
    color: #fff;
}

.torx-ap-l {
    background: #10b981;
    color: #fff;
}

/* ── Special char ── */
.torx-sc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
    background: #f0f2f5;
    color: #6b7280;
    border: 0.5px solid rgba(0,0,0,0.15);
    font-family: 'DM Mono', monospace;
}

/* ── CP badge ── */
.torx-cp-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: #ede9fe;
    color: #7c3aed;
    border: 0.5px solid #c4b5fd;
    font-family: 'DM Mono', monospace;
    cursor: pointer;
    transition: opacity .15s;
}

    .torx-cp-badge:hover {
        opacity: 0.8;
        color: #7c3aed;
    }

/* ── Expand toggle ── */
.torx-expand-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    color: #FF6B2B;
    cursor: pointer;
    font-weight: 500;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,107,43,0.07);
    border: 0.5px solid rgba(255,107,43,0.2);
    transition: background .12s;
    user-select: none;
    white-space: nowrap;
}

    .torx-expand-toggle:hover {
        background: rgba(255,107,43,0.12);
    }

.torx-no-actions-tag {
    display: inline-block;
    font-size: 0.68rem;
    color: #9e9e9b;
    margin-top: 4px;
    font-style: italic;
}

/* ── Expand row ── */
.torx-expand-row td {
    padding: 0 !important;
    background: #fafaf9;
    border-bottom: 0.5px solid rgba(0,0,0,0.12) !important;
}

.torx-expand-inner {
    padding: 14px 16px 14px 22px;
    border-left: 3px solid #FF6B2B;
    display: grid;
    grid-template-columns: 1fr 1fr 150px 110px 1fr 110px;
    gap: 14px 20px;
    align-items: start;
}

.torx-exp-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.torx-exp-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #9e9e9b;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.torx-exp-value {
    font-size: 0.75rem;
    color: #1a1d23;
    line-height: 1.5;
}

/* Status badges in expand */
.torx-st {
    display: inline-flex;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}

.torx-st-completed {
    background: #d1fae5;
    color: #065f46;
}

.torx-st-progress {
    background: #fef3c7;
    color: #92400e;
}

.torx-st-pending {
    background: #f0f2f5;
    color: #6b7280;
    border: 0.5px solid rgba(0,0,0,0.12);
}

/* New scores grid */
.torx-scores-grid {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.torx-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.torx-score-lbl {
    font-size: 0.62rem;
    color: #9e9e9b;
    text-transform: uppercase;
    font-family: 'DM Mono', monospace;
}

.torx-score-val {
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'DM Mono', monospace;
    color: #1a1d23;
}

/* ══ DARK MODE — PFMEA Items ══ */
body.dark-mode .torx-pfmea-context {
    background: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-ctx-row {
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-ctx-cell {
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-ctx-value {
    color: #E0E0E0;
}

body.dark-mode .torx-ctx-label,
body.dark-mode .torx-ctx-fn-label {
    color: #6A7484;
}

body.dark-mode .torx-ctx-fn-row {
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-ctx-fn-pill {
    background: rgba(13,110,253,0.15);
    color: #93c5fd;
    border-color: rgba(13,110,253,0.3);
}

body.dark-mode .torx-ctx-fn-pill--orange {
    background: rgba(255,107,43,0.15);
    color: #FF8C55;
    border-color: rgba(255,107,43,0.3);
}

body.dark-mode .torx-pfmea-cols th {
    background: #252932;
    color: #8A96A3;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-pfmea-row {
    border-color: rgba(255,255,255,0.06);
}

    body.dark-mode .torx-pfmea-row:hover {
        background: rgba(255,107,43,0.05);
    }

    body.dark-mode .torx-pfmea-row td {
        color: #E0E0E0;
        border-color: rgba(255,255,255,0.06);
    }

body.dark-mode .torx-muted {
    color: #8A96A3 !important;
}

body.dark-mode .torx-sc {
    background: #2C3140;
    color: #8A96A3;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .torx-cp-badge {
    background: rgba(124,58,237,0.15);
    color: #c4b5fd;
    border-color: rgba(124,58,237,0.3);
}

body.dark-mode .torx-expand-row td {
    background: #1e2229;
}

body.dark-mode .torx-exp-label {
    color: #6A7484;
}

body.dark-mode .torx-exp-value {
    color: #E0E0E0;
}

body.dark-mode .torx-score-val {
    color: #E0E0E0;
}

body.dark-mode .torx-st-pending {
    background: #2C3140;
    color: #8A96A3;
    border-color: rgba(255,255,255,0.1);
}

/* ══════════════════════════════════════════════
   TORX UI/UX — Edit pages (shared)
   ══════════════════════════════════════════════ */

/* ── Edit card ── */
.torx-edit-card {
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    overflow: hidden;
}

/* ── Section header ── */
.torx-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 0.5px solid rgba(0,0,0,0.1);
    background: #ebebea;
}

.torx-section-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FF6B2B;
    flex-shrink: 0;
}

.torx-section-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* ── Form body ── */
.torx-form-body {
    padding: 20px 16px;
}

/* ── Field divider ── */
.torx-field-divider {
    border: none;
    border-top: 0.5px solid rgba(0,0,0,0.08);
    margin: 16px 0;
}

/* ── Form actions bar ── */
.torx-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f4f4f2;
    border-top: 0.5px solid rgba(0,0,0,0.1);
}

/* ── M Category grid ── */
.torx-mcat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.torx-help-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.15);
    background: #f0f2f5;
    color: #9e9e9b;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
    font-family: inherit;
    padding: 0;
}

    .torx-help-btn:hover {
        border-color: #FF6B2B;
        color: #FF6B2B;
        background: rgba(255,107,43,0.07);
    }

.torx-m-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.torx-m-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1.5px solid rgba(0,0,0,0.12);
    cursor: pointer;
    transition: all .15s;
    user-select: none;
    background: #fff;
}

    .torx-m-option:hover {
        background: #f4f4f2;
    }

.torx-m-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.torx-m-name {
    font-size: 0.78rem;
    font-weight: 500;
    color: #6b7280;
}

/* Selected states per category */
.torx-m-option.opt-man.selected {
    background: #fef3c7;
    border-color: #d97706;
}

    .torx-m-option.opt-man.selected .torx-m-name {
        color: #92400e;
    }

.torx-m-option.opt-machine.selected {
    background: #e0f2fe;
    border-color: #0284c7;
}

    .torx-m-option.opt-machine.selected .torx-m-name {
        color: #0369a1;
    }

.torx-m-option.opt-material.selected {
    background: #f0fdf4;
    border-color: #16a34a;
}

    .torx-m-option.opt-material.selected .torx-m-name {
        color: #15803d;
    }

.torx-m-option.opt-method.selected {
    background: #f5f3ff;
    border-color: #7c3aed;
}

    .torx-m-option.opt-method.selected .torx-m-name {
        color: #6d28d9;
    }

.torx-m-option.opt-measurement.selected {
    background: #ccfbf1;
    border-color: #0d9488;
}

    .torx-m-option.opt-measurement.selected .torx-m-name {
        color: #0f766e;
    }

.torx-m-option.opt-environment.selected {
    background: #fff7ed;
    border-color: #ea580c;
}

    .torx-m-option.opt-environment.selected .torx-m-name {
        color: #9a3412;
    }

/* Selected badges preview */
.torx-m-preview {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    min-height: 24px;
}

/* ── 6M Modal ── */
.torx-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1060;
    align-items: center;
    justify-content: center;
}

    .torx-modal-overlay.torx-modal-open {
        display: flex;
    }

.torx-modal {
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.15);
    border-radius: 10px;
    width: min(580px, 92vw);
    overflow: hidden;
}

.torx-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 0.5px solid rgba(0,0,0,0.1);
}

.torx-modal-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1d23;
}

.torx-modal-sub {
    font-size: 0.72rem;
    color: #9e9e9b;
    margin-top: 3px;
}

.torx-modal-close {
    background: transparent;
    border: none;
    font-size: 16px;
    color: #9e9e9b;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

    .torx-modal-close:hover {
        background: #f0f2f5;
    }

.torx-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

    .torx-modal-table thead th {
        background: #ebebea;
        font-size: 0.68rem;
        font-weight: 600;
        color: #6b7280;
        padding: 7px 14px;
        text-align: left;
        border-bottom: 0.5px solid rgba(0,0,0,0.1);
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .torx-modal-table tbody td {
        padding: 10px 14px;
        border-bottom: 0.5px solid rgba(0,0,0,0.07);
        vertical-align: middle;
        color: #1a1d23;
        font-size: 0.78rem;
    }

    .torx-modal-table tbody tr:last-child td {
        border-bottom: none;
    }

    .torx-modal-table tbody tr:hover {
        background: #f4f4f2;
    }

.torx-modal-examples {
    font-size: 0.72rem;
    color: #6b7280;
    line-height: 1.4;
}

.torx-modal-footer {
    padding: 10px 18px;
    border-top: 0.5px solid rgba(0,0,0,0.07);
    background: #f4f4f2;
    display: flex;
    justify-content: flex-end;
}

.torx-mod-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ══ DARK MODE — Edit pages ══ */
body.dark-mode .torx-edit-card {
    background: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-section-header {
    background: #252932;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-section-title {
    color: #8A96A3;
}

body.dark-mode .torx-form-actions {
    background: #1e2229;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-field-divider {
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-m-option {
    background: #2C3140;
    border-color: rgba(255,255,255,0.1);
}

    body.dark-mode .torx-m-option:hover {
        background: #333948;
    }

body.dark-mode .torx-m-name {
    color: #8A96A3;
}

body.dark-mode .torx-help-btn {
    background: #2C3140;
    border-color: rgba(255,255,255,0.15);
    color: #6A7484;
}

body.dark-mode .torx-modal {
    background: #22262F;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .torx-modal-header {
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-modal-title {
    color: #E0E0E0;
}

body.dark-mode .torx-modal-sub {
    color: #6A7484;
}

body.dark-mode .torx-modal-close {
    color: #6A7484;
}

    body.dark-mode .torx-modal-close:hover {
        background: #2C3140;
    }

body.dark-mode .torx-modal-table thead th {
    background: #252932;
    color: #8A96A3;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-modal-table tbody td {
    color: #E0E0E0;
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-modal-table tbody tr:hover {
    background: #2C3140;
}

body.dark-mode .torx-modal-examples {
    color: #8A96A3;
}

body.dark-mode .torx-modal-footer {
    background: #1e2229;
    border-color: rgba(255,255,255,0.06);
}

/* ══════════════════════════════════════════════
   TORX UI/UX — Process Station Edit
   ══════════════════════════════════════════════ */

/* Two-column edit layout */
.torx-edit-two-col {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 12px;
    align-items: start;
}

/* Form hint text */
.torx-form-hint {
    font-size: 0.68rem;
    color: #9e9e9b;
    margin-top: 3px;
}

/* Character counter */
.torx-char-count {
    font-size: 0.68rem;
    color: #9e9e9b;
    font-family: 'DM Mono', monospace;
}

/* Tips card */
.torx-tips-card {
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    overflow: hidden;
}

.torx-tips-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.torx-tip-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.torx-tip-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #FF6B2B;
    flex-shrink: 0;
    margin-top: 6px;
}

.torx-tip-text {
    font-size: 0.78rem;
    color: #6b7280;
    line-height: 1.5;
}

    .torx-tip-text strong {
        color: #1a1d23;
        font-weight: 500;
    }

/* Status colors in context strip */
.torx-st-released {
    color: #065f46 !important;
}

.torx-st-approved {
    color: #1e40af !important;
}

.torx-st-underreview {
    color: #92400e !important;
}

.torx-st-draft {
    color: #6b7280 !important;
}

/* ══ DARK MODE ══ */
body.dark-mode .torx-tips-card {
    background: #22262F;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-tip-text {
    color: #8A96A3;
}

    body.dark-mode .torx-tip-text strong {
        color: #E0E0E0;
    }

body.dark-mode .torx-form-hint {
    color: #6A7484;
}

body.dark-mode .torx-char-count {
    color: #6A7484;
}

body.dark-mode .torx-st-released {
    color: #6ee7b7 !important;
}

body.dark-mode .torx-st-approved {
    color: #93c5fd !important;
}

body.dark-mode .torx-st-underreview {
    color: #fcd34d !important;
}

body.dark-mode .torx-st-draft {
    color: #9ca3af !important;
}

/* ══════════════════════════════════════════════
   TORX UI/UX — Project Edit
   ══════════════════════════════════════════════ */

/* ── Safety toggle ── */
.torx-safety-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    border: 1.5px solid rgba(0,0,0,0.12);
    cursor: pointer;
    transition: all .15s;
    user-select: none;
    background: #fff;
}

    .torx-safety-toggle.active {
        border-color: #fca5a5;
        background: #fff5f5;
    }

.torx-safety-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.torx-safety-text {
    flex: 1;
}

.torx-safety-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: #1a1d23;
}

.torx-safety-toggle.active .torx-safety-title {
    color: #991b1b;
}

.torx-safety-desc {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 1px;
}

.torx-safety-indicator {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: rgba(0,0,0,0.15);
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}

.torx-safety-toggle.active .torx-safety-indicator {
    background: #ef4444;
}

.torx-safety-indicator::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.torx-safety-toggle.active .torx-safety-indicator::after {
    transform: translateX(16px);
}

/* ── Status selector grid ── */
.torx-status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.torx-status-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 6px;
    border: 1.5px solid rgba(0,0,0,0.12);
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}

    .torx-status-opt:hover {
        background: #f0f2f5;
    }

.torx-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.torx-status-name {
    font-size: 0.72rem;
    font-weight: 500;
    color: #6b7280;
}

.torx-status-opt.opt-draft.selected {
    background: #f0f2f5;
    border-color: #d1d5db;
}

    .torx-status-opt.opt-draft.selected .torx-status-name {
        color: #6b7280;
    }

.torx-status-opt.opt-review.selected {
    background: #fef9c3;
    border-color: #fde047;
}

    .torx-status-opt.opt-review.selected .torx-status-name {
        color: #854d0e;
    }

.torx-status-opt.opt-approved.selected {
    background: #dbeafe;
    border-color: #93c5fd;
}

    .torx-status-opt.opt-approved.selected .torx-status-name {
        color: #1e40af;
    }

.torx-status-opt.opt-released.selected {
    background: #dcfce7;
    border-color: #86efac;
}

    .torx-status-opt.opt-released.selected .torx-status-name {
        color: #166534;
    }

/* ── Project Summary info fields ── */
.torx-info-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 16px;
}

.torx-info-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #9e9e9b;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.torx-info-value {
    font-size: 0.78rem;
    color: #1a1d23;
    font-family: 'DM Mono', monospace;
}

.torx-info-divider {
    height: 0.5px;
    background: rgba(0,0,0,0.07);
}

/* ══ DARK MODE — Project Edit ══ */
body.dark-mode .torx-safety-toggle {
    background: #22262F;
    border-color: rgba(255,255,255,0.1);
}

    body.dark-mode .torx-safety-toggle.active {
        background: rgba(239,68,68,0.1);
        border-color: rgba(239,68,68,0.4);
    }

body.dark-mode .torx-safety-title {
    color: #E0E0E0;
}

body.dark-mode .torx-safety-toggle.active .torx-safety-title {
    color: #fca5a5;
}

body.dark-mode .torx-safety-desc {
    color: #8A96A3;
}

body.dark-mode .torx-safety-indicator {
    background: rgba(255,255,255,0.15);
}

body.dark-mode .torx-status-opt {
    border-color: rgba(255,255,255,0.1);
}

    body.dark-mode .torx-status-opt:hover {
        background: #2C3140;
    }

body.dark-mode .torx-status-name {
    color: #8A96A3;
}

body.dark-mode .torx-info-value {
    color: #E0E0E0;
}

body.dark-mode .torx-info-label {
    color: #6A7484;
}

body.dark-mode .torx-info-divider {
    background: rgba(255,255,255,0.06);
}

/* ══════════════════════════════════════════════
   TORX UI/UX — PFMEA Items Edit
   ══════════════════════════════════════════════ */

/* ── Step header (collapsible) ── */
.torx-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 0.5px solid rgba(0,0,0,0.1);
    background: #ebebea;
    cursor: pointer;
    user-select: none;
    transition: background .12s;
}

    .torx-step-header:hover {
        background: #e2e2e0;
    }

.torx-step-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: #1a1d23;
}

.torx-step-desc {
    font-size: 0.72rem;
    color: #9e9e9b;
}

.torx-step-icon {
    font-size: 0.75rem;
    color: #9e9e9b;
    transition: transform .2s;
    flex-shrink: 0;
}

    .torx-step-icon.torx-collapsed {
        transform: rotate(-90deg);
    }

/* Step pills */
.torx-step-pill {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.04em;
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
}

.torx-pill-4 {
    background: #fffdf0;
    color: #d97706;
    border: 1px solid #fde68a;
}

.torx-pill-5 {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.torx-pill-6 {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.torx-pill-flags {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

/* Collapsible */
.torx-collapsible {
    overflow: hidden;
    transition: max-height .25s ease;
    max-height: 2000px;
}

    .torx-collapsible.torx-collapsed {
        max-height: 0;
    }

/* ── AP display badge ── */
.torx-ap-display {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.05em;
    background: #f0f2f5;
    color: #9e9e9b;
    border: 1px solid rgba(0,0,0,0.1);
}

.torx-ap-display-h {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.torx-ap-display-m {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.torx-ap-display-l {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

.torx-ap-hint {
    font-size: 0.65rem;
    color: #9e9e9b;
    text-align: center;
    margin-top: 3px;
    font-family: 'DM Mono', monospace;
}

/* ── Ref button (? circle) ── */
.torx-ref-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    background: #f0f2f5;
    color: #9e9e9b;
    font-size: 9px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
    font-family: inherit;
    padding: 0;
    vertical-align: middle;
}

    .torx-ref-btn:hover {
        border-color: #FF6B2B;
        color: #FF6B2B;
        background: rgba(255,107,43,0.07);
    }

/* ── Safety toggle (compact for PFMEA edit) ── */
.torx-safety-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1.5px solid rgba(0,0,0,0.12);
    cursor: pointer;
    transition: all .15s;
    user-select: none;
    background: #fff;
}

    .torx-safety-toggle.active {
        border-color: #fca5a5;
        background: #fff5f5;
    }

.torx-safety-check-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: #6b7280;
}

.torx-safety-toggle.active .torx-safety-check-text {
    color: #991b1b;
}

/* ── Color highlight circles ── */
.torx-color-opts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.torx-color-opt {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .15s;
}

    .torx-color-opt:hover {
        transform: scale(1.15);
    }

    .torx-color-opt.selected {
        border-width: 2px;
    }

/* ── Change comment section ── */
.torx-change-comment-section {
    background: #f4f4f2;
    border-top: 0.5px solid rgba(0,0,0,0.1);
    padding: 14px 16px;
}

.torx-change-comment-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.torx-optional-tag {
    font-size: 0.65rem;
    font-weight: 400;
    color: #9e9e9b;
    background: #ebebea;
    border: 0.5px solid rgba(0,0,0,0.12);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: none;
    letter-spacing: 0;
}

.torx-btn-hint {
    font-size: 0.68rem;
    color: #9e9e9b;
    margin-left: 4px;
}

/* ══ DARK MODE — PFMEA Edit ══ */
body.dark-mode .torx-step-header {
    background: #252932;
    border-color: rgba(255,255,255,0.08);
}

    body.dark-mode .torx-step-header:hover {
        background: #2C3140;
    }

body.dark-mode .torx-step-name {
    color: #E0E0E0;
}

body.dark-mode .torx-step-desc {
    color: #6A7484;
}

body.dark-mode .torx-step-icon {
    color: #6A7484;
}

body.dark-mode .torx-ap-display {
    background: #2C3140;
    color: #6A7484;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-ap-display-h {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.3);
}

body.dark-mode .torx-ap-display-m {
    background: rgba(245,158,11,0.15);
    color: #fcd34d;
    border-color: rgba(245,158,11,0.3);
}

body.dark-mode .torx-ap-display-l {
    background: rgba(16,185,129,0.15);
    color: #6ee7b7;
    border-color: rgba(16,185,129,0.3);
}

body.dark-mode .torx-change-comment-section {
    background: #1e2229;
    border-color: rgba(255,255,255,0.06);
}

body.dark-mode .torx-change-comment-label {
    color: #8A96A3;
}

body.dark-mode .torx-optional-tag {
    background: #2C3140;
    color: #6A7484;
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .torx-btn-hint {
    color: #6A7484;
}

body.dark-mode .torx-ref-btn {
    background: #2C3140;
    border-color: rgba(255,255,255,0.15);
    color: #6A7484;
}
