
    /* ── Bold Design Tokens ───────────────────────── */
    :root {
      --font-family: 'Inter', system-ui, -apple-system, sans-serif;
      --color-purple-700: #3f00a8;
      --color-purple-600: #5200d4;
      --color-purple-100: #f5f0ff;
      --color-purple-50:  #faf5ff;
      --color-gray-950: #140d26;
      --color-gray-700: #374151;
      --color-gray-600: #4B5563;
      --color-gray-500: #6B7280;
      --color-gray-400: #9CA3AF;
      --color-gray-300: #D1D5DB;
      --color-gray-250: #d4d4d4;
      --color-gray-200: #e5e5e5;
      --color-gray-150: #E5E7EB;
      --color-gray-100: #f5f5f5;
      --color-gray-75:  #f9f9f9;
      --color-gray-50:  #fafafa;
      --color-white:    #ffffff;
      --color-green-600: #16a34a;
      --color-green-100: #DCFCE7;
      --color-red-600:   #DC2626;
      --color-red-500:   #ef4444;
      --color-red-50:    #FEF2F2;
      --color-blue-600:  #2563eb;
      --color-blue-50:   #ebf0ff;
      --font-size-2xs: 10px;
      --font-size-xs:  12px;
      --font-size-sm:  13px;
      --font-size-md:  14px;
      --font-size-lg:  16px;
      --font-size-xl:  18px;
      --font-size-2xl: 20px;
      --font-weight-regular:   400;
      --font-weight-medium:    500;
      --font-weight-semibold:  600;
      --font-weight-bold:      700;
      --font-weight-extrabold: 800;
      --letter-spacing-tight: -0.8px;
      --letter-spacing-snug:  -0.5px;
      --letter-spacing-caps:   0.5px;
      --radius-2xs: 4px;
      --radius-xs:  6px;
      --radius-sm:  8px;
      --radius-md:  12px;
      --radius-xl:  16px;
      --radius-full: 360px;
      --shadow-xs: 0 1px 2px rgba(16,24,40,0.05);
      --shadow-sm: 0 1px 3px rgba(16,24,40,0.1), 0 1px 2px rgba(16,24,40,0.06);
      --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
      --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
      --transition-fast: all 0.15s ease;
      --transition-base: all 0.20s ease;
      --focus-ring-purple: 0 0 0 3px rgba(82,0,212,0.12);
    }

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

    body {
      font-family: var(--font-family);
      background: var(--color-gray-50);
      color: var(--color-gray-950);
      height: 100vh;
      display: flex;
      overflow: hidden;
      -webkit-font-smoothing: antialiased;
    }

    /* ─── SIDEBAR ─── */
    .sidebar {
      width: 220px;
      background: var(--color-white);
      border-right: 1px solid var(--color-gray-200);
      display: flex;
      flex-direction: column;
      height: 100vh;
      flex-shrink: 0;
    }
    .sidebar-logo {
      padding: 16px 20px;
      font-weight: var(--font-weight-semibold);
      font-size: var(--font-size-md);
      color: var(--color-gray-950);
      border-bottom: 1px solid var(--color-gray-100);
      display: flex;
      align-items: center;
    }
    .sidebar-section { padding: 16px 8px 4px; }
    .sidebar-section-label {
      font-size: var(--font-size-2xs); font-weight: var(--font-weight-semibold); color: var(--color-gray-400);
      text-transform: uppercase; letter-spacing: var(--letter-spacing-caps);
      padding: 0 10px 6px;
    }
    .nav-item {
      display: flex; align-items: center; gap: 8px;
      padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
      font-size: var(--font-size-sm); color: var(--color-gray-600); user-select: none;
      transition: var(--transition-fast);
    }
    .nav-item:hover { background: var(--color-gray-75); color: var(--color-gray-950); }
    .nav-item.active { background: var(--color-purple-50); color: var(--color-purple-600); font-weight: var(--font-weight-semibold); }
    .nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.65; }
    .nav-item.active .nav-icon { opacity: 1; }
    .nav-badge {
      margin-left: auto; background: var(--color-red-500); color: var(--color-white);
      font-size: var(--font-size-2xs); font-weight: var(--font-weight-bold);
      border-radius: var(--radius-full); padding: 1px 6px; min-width: 18px; text-align: center; line-height: 1.6;
    }
    .sidebar-footer {
      margin-top: auto; padding: 14px 16px;
      border-top: 1px solid var(--color-gray-100);
      display: flex; align-items: center; gap: 10px;
    }
    .avatar {
      width: 32px; height: 32px; border-radius: 50%;
      background: var(--color-purple-600); color: var(--color-white);
      display: flex; align-items: center; justify-content: center;
      font-size: 11px; font-weight: var(--font-weight-bold); flex-shrink: 0;
    }
    .avatar-name { font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); color: var(--color-gray-950); }
    .avatar-role { font-size: 10.5px; color: var(--color-gray-400); margin-top: 1px; }

    /* ─── MAIN ─── */
    .main { flex: 1; overflow-y: auto; padding: 28px 32px; }
    .page-header { margin-bottom: 22px; }
    .page-title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
    .page-subtitle { font-size: 12px; color: #999; margin-top: 3px; }

    /* ─── STATS ROW ─── */
    .stats-row { display: flex; gap: 12px; margin-bottom: 20px; }
    .stat-card {
      background: #fff; border: 1px solid #e8e8e4;
      border-radius: 8px; padding: 14px 18px; flex: 1;
    }
    .stat-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
    .stat-label { font-size: 11.5px; color: #888; margin-top: 3px; }
    .stat-sublabel { font-size: 11px; color: #bbb; margin-top: 2px; }
    .so-pill {
      display: inline-flex; align-items: center; gap: 5px;
      background: #eaf3e8; color: #2a5c24;
      font-size: 11px; font-weight: 700;
      border-radius: 5px; padding: 3px 9px; margin-top: 4px;
    }

    /* ─── FILTER BAR ─── */
    .filter-bar { display: flex; gap: 6px; margin-bottom: 16px; align-items: center; }
    .filter-tab {
      padding: 5px 13px; border-radius: 20px; font-size: 12px;
      font-weight: 500; cursor: pointer; border: 1px solid #e0e0da;
      color: #666; background: #fff; user-select: none;
    }
    .filter-tab:hover { background: #f5f5f0; }
    .filter-tab.active { background: #5200D4; color: #fff; border-color: #5200D4; }
    .filter-tab .ct { margin-left: 3px; opacity: 0.65; }
    .ml-auto { margin-left: auto; }

    /* ─── TABLE ─── */
    .table-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 8px; overflow: hidden; }
    .members-table-scroll { overflow-x: auto; }
    .members-table-scroll::-webkit-scrollbar { height: 4px; }
    .members-table-scroll::-webkit-scrollbar-track { background: var(--color-gray-100); }
    .members-table-scroll::-webkit-scrollbar-thumb { background: var(--color-gray-300); border-radius: 4px; }
    .members-table-scroll th:first-child { min-width: 170px; }
    .group-table-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 8px; min-width: max-content; clip-path: inset(0 round 8px); }
    .data-table { width: 100%; border-collapse: collapse; }
    .data-table th {
      font-size: 10.5px; font-weight: 600; color: #aaa;
      text-align: left; padding: 9px 16px; border-bottom: 1px solid #f0f0ec;
      background: #fafaf8; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
    }
    .data-table td {
      padding: 11px 16px; border-bottom: 1px solid #f5f5f2;
      font-size: 13px; vertical-align: middle;
    }
    .data-table tbody tr:last-child td { border-bottom: none; }
    .data-table tbody tr { cursor: pointer; transition: background 0.1s; }
    .data-table tbody tr:hover { background: #fafaf8; }
    .data-table tbody tr.row-flagged { background: transparent; }
    .data-table tbody tr.row-flagged:hover { background: #fafaf8; }
    .col-sticky { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 1px 0 0 var(--color-gray-300), 4px 0 8px rgba(0,0,0,0.05); }
    .data-table thead .col-sticky { background: #fafaf8; z-index: 3; }
    .col-picker-wrap { position: relative; display: inline-block; }
    .col-picker-panel {
      display: none; position: absolute; top: calc(100% + 4px); right: 0;
      background: #fff; border: 1px solid var(--color-gray-200); border-radius: var(--radius-md);
      box-shadow: 0 4px 16px rgba(0,0,0,0.10); z-index: 200; padding: 8px 0; min-width: 200px;
    }
    .col-picker-wrap.open .col-picker-panel { display: block; }
    .col-picker-label { font-size: 10.5px; font-weight: 700; color: var(--color-gray-400);
      text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 14px 4px; }
    .col-picker-item { display: flex; align-items: center; gap: 8px; padding: 6px 14px;
      font-size: 13px; color: var(--color-gray-700); cursor: pointer; user-select: none; }
    .col-picker-item:hover { background: var(--color-gray-50); }
    .col-picker-item input[type=checkbox] { accent-color: var(--color-purple-600); width: 13px; height: 13px; flex-shrink: 0; }
    .member-name { font-weight: 600; }
    .member-sub { font-size: 11px; color: #bbb; margin-top: 1px; }
    .score-main { font-weight: 600; }
    .delta { font-size: 11px; margin-left: 3px; }
    .delta.neg { color: #c0392b; }
    .delta.pos { color: #27ae60; }

    /* ─── BADGES ─── */
    .badge {
      display: inline-flex; align-items: center;
      padding: 3px 9px; border-radius: 12px;
      font-size: 10px; font-weight: 600; white-space: nowrap; text-transform: uppercase;
    }
    .b-escalated { background: #fde8e2; color: #c0392b; }
    .b-flagged   { background: #fef3e0; color: #d4890a; }
    .b-routine   { background: #e6f0fc; color: #1a6fa8; }
    .b-audit     { background: #f0f0ee; color: #777; }
    .b-active    { background: #e8f5e8; color: #2a5c24; }
    .b-archived  { background: #f0f0ee; color: #999; }
    .b-flag-action     { background: #fef3e0; color: #d4890a; }
    .b-escalate-action { background: #fde8e2; color: #c0392b; }
    .b-alert-action    { background: #e6f0fc; color: #1a6fa8; }
    .b-audit-action    { background: #f0f0ee; color: #777; }

    /* ─── BUTTONS ─── */
    .btn {
      padding: 6px 14px; border-radius: 6px; font-size: 12px;
      font-weight: 600; cursor: pointer; border: none;
      font-family: inherit; transition: opacity 0.15s; white-space: nowrap;
    }
    .btn:hover { opacity: 0.82; }
    .btn:active { opacity: 0.65; }
    .btn-dark    { background: #1a1a1a; color: #fff; }
    .btn-green   { background: #2a5c24; color: #fff; }
    .btn-outline { background: #fff; color: #333; border: 1px solid #ddddd8; }
    .btn-outline:hover { background: #f5f5f0; }
    .btn-review  { background: #fff; color: #1a6fa8; border: 1px solid #90c0e8; font-size: 12px; }
    .btn-approve { background: #edf7eb; color: #2a5c24; border: 1px solid #a8d8a4; font-size: 12px; }
    .btn-danger  { background: #fde8e2; color: #c0392b; border: 1px solid #f5a898; }

    /* ─── MODAL ─── */
    .overlay {
      position: fixed; inset: 0; background: rgba(0,0,0,0.32);
      z-index: 100; display: flex; align-items: flex-start;
      justify-content: center; padding: 36px 20px; overflow-y: auto;
    }
    .modal {
      background: var(--color-white); border-radius: var(--radius-xl); width: 820px;
      max-width: 96vw; box-shadow: var(--shadow-lg); position: relative;
    }
    .modal-head { padding: 20px 24px 0; }
    .modal-close {
      position: absolute; top: 14px; right: 14px;
      background: none; border: none; font-size: 17px; cursor: pointer;
      color: #aaa; width: 28px; height: 28px;
      display: flex; align-items: center; justify-content: center; border-radius: 4px;
    }
    .modal-close:hover { background: #f5f5f0; color: #333; }
    .modal-patient-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
    .modal-patient-meta { font-size: 12px; color: #999; margin-top: 2px; }
    .phase-chip {
      display: inline-flex; align-items: center;
      background: #e6f0fc; color: #1a6fa8;
      font-size: 11px; font-weight: 600; border-radius: 4px; padding: 2px 8px; margin-left: 6px;
    }
    .modal-tabs {
      display: flex; border-bottom: 1px solid #f0f0ec;
      margin-top: 14px; padding: 0 24px;
    }
    .modal-tab {
      padding: 8px 14px; font-size: 12px; font-weight: 500; color: #aaa;
      cursor: pointer; border-bottom: 2px solid transparent;
      margin-bottom: -1px; user-select: none; white-space: nowrap;
    }
    .modal-tab:hover { color: #444; }
    .modal-tab.active { color: #1a1a1a; border-bottom-color: #1a1a1a; font-weight: 600; }
    .modal-alert {
      margin: 14px 24px 0; background: #fff8f0;
      border: 1px solid #f0c878; border-left: 4px solid #e67e22;
      border-radius: 6px; padding: 10px 14px;
      font-size: 12px; color: #7a3f00; line-height: 1.55;
    }
    .modal-body { padding: 18px 24px; }
    .modal-foot {
      padding: 14px 24px; border-top: 1px solid #f0f0ec;
      display: flex; justify-content: space-between; align-items: center; gap: 8px;
    }

    /* Patient profile */
    .profile-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 20px; margin-bottom: 20px; }
    .pf-label { font-size: 10px; font-weight: 600; color: #bbb; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 3px; }
    .pf-value { font-size: 13px; font-weight: 500; }
    .section-head { font-size: 10.5px; font-weight: 700; color: #bbb; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
    .phase-log-entry { display: flex; gap: 14px; font-size: 12px; padding: 9px 0; border-bottom: 1px solid #f5f5f2; }
    .phase-log-entry:last-child { border-bottom: none; }
    .log-date { color: #bbb; font-size: 11px; white-space: nowrap; min-width: 88px; padding-top: 1px; }
    .log-text { color: #555; line-height: 1.45; }

    /* Outcome table */
    .outcome-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
    .outcome-tbl th {
      font-size: 10px; font-weight: 600; color: #bbb; text-align: left;
      padding: 6px 10px; border-bottom: 1px solid #f0f0ec;
      text-transform: uppercase; letter-spacing: 0.06em;
    }
    .outcome-tbl td { padding: 9px 10px; border-bottom: 1px solid #f7f7f5; vertical-align: middle; }
    .outcome-tbl tr:last-child td { border-bottom: none; }
    .msr-name { font-weight: 600; font-size: 13px; }
    .msr-sub  { font-size: 10px; color: #bbb; margin-top: 1px; }
    .ch-pos { color: #27ae60; font-weight: 600; }
    .ch-neg { color: #c0392b; font-weight: 600; }

    /* Outcome charts */
    .outcome-charts { display: flex; flex-direction: column; gap: 0; }
    .outcome-chart-card { padding: 20px 24px; border-bottom: 1px solid #f0f0ee; }
    .outcome-chart-card:last-child { border-bottom: none; }
    .chart-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
    .chart-card-title { font-size: 13px; font-weight: 700; color: var(--color-gray-900); display: flex; align-items: center; gap: 6px; }
    .chart-card-sub { font-size: 11px; color: var(--color-gray-400); margin-top: 3px; }
    .chart-delta-badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
    .chart-delta-badge.pos  { background: #f0fdf4; color: #16a34a; }
    .chart-delta-badge.neg  { background: #fef2f2; color: #dc2626; }
    .chart-delta-badge.neu  { background: #f4f4f2; color: #6b7280; }
    .chart-card-footer { display: flex; justify-content: space-between; font-size: 11px; color: var(--color-gray-400); margin-top: 8px; }
    .chart-card-footer strong { color: var(--color-gray-700); font-weight: 600; }

    /* Chart tooltip */
    #chart-tip {
      position: fixed; background: #1c1c1a; color: #fff;
      font-size: 11px; font-weight: 600; font-family: inherit;
      padding: 5px 10px; border-radius: 6px;
      pointer-events: none; display: none; z-index: 9999;
      transform: translate(-50%, calc(-100% - 10px));
      white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    }
    #chart-tip::after {
      content: ''; position: absolute; top: 100%; left: 50%;
      transform: translateX(-50%);
      border: 5px solid transparent; border-top-color: #1c1c1a;
    }

    /* Class history */
    .class-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f5f5f2; font-size: 12.5px; }
    .class-item:last-child { border-bottom: none; }
    .c-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .c-dot.done { background: #2a5c24; }
    .c-dot.skip { background: #ddd; }
    .c-name { font-weight: 500; flex: 1; }
    .c-type { color: #aaa; font-size: 11px; }
    .c-date { color: #bbb; font-size: 11px; white-space: nowrap; }
    .c-status { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
    .c-status.done { background: #e8f5e8; color: #2a5c24; }
    .c-status.skip { background: #f5f5f2; color: #aaa; }

    /* Actions */
    .action-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f5f5f2; cursor: pointer; }
    .action-row:last-child { border-bottom: none; }
    .action-row:hover { opacity: 0.8; }
    .action-row input[type=checkbox] { margin-top: 2px; flex-shrink: 0; width: 15px; height: 15px; accent-color: #1a1a1a; cursor: pointer; }
    .action-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
    .action-desc  { font-size: 11px; color: #aaa; }

    /* ─── DRAWER ─── */
    .drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.18); z-index: 200; display: flex; justify-content: flex-end; }
    .drawer {
      background: #fff; width: 480px; height: 100vh;
      display: flex; flex-direction: column;
      box-shadow: -4px 0 28px rgba(0,0,0,0.12);
      animation: slideIn 0.2s ease;
    }
    @keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
    .drawer-head { padding: 20px 24px; border-bottom: 1px solid #f0f0ec; display: flex; justify-content: space-between; align-items: flex-start; }
    .drawer-title    { font-size: 16px; font-weight: 700; }
    .drawer-subtitle { font-size: 12px; color: #aaa; margin-top: 3px; }
    .drawer-body { flex: 1; padding: 20px 24px; overflow-y: auto; }
    .drawer-foot { padding: 14px 24px; border-top: 1px solid #f0f0ec; display: flex; gap: 8px; justify-content: flex-end; }
    .form-group { margin-bottom: 15px; }
    .form-label { display: block; font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px; }
    .form-input, .form-select, .form-textarea {
      width: 100%; padding: 8px 11px; border: 1px solid #ddddd8;
      border-radius: 6px; font-size: 13px; color: #1a1a1a; background: #fff; font-family: inherit;
    }
    .form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: #888; }
    .form-input[readonly] { background: #fafaf8; color: #aaa; }
    .form-textarea { height: 145px; resize: vertical; line-height: 1.55; }
    .input-hint { font-size: 10.5px; color: #bbb; margin-top: 5px; }

    /* ─── STANDING ORDERS ─── */
    .so-cards { display: flex; gap: 14px; margin-bottom: 22px; }
    .so-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 8px; padding: 18px; flex: 1; }
    .so-card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
    .so-row { display: flex; justify-content: space-between; font-size: 12px; color: #888; margin-bottom: 9px; }
    .so-row strong { color: #1a1a1a; }
    .so-link { color: #1a6fa8; cursor: pointer; text-decoration: underline; font-size: 12px; }
    .vh-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f5f5f2; font-size: 12.5px; }
    .vh-item:last-child { border-bottom: none; }
    .rules-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
    .rules-title { font-size: 15px; font-weight: 700; }
    .rules-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 8px; overflow: hidden; }
    .rules-tbl { width: 100%; border-collapse: collapse; }
    .rules-tbl th { font-size: 10px; font-weight: 600; color: #bbb; text-transform: uppercase; letter-spacing: 0.07em; padding: 9px 16px; background: #fafaf8; border-bottom: 1px solid #f0f0ec; text-align: left; }
    .rules-tbl td { padding: 11px 16px; border-bottom: 1px solid #f5f5f2; font-size: 12.5px; }
    .rules-tbl tr:last-child td { border-bottom: none; }
    .rule-name { font-weight: 600; font-size: 13px; }
    .rule-sub  { font-size: 10px; color: #bbb; margin-top: 1px; }
    .clinical-rationale { background: #fafaf8; border: 1px solid #e8e8e4; border-radius: 6px; padding: 12px 16px; font-size: 12px; color: #888; font-style: italic; margin-top: 16px; line-height: 1.5; }
    .so-drawer { width: 580px; }
    .rules-editor-head { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 32px; gap: 8px; font-size: 10px; font-weight: 600; color: #bbb; text-transform: uppercase; letter-spacing: 0.07em; padding: 6px 0 8px; border-bottom: 1px solid #f0f0ec; margin-bottom: 4px; }
    .rule-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 32px; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid #f7f7f5; }
    .rule-row input, .rule-row select { padding: 6px 8px; border: 1px solid #ddddd8; border-radius: 4px; font-size: 12px; font-family: inherit; width: 100%; }
    .rule-row input:focus, .rule-row select:focus { outline: none; border-color: #888; }
    .remove-rule-btn { background: none; border: none; color: #ccc; cursor: pointer; font-size: 17px; padding: 2px; line-height: 1; }
    .remove-rule-btn:hover { color: #c0392b; }

    /* ─── INSTRUMENTS LIST ─── */
    .instruments-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
    .inst-card {
      background: #fff; border: 1px solid #e8e8e4; border-radius: 8px;
      padding: 18px; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
      display: flex; flex-direction: column;
    }
    .inst-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); border-color: #ccc; }
    .inst-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 5px; }
    .inst-abbr { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
    .bp-chip { font-size: 11px; font-weight: 600; border-radius: 5px; padding: 3px 9px; white-space: nowrap; flex-shrink: 0; }
    .cadence-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; background: #f0f0ee; color: #666; border-radius: 5px; padding: 3px 8px; }
    .inst-fullname { font-size: 11.5px; color: #888; margin-bottom: 14px; line-height: 1.4; flex: 1; }
    .inst-meta { margin-bottom: 12px; }
    .inst-meta-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #555; margin-bottom: 5px; }
    .inst-meta-icon { width: 13px; height: 13px; flex-shrink: 0; color: var(--color-gray-400); }
    .inst-card-footer { font-size: 12px; font-weight: 600; color: #1a6fa8; text-align: right; padding-top: 8px; border-top: 1px solid #f5f5f2; }

    /* ─── INSTRUMENT DETAIL ─── */
    .inst-detail-meta {
      display: flex; gap: 20px; flex-wrap: wrap;
      font-size: 12px; color: #888; margin-top: 10px;
      padding: 12px 16px; background: #fff;
      border: 1px solid #e8e8e4; border-radius: 8px; margin-bottom: 20px;
    }
    .inst-detail-meta span { display: flex; align-items: center; gap: 5px; }
    .inst-detail-meta strong { color: #333; }

    .inst-questions {
      background: var(--color-white); border: 1px solid var(--color-gray-150);
      border-radius: var(--radius-lg); padding: 24px 28px;
    }
    .q-section-head {
      font-size: 14px; font-weight: var(--font-weight-bold); color: var(--color-gray-900);
      margin: 26px 0 4px;
    }
    .q-section-head:first-child { margin-top: 0; }
    .q-intro {
      font-size: 12.5px; color: var(--color-gray-400); line-height: 1.55;
      margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--color-gray-150);
    }
    .q-item { margin-bottom: 22px; }
    .q-item:last-child { margin-bottom: 0; }
    .q-item-text { display: flex; gap: 8px; font-size: 13.5px; font-weight: var(--font-weight-semibold); color: var(--color-gray-900); line-height: 1.4; margin-bottom: 10px; }
    .q-item-num { flex-shrink: 0; color: var(--color-gray-400); font-weight: var(--font-weight-semibold); }
    .q-baseline-tag { display:inline-flex; align-items:center; gap:3px; background:#fef3e0; color:#d4890a; font-size:10px; font-weight:600; padding:2px 7px; border-radius:var(--radius-full); margin-left:8px; vertical-align:middle; }
    .q-opts { display: flex; flex-direction: column; gap: 7px; margin-left: 22px; }
    .q-opt {
      display: flex; align-items: center; justify-content: space-between;
      background: var(--color-gray-50); border: 1px solid var(--color-gray-150);
      border-radius: var(--radius-md); padding: 10px 16px;
      font-size: 13px; color: var(--color-gray-700);
    }
    .q-opt-value { font-weight: var(--font-weight-semibold); color: var(--color-gray-400); font-size: 12.5px; flex-shrink: 0; margin-left: 16px; }

    /* ─── TOAST ─── */
    .toast {
      position: fixed; bottom: 22px; right: 22px;
      background: #1a1a1a; color: #fff; padding: 11px 18px;
      border-radius: 8px; font-size: 13px; font-weight: 500;
      z-index: 999; display: flex; align-items: center; gap: 8px;
      box-shadow: 0 6px 24px rgba(0,0,0,0.2);
      animation: fadeUp 0.2s ease;
    }
    @keyframes fadeUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
    .toast.t-success { background: #2a5c24; }

    /* ─── CONTROL BAR (group by / sort by) ─── */
    .ctrl-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
    .ctrl-dropdown { position: relative; display: inline-block; }
    .ctrl-btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 6px 12px; border: 1px solid var(--color-gray-200);
      border-radius: var(--radius-sm); background: var(--color-white);
      font-size: var(--font-size-xs); font-weight: var(--font-weight-medium);
      color: var(--color-gray-700); cursor: pointer; font-family: var(--font-family);
      white-space: nowrap; user-select: none; transition: var(--transition-fast);
    }
    .ctrl-btn:hover { background: var(--color-gray-75); }
    .ctrl-btn.active { background: var(--color-purple-50); border-color: var(--color-purple-600); color: var(--color-purple-600); }
    .ctrl-btn-arrow { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.6; transition: transform 0.15s ease; }
    .ctrl-dropdown.open .ctrl-btn-arrow { transform: rotate(180deg); }
    .ctrl-menu {
      display: none; position: absolute; top: calc(100% + 4px); left: 0;
      background: var(--color-white); border: 1px solid var(--color-gray-200);
      border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
      z-index: 50; min-width: 200px; overflow: hidden;
    }
    .ctrl-dropdown.open .ctrl-menu { display: block; }
    .ctrl-menu-label {
      font-size: var(--font-size-2xs); font-weight: var(--font-weight-semibold);
      color: var(--color-gray-400); text-transform: uppercase;
      letter-spacing: var(--letter-spacing-caps); padding: 10px 14px 4px;
    }
    .ctrl-menu-item {
      display: flex; align-items: center; justify-content: space-between;
      padding: 9px 14px; font-size: var(--font-size-xs);
      font-weight: var(--font-weight-medium); color: var(--color-gray-700);
      cursor: pointer; transition: var(--transition-fast);
    }
    .ctrl-menu-item:hover { background: var(--color-gray-75); }
    .ctrl-menu-item.selected { color: var(--color-purple-600); font-weight: var(--font-weight-semibold); }
    .ctrl-menu-check { font-size: 11px; opacity: 0; }
    .ctrl-menu-item.selected .ctrl-menu-check { opacity: 1; }

    /* ─── GROUP HEADER ROW ─── */
    .group-header-row td { padding: 0; border: none; background: transparent; }
    .group-spacer-row td { height: 20px; padding: 0; border: none !important; background: transparent; }
    .group-band { display: flex; align-items: center; gap: 8px; padding: 10px 14px 9px; background: var(--color-gray-50); border-top: 1px solid var(--color-gray-200); border-bottom: 1px solid var(--color-gray-200); }
    .group-band svg { color: var(--color-gray-400); flex-shrink: 0; }
    .group-band-label { font-size: 13px; font-weight: 700; color: var(--color-gray-800); }
    .group-count { display: inline-flex; align-items: center; justify-content: center; background: var(--color-gray-200); color: var(--color-gray-600); font-size: 11px; font-weight: 600; min-width: 20px; height: 18px; border-radius: var(--radius-full); padding: 0 7px; }
    .group-col-header th { font-size: 10.5px; font-weight: 600; color: #aaa; text-align: left; padding: 9px 16px; background: #fafaf8; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; border-bottom: 1px solid #f0f0ec; }
    .group-col-header .col-sticky { background: #fafaf8; z-index: 3; }

    .hidden { display: none !important; }
    ::-webkit-scrollbar { width: 4px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

    /* Destructive button */
    .btn-red { background: #dc2626; color: #fff; border: 1px solid #dc2626; }
    .btn-red:hover { background: #b91c1c; border-color: #b91c1c; }

    /* Two-badge outcome chart header */
    .chart-badge-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
    .chart-badge-dir { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px 3px 6px; border-radius: 20px; white-space: nowrap; background: #f0fdf4; color: #15803d; }
    .chart-badge-dir.neg { background: #fef2f2; color: #dc2626; }
    .chart-badge-dir.neu { background: #f4f4f2; color: #6b7280; }
    .chart-badge-pts { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; background: #dcfce7; color: #166534; }
    .chart-badge-pts.neg { background: #fee2e2; color: #991b1b; }
    .chart-badge-pts.neu { background: #f0f0ee; color: #6b7280; }

    /* PSFS activity chip */
    .psfs-activity-chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; color: var(--color-gray-500); background: var(--color-gray-100); border-radius: 4px; padding: 2px 7px; margin-left: 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Traffic light signal section */
    .traffic-signal-section { margin-bottom: 20px; padding: 18px 20px 14px; background: #fff; border: 1px solid #ebebea; border-radius: 10px; }
    .traffic-signal-title { font-size: 13px; font-weight: 700; color: var(--color-gray-900); margin-bottom: 3px; }
    .traffic-signal-sub { font-size: 11px; color: var(--color-gray-500); margin-bottom: 14px; line-height: 1.45; }
    .traffic-signal-legend { display: flex; gap: 16px; margin-bottom: 12px; }
    .tl-leg-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--color-gray-600); }
    .tl-dot-sm { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  