/* LEASH — ledger paper and a control room.
   Hairline rules instead of cards, ink instead of chrome, and one colour
   (safety orange) reserved for limits and attacks so it always means danger. */

:root {
  --paper: #f4f1ea;
  --paper-2: #ece8de;
  --ink: #111114;
  --ink-2: #3a3a3f;
  --ink-3: #6b6b70;
  --rule: #cfc9bb;
  --signal: #d8481f;
  --signal-ink: #8f2c10;
  --ok: #1f6f4a;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "IBM Plex Mono", Menlo, monospace;
  --sans: "Helvetica Neue", Inter, ui-sans-serif, system-ui, sans-serif;
  --step: clamp(0.75rem, 0.7rem + 0.2vw, 0.875rem);
  --col: minmax(0, 1fr);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  font-feature-settings: "tnum" 1, "cv05" 1;
}

.skip {
  position: absolute; left: -9999px;
}
.skip:focus { left: 1rem; top: 1rem; background: var(--ink); color: var(--paper); padding: .5rem .75rem; z-index: 10; }

/* ------------------------------------------------------------------ chrome */
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.mark { width: 26px; height: 26px; color: var(--ink); flex: none; }
.wordmark { font-weight: 700; letter-spacing: .22em; font-size: .95rem; }
.tagline {
  color: var(--ink-3); font-size: var(--step);
  padding-left: .9rem; border-left: 1px solid var(--rule);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.netbadge {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-2);
  border: 1px solid var(--rule); padding: .28rem .55rem; border-radius: 2px;
  white-space: nowrap;
}
.netbadge.live { border-color: var(--ok); color: var(--ok); }
.netbadge.dead { border-color: var(--signal); color: var(--signal-ink); }

/* ------------------------------------------------------------------- layout */
main { padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 3rem) 4rem; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr) minmax(0, .9fr);
  gap: clamp(1.25rem, 3vw, 3rem);
  align-items: start;
}
@media (max-width: 1080px) { .grid { grid-template-columns: 1fr 1fr; } .attack-col { grid-column: 1 / -1; } }
@media (max-width: 720px)  { .grid { grid-template-columns: 1fr; } }

.col { min-width: 0; }
.col + .col { border-left: 1px solid var(--rule); padding-left: clamp(1rem, 2.5vw, 2.5rem); }
@media (max-width: 720px) { .col + .col { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 1.5rem; } }

.col-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; border-bottom: 1px solid var(--ink); padding-bottom: .5rem; margin-bottom: 1.25rem;
}
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: .95rem; letter-spacing: .16em; text-transform: uppercase; }

.lede { color: var(--ink-2); max-width: 60ch; margin: .9rem 0 1.75rem; }
.lede.small { font-size: var(--step); margin: .2rem 0 1rem; }
.dim { color: var(--ink-3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .82rem; }
.signal { color: var(--signal-ink); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------------- setup */
.panel.wide { max-width: 62rem; }
.field { display: block; margin-bottom: .5rem; }
.field-label {
  display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: .45rem;
}
textarea {
  width: 100%; resize: vertical; padding: .9rem 1rem;
  background: #fbf9f4; color: var(--ink);
  border: 1px solid var(--ink); border-radius: 2px;
  font-family: var(--mono); font-size: .88rem; line-height: 1.5;
}
textarea:focus { outline: 2px solid var(--signal); outline-offset: 1px; }

.hint { color: var(--ink-3); font-size: var(--step); margin: .4rem 0 1.2rem; }
.hint code, .proof code { font-family: var(--mono); font-size: .78rem; background: var(--paper-2); padding: .05rem .25rem; }

.presets { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.preset {
  font: inherit; font-size: var(--step); cursor: pointer;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--rule); border-radius: 2px; padding: .35rem .6rem;
}
.preset:hover { border-color: var(--ink); color: var(--ink); }

.actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.actions.stack { flex-direction: column; align-items: stretch; margin-top: 1.5rem; }

button.primary, button.danger, button.secondary {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  padding: .7rem 1.1rem; border-radius: 2px; border: 1px solid var(--ink);
  transition: transform .06s ease, background .15s ease;
}
button.primary { background: var(--ink); color: var(--paper); }
button.primary:hover { background: #000; }
button.primary:active { transform: translateY(1px); }
button.danger { background: transparent; color: var(--signal-ink); border-color: var(--signal); }
button.danger:hover { background: var(--signal); color: #fff; }
/* Housekeeping, not a decision the agent makes: no box, just ink and a
   hairline. It sits under the two real actions without pretending to be one. */
button.secondary {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  color: var(--ink-2);
  font-weight: 500;
  padding: .5rem .1rem;
  align-self: flex-start;
}
button.secondary:hover { color: var(--ink); border-bottom-color: var(--ink); }
button.secondary:active { transform: none; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button:focus-visible, .attack:focus-visible, summary:focus-visible {
  outline: 2px solid var(--signal); outline-offset: 2px;
}

.status { color: var(--ink-3); font-size: var(--step); font-family: var(--mono); }
.status.err { color: var(--signal-ink); }

.steps { list-style: none; margin: 1.75rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.steps li {
  display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .75rem;
  padding: .55rem 0; border-bottom: 1px solid var(--rule); font-size: var(--step);
  animation: rise .25s ease both;
}
.steps li .n { font-family: var(--mono); color: var(--ink-3); }
.steps li .s { color: var(--ink-3); font-family: var(--mono); }
.steps li.done .s { color: var(--ok); }
.steps li.fail .s { color: var(--signal-ink); }
.steps li.active .s { color: var(--ink); }

/* -------------------------------------------------------------------- leash */
.leash {
  display: grid; grid-template-columns: 1fr 3.5rem 1fr;
  align-items: stretch; gap: .5rem; margin-bottom: 1.5rem;
}
.vault, .agent {
  border: 1px solid var(--ink); border-radius: 2px; padding: .9rem;
  display: flex; flex-direction: column; gap: .25rem; min-width: 0;
  background: #fbf9f4;
}
.vault { border-left-width: 4px; }
.agent { border-right-width: 4px; }
.vault-label, .agent-label {
  font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
}
.vault-value { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.vault-sub, .agent-value, .agent-sub { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.agent-sub { font-size: var(--step); }

.tether { position: relative; display: flex; align-items: center; justify-content: center; }
.tether svg { width: 100%; height: 100%; min-height: 84px; }
.tether-allowance {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--paper); padding: .15rem .3rem; font-size: .68rem;
  color: var(--signal-ink); white-space: nowrap;
}

.facts { margin: 0 0 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.facts > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .45rem 0; border-bottom: 1px solid var(--rule); min-width: 0;
}
.facts dt { color: var(--ink-3); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.facts dd { margin: 0; text-align: right; min-width: 0; }

.proof { margin-top: 1.5rem; border-top: 1px solid var(--rule); padding-top: .75rem; }
.proof summary { cursor: pointer; font-size: var(--step); color: var(--ink-2); }
.txs { list-style: none; padding: 0; margin: .75rem 0 .5rem; }
.txs li { padding: .3rem 0; border-bottom: 1px dotted var(--rule); font-family: var(--mono); font-size: .74rem; }
.txs a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); }
.txs a:hover { color: var(--signal-ink); border-color: var(--signal); }

/* ------------------------------------------------------------------- record */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 4.2rem 1fr; gap: .9rem;
  padding: .7rem 0; border-bottom: 1px solid var(--rule);
  animation: rise .25s ease both;
}
.timeline .t { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); padding-top: .15rem; }
.timeline .body { min-width: 0; }
.timeline .kind {
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); display: block; margin-bottom: .15rem;
}
.timeline .text { font-size: .86rem; color: var(--ink); }
.timeline .meta { margin-top: .25rem; font-family: var(--mono); font-size: .72rem; color: var(--ink-3); }
.timeline li.spend .kind { color: var(--ok); }
.timeline li.refused .kind, .timeline li.attack .kind { color: var(--signal-ink); }
.timeline li.empty { display: block; color: var(--ink-3); font-size: var(--step); }

/* ------------------------------------------------------------------ attacks */
.attacks { display: grid; gap: .5rem; }
.attack {
  text-align: left; cursor: pointer; font: inherit;
  background: #fbf9f4; border: 1px solid var(--rule); border-left: 3px solid var(--signal);
  border-radius: 2px; padding: .65rem .8rem;
  display: flex; flex-direction: column; gap: .15rem;
  transition: border-color .12s ease, background .12s ease;
}
.attack:hover { border-color: var(--signal); background: #fdf6f3; }
.attack:disabled { opacity: .5; }
.a-name { font-weight: 600; font-size: .86rem; }
.a-desc { color: var(--ink-3); font-size: .76rem; }

.verdict {
  margin-top: 1.25rem; border-top: 1px solid var(--ink); padding-top: .9rem;
}
.verdict h3 { margin: 0 0 .4rem; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; }
.verdict .v-line { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dotted var(--rule); font-family: var(--mono); font-size: .76rem; }
.verdict .v-line span:first-child { color: var(--ink-3); }
.verdict .v-text { margin-top: .7rem; font-size: .84rem; color: var(--ink-2); }
.verdict .v-refused { color: var(--ok); font-weight: 600; }
.verdict .v-passed { color: var(--signal-ink); font-weight: 600; }

/* ------------------------------------------------------------------ footers */
.colophon {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--ink); padding: .9rem clamp(1rem, 4vw, 3rem);
  color: var(--ink-3); font-size: .72rem; letter-spacing: .04em;
}

@keyframes rise { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
