:root {
  --paper: #f5f3ee;
  --surface: #ffffff;
  --ink: #16140f;
  --muted: rgba(22, 20, 15, 0.58);
  --faint: rgba(22, 20, 15, 0.38);
  --line: rgba(22, 20, 15, 0.1);
  --line2: rgba(22, 20, 15, 0.18);
  --copper: #b4622d;
  --copper-soft: #f3e4d8;
  --green: #1f7a4d;
  --green-soft: #e3f1e9;
  --red: #b3261e;
  --red-soft: #f8e3e1;
  --r: 6px;
  --rc: 12px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.label { margin: 0; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: 8px; flex-wrap: wrap; }
[hidden] { display: none !important; }

/* header */
.top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: var(--paper); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.tag { color: var(--muted); font-size: 13.5px; }
.spacer { flex: 1; }
.net { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.net i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.wallet {
  font: 500 12.5px var(--mono); border: 1px solid var(--line2); background: var(--surface);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--ink);
}

main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 24px; }

/* buttons */
.btn {
  font: 500 14px var(--sans); border-radius: var(--r); padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--surface); color: var(--ink);
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: #2c2920; }
.btn.ghost { padding: 7px 10px; font-size: 13px; }
.btn.kill { width: 100%; margin: 14px 0 8px; border-color: var(--red); color: var(--red); background: var(--surface); }
.btn.kill:hover { background: var(--red-soft); }
.btn.kill.on { background: var(--red); color: #fff; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rc); padding: 18px; }

/* onboarding */
.onboard { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: start; padding-top: 24px; }
.intro h1 { font-weight: 500; font-size: clamp(32px, 4.2vw, 52px); line-height: 1.04; letter-spacing: -0.025em; margin: 8px 0 18px; }
.lede { font-size: 17px; color: var(--muted); max-width: 34em; margin: 0 0 28px; }
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 34em; }
.how li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: baseline; padding: 12px 0; border-top: 1px dashed var(--line2); color: var(--muted); }
.how b { font: 500 13px var(--mono); color: var(--copper); }
.setup { padding: 8px 20px; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 18px 0; }
.step + .step { border-top: 1px solid var(--line); }
.step h3 { margin: 2px 0 4px; font-weight: 500; font-size: 16px; }
.step p { margin: 0 0 12px; }
.step .n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line2); display: grid; place-items: center; font: 500 12px var(--mono); }
.step.done .n { background: var(--green); color: #fff; border-color: var(--green); }
.step.locked { opacity: .45; pointer-events: none; }
.bal { margin-left: 10px; font: 500 13px var(--mono); color: var(--green); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
label { font-size: 12.5px; color: var(--muted); display: grid; gap: 4px; }
.inp { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line2); border-radius: var(--r); padding: 0 10px; background: var(--surface); color: var(--muted); font-family: var(--mono); }
.inp:focus-within { border-color: var(--ink); }
.inp input { border: 0; outline: 0; font: 500 14px var(--mono); padding: 8px 0; width: 100%; background: transparent; color: var(--ink); }
.mlist { display: grid; gap: 4px; margin: 6px 0 16px; }
.mopt { display: grid; grid-template-columns: 20px 1fr auto 86px; gap: 10px; align-items: center; padding: 7px 8px; border-radius: var(--r); }
.mopt:hover { background: var(--paper); }
.mopt .nm { font-size: 14px; color: var(--ink); }
.mopt .nm small { display: block; color: var(--muted); font-size: 12px; }
.mopt .pr { font: 12.5px var(--mono); color: var(--muted); }
.mopt .inp input { padding: 5px 0; font-size: 13px; }
.mopt input[type="checkbox"] { accent-color: var(--ink); width: 16px; height: 16px; }

/* console */
.console { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.col { display: grid; gap: 18px; }
.big { font-size: 40px; font-weight: 500; letter-spacing: -0.02em; margin: 6px 0 12px; }
.meter { height: 6px; border-radius: 3px; background: var(--paper); overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--copper); transition: width .5s; }
#aTodayTxt { margin: 6px 0 0; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 16px 0 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.allowance.paused .big { color: var(--faint); }
.merchants { display: grid; gap: 12px; margin-top: 10px; }
.mrow .top2 { display: flex; justify-content: space-between; font-size: 13.5px; gap: 8px; }
.mrow .top2 .mono { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mrow .bar { height: 3px; background: var(--paper); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.mrow .bar div { height: 100%; background: var(--ink); width: 0; transition: width .5s; }
.mrow.off .top2 span:first-child { color: var(--faint); text-decoration: line-through; }
.mrow.flash .bar div { background: var(--copper); }

/* agent feed */
.agent { display: flex; flex-direction: column; min-height: 640px; }
.feed { flex: 1; display: flex; flex-direction: column; gap: 10px; margin: 14px 0; overflow-y: auto; max-height: 62vh; padding-right: 4px; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 26em; }
.msg { padding: 12px 14px; border-radius: var(--rc); line-height: 1.55; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--paper); max-width: 80%; }
.msg.bot { background: var(--paper); max-width: 92%; }
.msg.bot strong { font-weight: 600; }
.msg.err { background: var(--red-soft); color: var(--red); }
.buy { border: 1px solid var(--line); border-radius: var(--rc); padding: 10px 12px; display: grid; gap: 6px; font-size: 13.5px; }
.buy .h { display: flex; justify-content: space-between; gap: 8px; }
.buy .h b { font-weight: 500; }
.buy .h .mono { color: var(--muted); font-size: 12.5px; }
.buy .in { font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps span { font: 500 11.5px var(--mono); padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--faint); }
.steps span.on { color: var(--ink); border-color: var(--line2); }
.steps span.ok { color: var(--green); background: var(--green-soft); border-color: transparent; }
.steps span.no { color: var(--red); background: var(--red-soft); border-color: transparent; }
.buy .why { color: var(--red); font-size: 12.5px; }
.buy .tx { font: 12px var(--mono); color: var(--green); text-decoration: none; }
.buy .tx:hover { text-decoration: underline; }
.summary { font: 12.5px var(--mono); color: var(--muted); padding: 4px 2px; border-top: 1px dashed var(--line2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font: 13px var(--sans); border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 11px; cursor: pointer; color: var(--muted); text-align: left; }
.chip:hover { color: var(--ink); border-color: var(--line2); }
.ask { display: flex; gap: 8px; align-items: flex-end; }
.ask textarea { flex: 1; resize: none; font: 15px/1.45 var(--sans); border: 1px solid var(--line2); border-radius: var(--r); padding: 10px 12px; outline: 0; background: var(--surface); color: var(--ink); }
.ask textarea:focus { border-color: var(--ink); }
.ask .btn { padding: 11px 18px; }

/* receipt tape */
.tape {
  background: #fffdf8; position: relative; padding: 18px 18px 14px;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  --zz: radial-gradient(circle at 6px 0, transparent 5px, #fffdf8 5.5px);
}
.tape::before, .tape::after { content: ""; position: absolute; left: 0; right: 0; height: 8px; background: var(--zz); background-size: 12px 8px; }
.tape::before { top: -8px; transform: rotate(180deg); }
.tape::after { bottom: -8px; }
.tape-head { text-align: center; padding-bottom: 10px; border-bottom: 1px dashed var(--line2); }
.tape-head .label { color: var(--ink); letter-spacing: .02em; }
.tape-head p { margin: 0; }
.tape-body { font: 12.5px/1.45 var(--mono); max-height: 60vh; overflow-y: auto; }
.tline { padding: 9px 0; border-bottom: 1px dashed var(--line); display: grid; gap: 2px; }
.tline .a { display: flex; justify-content: space-between; gap: 8px; }
.tline .b { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; }
.tline a { color: var(--muted); }
.tline.new { animation: print .8s ease-out; }
.tline.sys .a { color: var(--muted); }
@keyframes print { from { background: var(--copper-soft); } to { background: transparent; } }
.tape-empty { color: var(--muted); text-align: center; padding: 24px 0; font: 12.5px var(--mono); }
.tape-foot { border-top: 1px dashed var(--line2); padding-top: 10px; margin-top: 4px; font-size: 12.5px; display: grid; gap: 4px; }
.tape-foot div { display: flex; justify-content: space-between; gap: 8px; }
.tape-foot span { color: var(--muted); }
.tape-foot b { font-weight: 500; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r); font-size: 13.5px; max-width: 92vw;
}
.toast a { color: #e7b48f; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 24px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }

@media (max-width: 1120px) {
  .console { grid-template-columns: 280px minmax(0, 1fr); }
  .col.right { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  main { padding: 16px; }
  .top { padding: 12px 16px; gap: 10px; }
  .tag, .net { display: none; }
  .onboard { grid-template-columns: 1fr; gap: 24px; padding-top: 4px; }
  .console { grid-template-columns: minmax(0, 1fr); }
  .col.mid { order: -1; }
  .agent { min-height: 0; }
  .feed { max-height: none; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .mopt { grid-template-columns: 20px 1fr 76px; }
  .mopt .pr { display: none; }
  .foot { padding: 16px; }
}

.loading { display: grid; place-items: center; gap: 10px; padding: 18vh 0; }
.loading img { animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(12deg); } }
.note { font-size: 12.5px; color: var(--muted); padding: 0 4px; font-style: italic; white-space: pre-wrap; }
