/* settings.html — page-specific styles */

.settings-card {
      background: var(--surface); border: 1px solid var(--border-card);
      border-radius: var(--radius); padding: var(--sp-5); margin-bottom: var(--sp-4);
      box-shadow: var(--shadow-sm);
    }
    .settings-card h3 { margin: 0 0 var(--sp-1); font-size: 14px; font-weight: 700; }
    .settings-card p { margin: 0 0 var(--sp-3); font-size: 12px; color: var(--text-muted); }

    .tag-list { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
    .tag-item {
      display: flex; align-items: center; gap: 4px; padding: 3px 10px;
      background: var(--accent-subtle); border: 1px solid rgba(255,180,0,0.1);
      border-radius: var(--radius-full); font-size: 11px; color: var(--accent); font-weight: 600;
    }
    .tag-item .remove {
      background: none; border: none; color: var(--text-muted); cursor: pointer;
      font-size: 13px; padding: 0 2px; line-height: 1;
      transition: color 0.1s ease;
    }
    .tag-item .remove:hover { color: var(--red); }

    .add-row { display: flex; gap: var(--sp-2); }
    .add-row input, .add-row select {
      padding: 6px 10px; border: 1px solid var(--border-card); border-radius: var(--radius-sm);
      font-size: 12px; background: var(--surface); color: var(--text); flex: 1;
    }
    .add-row button {
      padding: 6px 14px; border: none; border-radius: var(--radius-sm);
      background: var(--accent); color: #0E0E0E; font-size: 12px; font-weight: 600;
      cursor: pointer; white-space: nowrap;
      transition: background 0.12s ease;
    }
    .add-row button:hover { background: var(--accent-hover); }

    .save-bar {
      display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-3) 0;
      border-top: 1px solid var(--border-card); margin-top: var(--sp-2);
    }
    .save-bar button {
      padding: 7px 20px; border: none; border-radius: var(--radius-sm);
      font-size: 13px; font-weight: 600; cursor: pointer;
    }
    .btn-save { background: var(--green); color: #0E0E0E; transition: background 0.12s ease; }
    .btn-save:hover { background: var(--green-hover); }
    .save-msg { font-size: 12px; color: var(--green); display: none; }

    .pipeline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
    .pipeline-card {
      padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); border: 1px solid var(--border-card);
      background: var(--surface); display: flex; flex-direction: column; gap: var(--sp-1);
      box-shadow: var(--shadow-xs);
      transition: border-color 0.12s ease;
    }
    .pipeline-card:hover { border-color: rgba(255,180,0,0.15); }
    .pipeline-card .pipe-header { display: flex; align-items: center; justify-content: space-between; }
    .pipeline-card .pipe-label { font-weight: 700; font-size: 13px; }
    .pipeline-card .pipe-desc { font-size: 11px; color: var(--text-muted); }
    .pipeline-card .pipe-status { font-size: 11px; color: var(--text-muted); min-height: 16px; }
    .pipeline-card .pipe-status.running { color: var(--amber); font-weight: 600; }
    .pipeline-card .pipe-status.done { color: var(--green); }
    .pipeline-card .pipe-status.error { color: var(--red); }
    .pipe-btn {
      padding: 5px 14px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600;
      cursor: pointer; border: none; background: var(--accent); color: #0E0E0E;
      transition: background 0.12s ease; white-space: nowrap;
      min-width: 52px; text-align: center;
    }
    .pipe-btn:hover { background: var(--accent-hover); }
    .pipe-btn.stop { background: var(--amber); }
    .pipe-btn.stop:hover { background: #d97706; }
    /* Disabled = neutral grey, legible text, not washed-out gold (design/README.md § Buttons). */
    .pipe-btn:disabled { background: var(--gray-100); color: var(--text-muted); opacity: 1; cursor: not-allowed; }
    .pipe-btn:disabled:hover { background: var(--gray-100); }
    .pipe-live-dot { width:7px;height:7px;border-radius:50%;background:#10b981;flex-shrink:0;box-shadow:0 0 0 0 rgba(16,185,129,0.5);animation:pipeLive 1.8s ease-in-out infinite; }
    @keyframes pipeLive { 0%,100%{box-shadow:0 0 0 0 rgba(16,185,129,0.5);} 50%{box-shadow:0 0 0 4px rgba(16,185,129,0);} }
    .pipe-freq {
      font-size: 10px; font-weight: 700; color: var(--accent);
      letter-spacing: 0.02em; margin-top: 4px;
      padding: 2px 0;
    }
    .live-dot {
      width: 8px; height: 8px; border-radius: 50%; background: var(--green);
      display: inline-block; vertical-align: middle; margin-right: 6px;
      animation: livePulse 2s ease-in-out infinite;
    }
    @keyframes livePulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

    .browse-link { font-size: 11px; color: var(--accent); cursor: pointer; text-decoration: underline; }
    .category-browser {
      display: none; max-height: 200px; overflow-y: auto; margin-top: var(--sp-2);
      padding: var(--sp-2); background: var(--accent-subtle); border: 1px solid rgba(255,180,0,0.06);
      border-radius: var(--radius-sm);
    }
    .category-browser.open { display: block; }
    .category-browser input { margin-bottom: var(--sp-2); width: 100%; padding: 5px 8px; border: 1px solid var(--border-card); border-radius: var(--radius-sm); font-size: 12px; }
    .cat-option {
      padding: 3px 6px; cursor: pointer; font-size: 11px; border-radius: var(--radius-xs);
      transition: background 0.1s ease;
    }
    .cat-option:hover { background: rgba(255,180,0,0.06); }

    /* ── Responsive ── */
    @media (max-width: 768px) {
      .pipeline-grid { grid-template-columns: 1fr; }
      .settings-card { padding: var(--sp-4); }
    }
    @media (max-width: 640px) {
      .settings-card h3 { font-size: 13px; }
      .pipeline-card .pipe-label { font-size: 12px; }
      .pipeline-card .pipe-desc { font-size: 10px; }
      .pipe-btn { min-height: 44px; padding: 8px 16px; font-size: 12px; }
      .add-row { flex-wrap: wrap; }
      .add-row input, .add-row select { font-size: 16px; flex: 1 1 100%; }
      .add-row button { min-height: 44px; width: 100%; }
      .tag-item { font-size: 10px; padding: 4px 8px; }
      .tag-item .remove { min-width: 28px; min-height: 28px; display: flex; align-items: center; justify-content: center; }
      .save-bar { flex-wrap: wrap; }
      .save-bar button { min-height: 44px; flex: 1; }
    }

#cg-api-detail.open, #cex-api-detail.open, #other-api-detail.open { display:block !important; }
        .api-ref { margin-bottom:var(--sp-4); padding:var(--sp-4) var(--sp-5); background:var(--surface); border:1px solid var(--border-card); border-radius:var(--radius); box-shadow:var(--shadow-sm); }
        .api-ref-title { font-size:13px; font-weight:700; letter-spacing:-0.02em; margin-bottom:var(--sp-4); padding-bottom:var(--sp-2); border-bottom:1px solid var(--gray-100); }
        .api-pipeline { margin-bottom:var(--sp-4); }
        .api-pipeline:last-child { margin-bottom:0; }
        .api-pipe-name { font-size:12px; font-weight:700; color:var(--text); margin-bottom:var(--sp-2); display:flex; align-items:center; gap:var(--sp-2); }
        .api-pipe-name .api-cost { font-weight:600; font-size:10px; padding:2px 8px; border-radius:var(--radius-full); background:var(--accent-subtle); color:var(--accent); }
        .api-endpoint { display:flex; gap:var(--sp-3); padding:6px 0; border-bottom:1px solid var(--gray-50); align-items:baseline; }
        .api-endpoint:last-child { border-bottom:none; }
        .api-ep-path { font-family:'SF Mono','Fira Code',monospace; font-size:10px; color:var(--accent); font-weight:500; min-width:160px; flex-shrink:0; }
        .api-ep-desc { font-size:11px; color:var(--text-secondary); line-height:1.5; flex:1; }
        .api-ep-calls { font-size:10px; font-weight:700; color:var(--text-muted); min-width:50px; text-align:right; flex-shrink:0; }
        .api-cost-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); gap:var(--sp-2); margin-top:var(--sp-3); }
        .api-cost-card { padding:var(--sp-3); background:var(--gray-50); border-radius:var(--radius-sm); }
        .api-cost-card .cost-label { font-size:10px; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-muted); font-weight:600; margin-bottom:2px; }
        .api-cost-card .cost-value { font-size:15px; font-weight:700; color:var(--text); }
        .api-cost-card .cost-detail { font-size:10px; color:var(--text-muted); margin-top:2px; }

.flow-table { width:100%;table-layout:fixed;border-collapse:collapse;font-size:11px; }
            .flow-table th { text-align:left;padding:8px;border-bottom:2px solid var(--border-card);font-size:10px;text-transform:uppercase;letter-spacing:0.04em;color:var(--text-muted); }
            .flow-table td { padding:6px 8px;border-bottom:1px solid var(--gray-50);vertical-align:top;overflow-wrap:anywhere;word-break:break-word; }
            /* long setting-key tokens must wrap so the fixed table never overflows/clips */
            .flow-table code { overflow-wrap:anywhere;word-break:break-word; }
            /* narrow label column; remaining columns share the rest evenly */
            .flow-table th:first-child, .flow-table td:first-child { width:12%; }
            .flow-table tr:hover { background:var(--gray-50); }

/* ── Pipeline section card ── */
        .pp-section { background:var(--surface);border:1px solid var(--border-card);border-radius:var(--radius);margin-bottom:16px;overflow:hidden; }
        .pp-head { display:flex;align-items:center;gap:10px;padding:14px 20px;border-bottom:1px solid var(--gray-100); }
        .pp-dot { width:8px;height:8px;border-radius:50%;flex-shrink:0; }
        .pp-dot.idle { background:var(--gray-300); }
        .pp-dot.live { background:#10b981;animation:pipeLive 1.8s ease-in-out infinite; }
        .pp-title { font-size:13px;font-weight:700;color:var(--text);letter-spacing:-0.01em; }
        .pp-badge { font-family:var(--font-mono);font-size:8px;font-weight:700;padding:2px 8px;border-radius:var(--radius-full);letter-spacing:0.05em;text-transform:uppercase; }
        .pp-badge.idle { background:var(--gray-100);color:var(--text-muted); }
        .pp-badge.running { background:rgba(255,180,0,0.12);color:#FFB400; }
        .pp-badge.active { background:rgba(16,185,129,0.1);color:#10b981; }
        .pp-controls { display:flex;align-items:center;gap:8px;margin-left:auto; }
        .pp-freq-label { font-family:var(--font-mono);font-size:9px;font-weight:600;color:var(--text-muted);letter-spacing:0.03em; }
        input.pp-freq-input[type="number"] {
          width:36px;padding:4px 2px;border:1px solid var(--gray-200);border-radius:6px;
          font-size:12px;font-weight:700;text-align:center;font-family:var(--font-mono);
          color:var(--text);background:var(--surface);
          transition:border-color 0.15s;
          -moz-appearance:textfield;
        }
        input.pp-freq-input::-webkit-outer-spin-button,
        input.pp-freq-input::-webkit-inner-spin-button { -webkit-appearance:none;margin:0; }
        input.pp-freq-input[type="number"]:focus { border-color:#FFB400;outline:none; }
        .pp-body { padding:0 20px; }
        .pp-toggle { font-size:10px;color:#FFB400;cursor:pointer;font-weight:600;user-select:none; }

        /* ── Pipeline row ── */
        .pp-row { display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--gray-50); }
        .pp-row:last-child { border-bottom:none; }
        .pp-row-num { font-family:var(--font-mono);font-size:9px;font-weight:700;width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all 0.2s; }
        .pp-row-num.pending { color:var(--text-muted);background:var(--gray-100); }
        .pp-row-num.active { color:#FFB400;background:rgba(255,180,0,0.12);animation:pulse 1.5s ease-in-out infinite; }
        .pp-row-num.done { color:#10b981;background:rgba(16,185,129,0.1); }
        .pp-row-num.error { color:var(--red);background:rgba(239,68,68,0.1); }
        .pp-row-dot { width:6px;height:6px;border-radius:50%;flex-shrink:0; }
        .pp-row-dot.live { background:#10b981;animation:pipeLive 1.8s ease-in-out infinite; }
        .pp-row-dot.sched { background:#3b82f6; }
        .pp-row-dot.idle { background:var(--gray-300); }
        .pp-row-body { flex:1;min-width:0; }
        .pp-row-name { font-size:11.5px;font-weight:600;color:var(--text); }
        .pp-row-meta { font-family:var(--font-mono);font-size:9px;color:var(--text-muted);margin-top:1px; }
        .pp-row-source { font-family:var(--font-mono);font-size:8px;font-weight:600;color:var(--text-muted);background:var(--gray-100);padding:1px 5px;border-radius:var(--radius-full);margin-left:4px; }
        .pp-row-freq { display:flex;align-items:center;gap:3px;flex-shrink:0; }
        .pp-row-tag { font-family:var(--font-mono);font-size:8px;font-weight:700;padding:2px 6px;border-radius:var(--radius-full);letter-spacing:0.04em;text-transform:uppercase;flex-shrink:0; }
        .pp-row-tag.cont { background:rgba(16,185,129,0.08);color:#10b981; }
        .pp-row-tag.sched { background:rgba(59,130,246,0.08);color:#3b82f6; }
        .pp-row-tag.trigger { background:rgba(139,92,246,0.08);color:#8b5cf6; }

        /* ── Log panel ── */
        .pp-log { padding:0 20px 12px; }
        .pp-log-title { font-family:var(--font-mono);font-size:8px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.08em;margin-bottom:4px;padding-top:8px;border-top:1px solid var(--gray-50);cursor:pointer;display:flex;align-items:center;gap:4px; }
        .pp-log-entries { max-height:120px;overflow-y:auto;scrollbar-width:thin; }
        .pp-log-entry { display:flex;align-items:baseline;gap:8px;padding:2px 0;font-size:10px; }
        .pp-log-time { font-family:var(--font-mono);font-size:9px;color:var(--text-muted);flex-shrink:0;min-width:110px; }
        .pp-log-msg { color:var(--text);flex:1; }
        .pp-log-msg.ok { color:#10b981; }
        .pp-log-msg.err { color:var(--red); }

        /* ── Report block ── */
        .pp-report { padding:10px 20px 14px;border-top:1px solid var(--gray-100); }
        .pp-report-row { display:flex;justify-content:space-between;align-items:center;padding:2px 0;font-size:10.5px; }
        .pp-report-label { color:var(--text-muted); }
        .pp-report-value { font-family:var(--font-mono);font-weight:600;color:var(--text); }

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

/* extracted free inline styles (css-verify) */
.setf-1 { position:relative;z-index:1; }
.setf-2 { font-size:10px;color:var(--accent);cursor:pointer;font-weight:600; }
.setf-3 { opacity:0.4; }
.setf-4 { opacity:0.3; }
.setf-5 { opacity:0.5; }
.setf-6 { font-weight:600; }
.setf-7 { min-width:0; }
.setf-8 { opacity:0.35; }
.setf-9 { font-weight:600;text-decoration:line-through; }
.setf-10 { color:#10b981; }
.setf-11 { color:var(--amber); }
input.pp-freq-input[type="number"].setf-12 { width:44px; }
input.pp-freq-input[type="number"].setf-13 { width:48px; }
.setf-14 { accent-color:#FFB400; }
.setf-15 { cursor:default; }
.setf-16 { flex:1; }
.pipeline-card .pipe-status.setf-17 { font-size:10px;min-height:0; }

/* ── Lab economy v2 settings group (class-based; replaces inline ec_inp/ec_grp) ── */
.lab-econ-input {
  width: 100%; max-width: 78px; padding: 4px 4px; border: 1px solid var(--gray-200); border-radius: 6px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; text-align: center;
  color: var(--text); background: var(--surface); outline: none; transition: border-color 0.15s;
  -moz-appearance: textfield;  /* hide the spinner arrows so the value isn't clipped */
}
.lab-econ-input::-webkit-outer-spin-button,
.lab-econ-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lab-econ-input:focus { border-color: #FFB400; }
/* Rate-limit inputs use an "∞" placeholder = unlimited. Make it clearly visible so
   it shows the instant the field is emptied (no save needed), not a faint grey hint. */
.lab-econ-input::placeholder { color: #FFB400; opacity: 0.85; font-weight: 700; font-size: 14px; }
.lab-econ-input:placeholder-shown { border-style: dashed; border-color: rgba(255, 180, 0, 0.45); }
/* Invalid input flagged by save-time validation */
.lab-econ-input.ec-invalid { border-color: var(--red); border-style: solid; background: rgba(239, 68, 68, 0.08); }

/* Multi-line free-text tunable (e.g. accepted funds tokens) — spans both value
   columns instead of the numeric pre/post inputs. */
.lab-econ-text {
  width: 100%; min-height: 66px; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 6px;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5; text-align: left;
  color: var(--text); background: var(--surface); outline: none; resize: vertical;
  white-space: pre; overflow-wrap: normal;
}
.lab-econ-text:focus { border-color: #FFB400; }
.lab-econ-text:placeholder-shown { border-style: dashed; border-color: rgba(255, 180, 0, 0.45); }
.lab-econ-text::placeholder { color: var(--text-muted); font-weight: 400; }
/* Single-line variant (chain RPC / id / name) — compact, no vertical resize. */
.lab-econ-line { min-height: 0; white-space: nowrap; overflow-x: auto; resize: none; }

/* Fixed table layout so long setting descriptions WRAP instead of pushing the value
   columns off-screen. ID specificity overrides the extracted .setc-* inline styles
   (which load after this file). Setting col takes the rest; the others are bounded. */
#lab-economy-section table.setc-41 { table-layout: fixed; }
#lab-economy-section table.setc-41 th:nth-child(2) { width: 92px; }   /* Category */
#lab-economy-section table.setc-41 th:nth-child(3),
#lab-economy-section table.setc-41 th:nth-child(4) { width: 88px; }   /* Pre-TGE / Post-TGE */
#lab-economy-section .setc-43 { word-break: break-word; overflow-wrap: anywhere; }
#lab-economy-section .setc-45 { white-space: normal; }
/* Mobile: the economy config tables are wider than a phone and were being
   CLIPPED (cut off) by an overflow:hidden ancestor. Make the table itself the
   horizontal scroll box so every column stays reachable, and slim the value
   columns so the setting-name column keeps room. */
@media (max-width: 900px) {
  /* Both economy config tables (one is outside #lab-economy-section) become their
     own horizontal scroll box so no column is clipped off-screen. ≤900px covers
     the drawer band where the page is full-width and these wide tables don't fit. */
  table.setc-41 {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    min-width: 0; max-width: 100%;
  }
  #lab-economy-section table.setc-41 th:nth-child(2) { width: 72px; }
  #lab-economy-section table.setc-41 th:nth-child(3),
  #lab-economy-section table.setc-41 th:nth-child(4) { width: 68px; }
}
/* Section + group header notes span the full-width colspan cell — defeat the table's
   global nowrap so the long descriptions wrap instead of overflowing/clipping. */
#lab-economy-section .lab-econ-section, #lab-economy-section .lab-econ-section small,
#lab-economy-section .lab-econ-grp, #lab-economy-section .lab-econ-grp-note {
  white-space: normal; overflow-wrap: anywhere;
}
/* Per-phase value columns (Pre-TGE | Post-TGE) sit side by side. The column matching
   the live phase is highlighted gold so it's clear which one the engines read now. */
.ec-col-head { color: var(--text-muted); }
.ec-col-head.ec-col-active { color: #FFB400; }
.lab-econ-input.ec-col-active { border-color: rgba(255, 180, 0, 0.55); background: rgba(255, 180, 0, 0.07); }

/* "What the toggle changes" info panel under the phase selector */
.ec-phase-info {
  margin: 10px 0 18px; padding: 0 14px;
  border: 1px solid var(--border-card); border-radius: 8px; background: var(--gray-50);
}
.ec-phase-info > summary {
  cursor: pointer; padding: 12px 0; list-style: none;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.ec-phase-info > summary::marker, .ec-phase-info > summary::-webkit-details-marker { display: none; }
/* +/- toggle (matches the shared .rf-acc accordion). */
.ec-phase-info > summary::after { content: "+"; margin-left: auto; font-family: var(--font-mono); font-size: 16px; font-weight: 400; line-height: 1; color: #FFB400; }
.ec-phase-info[open] > summary::after { content: "\2212"; }
.ec-pi-grid { display: grid; grid-template-columns: 130px 1fr 1fr; column-gap: 14px; padding: 4px 0 10px; }
.ec-pi-head {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700; padding-bottom: 6px;
}
.ec-pi-head.ec-pi-pre, .ec-pi-head.ec-pi-post { color: #FFB400; }
.ec-pi-aspect, .ec-pi-c { padding: 7px 0; border-top: 1px solid var(--border-card); font-size: 11px; line-height: 1.45; }
.ec-pi-aspect { font-weight: 700; color: var(--text); }
.ec-pi-c { color: var(--text-secondary); }
.ec-pi-c code { font-family: var(--font-mono); font-size: 10px; }
.ec-pi-note {
  font-size: 11px; line-height: 1.5; color: var(--text-secondary);
  padding: 10px 0; border-top: 1px solid var(--border-card);
}
.ec-pi-note.ec-pi-warn { color: var(--text-muted); }
@media (max-width: 640px) { .ec-pi-grid { grid-template-columns: 1fr; } .ec-pi-aspect { padding-bottom: 0; border-bottom: none; } }
.lab-econ-grp {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  color: #FFB400; font-weight: 700; padding: 10px 10px 4px; background: var(--gray-50);
}
.lab-econ-grp-note {
  display: block; margin-top: 3px; font-family: var(--font-body); font-size: 11px;
  font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-secondary); line-height: 1.5;
}
/* Top-level Lab-economy section divider (Instant / Retrospective / Global) */
.lab-econ-section {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text); font-weight: 800; padding: 16px 10px 6px; background: var(--gray-100);
  border-top: 2px solid #FFB400;
}
.lab-econ-section small {
  display: block; font-size: 8px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: none; color: var(--text-muted); margin-top: 2px;
}

/* Sub-pool % rows nested under the "Split into sub-pools" toggle (shown only when split is on). */
.ec-subrow .setc-44 { padding-left: 16px; position: relative; }
.ec-subrow .setc-44::before { content: "\21B3"; position: absolute; left: 0; color: var(--text-muted); opacity: 0.6; }
