/* Pinch Impact Report — config page. Design translated from the approved mockup:
   light #eef1f4 canvas, white cards, navy #0e2233, action blue #1d4e89,
   Instrument Sans + Spline Sans Mono. */

:root {
  /* Pinch brand: deep navy #002E50, cream #F3F3EB, pink accent #FFB3EC */
  --navy: #002E50;
  --ink: #12283f;
  --ink-mid: #40536a;
  --ink-soft: #566577;
  --ink-faint: #6a7889;
  --ink-mute: #8a96a5;
  --blue: #124a7e;
  --blue-soft: #eef4f9;
  --blue-wash: #edf3f8;
  --pink: #FFB3EC;
  --pink-soft: #ffe6f8;
  --canvas: #F3F3EB;
  --card: #ffffff;
  --line: #e4e2d8;
  --line-soft: #eeece2;
  --line-mid: #e7e5db;
  --input-border: #d3d2c6;
  --input-bg: #fbfbf7;
  --green: #17936a;
  --green-glow: #5fd4a2;
  --amber: #d99a2b;
  --red: #cf4f38;
  --mono: 'Spline Sans Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  color: var(--ink);
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--navy); text-decoration: underline; }
input, select, button { font-family: inherit; }
input:focus, select:focus { outline: 2px solid #1d4e8955; outline-offset: 1px; }
.hidden { display: none !important; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--line-soft); border-radius: 5px; padding: 1px 5px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 58px; flex: none;
}
.brandline { display: flex; align-items: center; gap: 13px; }
.brand-logo { height: 20px; width: auto; display: block; }
.brand-divider { width: 1px; height: 18px; background: rgba(255,255,255,.22); }
.brand-word { font-weight: 700; letter-spacing: .22em; font-size: 17px; }
.brand-sub { color: #c9d5df; font-size: 14px; font-weight: 500; letter-spacing: .01em; }
.conn-pill {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; color: #c8d6e2;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 99px; padding: 6px 14px;
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #8b98a7; }
.conn-dot.ok { background: var(--green-glow); box-shadow: 0 0 6px var(--green-glow); }
.conn-dot.bad { background: var(--red); box-shadow: 0 0 6px var(--red); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.tools-link { color: #cdd8df; font-size: 13px; text-decoration: none; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: 5px 12px; }
.tools-link:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #c8d6e2;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 99px; padding: 4px 6px 4px 4px;
}
.user-pic { width: 24px; height: 24px; border-radius: 50%; }
.user-email { font-family: var(--mono); font-size: 12px; padding-left: 4px; }
.signout-btn {
  border: none; cursor: pointer; border-radius: 99px; padding: 4px 10px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 12px;
}
.signout-btn:hover { background: rgba(255,255,255,.22); }

/* ── Layout ─────────────────────────────────────────────────────── */
.layout {
  width: 100%; max-width: 1220px; margin: 0 auto;
  padding: 30px 28px 60px;
  display: grid; grid-template-columns: minmax(0,1fr) 336px; gap: 24px; align-items: start;
}
.layout.one-col { grid-template-columns: minmax(0,720px); justify-content: center; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 3px rgba(14,34,51,.05); overflow: hidden;
}

.card-head { padding: 26px 30px 20px; border-bottom: 1px solid var(--line-soft); }
.card-head h1 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.01em; color: var(--navy); position: relative; padding-left: 14px; }
.card-head h1::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 3px; background: var(--pink); }
.card-head p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-soft); }

.step { padding: 24px 30px; border-bottom: 1px solid var(--line-soft); }
.step.step-last { border-bottom: none; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff;
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center; flex: none;
}
.step-title { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mid); }
.step-actions { margin-left: auto; display: flex; gap: 16px; }
.linkbtn { background: none; border: none; color: var(--blue); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }

/* ── Merchants ──────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; border: 1px solid var(--input-border); border-radius: 10px;
  padding: 11px 14px; font-size: 14px; background: var(--input-bg); color: var(--ink);
}
.suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(14,34,51,.14); z-index: 20;
  max-height: 262px; overflow-y: auto;
}
.suggestion {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  cursor: pointer; border-bottom: 1px solid #f2f4f7;
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover, .suggestion.focused { background: #f4f7fa; }
.suggestion .sid {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  background: var(--line-soft); border-radius: 6px; padding: 3px 7px; min-width: 30px; text-align: center;
}
.suggestion .sname { font-size: 14px; font-weight: 500; flex: 1; }
.suggestion .sadd { font-size: 12px; color: var(--blue); font-weight: 600; }
.suggestion.none { color: #7a8797; font-size: 13px; cursor: default; }
.suggestion.none:hover { background: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); background: var(--input-bg);
  border-radius: 99px; padding: 7px 8px 7px 13px;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #c3ccd5; }
.chip .dot.testing { background: var(--amber); animation: pulse 1s infinite; }
.chip .dot.ok { background: var(--green); }
.chip .dot.fail { background: var(--red); }
.chip .cname { font-size: 13.5px; font-weight: 600; }
.chip .cid { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.chip .test {
  border: none; background: var(--line-soft); color: var(--ink-mid);
  border-radius: 99px; font-size: 11px; font-weight: 600; padding: 4px 9px; cursor: pointer;
}
.chip .remove { border: none; background: none; color: var(--ink-mute); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; }
.chip .remove:hover { color: var(--navy); }
.muted-note { margin: 12px 0 0; font-size: 13px; color: var(--ink-mute); }

/* ── Segmented controls ─────────────────────────────────────────── */
.seg { display: inline-flex; background: var(--line-soft); border-radius: 10px; padding: 3px; gap: 3px; }
.seg-btn {
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--ink-soft);
}
.seg-btn.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(14,34,51,.15); }

/* ── Reporting window ───────────────────────────────────────────── */
#mode-seg { margin-bottom: 16px; }
.fields { display: flex; gap: 16px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-mid); }
.field select, .field input {
  border: 1px solid var(--input-border); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; background: var(--input-bg); color: var(--ink); min-width: 170px;
}
.field select { min-width: 200px; }
#f-span-custom { min-width: 130px; width: 150px; }
.runs-strip {
  margin-top: 16px; background: var(--blue-wash); border: 1px solid #d9e5f0;
  border-radius: 10px; padding: 11px 14px; font-size: 13.5px; color: #2a4058;
  display: flex; gap: 10px; align-items: baseline;
}
.runs-tag { font-weight: 700; font-size: 12px; letter-spacing: .06em; color: var(--blue); flex: none; }

/* ── Scope ──────────────────────────────────────────────────────── */
.mod-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
@media (max-width: 720px) { .mod-grid { grid-template-columns: 1fr; } }
.mod-card {
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 13px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 5px;
  user-select: none;
}
.mod-card.on { border-color: var(--blue); background: var(--blue-soft); }
.mod-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mod-name { font-size: 14px; font-weight: 700; }
.switch { width: 32px; height: 18px; border-radius: 99px; position: relative; flex: none; background: #c3ccd5; transition: background .15s; }
.mod-card.on .switch { background: var(--blue); }
.knob {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s;
}
.mod-card.on .knob { left: 16px; }
.mod-desc { font-size: 12px; color: var(--ink-faint); line-height: 1.45; }

.scope-row { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-mid); margin-bottom: 6px; }
.sev-help { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-faint); max-width: 420px; line-height: 1.5; }
.sev-warn {
  margin: 8px 0 0; font-size: 12.5px; color: #9a6a1f; background: #fdf6e7;
  border: 1px solid #f0e2c0; border-radius: 8px; padding: 8px 12px; max-width: 420px;
}
.cost-field { max-width: 190px; }
.topn-field { max-width: 210px; }
.topn-field select { min-width: 150px; }
#f-topn-custom {
  margin-top: 8px; border: 1px solid var(--input-border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; background: var(--input-bg); color: var(--ink); width: 150px; min-width: 0;
}
.cost-wrap {
  display: flex; align-items: center; border: 1px solid var(--input-border);
  border-radius: 10px; background: var(--input-bg); overflow: hidden;
}
.cost-symbol { padding: 10px 0 10px 12px; color: var(--ink-mute); font-size: 14px; }
.cost-wrap input { border: none; background: none; padding: 10px 12px 10px 6px; font-size: 14px; width: 90px; min-width: 0; color: var(--ink); }
.cost-wrap input:focus { outline: none; }
.cost-wrap:focus-within { outline: 2px solid #1d4e8955; outline-offset: 1px; }
.field-hint { font-weight: 400; color: var(--ink-mute); font-size: 12px; }

/* ── Card footer ────────────────────────────────────────────────── */
.card-foot {
  display: flex; align-items: center; gap: 16px; padding: 18px 30px;
  background: #faf9f3; border-top: 1px solid var(--line-soft);
}
.summary { flex: 1; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.generate {
  border: none; border-radius: 10px; padding: 13px 26px; font-size: 15px; font-weight: 700;
  color: #fff; background: var(--navy); cursor: pointer; box-shadow: 0 2px 6px rgba(14,34,51,.2);
}
.generate:disabled { background: #a9b4bf; cursor: not-allowed; }

/* ── Sidebar ────────────────────────────────────────────────────── */
.side { display: flex; flex-direction: column; gap: 20px; }
.side-card { padding: 20px 22px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.side-head h2, .runs-title { margin: 0; font-size: 15px; font-weight: 700; }
.runs-title { margin-bottom: 12px; }
.btn-outline {
  background: none; border: 1px solid var(--input-border); border-radius: 8px;
  color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; padding: 5px 10px;
}
.btn-outline:hover { background: var(--blue-wash); }
#btn-recheck { margin-top: 14px; font-size: 13px; padding: 9px 14px; }
.setup-steps { margin: 0 0 4px 20px; padding: 0; font-size: 13.5px; line-height: 1.9; }

.preset-list { display: flex; flex-direction: column; gap: 8px; }
.preset {
  border: 1.5px solid var(--line-mid); background: #fff; border-radius: 10px;
  padding: 10px 13px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.preset:hover { border-color: var(--blue); }
.preset.active { border-color: var(--blue); background: var(--blue-soft); }
.preset .pname { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.preset .pbadge { font-size: 10.5px; font-weight: 700; color: var(--blue); background: #e3edf7; border-radius: 99px; padding: 2px 8px; }
.preset .psummary { font-size: 12px; color: var(--ink-faint); }

.runs-empty {
  border: 1.5px dashed #d5dde4; border-radius: 10px; padding: 18px 14px;
  text-align: center; font-size: 12.5px; color: var(--ink-mute); line-height: 1.5;
}
.run-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.run {
  border: 1px solid var(--line-mid); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 7px;
}
.run-top { display: flex; align-items: center; gap: 8px; }
.run .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #c3ccd5; }
.run .dot.running { background: var(--amber); animation: pulse 1s infinite; }
.run .dot.done { background: var(--green); }
.run .dot.failed { background: var(--red); }
.run .rtitle { font-size: 13px; font-weight: 700; flex: 1; }
.run .rtime { font-size: 11.5px; color: var(--ink-mute); font-family: var(--mono); }
.run .rdetail { font-size: 12px; color: var(--ink-faint); }
.progress-track { height: 5px; background: var(--line-soft); border-radius: 99px; overflow: hidden; margin-bottom: 5px; }
.progress-bar { height: 100%; background: var(--blue); border-radius: 99px; transition: width .3s; width: 0; }
.run .rstage { font-size: 11.5px; color: var(--blue); font-weight: 600; }
.run-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.run .rstatus { font-size: 12px; font-weight: 700; }
.run .rstatus.done { color: var(--green); }
.run .rstatus.failed { color: var(--red); }
.run-links a, .run-links .rerun { font-size: 12px; font-weight: 600; }
.run .rerun { background: none; border: none; color: var(--blue); cursor: pointer; padding: 0; }
.run .rerun:hover { text-decoration: underline; }
.run .dl { color: var(--ink-faint); }

/* ── Diagnostics modal ──────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(14,34,51,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
}
.modal-card {
  background: #fff; border-radius: 16px; max-width: 760px; width: 100%;
  max-height: 84vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(14,34,51,.35);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-body { padding: 18px 24px; overflow-y: auto; }
.diag-section h3 { margin: 14px 0 8px; font-size: 13px; font-weight: 700; color: var(--ink-mid); }
.diag-section:first-child h3 { margin-top: 0; }
.diag-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.diag-table th {
  text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); padding: 6px 10px; border-bottom: 1px solid var(--line-soft); background: #fbfcfd;
}
.diag-table td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); font-family: var(--mono); font-size: 12px; }
.diag-warn { font-size: 12.5px; color: #9a6a1f; background: #fdf6e7; border: 1px solid #f0e2c0; border-radius: 8px; padding: 8px 12px; margin: 0 0 8px; }
.error-box {
  background: #fdf0ed; border: 1px solid #eecfc7; color: #8a3324;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
}
.muted { color: var(--ink-mute); }
.small { font-size: 12.5px; }
