    /* ── Variables ──────────────────────────────────────── */
    :root {
      --bg:      #f8fafc;
      --surface: #ffffff;
      --border:  #e2e8f0;
      --txt:     #1e293b;
      --muted:   #64748b;
      --primary: #7546FF;
      --primary-h: #6235ee;
      --green:   #22c55e;
      --amber:   #f59e0b;
      --red:     #ef4444;
      --r: 8px;
    }
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
      color: var(--txt);
      background: var(--bg);
    }

    /* ── Header ─────────────────────────────────────────── */
    header {
      background: #000000;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 24px;
      height: 52px;
      position: sticky;
      top: 0;
      z-index: 50;
      box-shadow: 0 1px 4px rgba(0,0,0,.4);
    }
    .brand-name { font-size: 15px; font-weight: 800; letter-spacing: .06em; color: #ffffff; }
    .brand-sub  { font-size: 13px; color: #94a3b8; margin-left: 8px; }
    .h-status   { display: flex; align-items: center; gap: 6px; }
    .hdot       { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
    .htext      { font-size: 12px; color: #94a3b8; }

    /* ── Infobox ────────────────────────────────────────── */
    #infobox {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 14px 20px;
      font-size: 13px;
      color: var(--txt);
      display: flex;
      align-items: flex-start;
      gap: 12px;
      line-height: 1.6;
    }
    #ib-text { flex: 1; white-space: pre-wrap; }
    #ib-close {
      margin-left: auto;
      background: none;
      border: none;
      color: var(--muted);
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      flex-shrink: 0;
      padding: 2px 0 0;
      opacity: .6;
    }
    #ib-close:hover { opacity: 1; }

    /* ── Layout ─────────────────────────────────────────── */
    main {
      max-width: 1400px;
      margin: 0 auto;
      padding: 24px 16px 72px;
      display: flex;
      flex-direction: column;
      gap: 20px;
    }
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 24px;
    }
    .section-title {
      font-size: 15px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 16px;
    }
    .step-num {
      width: 24px; height: 24px;
      border-radius: 50%;
      background: #1e40af;
      color: #fff;
      font-size: 12px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .section-note { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.6; }

    /* ── Connect section ───────────────────────────────── */
    .connect-fields {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 12px;
      margin-bottom: 16px;
    }
    .field { display: flex; flex-direction: column; gap: 4px; }
    .field.wide { grid-column: 1 / -1; }
    .field label {
      font-size: 11px; font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .05em;
    }
    .field input {
      width: 100%;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 6px;
      font-size: 14px;
      color: var(--txt);
      background: #fff;
      transition: border-color .15s, box-shadow .15s;
    }
    .field input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(117,70,255,.12);
    }

    /* ── Fetch progress steps ───────────────────────────── */
    #fetch-steps { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
    .fetch-step  { display: flex; align-items: center; gap: 8px; font-size: 13px; }
    .step-icon {
      width: 20px; height: 20px;
      border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 11px; font-weight: 700;
      flex-shrink: 0;
    }
    .step-icon[data-state="pending"] { background: #f1f5f9; color: #94a3b8; }
    .step-icon[data-state="running"] { background: #dbeafe; color: #2563eb; animation: pulse 1.2s ease-in-out infinite; }
    .step-icon[data-state="done"]    { background: #dcfce7; color: #16a34a; }
    .step-icon[data-state="error"]   { background: #fee2e2; color: #dc2626; }
    @keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.55;transform:scale(.88)} }

    /* ── Buttons ────────────────────────────────────────── */
    .btn {
      padding: 9px 20px;
      border: none;
      border-radius: 6px;
      font-size: 13px; font-weight: 600;
      cursor: pointer;
      transition: background .12s, opacity .12s;
      white-space: nowrap;
    }
    .btn:disabled { opacity: .5; cursor: not-allowed; }
    .btn-primary  { background: var(--primary); color: #fff; }
    .btn-primary:hover:not(:disabled)  { background: var(--primary-h); }
    .btn-score    { background: #7546FF; color: #fff; }
    .btn-score:hover:not(:disabled)    { background: #6235ee; }
    .btn-outline  { background: #fff; color: var(--txt); border: 1px solid var(--border); }
    .btn-outline:hover:not(:disabled)  { background: var(--bg); }

    .connect-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
    .form-actions    { margin-top: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
    .results-actions { margin-top: 20px; display: flex; align-items: center; gap: 12px; }

    /* ── Error / muted text ─────────────────────────────── */
    .err-msg    { font-size: 12px; color: var(--red); }

    /* ── Fetch error summary panel ───────────────────────── */
    #fetch-error-summary {
      margin-top: 16px;
      background: #fff5f5;
      border: 1px solid #fecaca;
      border-radius: 6px;
      padding: 14px 16px;
    }
    #fetch-error-summary p { font-size: 13px; color: var(--txt); margin-bottom: 10px; }
    .refetch-warning {
      margin-top: 10px;
      font-size: 12px;
      color: var(--muted);
      background: #fefce8;
      border: 1px solid #fde68a;
      border-radius: 4px;
      padding: 8px 10px;
    }
    .muted-note { font-size: 12px; color: var(--muted); }

    /* ── Task form: category sections ───────────────────── */
    details.cat-section {
      border: 1px solid var(--border);
      border-radius: 6px;
      margin-bottom: 8px;
      overflow: hidden;
    }
    details.cat-section summary {
      padding: 11px 14px;
      cursor: pointer;
      font-size: 13px; font-weight: 600;
      display: flex; align-items: center; gap: 8px;
      list-style: none;
      background: #f8fafc;
      user-select: none;
    }
    details.cat-section summary::-webkit-details-marker { display: none; }
    details.cat-section[open] summary { border-bottom: 1px solid var(--border); }
    details.cat-section summary::after {
      content: '›';
      margin-left: auto;
      font-size: 18px;
      color: var(--muted);
      transition: transform .15s;
    }
    details.cat-section[open] summary::after { transform: rotate(90deg); }

    .cat-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .cat-count { font-size: 11px; font-weight: 400; color: var(--muted); }

    /* ── Task rows ──────────────────────────────────────── */
    .task-grid-header {
      display: grid;
      grid-template-columns: 1fr 108px 86px 22px;
      gap: 0 8px;
      padding: 6px 14px;
      border-bottom: 1px solid var(--border);
    }
    .task-grid-header span {
      font-size: 10px; font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .05em;
    }
    .task-rows { padding: 4px 14px 10px; }
    .task-row {
      display: grid;
      grid-template-columns: 1fr 108px 86px 22px;
      align-items: center;
      gap: 0 8px;
      padding: 5px 0;
      border-bottom: 1px solid #f1f5f9;
    }
    .task-row:last-child { border-bottom: none; }
    .task-label {
      font-size: 12.5px;
      color: var(--txt);
      cursor: default;
      padding-right: 6px;
    }
    .task-input {
      width: 108px;
      padding: 5px 8px;
      border: 1px solid var(--border);
      border-radius: 4px;
      font-size: 13px;
      color: var(--txt);
      text-align: right;
      background: #fff;
      transition: border-color .12s, background .12s;
    }
    .task-input:focus { outline: none; border-color: var(--primary); }
    .task-input.is-fetched { border-color: #22c55e; background: #f0fdf4; }

    /* ── Badges ─────────────────────────────────────────── */
    .badge {
      display: inline-flex; align-items: center;
      font-size: 10px; font-weight: 600;
      padding: 2px 7px;
      border-radius: 999px;
      white-space: nowrap;
    }
    .badge-fetched  { background: #dcfce7; color: #15803d; }
    .badge-manual   { background: #fef3c7; color: #92400e; }
    .badge-pending  { background: #f1f5f9; color: #64748b; }
    .badge-na       { background: #f1f5f9; color: #64748b; }
    .badge-error    { background: #fee2e2; color: #b91c1c; }
    .unit { font-size: 12px; color: var(--muted); }

    /* N/A row: grey out — API fetched 0 issues (no issue to prioritise) */
    .task-row-na { opacity: 0.5; }
    .task-row-na .task-label { color: var(--muted); }
    /* Error row: light red background — API fetch failed */
    .task-row-error { background: #fff5f5; }

    /* Results table: N/A and error row colours */
    tr.row-na td  { color: #94a3b8; }
    tr.row-error td { background: #fff5f5; }

    /* ── Results table ──────────────────────────────────── */
    .table-wrap { overflow-x: auto; margin-bottom: 28px; }
    table { width: 100%; border-collapse: collapse; font-size: 13px; }
    th {
      padding: 8px 10px;
      text-align: left;
      font-size: 11px; font-weight: 600;
      text-transform: uppercase;
      letter-spacing: .04em;
      color: var(--muted);
      border-bottom: 2px solid var(--border);
      white-space: nowrap;
      background: #f8fafc;
    }
    td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
    tr:hover td { background: #f8fafc; }
    tr:last-child td { border-bottom: none; }
    .td-num   { text-align: center; }
    .td-score { text-align: center; font-weight: 700; border-radius: 4px; }
    .col-green { background: #dcfce7; color: #15803d; }
    .col-amber { background: #fef3c7; color: #92400e; }
    .col-red   { background: #fee2e2; color: #b91c1c; }

    /* ── Chart ──────────────────────────────────────────── */
    .chart-header   { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
    .chart-title    { font-size: 14px; font-weight: 600; }
    .chart-subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }
    .chart-controls { display:flex; flex-direction:column; gap:8px; }
    .ctrl-group     { display:flex; gap:6px; flex-wrap:wrap; }
    .ctrl-btn       { padding:4px 12px; font-size:11px; border:1px solid #cbd5e1; border-radius:4px; background:#fff; cursor:pointer; color:#475569; }
    .ctrl-btn.active{ background:#0f172a; color:#fff; border-color:#0f172a; }
    #chart-wrap     { display:flex; justify-content:center; }
    #chart          { width:580px; height:580px; }

    /* ── Variant tabs ───────────────────────────────────── */
    #variant-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
    .v-tab { padding: 8px 18px; border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); transition: color .15s, border-color .15s; white-space: nowrap; margin-bottom: -1px; }
    .v-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
    .v-tab:hover:not(.active) { color: var(--txt); }

    /* ── Input tabs ─────────────────────────────────────────────────────── */
    .input-tabs {
      display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap;
    }
    .itab {
      padding: 7px 16px; border-radius: 6px; border: 1px solid var(--border);
      background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500;
      cursor: pointer; transition: all .15s;
    }
    .itab:hover { color: var(--txt); border-color: #94a3b8; }
    .itab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
    .itab-disabled { opacity: .5; cursor: default; pointer-events: none; }
    .badge-soon {
      display: inline-block; font-size: 10px; background: #64748b; color: #fff;
      border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle;
    }
    .tab-pane { display: none; }
    .tab-pane.active { display: block; }
    .tab-login-notice {
      background: #fefce8; border: 1px solid #fde047; border-radius: 6px;
      padding: 8px 14px; font-size: 12px; color: #713f12; margin-bottom: 12px;
    }

    /* ── Deep-link icon ─────────────────────────────────────────────────── */
    .deep-link-icon {
      display: none; margin-left: 5px; color: var(--primary); font-size: 12px;
      text-decoration: none; opacity: .7;
    }
    .deep-link-icon:hover { opacity: 1; }
    .has-project .deep-link-icon { display: inline; }

    /* ── Task display hint (e.g. computed aggregates) ───────────────────── */
    .task-hint {
      grid-column: 1 / -1;
      font-size: 11px;
      color: #94a3b8;
      margin-top: -2px;
      padding-bottom: 3px;
      font-style: italic;
    }

    /* ── Unscored task rows ─────────────────────────────────────────────── */
    .task-row.is-unscored { opacity: .55; }
    .badge-unscored {
      display: inline-block; font-size: 10px; background: #94a3b8; color: #fff;
      border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: middle;
    }
    .results-unscored td { color: var(--muted); font-style: italic; }

    /* ── Project picker ─────────────────────────────────── */
    .proj-picker-row { display:flex; gap:8px; align-items:flex-start; }
    .proj-picker-box { position:relative; flex:1; }
    .proj-search-input { width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:6px; font-size:14px; box-sizing:border-box; }
    .proj-search-input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(117,70,255,.12); }
    .proj-search-input:disabled { background:#f8fafc; cursor:not-allowed; color:var(--muted); }
    .proj-dropdown { position:absolute; top:calc(100% + 4px); left:0; right:0; background:#fff; border:1px solid var(--border); border-radius:6px; box-shadow:0 4px 12px rgba(0,0,0,.1); max-height:220px; overflow-y:auto; z-index:200; }
    .proj-item { padding:9px 12px; cursor:pointer; border-bottom:1px solid #f1f5f9; font-size:13px; line-height:1.4; }
    .proj-item:last-child { border-bottom:none; }
    .proj-item:hover { background:#f5f3ff; }
    .proj-item-name { font-weight:600; color:#1e293b; }
    .proj-item-sub  { color:var(--muted); font-size:12px; margin-top:1px; }
    .btn-sm { padding:7px 12px; font-size:13px; white-space:nowrap; }

    /* ── Utils ──────────────────────────────────────────── */
    [hidden] { display: none !important; }
