* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* ── COLOUR TOKENS ── */
        :root {
            --bg: #ffffff;
            --text-primary: #1a1a1a;
            --text-muted: #666;
            --section-bg: rgba(229, 240, 220, 0.82);
            --card-bg: rgb(214, 224, 238);
            --border-color: #e0e0e0;
            --checklist-bg: rgba(251, 233, 236, 0.82);
            --cl-thead-bg: #f4f7fc;
            --cl-border: #e0e8f5;
            --cl-row-bg: rgba(255,255,255,0.88);
            --cl-row-hover: #f8faff;
            --cl-td-border: #f0f3f8;
            --modal-bg: #ffffff;
            --upload-zone-bg: #f0f5ff;
            --upload-zone-border: #6684a8;
            --input-bg: #ffffff;
            --input-border: #ddd;
            --file-name-bg: #e8f1ff;
        }
        body.dark {
            --bg: #13142a;
            --text-primary: #dde0f5;
            --text-muted: #ffffff;
            --section-bg: #1c1f3e;
            --card-bg: #22264a;
            --border-color: #36386a;
            --checklist-bg: rgba(32, 32, 66, 0.95);
            --cl-thead-bg: #171a38;
            --cl-border: #2e3160;
            --cl-row-bg: #20244e;
            --cl-row-hover: #20244e;
            --cl-td-border: #252855;
            --modal-bg: #1c1f3e;
            --upload-zone-bg: #171a38;
            --upload-zone-border: #1e3146;
            --input-bg: #171a38;
            --input-border: #36386a;
            --file-name-bg: #18204e;
        }

        body {
            font-family: 'Lexend', sans-serif;
            background: var(--bg);
            color: var(--text-primary);
            line-height: 1.6;
            margin : 0;
            padding: 0;
        }

        header {
            background: linear-gradient(135deg, #9bb3ef 0%, #fbbfc8 100%);
            color: white;
            padding: 24px 32px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            top: 40px;
            position: relative;
            z-index: 1;
        }

        header h1 {
            font-size: 28px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        header p {
            font-size: 14px;
            opacity: 0.9;
        }

        .container {
            max-width: 1600px;
            margin: 0 auto;
            padding: 24px;
            position: relative;
            z-index: 1;
        }

        .top-bar {
            display: flex;
            gap: 12px;
            margin-bottom: 24px;
            justify-content: space-between;
            flex-wrap: wrap;
        }

        .button-group {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }

        button {
            padding: 10px 16px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-primary {
            background: #739bd5;
            color: white;
        }

        .btn-primary:hover {
            background: #374963;
            box-shadow: 0 4px 12px rgba(0, 82, 204, 0.3);
        }

        /* Process Files / Extract action buttons — pastel, matching the tool cards */
        #uploadBtn {
            background: linear-gradient(135deg, #c5d8f8 0%, #d8c5f8 100%);
            color: #3a3a7a;
        }
        #uploadBtn:hover:not(:disabled) {
            background: linear-gradient(135deg, #b6ccf6 0%, #ccb6f6 100%);
            box-shadow: 0 4px 12px rgba(120, 130, 200, 0.3);
        }
        #uploadBtn:disabled { opacity: 0.55; cursor: not-allowed; }
        body.dark #uploadBtn {
            background: linear-gradient(135deg, #233f69 0%, #421e63 100%);
            color: #fff;
        }
        body.dark #uploadBtn:hover:not(:disabled) {
            background: linear-gradient(135deg, #2b4d80 0%, #512676 100%);
        }

        .btn-secondary {
            color: #0a0c0f;
        }

        .btn-secondary:hover {
            background: #f0f5ff;
        }

        .btn-tool {
            background: linear-gradient(135deg, #233f69 0%, #421e63 100%);
            color: white;
            border: none;
            font-size: 12px;
        }

        .btn-tool:hover {
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .grid-2col {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 24px;
            margin-bottom: 24px;
        }

        .grid-1-2col {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 24px;
            margin-bottom: 24px;
            align-items: start;
        }

        .right-agents {
            display: grid;
            grid-template-columns: 1fr;
            gap: 24px;
        }

        @media (max-width: 1200px) {
            .grid-2col,
            .grid-1-2col {
                grid-template-columns: 1fr;
            }

            .right-agents {
                grid-template-columns: 1fr;
            }
        }

        .section {
            background: var(--section-bg);
            border-radius: 8px;
            padding: 24px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        }

        .section-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 16px;
            color: #1a1a1a;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .section-title span {
            font-size: 20px;
        }

        .upload-zone {
            border: 2px dashed var(--upload-zone-border);
            border-radius: 8px;
            padding: 32px;
            text-align: center;
            background: var(--upload-zone-bg);
            cursor: pointer;
            transition: all 0.2s;
            margin-bottom: 16px;
        }
        body.dark header {
            background: linear-gradient(135deg, #233f69 0%, #421e63 100%);
        }
        .upload-zone:hover {
            background: #dde8ff;
            border-color: #5f87c3;
        }
        body.dark .upload-zone:hover {
            background: #333660;
            border-color: #6688cc;
        }

        .upload-icon {
            font-size: 40px;
            margin-bottom: 12px;
        }

        .upload-text {
            font-weight: 500;
            margin-bottom: 8px;
        }

        .upload-subtext {
            font-size: 13px;
            color: #666;
        }

        .file-name {
            background: var(--file-name-bg);
            color: #547dbb;
            padding: 8px 12px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 600;
            margin-top: 8px;
            display: inline-block;
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-group label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 6px;
            color: #333;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid var(--input-border);
            border-radius: 4px;
            font-size: 14px;
            font-family: inherit;
            background: var(--input-bg);
            color: var(--text-primary);
        }

        .form-group textarea {
            resize: vertical;
            min-height: 80px;
        }

        .form-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
        }

        .metric-card {
            background: linear-gradient(135deg, #e18692 0%, #a43040 100%);
            color: white;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 16px;
        }

        .metric-card.warning {
            background: linear-gradient(135deg, #f5a623 0%, #e67e22 100%);
        }

        .metric-card.success {
            background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
        }

        .metric-label {
            font-size: 12px;
            opacity: 0.9;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 8px;
            font-weight: 600;
        }

        .metric-value {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 4px;
        }

        .metric-subtext {
            font-size: 13px;
            opacity: 0.85;
        }

        .checklist-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 16px;
        }

        .tag {
            background: #e8f1ff;
            color: #0052cc;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            border: 1px solid #0052cc;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .tag.ts {
            background: #fff3e0;
            color: #e65100;
            border-color: #e65100;
        }

        .tag.highlight {
            background: #fff9c4;
            color: #f57f17;
            border-color: #f57f17;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        .deliverables-grid {
            display: grid;
            gap: 12px;
            margin-top: 16px;
        }

        .deliverable-item {
            background: #f9f9f9;
            border-left: 4px solid #0052cc;
            padding: 12px;
            border-radius: 4px;
            display: grid;
            grid-template-columns: 1fr 60px;
            gap: 12px;
            align-items: center;
        }

        .deliverable-item.process {
            border-left-color: #0052cc;
        }

        .deliverable-item.techsafe {
            border-left-color: #e65100;
        }

        .deliverable-name {
            font-weight: 500;
            font-size: 13px;
        }

        .deliverable-effort {
            background: #0052cc;
            color: white;
            padding: 6px 12px;
            border-radius: 4px;
            text-align: center;
            font-weight: 600;
            font-size: 12px;
        }

        .deliverable-item.techsafe .deliverable-effort {
            background: #e65100;
        }

        .effort-summary {
            background: #f0f5ff;
            border: 1px solid #0052cc;
            border-radius: 6px;
            padding: 16px;
            margin-top: 16px;
        }

        .effort-title {
            font-weight: 600;
            color: #0052cc;
            margin-bottom: 8px;
        }

        .effort-row {
            display: flex;
            justify-content: space-between;
            padding: 6px 0;
            font-size: 13px;
            border-bottom: 1px solid #e0e0e0;
        }

        .effort-row:last-child {
            border-bottom: none;
        }

        .effort-row.total {
            font-weight: 600;
            color: #0052cc;
            padding-top: 12px;
            border-top: 2px solid #0052cc;
            margin-top: 8px;
        }

        .timeline-section {
            background: #e8f1ff;
            padding: 16px;
            border-radius: 6px;
            margin-top: 16px;
        }

        .timeline-title {
            font-weight: 600;
            color: #0052cc;
            margin-bottom: 12px;
            font-size: 13px;
        }

        .timeline-weeks {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
        }

        .timeline-week {
            background: white;
            padding: 12px;
            border-radius: 4px;
            text-align: center;
            font-size: 12px;
            border: 1px solid #0052cc;
        }

        .timeline-week.active {
            background: #0052cc;
            color: white;
            font-weight: 600;
        }

        .missed-scope-section {
            background: #fff3e0;
            border: 1px solid #f5a623;
            border-radius: 6px;
            padding: 16px;
            margin-top: 16px;
        }

        .missed-scope-title {
            font-weight: 600;
            color: #e65100;
            margin-bottom: 12px;
            font-size: 13px;
        }

        .missed-scope-item {
            background: white;
            padding: 10px;
            border-radius: 4px;
            margin-bottom: 8px;
            border-left: 3px solid #f5a623;
            font-size: 12px;
        }

        .missed-scope-item:last-child {
            margin-bottom: 0;
        }

        /* All tools fit on one page width as a wrapping grid (no horizontal
           scroll). 7-8 cards in 4 columns => 2 rows. */
        .tools-navigation {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            overflow: visible;
            padding-bottom: 10px;
        }
        @media (max-width: 1000px) { .tools-navigation { grid-template-columns: repeat(3, 1fr); } }
        @media (max-width: 680px)  { .tools-navigation { grid-template-columns: repeat(2, 1fr); } }
        .tools-wrapper { display: block; }

        .tool-card {
            position: relative;
            display: flex;
            flex-direction: column;

            background: var(--card-bg);
            border-radius: 12px;
            padding: 20px;

            box-shadow: 0 2px 6px rgba(0,0,0,.1);
        }

        .tool-card:hover {
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
            transform: translateY(-2px);
        }

        /* "Coming soon" — not-yet-live tools/sections: muted, badged, inert */
        .coming-soon-badge {
            display: inline-block; background: #eef2f7; color: #7b8794;
            font-size: 10px; font-weight: 700; letter-spacing: .04em;
            text-transform: uppercase; padding: 4px 9px; border-radius: 20px;
            vertical-align: middle; margin-left: 8px;
        }
        .tool-card .coming-soon-badge { position: absolute; top: 14px; right: 14px; margin-left: 0; }
        .tool-card.coming-soon { opacity: .68; }
        .tool-card.coming-soon:hover { transform: none; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
        .tool-card.coming-soon button,
        .checklist-section.coming-soon .btn-add-task {
            background: #e8ebf0; color: #9aa6b5; cursor: not-allowed;
        }
        .tool-card.coming-soon button:hover { transform: none; box-shadow: none; }
        .checklist-section.coming-soon { opacity: .68; }
        body.dark .coming-soon-badge { background: #2a3340; color: #9aa6b5; }
        body.dark .tool-card.coming-soon button,
        body.dark .checklist-section.coming-soon .btn-add-task { background: #2a3340; color: #7b8794; }

        .tool-card h3 {
            color: #667eea;
            font-size: 16px;
            margin-bottom: 8px;
            font-weight: 600;
        }

        .tool-card p {
            font-size: 13px;
            color: #666;
            margin-bottom: 12px;
            line-height: 1.5;
        }

        .tool-card button {
            width: 100%;
            background: #fff3ce;
            color: #3a3a7a;
            border: none;
            border-radius: 4px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            margin-top: auto;
        }

        .tool-card button:hover {
            box-shadow: 0 4px 12px rgba(180, 160, 240, 0.4);
            transform: scale(1.02);
            filter: brightness(0.95);
        }

        .icon {
            font-size: 28px;
            margin-bottom: 8px;
        }

        .status-indicator {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: #4caf50;
            margin-right: 6px;
            vertical-align: middle;
        }

        .status-indicator.warning {
            background: #f5a623;
        }

        .toast {
            position: fixed;
            bottom: 24px;
            right: 24px;
            background: #4caf50;
            color: white;
            padding: 12px 20px;
            border-radius: 6px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            z-index: 1000;
            animation: slideup 0.3s ease-out;
        }

        @keyframes slideup {
            from { transform: translateY(100px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        /* ─── TASK CHECKLIST SECTION ─────────────────────────────── */
        .checklist-section {
            position: relative;
            background: var(--checklist-bg);
            backdrop-filter: blur(2px);
            border-radius: 16px;
            padding: 28px;
            box-shadow: 0 2px 12px rgba(0,0,0,0.08);
            margin-bottom: 32px;
            z-index: 1;
        }

        /* ── PAGE-LEVEL BACKGROUND SHAPES ── */
        .bg-shape {
            position: fixed;
            border-radius: 50%;
            opacity: 0.13;
            pointer-events: none;
            z-index: 0;
        }
        .bg-shape--1 { width: 420px; height: 420px; background: #667eea; top: -120px; left: -100px; }
        .bg-shape--2 { width: 280px; height: 280px; background: #f5a623; top: 30px;  right: 80px;  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
        .bg-shape--3 { width: 200px; height: 200px; background: #4caf50; top: 50%;   left: 5%;    transform: translateY(-50%); }
        .bg-shape--4 { width: 320px; height: 320px; background: #e21836; bottom: -100px; right: -80px; border-radius: 30% 70% 50% 50% / 60% 40% 60% 40%; }
        .bg-shape--5 { width: 160px; height: 160px; background: #00bcd4; bottom: 15%; left: 40%; border-radius: 60% 40% 50% 50%; }
        .bg-shape--6 { width: 110px; height: 110px; background: #ab47bc; top: 35%;   left: 60%;  border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%; }
        .bg-shape--7 { width: 240px; height: 240px; background: #0052cc; bottom: 30%; left: -60px; border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%; }
        .bg-shape--8 { width: 140px; height: 140px; background: #ff7043; top: 60%;   right: 25%; border-radius: 30% 70% 60% 40% / 50% 40% 60% 50%; }

        .checklist-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            position: relative;
            z-index: 1;
        }
        .checklist-title-row {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .checklist-main-title {
            font-size: 18px;
            font-weight: 700;
            color: #1a1a1a;
        }
        .checklist-sub {
            font-size: 13px;
            color: #666;
        }
        .btn-add-task {
            background:  #fff3ce;
            color: #3a3a7a;
            border: none;
            border-radius: 8px;
            padding: 10px 18px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        .btn-add-task:hover {
            box-shadow: 0 4px 12px rgba(180, 160, 240, 0.4);
            transform: translateY(-1px);
            filter: brightness(0.95);
        }
        body.dark .btn-add-task {
            background: linear-gradient(135deg, #233f69 0%, #421e63 100%);
            color: white;
            filter: none;
        }

        /* table */
        .cl-table {
            position: relative;
            z-index: 1;
            width: 100%;
            border-radius: 10px;
            overflow: hidden;
            border: 1px solid #e8edf5;
        }
        .cl-thead {
            display: flex;
            background: var(--cl-thead-bg);
            padding: 12px 16px;
            border-bottom: 2px solid var(--cl-border);
        }
        .cl-th {
            font-size: 12px;
            font-weight: 700;
            color: #555;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .cl-row {
            display: flex;
            align-items: center;
            padding: 14px 16px;
            border-bottom: 1px solid var(--cl-td-border);
            background: var(--cl-row-bg);
            transition: background 0.15s;
        }
        .cl-row:last-child { border-bottom: none; }
        .cl-row:hover { background: var(--cl-row-hover); }
        .cl-td {
            font-size: 14px;
            padding-right: 12px;
        }

        /* progress bar */
        .progress-track {
            flex: 1;
            height: 8px;
            background: #e8edf5;
            border-radius: 99px;
            overflow: hidden;
        }
        .progress-fill {
            height: 100%;
            border-radius: 99px;
            transition: width 0.4s ease;
        }

        /* status pill */
        .status-pill {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            white-space: nowrap;
        }

        /* action buttons */
        .cl-action-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
            padding: 4px 6px;
            border-radius: 6px;
            transition: background 0.15s;
        }
        .cl-action-btn:hover { background: #f0f3f8; }

        /* modal */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.45);
            z-index: 2000;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .modal-box {
            background: var(--modal-bg);
            border-radius: 14px;
            padding: 28px;
            width: 480px;
            max-width: 95vw;
            box-shadow: 0 8px 40px rgba(0,0,0,0.18);
        }
        .modal-title {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 20px;
            color: #1a1a1a;
        }

        /* ─── END CHECKLIST SECTION ──────────────────────────────── */

        .footer {
            text-align: center;
            font-size: 11px;
            color: #999;
            padding: 24px;
            margin-top: 48px;
            border-top: 1px solid #e0e0e0;
        }

        .standardized-output {
            background: #f5f5f5;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 12px;
            margin-top: 12px;
            font-family: monospace;
            font-size: 11px;
            max-height: 200px;
            overflow-y: auto;
        }

        .status-badge {
            display: inline-block;
            background: #e8f1ff;
            color: #0052cc;
            padding: 4px 8px;
            border-radius: 3px;
            font-size: 11px;
            font-weight: 600;
        }

        .status-badge.alert {
            background: #fff3e0;
            color: #e65100;
        }

        .agent-card {
            background: linear-gradient(135deg, #233f69 0%, #421e63 100%);
            color: white;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 12px;
        }

        .agent-card h4 {
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 6px;
        }

        .agent-card p {
            font-size: 12px;
            line-height: 1.5;
            opacity: 0.95;
            margin-bottom: 10px;
        }

        .agent-features {
            list-style: none;
            margin-left: 0;
            font-size: 11px;
            margin-bottom: 10px;
        }

        .agent-features li {
            padding: 3px 0;
            padding-left: 18px;
            position: relative;
            line-height: 1.4;
        }

        .agent-features li:before {
            content: "✓";
            position: absolute;
            left: 0;
            font-weight: bold;
            opacity: 0.9;
            font-size: 11px;
        }

        .agent-button {
            background: white;
            color: #667eea;
            padding: 8px 14px;
            border-radius: 4px;
            font-weight: 600;
            font-size: 11px;
            border: none;
            cursor: pointer;
            transition: all 0.2s;
            width: 100%;
        }

        .agent-button:hover {
            transform: scale(1.02);
            box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
        }

        .agent-section-wrapper {
            background: white;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
            display: flex;
            flex-direction: column;
        }

        .agent-section-wrapper .section-title {
            margin-bottom: 12px;
        }

        .agent-output {
            background: #f9f9f9;
            padding: 12px;
            border-radius: 6px;
            margin-top: 12px;
            font-size: 11px;
            line-height: 1.5;
        }

        .agent-output p {
            margin-bottom: 6px;
        }

        .agent-output p:last-child {
            margin-bottom: 0;
        }

        /* ── SHARED BADGE STYLES ── */
        .status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
        .badge-running { background: #dbeafe; color: #1d4ed8; }
        .badge-done    { background: #e8f5e9; color: #2e7d32; }
        .badge-error   { background: #fdecea; color: #c62828; }
        .badge-nopid   { background: #f3e8ff; color: #7c3aed; }
        .uploaded-file-name { font-weight: 600; color: #0052cc; }
        .uploaded-file-size { color: #666; margin-left: auto; }

        /* ── MOC PAGE ── */
        .progress-bar-wrap { background: #e0e0e0; border-radius: 6px; height: 8px; margin-top: 8px; overflow: hidden; }
        .progress-bar-fill { height: 100%; background: linear-gradient(90deg, #4d78a9, #d96979); border-radius: 6px; width: 0%; transition: width 0.4s ease; animation: pulsebar 1.5s infinite ease-in-out; }
        @keyframes pulsebar { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
        .progress-bar-fill.done { animation: none; width: 100%; background: #4caf50; }
        .ext-table { width: 100%; border-collapse: collapse; font-size: 13px; }
        .ext-table th { background: #9fa1bd; color: #fff; padding: 8px 10px; text-align: left; font-weight: 600; font-size: 12px; }
        .ext-table td { padding: 7px 10px; border-bottom: 1px solid #eee; }
        .ext-table tr:hover td { background: #f0f5ff; }
        .ext-table .no-data td { text-align: center; color: #999; font-style: italic; padding: 24px; }
        .markup-card { border: 1px solid #ddd; border-radius: 8px; padding: 12px; margin-bottom: 12px; background: #fff; }
        .markup-card img { width: 100%; border-radius: 4px; display: block; border: 1px solid #eee; }
        .markup-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
        .markup-text-box { background: #f7f7f7; border: 1px solid #ddd; border-radius: 4px; padding: 8px 10px; font-size: 12px; white-space: pre-wrap; margin-top: 8px; max-height: 80px; overflow-y: auto; color: #444; }
        .markup-label { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; color: #555; letter-spacing: 0.5px; }
        .markup-file-label { font-size: 11px; color: #888; margin-left: auto; }
        .color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
        .dot-red    { background: #e53935; }
        .dot-blue   { background: #1e88e5; }
        .dot-yellow { background: #f9a825; }
        .dot-cyan   { background: #00acc1; }
        .pid-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
        .pid-tab { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid #4d78a9; color: #4d78a9; background: #fff; transition: all 0.2s; }
        .pid-tab.active { background: #4d78a9; color: #fff; }
        .pid-tab:hover { background: #dde8ff; }
        .empty-state { text-align: center; padding: 40px 20px; color: #999; }
        .empty-state .icon { font-size: 40px; margin-bottom: 8px; }
        #pdfViewer { height: 440px; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; background: #f7f7f7; }
        #markupContainer { height: 440px; overflow-y: auto; }

        /* ── PSV PAGE ── */
        .psv-table { width: 100%; border-collapse: collapse; font-size: 12px; }
        .psv-table th, .psv-table td { padding: 8px 10px; border: 1px solid #dde3f0; text-align: left; vertical-align: top; }
        .psv-table th { background: #c1d7eb; color: #131316; font-weight: 600; white-space: nowrap; }
        .psv-table tr:nth-child(even) td { background: #f4f7ff; }
        .psv-table tr:hover td { background: #dde8ff; }
        .psv-table td.bad  { background: #fee2e2 !important; }
        .psv-table td.warn { background: #fff7e0 !important; }
        .tag-cell { font-weight: 700; color: #0052cc; }
        #progressWrap { display: none; margin: 16px 0; }
        #progressBar  { background: #e8ecf5; border-radius: 20px; height: 10px; overflow: hidden; }
        #progressFill { height: 100%; width: 0%; background: linear-gradient(90deg, #0052cc, #4a90e2); border-radius: 20px; transition: width 0.3s; }
        #progressFill.done { background: #22c55e; }

        /* ── LAYOUT UTILITIES ── */
        .back-link { text-decoration: none; display: inline-block; margin-bottom: 20px; }
        .section-heading { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
        .tools-section { margin-bottom: 20px; }
        .subsection-title { font-size: 15px; font-weight: 600; }
        .flex-between { display: flex; justify-content: space-between; align-items: center; }
        .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
        .btn-cancel { background: #eee; color: #333; padding: 10px 20px; border-radius: 6px; }
        body.dark .btn-cancel { background: #2a2d55; color: #ccc; }
        .progress-val { font-size: 13px; color: #0052cc; font-weight: 600; }
        #taskModal { display: none; }

        /* Checklist column layout */
        .cl-col-title    { flex: 2; font-weight: 600; }
        .cl-col-desc     { flex: 3; font-size: 13px; }
        .cl-col-due      { flex: 1.5; font-size: 13px; }
        .cl-col-progress { flex: 2; }
        .cl-col-status   { flex: 1.2; }
        .cl-col-actions  { flex: 0.8; display: flex; gap: 8px; justify-content: center; }
        .progress-cell-inner { display: flex; align-items: center; gap: 8px; }
        .progress-pct { font-size: 12px; font-weight: 600; min-width: 32px; }
        .due-overdue { color: #c62828; font-weight: 600; }

        /* ── DARK MODE TOGGLE ── */
        .dark-toggle {
            position: absolute;
            right: 32px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            align-items: center;
            gap: 8px;
            z-index: 2;
        }
        .dark-toggle-label { font-size: 16px; line-height: 1; }
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 46px;
            height: 24px;
        }
        .toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
        .toggle-slider {
            position: absolute;
            cursor: pointer;
            inset: 0;
            background: rgba(255,255,255,0.28);
            border-radius: 24px;
            transition: background 0.3s;
            border: 1px solid rgba(255,255,255,0.4);
        }
        .toggle-slider:before {
            content: "";
            position: absolute;
            height: 18px;
            width: 18px;
            left: 2px;
            bottom: 2px;
            background: white;
            border-radius: 50%;
            transition: transform 0.3s;
            box-shadow: 0 1px 4px rgba(0,0,0,0.25);
        }
        .toggle-switch input:checked + .toggle-slider { background: rgba(255,255,255,0.52); }
        .toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

        /* ── DARK MODE BROAD OVERRIDES ── */
        body.dark { background: var(--bg); color: var(--text-primary); }
        body.dark .tool-card button {
            background: linear-gradient(135deg, #233f69 0%, #421e63 100%);
            color: white;
            filter: none;
        }
        body.dark h2 { color: var(--text-primary) !important; }
        body.dark h3 { color: var(--text-primary); }
        body.dark .checklist-main-title { color: var(--text-primary); }
        body.dark .checklist-sub { color: var(--text-muted); }
        body.dark .upload-subtext { color: var(--text-muted); }
        body.dark .tool-card p { color: var(--text-muted); }
        body.dark .cl-th { color: #9090b0; }
        /* inline styles in mainweb.js use hardcoded colors — override with !important */
        body.dark .cl-row .cl-td { color: var(--text-primary) !important; }
        body.dark .cl-table { border-color: var(--border-color); }
        body.dark .modal-title { color: var(--text-primary); }
        body.dark .form-group label { color: #aaaacc; }
        body.dark .footer { border-color: var(--border-color); color: #666688; }
        body.dark .btn-secondary { color: #aaaadd; background: rgba(255,255,255,0.06); }
        body.dark .btn-secondary:hover { background: rgba(255,255,255,0.12); }
        body.dark .cl-action-btn:hover { background: rgba(255,255,255,0.1); }
        body.dark .agent-section-wrapper { background: var(--section-bg); }
        body.dark .standardized-output { background: var(--input-bg); border-color: var(--border-color); color: #bbbbd0; }
        /* uploaded-file chips on MOC/PSV */
        body.dark .uploaded-file { background: var(--file-name-bg); color: var(--text-primary); }
        /* MOC: ext-table */
        body.dark .ext-table th { background: #2a2e58; color: #dde0f5; }
        body.dark .ext-table td { border-bottom-color: var(--cl-td-border); background: var(--cl-row-bg); color: var(--text-primary); }
        body.dark .ext-table tr:hover td { background: var(--cl-row-hover); }
        /* MOC: P&ID viewer + markup container */
        body.dark #pdfViewer { background: var(--input-bg); border-color: var(--border-color); }
        /* MOC: markup cards */
        body.dark .markup-card { background: var(--section-bg); border-color: var(--border-color); }
        body.dark .markup-text-box { background: var(--input-bg); border-color: var(--border-color); color: #bbbbd0; }
        /* MOC: P&ID tabs */
        body.dark .pid-tab { background: var(--input-bg); border-color: #4d78a9; color: #88aadd; }
        body.dark .pid-tab.active { background: #4d78a9; color: #fff; }
        body.dark .pid-tab:hover:not(.active) { background: var(--cl-row-hover); }
        /* MOC/PSV: progress bars */
        body.dark .progress-bar-wrap { background: #252855; }
        body.dark #progressBar { background: #252855; }
        /* PSV: table */
        body.dark .psv-table th { background: #2a2e58; color: #dde0f5; border-color: var(--cl-td-border); }
        body.dark .psv-table td { border-color: var(--cl-td-border); color: var(--text-primary); }
        body.dark .psv-table tr:nth-child(even) td { background: #1e2145; }
        body.dark .psv-table tr:hover td { background: var(--cl-row-hover); }
        body.dark .psv-table td.bad { background: #3d1a1a !important; }
        body.dark .psv-table td.warn { background: #2e2610 !important; }
        body.dark .tag-cell { color: #7aa8ff; }
        /* section-title text in dark */
        body.dark .section-title { color: var(--text-primary); }

        /* ── SHARED HELPERS (used by iPRSM, safe for MOC/PSV) ── */
        .mono { font-family: "JetBrains Mono","IBM Plex Mono",ui-monospace,Menlo,monospace; }
        .progress-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
        .uploaded-file {
            display: flex; align-items: center; gap: 8px;
            background: var(--file-name-bg); color: var(--text-primary);
            border-radius: 6px; padding: 8px 12px; margin-top: 6px; font-size: 13px;
        }
        .upload-zone.drag-over { background: #dde8ff; border-color: #5f87c3; }
        body.dark .upload-zone.drag-over { background: #333660; border-color: #6688cc; }

        /* ── iPRSM PAGE ── */
        .iprsm-intro { color: var(--text-muted); font-size: 14px; margin-top: 6px; line-height: 1.6; }
        .iprsm-error { border: 1px solid #f0c850; background: #fff8e1; }
        body.dark .iprsm-error { border-color: #6b5418; background: #2c2410; }
        .iprsm-error p { color: var(--text-primary); }

        .flag-legend { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; font-weight: 600; }
        .flag-amber { background: #fff3cd; color: #8a6d1b; }
        .flag-pink  { background: #fde8ec; color: #b23a52; }
        body.dark .flag-amber { background: #3a3115; color: #e3c879; }
        body.dark .flag-pink  { background: #3a1d24; color: #f0a9b8; }

        /* valve card */
        .iprsm-card {
            background: var(--section-bg); border: 1px solid var(--border-color);
            border-radius: 10px; padding: 18px 20px; margin-bottom: 18px;
        }
        .iprsm-card-head {
            display: flex; align-items: center; justify-content: space-between;
            gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
            padding-bottom: 12px; border-bottom: 1px solid var(--border-color);
        }
        .iprsm-card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
        .iprsm-tag { font-size: 17px; font-weight: 700; color: var(--text-primary); }
        .iprsm-source { font-size: 12px; color: var(--text-muted); }
        .badge-phase { background: #e8f1ff; color: #0052cc; }
        body.dark .badge-phase { background: #1d2b50; color: #7aa8ff; }
        .iprsm-dl-one {
            border: 1px solid var(--input-border); border-radius: 6px;
            padding: 7px 12px; font-size: 12px; white-space: nowrap; max-width: 320px;
            overflow: hidden; text-overflow: ellipsis;
        }

        .iprsm-section { margin-top: 14px; }
        .iprsm-section-name {
            font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
            text-transform: uppercase; color: var(--text-muted);
            margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px dashed var(--border-color);
        }
        .iprsm-field-grid {
            display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 10px 16px;
        }
        .iprsm-field { display: flex; flex-direction: column; gap: 3px; }
        .iprsm-field-label { font-size: 12px; color: var(--text-muted); }
        .iprsm-field-control { display: flex; align-items: center; gap: 6px; }
        .iprsm-field-input {
            flex: 1; min-width: 0; padding: 7px 9px; font-size: 13px;
            border: 1px solid var(--input-border); border-radius: 6px;
            background: var(--input-bg); color: var(--text-primary);
        }
        .iprsm-field-input:focus { outline: none; border-color: #5f87c3; }
        .iprsm-unit { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

        /* flag states colour the input */
        .iprsm-field.field-flagged .iprsm-field-input { background: #fff8e1; border-color: #f0c850; }
        .iprsm-field.field-empty   .iprsm-field-input { background: #fde8ec; border-color: #f3a9b8; }
        body.dark .iprsm-field.field-flagged .iprsm-field-input { background: #2c2410; border-color: #6b5418; }
        body.dark .iprsm-field.field-empty   .iprsm-field-input { background: #2c1620; border-color: #5e2c39; }
        .iprsm-flag-mark { color: #e6890a; font-size: 11px; }
        body.dark .iprsm-flag-mark { color: #e3b057; }

        /* editable tag / plant / phase row + filename preview */
        .iprsm-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
        .iprsm-meta select.iprsm-field-input { cursor: pointer; }
        .iprsm-fname-row { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
        .iprsm-fname { color: #16a34a; font-weight: 600; }
        body.dark .iprsm-fname { color: #4ade80; }
        .iprsm-include {
            display: inline-flex; align-items: center; gap: 6px;
            font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none;
        }
        .iprsm-include input { cursor: pointer; }
        .iprsm-card.excluded { opacity: 0.55; }

/* ── P&ID PAGE COUNT CHART SECTION ── */
        .pid-stat-section { margin-top: 32px; }
        .pid-stat-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
        .pid-stat-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
            gap: 14px;
            margin-bottom: 22px;
        }
        .pid-stat-card {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 16px 18px;
            box-shadow: 0 2px 6px rgba(0,0,0,.08);
        }
        .pid-stat-card h4 { font-size: 14px; font-weight: 600; color: #667eea; margin-bottom: 10px; }
        body.dark .pid-stat-card h4 { color: #9bb3ef; }
        .pid-stat-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--text-primary); }
        .pid-stat-row b { font-weight: 700; }
        .pid-chart-wrap { position: relative; height: 380px; }
        .pid-legend-note { font-size: 12px; color: var(--text-muted); margin-top: 14px; }
        .pid-legend-note .pid-flag { color: #e67e22; font-weight: 600; }
        .pid-table { width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--cl-border); border-collapse: collapse; }
        .pid-table thead { background: var(--cl-thead-bg); }
        .pid-table th {
            font-size: 12px; font-weight: 700; color: var(--axis-text);
            text-transform: uppercase; letter-spacing: 0.5px;
            padding: 12px 16px; text-align: left;
            border-bottom: 2px solid var(--cl-border);
        }
        .pid-table td {
            font-size: 14px; padding: 12px 16px;
            border-bottom: 1px solid var(--cl-td-border);
            background: var(--cl-row-bg);
            color: var(--text-primary);
        }
        .pid-table tbody tr:last-child td { border-bottom: none; }
        .pid-table tbody tr:hover td { background: var(--cl-row-hover); }
        .pid-table td.pid-num { text-align: center; }
        .pid-pill {
            display: inline-block; padding: 2px 9px; border-radius: 20px;
            font-size: 11px; font-weight: 600; background: #fff3ce; color: #3a3a7a;
        }
        body.dark .pid-pill { background: linear-gradient(135deg, #233f69 0%, #421e63 100%); color: #fff; }

        /* ── TECHNICAL BID EVALUATION ── */
        .hidden { display: none !important; }
        .tbe-intro { color: var(--text-muted); font-size: 14px; margin-top: 6px; line-height: 1.6; }
        .tbe-sub { color: var(--text-muted); font-size: 13px; margin: -8px 0 14px; }
        .tbe-lg-dev     { background: #fce3e1; color: #b91c1c; }
        .tbe-lg-advised { background: #fff7e0; color: #8a6d00; }
        .tbe-lg-match   { background: #e7f4e9; color: #15803d; }
        body.dark .tbe-lg-dev     { background: #3a1d1d; color: #f0a9a0; }
        body.dark .tbe-lg-advised { background: #3a3115; color: #e3c879; }
        body.dark .tbe-lg-match   { background: #173a23; color: #7dd39b; }

        /* required-datasheet chips + status */
        .tbe-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
        .tbe-chip {
            display: inline-block; background: var(--file-name-bg); color: var(--text-primary);
            border: 1px solid var(--cl-border); border-radius: 6px; padding: 3px 9px; font-size: 12px;
        }
        .tbe-chip-sub { color: var(--text-muted); }
        .tbe-req-status { font-size: 13px; color: #15803d; margin-top: 8px; }
        body.dark .tbe-req-status { color: #7dd39b; }

        /* tables (vendor detection + per-tag comparison) */
        .tbe-table-wrap { overflow-x: auto; border-radius: 8px; }
        .tbe-table { width: 100%; border-collapse: collapse; font-size: 13px; }
        .tbe-table th {
            background: #2a2e58; color: #dde0f5; padding: 8px 10px; text-align: left;
            font-weight: 600; font-size: 12px; white-space: nowrap;
        }
        body:not(.dark) .tbe-table th { background: #9fa1bd; color: #fff; }
        .tbe-table td {
            padding: 7px 10px; border-bottom: 1px solid var(--cl-td-border);
            background: var(--cl-row-bg); color: var(--text-primary); vertical-align: top;
        }
        .tbe-table tbody tr:hover td { background: var(--cl-row-hover); }
        .tbe-file { font-size: 12px; }
        .tbe-signal { font-size: 11.5px; color: var(--text-muted); }
        .tbe-field { font-weight: 500; }
        .tbe-required { color: #33507a; text-align: center; white-space: nowrap; }
        body.dark .tbe-required { color: #8aa6d8; }
        .tbe-review td { background: #fff7e0; }
        body.dark .tbe-review td { background: #2c2410; }
        .tbe-vassign {
            width: 150px; padding: 4px 6px; border: 1px solid var(--input-border);
            border-radius: 4px; font-size: 12.5px; font-family: inherit;
            background: var(--input-bg); color: var(--text-primary);
        }
        .tbe-vassign-warn { border-color: #f5a623; }

        /* confidence badge */
        .tbe-conf { font-size: 11px; font-weight: 600; }
        .tbe-conf-high   { color: #15803d; }
        .tbe-conf-medium { color: #8a6d00; }
        .tbe-conf-low    { color: #b45309; }
        .tbe-conf-none   { color: var(--text-muted); }
        body.dark .tbe-conf-high { color: #7dd39b; }

        /* flag-coloured comparison cells */
        .tbe-cell { white-space: nowrap; }
        .tbe-flag-deviation, .tbe-flag-low { background: #fce3e1; color: #b91c1c; }
        .tbe-flag-advised  { background: #fff7e0; color: #8a6d00; }
        .tbe-flag-match    { background: #e7f4e9; color: #15803d; }
        .tbe-flag-missing  { background: #f4f5f7; color: #9aa6b5; }
        body.dark .tbe-flag-deviation, body.dark .tbe-flag-low { background: #3a1d1d; color: #f0a9a0; }
        body.dark .tbe-flag-advised  { background: #3a3115; color: #e3c879; }
        body.dark .tbe-flag-match    { background: #173a23; color: #7dd39b; }
        body.dark .tbe-flag-missing  { background: #20243f; color: #8890b5; }

        /* download button (green) + progress */
        .tbe-dl-btn { background: #16a34a !important; color: #fff !important; }
        .tbe-dl-btn:hover { background: #138a3e !important; }
        .tbe-prog { margin-top: 14px; }

        /* summary metric cards */
        .tbe-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
        .tbe-metric {
            background: var(--card-bg); border-radius: 12px; padding: 16px 18px;
            box-shadow: 0 2px 6px rgba(0,0,0,.08); border-left: 4px solid #16a34a;
        }
        .tbe-metric.warning { border-left-color: #f5a623; }
        .tbe-metric.bad { border-left-color: #b91c1c; }
        .tbe-metric-label { font-size: 14px; font-weight: 600; color: #667eea; margin-bottom: 6px; }
        body.dark .tbe-metric-label { color: #9bb3ef; }
        .tbe-metric-value { font-size: 18px; font-weight: 700; color: var(--text-primary); }
        .tbe-metric-sub { font-size: 12px; margin-top: 6px; color: var(--text-muted); }

        /* per-tag section heading */
        .tbe-tag-section { margin-bottom: 18px; }
        .tbe-tag-head { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
        .tbe-tag-name { color: #0052cc; }
        body.dark .tbe-tag-name { color: #7aa8ff; }
        .tbe-tag-meta { font-size: 12px; color: var(--text-muted); font-weight: 400; }

        /* toasts */
        #tbe-toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
        .tbe-toast {
            background: var(--section-bg); color: var(--text-primary);
            border: 1px solid var(--border-color); border-left: 4px solid #6684a8;
            border-radius: 8px; padding: 10px 16px; font-size: 13px;
            box-shadow: 0 4px 14px rgba(0,0,0,0.18); max-width: 360px;
            animation: tbeToastIn 0.2s ease;
        }
        .tbe-toast.success { border-left-color: #16a34a; }
        .tbe-toast.error { border-left-color: #b91c1c; }
        @keyframes tbeToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }