:root {
  --bg: #0c0f0f;
  --panel: #141a19;
  --panel-2: #1b2322;
  --line: #263130;
  --ink: #eaf2f0;
  --muted: #8aa09d;
  --yellow: #ffd400;
  --green: #35d07f;
  --red: #ff5c5c;
  --blue: #5b9dff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #16201e, var(--bg));
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
code { color: var(--yellow); font-family: "Space Mono", ui-monospace, monospace; }

.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(12,15,15,.85); backdrop-filter: blur(8px); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--yellow);
  color: #111; font-weight: 800; display: grid; place-items: center;
}
.brand__name { font-weight: 700; letter-spacing: .2px; }
.brand__tag { color: var(--muted); font-size: 13px; }
.nav__status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.viewtabs { display: flex; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.viewtab { border: none; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; }
.viewtab--on { background: var(--yellow); color: #111; }

.pill {
  border: 1px solid var(--line); background: var(--panel);
  padding: 6px 10px; border-radius: 999px; font-size: 12px; color: var(--muted);
}

.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: #3a4a48; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--y { background: var(--yellow); color: #111; border-color: var(--yellow); }
.btn--full { width: 100%; margin-top: 12px; }

.notice {
  margin: 16px 24px 0; padding: 12px 14px; border-left: 3px solid var(--yellow);
  background: var(--panel); border-radius: 8px; color: var(--muted); font-size: 13px; line-height: 1.5;
}

.grid {
  display: grid; gap: 16px; padding: 20px 24px;
  grid-template-columns: repeat(3, 1fr);
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
}
.card--wide { grid-column: 1 / -1; }
.card h2 { margin: 0 0 12px; font-size: 15px; }

.kv { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 14px; }
.kv span { color: var(--muted); }
.kv b { font-family: "Space Mono", monospace; font-weight: 500; }

.row { display: flex; gap: 8px; margin-top: 12px; }
input, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  font-family: "Space Mono", monospace;
}
.lbl { display: block; color: var(--muted); font-size: 12px; margin: 12px 0 6px; }

.tabs { display: flex; gap: 8px; margin-bottom: 6px; }
.tab {
  flex: 1; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  padding: 8px; border-radius: 10px; cursor: pointer; font-weight: 600;
}
.tab--on { background: var(--ink); color: #111; border-color: var(--ink); }

.quote { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.hint { color: var(--muted); font-size: 12px; min-height: 16px; margin: 8px 0 0; word-break: break-all; }
.muted { color: var(--muted); font-size: 13px; }

.hold { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hold b { font-family: "Space Mono", monospace; }

.events { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.evt {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.evt .evt__top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.evt .buy { color: var(--green); } .evt .sell { color: var(--red); }
.evt code { color: var(--blue); font-size: 12px; }

.pos { color: var(--green); } .neg { color: var(--red); }

/* Inline helper hints next to headings + block explainers */
.help { font-weight: 400; font-size: 12px; color: var(--muted); }
.help--block { display: block; margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; }
.card h2 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

/* Execution stepper */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.step {
  position: relative; border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.step__ic {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); transition: color .2s, border-color .2s, background .2s;
}
.step__ic svg { width: 18px; height: 18px; display: block; }
.step__title { font-weight: 700; font-size: 13px; }
.step__desc { color: var(--muted); font-size: 12px; line-height: 1.45; }
.step__body { flex: 1; }
.step__st {
  align-self: flex-start; font-size: 11px; font-family: "Space Mono", monospace;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
}
.step--active {
  border-color: var(--yellow); box-shadow: 0 0 0 1px var(--yellow), 0 8px 24px rgba(255,212,0,.08);
  transform: translateY(-2px);
}
.step--active .step__ic { color: var(--yellow); border-color: var(--yellow); background: rgba(255,212,0,.08); }
.step--active .step__st { color: #111; background: var(--yellow); border-color: var(--yellow); }
.step--done { border-color: #2b5f45; }
.step--done .step__ic { color: var(--green); border-color: #2b5f45; }
.step--done .step__st { color: var(--green); border-color: #2b5f45; }
.step--error { border-color: var(--red); }
.step--error .step__st { color: var(--red); border-color: var(--red); }
.step--error .step__bar > span { background: var(--red); }

/* Per-step progress bar */
.step__bar { margin-top: 8px; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.step__bar > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--muted); }
.step--active .step__bar > span { background: var(--yellow); }
.step--done .step__bar > span { width: 100% !important; background: var(--green); transition: none; }

/* Live TEE enclave console */
.tee-console {
  margin-top: 16px; border: 1px solid var(--line); border-radius: 12px;
  background: #0a0e0d; overflow: hidden; font-family: "Space Mono", ui-monospace, monospace;
}
.tee-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.tee-dot { width: 9px; height: 9px; border-radius: 50%; background: #3a4744; }
.tee-console.is-live .tee-dot { background: var(--green); animation: teePulse 1.4s infinite; }
@keyframes teePulse {
  0% { box-shadow: 0 0 0 0 rgba(53,208,127,.5); }
  70% { box-shadow: 0 0 0 6px rgba(53,208,127,0); }
  100% { box-shadow: 0 0 0 0 rgba(53,208,127,0); }
}
.tee-title { font-size: 12px; color: var(--ink); letter-spacing: .02em; }
.tee-mr { margin-left: auto; font-size: 11px; color: var(--muted); }
.tee-log { height: 156px; overflow-y: auto; padding: 10px 12px; font-size: 12px; line-height: 1.75; color: #9fe6c0; }
.tee-log:empty::before { content: "awaiting trade\2026"; color: var(--muted); }
.tee-line { white-space: pre-wrap; opacity: 0; animation: teeIn .18s ease forwards; }
@keyframes teeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.tee-ts { color: #4f6b64; margin-right: 8px; }
.tee-line--warn { color: var(--yellow); }
.tee-line--ok { color: var(--green); }
.tee-line--info { color: var(--blue); }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--green);
  color: var(--ink); padding: 10px 14px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: opacity .3s; max-width: 320px;
}
.toast--err { border-left-color: var(--red); }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}
