:root {
  color-scheme: light;
  --paper: #f6f5f0;
  --ink: #202722;
  --muted: #526056;
  --line: #d9ddd4;
  --accent: #dbef90;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  padding: 16px max(5vw, 16px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #242c25;
  color: white;
}
.brand { color: white; text-decoration: none; font-size: 21px; font-weight: 900; }
.brand strong { font-size: 14px; font-weight: 500; }
.brand span { color: var(--accent); }
nav { display: flex; gap: 5px; }
nav button { background: transparent; color: white; border-color: #727d72; }
nav button[aria-pressed="true"] { color: var(--ink); background: var(--accent); border-color: var(--accent); }
main { width: min(1260px, 90%); margin: 32px auto 56px; }
.title { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 23px; }
h1 { margin: 0; font-size: clamp(33px, 5vw, 64px); line-height: 1; letter-spacing: -.05em; }
h2 { margin: 0; font-size: 20px; }
p { color: var(--muted); line-height: 1.45; margin: 8px 0 0; }
button, input, select { font: inherit; color: inherit; padding: 10px 12px; border: 1px solid #a6afa2; border-radius: 7px; background: white; }
button { cursor: pointer; }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 3px solid #487c37; outline-offset: 2px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
article, .leads, aside { background: white; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
article { padding: 16px; display: grid; gap: 8px; }
article:first-child { background: #e9f3cc; }
article h2, article small { font-size: 13px; color: var(--muted); }
article strong { font-size: clamp(23px, 3vw, 37px); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
a { color: #365431; }
.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; gap: 14px; margin-top: 18px; }
.padding, aside { padding: 18px; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 14px; }
label { display: grid; font-size: 13px; gap: 4px; }
input, select { min-width: 0; width: 100%; }
.list-title, li { padding: 12px 18px; border-top: 1px solid var(--line); }
.list-title, .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row label { display: flex; align-items: center; gap: 7px; }
.row input { width: auto; }
.row small { display: block; color: var(--muted); }
.row > span:last-child { text-align: right; font-size: 13px; color: var(--muted); }
ul { list-style: none; margin: 0; padding: 0; }
aside button { display: block; width: 100%; margin-top: 8px; }
aside label { margin-top: 14px; }
aside ol { padding-left: 22px; font-size: 13px; }
aside li { padding: 7px 0; }
.badge { display: inline-block; background: #edf1e7; border-radius: 100px; padding: 3px 9px; font-size: 13px; }
.primary { background: var(--accent); color: var(--ink); border-color: #8da54b; font-weight: 700; margin-top: 14px; }
#more { margin: 12px 18px; }
#estimate { font-size: 13px; }
.segments { flex-wrap: wrap; margin-top: 14px; }
.segments button { color: var(--ink); background: white; }
.row .open-lead { font-size: 13px; padding: 6px 9px; }
.row-actions { display: flex; align-items: center; justify-content: end; gap: 8px; flex-wrap: wrap; }
.row-actions small { text-align: right; }
dialog { width: min(530px, calc(100% - 28px)); max-height: 85vh; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 21px; }
dialog::backdrop { background: #20272299; }
dialog form { display: flex; justify-content: end; margin-bottom: 10px; }
dialog a { display: inline-block; margin-top: 12px; }
#balance-connect { margin-top: 8px; width: 100%; }
#balance-form { display: grid; gap: 10px; }
#balance-result:empty { display: none; }
.outcome-feed { margin-top: 16px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.outcome-feed li { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) minmax(160px, 1.3fr); gap: 14px; }
.outcome-feed small { display: block; margin-top: 5px; color: var(--muted); }
.outcome-feed .confirmed { color: #365431; }
.mobile-queue { display: none; }
@media (max-width: 760px) {
  .outcome-feed li { grid-template-columns: 1fr; gap: 9px; }
}
@media (max-width: 760px) {
  main { width: calc(100% - 28px); margin-top: 22px; margin-bottom: 95px; }
  .title { align-items: start; flex-direction: column; }
  .layout { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #queue { scroll-margin-top: 12px; }
  .mobile-queue {
    display: flex;
    position: fixed;
    z-index: 2;
    inset: auto 0 0;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 14px max(8px, env(safe-area-inset-bottom));
    background: #242c25;
    color: white;
  }
  .mobile-queue a { padding: 10px 13px; background: var(--accent); border-radius: 7px; color: var(--ink); font-weight: 700; text-decoration: none; }
}
.setup { width: min(480px, calc(100% - 28px)); }
.setup form { margin-top: 24px; display: grid; gap: 12px; }
.setup #setup-continue { display: inline-block; margin-top: 16px; }
.panel-tabs { margin-bottom: 22px; flex-wrap: wrap; }
.panel-tabs button { background: white; color: var(--ink); border-color: var(--line); }
.panel-tabs button[aria-pressed="true"] { background: var(--accent); border-color: #8da54b; color: var(--ink); }
.history-filters { display: flex; gap: 8px; margin-bottom: 14px; }
.history-run summary { cursor: pointer; }
.history-run summary strong { margin-inline-end: 8px; }
.history-run ol { padding: 0; list-style: none; }
.history-run li { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 8px; border-top: 1px solid var(--line); padding: 12px 0; }
.history-run li small { display: block; color: var(--muted); }
.script-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(250px, 1fr); gap: 14px; align-items: start; }
.script-panel { min-width: 0; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 18px; }
.script-panel label { max-width: 430px; }
#script-copy h2 { margin-top: 20px; }
#script-copy blockquote { margin: 10px 0 0; padding: 14px 16px; border-left: 4px solid #8da54b; background: #f1f5e8; line-height: 1.5; }
#script-copy ol { padding: 0 0 0 23px; }
#script-copy li { padding: 9px 0; line-height: 1.5; }
#script-settings { margin-bottom: 0; }
#script-settings > div { border-top: 1px solid var(--line); padding: 10px 0; }
#script-settings dt { font-size: 13px; color: var(--muted); }
#script-settings dd { margin: 4px 0 0; line-height: 1.4; }
@media (max-width: 760px) {
  .script-layout { grid-template-columns: 1fr; }
  .history-run li { grid-template-columns: 1fr; }
  .panel-tabs { margin-bottom: 16px; }
}
