/* Leash — site styles */
:root {
  --bg: #eef1ef;
  --paper: #ffffff;
  --ink: #0f1e1b;
  --muted: #5b6b67;
  --line: #d3dad7;
  --soft: #e3e8e5;
  --teal: #0e6b5c;
  --teal-dark: #0a4f44;
  --ok: #1e8f5f;
  --stop: #e8501a;
  --ask: #b97d12;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --font-head: "Sora", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, monospace;
  --wrap: 1160px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.3rem, 5.2vw, 4.2rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 650; }
h3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.section { padding: 88px 0; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 58ch; }
.page-head { padding: 64px 0 36px; }
.page-head .lead { margin: 0; }
.sim-note { font-size: 0.82rem; color: var(--muted); }
.sim-tag { display: inline-block; font-size: 0.72rem; font-weight: 600; color: var(--muted); border: 1px dashed #b7c2be; border-radius: 999px; padding: 1px 8px; vertical-align: middle; letter-spacing: 0.03em; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(238, 241, 239, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.logo svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 0.95rem; }
.nav a:hover { color: var(--ink); background: var(--soft); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.kill-pill { display: none; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: #fff; background: var(--stop); border-radius: 999px; padding: 5px 12px; text-decoration: none; }
.kill-pill.on { display: inline-flex; }
.menu-btn { display: none; margin-left: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); text-decoration: none; font-weight: 600; font-size: 0.95rem; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-sm { padding: 7px 14px; font-size: 0.86rem; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- stamps (the signature element) ---------- */
.stamp {
  display: inline-block; font-family: var(--font-head); font-weight: 800; font-size: 0.72rem; letter-spacing: 0.08em;
  padding: 3px 9px; border: 2px solid currentColor; border-radius: 6px; transform: rotate(-3deg); white-space: nowrap; line-height: 1.3;
}
.stamp.allowed { color: var(--ok); }
.stamp.blocked { color: var(--stop); }
.stamp.approval { color: var(--ask); transform: rotate(2deg); }
.stamp.big { font-size: 1.05rem; padding: 6px 14px; border-width: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .stamp.fresh { animation: stampIn 0.45s cubic-bezier(.2,1.6,.4,1); }
}
@keyframes stampIn { from { transform: scale(2.2) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(-3deg); opacity: 1; } }

/* ---------- hero ---------- */
.hero { padding: 72px 0 88px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.hero-grid > * { min-width: 0; }
.hero h1 { max-width: 12ch; }
.hero .lead { margin-bottom: 28px; }

.checker { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 8px; box-shadow: 0 24px 50px -32px rgba(15, 30, 27, 0.45); }
.checker-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-size: 0.88rem; color: var(--muted); }
.checker-head strong { color: var(--ink); font-family: var(--font-head); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; border-top: 1px solid var(--soft); }
.check .what { font-weight: 600; }
.check .why { font-size: 0.85rem; color: var(--muted); }
.dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 0.72rem var(--font-head); flex: none; }
.checker-foot { padding: 12px 14px 8px; border-top: 1px solid var(--soft); font-size: 0.8rem; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }

/* ---------- budget meter ---------- */
.meter { height: 8px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width 0.6s ease; }
.meter.warn span { background: var(--ask); }
.meter.full span { background: var(--stop); }
.meter-row { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 6px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.stat { padding: 24px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-value { font-family: var(--font-head); font-size: clamp(1.45rem, 2.5vw, 2rem); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.9rem; }

/* ---------- rule list on home ---------- */
.rule-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; margin-top: 32px; }
.rule-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 20px 0; border-top: 1px solid var(--line); }
.rule-item h3 { margin: 0; }
.rule-item .eg { font-family: var(--font-num); font-size: 0.88rem; color: var(--teal); text-align: right; }
.rule-item p { grid-column: 1 / -1; color: var(--muted); margin: 0; }

/* ---------- steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 32px; }
.step-num { font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; margin-bottom: 16px; }
.step p { color: var(--muted); margin: 0; }

/* ---------- kill switch ---------- */
.kill-band { background: var(--ink); color: #e7eeeb; border-radius: var(--radius-lg); padding: 48px; display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
.kill-band .lead { color: #a9b8b3; margin: 0; }
.switch-big { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.kill-switch {
  position: relative; width: 132px; height: 64px; border-radius: 999px; border: 0; cursor: pointer;
  background: #33433f; box-shadow: inset 0 2px 6px rgba(0,0,0,.45); transition: background 0.2s;
}
.kill-switch::after {
  content: ""; position: absolute; top: 6px; left: 6px; width: 52px; height: 52px; border-radius: 50%;
  background: #f4f7f6; box-shadow: 0 3px 8px rgba(0,0,0,.35); transition: transform 0.25s cubic-bezier(.3,1.4,.5,1);
}
.kill-switch[aria-checked="true"] { background: var(--stop); }
.kill-switch[aria-checked="true"]::after { transform: translateX(68px); }
.kill-state { font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; }
.kill-state.on { color: #ff8a5c; }

/* ---------- panels / dashboard ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.dash-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.kill-inline { display: flex; align-items: center; gap: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px 8px 8px; }
.kill-inline .kill-switch { width: 72px; height: 36px; }
.kill-inline .kill-switch::after { width: 28px; height: 28px; top: 4px; left: 4px; }
.kill-inline .kill-switch[aria-checked="true"]::after { transform: translateX(36px); }
.kill-inline .kill-state { color: var(--ink); font-size: 0.9rem; }
.kill-inline .kill-state.on { color: var(--stop); }
.agents { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.agent { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.agent.paused { background: #f6f8f7; }
.agent-top { display: flex; gap: 12px; align-items: center; }
.agent-top h3 { margin: 0; }
.agent-top .muted { font-size: 0.85rem; line-height: 1.35; }
.agent-state { margin-left: auto; font-size: 0.78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #dff1e8; color: var(--ok); white-space: nowrap; }
.agent-state.off { background: #fde5dc; color: var(--stop); }
.agent .btn-row { margin-top: auto; }
.dash-grid { display: grid; grid-template-columns: 1fr 360px; gap: 24px; margin-top: 24px; align-items: start; }
.dash-grid > * { min-width: 0; }
.pending-item { padding: 14px 0; border-top: 1px solid var(--soft); }
.pending-item:first-of-type { border-top: 0; }
.pending-item .what { font-weight: 600; }
.pending-item .why { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* ---------- activity table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toolbar h2, .toolbar h3 { margin: 0; }
select { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
table.log { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.log th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.8rem; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.log td { padding: 12px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.log tr:last-child td { border-bottom: 0; }
.log .amt { text-align: right; font-family: var(--font-num); }
.log .reason { color: var(--muted); font-size: 0.86rem; }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who .dot { width: 22px; height: 22px; font-size: 0.6rem; }

/* ---------- rules editor ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tab { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.rules-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 24px; align-items: start; }
.rules-grid > * { min-width: 0; }
.field { padding: 18px 0; border-top: 1px solid var(--soft); }
.field:first-of-type { border-top: 0; padding-top: 0; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.field-head label, .field-head .label { font-weight: 600; }
.field-head output { font-family: var(--font-num); font-weight: 500; color: var(--teal); }
.field .hint { font-size: 0.84rem; color: var(--muted); margin-top: 6px; }
input[type="range"] { width: 100%; accent-color: var(--teal); }
input[type="number"], input[type="text"] { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; width: 100%; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 0.9rem; user-select: none; }
.check-chip input { accent-color: var(--teal); margin: 0; }
.check-chip:has(input:checked) { border-color: var(--teal); background: #e3f1ed; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.toggle { position: relative; width: 44px; height: 24px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: #c5cfcb; transition: background 0.2s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle input:checked + span { background: var(--teal); }
.toggle input:checked + span::after { transform: translateX(20px); }
.toggle input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.hours { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.hours input { width: 90px; }
.save-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--soft); }
.saved-msg { color: var(--ok); font-weight: 600; font-size: 0.9rem; }
.tester .result { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius-md); background: var(--bg); margin: 16px 0; min-height: 72px; }
.tester .result .why { font-size: 0.92rem; }
.sample { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--soft); font-size: 0.9rem; }
.sticky { position: sticky; top: 88px; }

/* ---------- token ---------- */
.burn { text-align: center; padding: 88px 0 64px; }
.burn-num { font-family: var(--font-head); font-weight: 700; font-size: clamp(3rem, 10vw, 7rem); letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.plan { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; }
.plan.active { border: 2px solid var(--teal); padding: 27px; }
.plan .hold { font-family: var(--font-head); font-weight: 650; font-size: 1.6rem; margin: 6px 0 4px; }
.plan ul { list-style: none; padding: 0; margin: 16px 0 0; }
.plan li { padding: 8px 0; border-top: 1px solid var(--soft); color: var(--muted); }
.uses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 32px; }
.uses p { color: var(--muted); margin: 0; }
.note { border-left: 3px solid var(--teal); padding: 12px 16px; background: var(--paper); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--muted); }

/* ---------- docs ---------- */
.docs-layout { display: grid; grid-template-columns: 210px 1fr; gap: 56px; align-items: start; padding-bottom: 96px; }
.docs-layout > * { min-width: 0; }
.docs-nav { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; }
.docs-nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.93rem; }
.docs-nav a:hover { color: var(--ink); background: var(--soft); }
.docs-body section { padding-bottom: 44px; scroll-margin-top: 96px; }
.docs-body p, .docs-body li { max-width: 68ch; }
:not(pre) > code { background: var(--soft); padding: 1px 6px; border-radius: 4px; font: 0.88em var(--font-num); }
.code { position: relative; background: var(--ink); color: #dce6e2; border-radius: var(--radius-md); }
.code pre { margin: 0; padding: 20px; overflow-x: auto; font: 0.86rem/1.7 var(--font-num); }
.code .copy { position: absolute; top: 10px; right: 10px; background: #22322e; color: #dce6e2; border-color: #33433f; }
.tok-k { color: #7fd6c2; } .tok-s { color: #ffc98a; } .tok-c { color: #7f918b; }
details.faq { border-top: 1px solid var(--line); }
details.faq:last-of-type { border-bottom: 1px solid var(--line); }
details.faq summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 1.3rem; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { padding-bottom: 16px; margin: 0; color: var(--muted); }

/* ---------- toast + footer ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 0.92rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 100; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.site-footer { border-top: 1px solid var(--line); padding: 44px 0; color: var(--muted); font-size: 0.9rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.disclaimer { margin-top: 20px; font-size: 0.82rem; max-width: 72ch; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .rules-grid, .dash-grid, .docs-layout { grid-template-columns: 1fr; }
  .agents, .plans, .uses { grid-template-columns: 1fr; }
  .sticky, .docs-nav { position: static; }
  .docs-nav { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 768px) {
  .section { padding: 60px 0; }
  .wrap { padding: 0 16px; }
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .nav.open { display: flex; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .rule-list, .steps { grid-template-columns: 1fr; }
  .kill-band { grid-template-columns: 1fr; padding: 32px 24px; text-align: center; }
  .kill-band .lead { margin: 0 auto; }
  /* activity table → stacked rows */
  table.log thead { display: none; }
  table.log, .log tbody, .log tr, .log td { display: block; width: 100%; }
  .log tr { padding: 12px 0; border-bottom: 1px solid var(--soft); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .log td { border: 0; padding: 0; }
  .log td.time { display: none; }
  .log td.amt { text-align: right; }
  .log td.verdict { grid-column: 2; grid-row: 1; justify-self: end; }
  .log td.reason { grid-column: 1 / -1; }
}
