:root {
  color-scheme: dark;
  --bg: #031811;
  --panel: #0c241e;
  --line: #245258;
  --text: #fbfbfd;
  --muted: #add0d6;
  --accent: #46c6d1;
  --green: #99e8c5;
  font-family: system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(ellipse 78% 32rem at 55% -16rem, #135c7f, transparent), var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #baffef; outline-offset: 3px; }
[hidden] { display: none !important; }

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 1.7rem;
  padding: .6rem max(1rem, calc((100vw - 1512px) / 2));
  border-bottom: 1px solid var(--line);
  background: #12211fe8;
}
.brand img { display: block; width: 128px; height: auto; }
.topbar nav { display: flex; gap: 1.2rem; color: var(--muted); font-size: .88rem; }
.selected { color: var(--text); }
.mode {
  margin-left: auto;
  white-space: nowrap;
  padding: .34rem .68rem;
  border: 1px solid #57a299;
  border-radius: .5rem;
  background: #234642;
  color: #cffff4;
  font-size: .78rem;
}
main { max-width: 1544px; margin: auto; padding: 1.2rem 1rem 3rem; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.45rem, 3.5vw, 2.05rem); letter-spacing: -.045em; line-height: 1.12; }
.intro p { margin-top: .25rem; color: var(--muted); font-size: .85rem; }

.market {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(.95rem, 3vw, 2.2rem);
  margin-bottom: .75rem;
  padding: .65rem .85rem;
  border: 1px solid #446763;
  border-radius: .72rem;
  background: linear-gradient(110deg, #234440, #152a27 72%);
}
.market-symbol { display: flex; align-items: center; gap: .65rem; white-space: nowrap; }
.market-symbol div { display: grid; gap: .15rem; }
.market-symbol small, .dock-caption { color: var(--muted); font-size: .76rem; }
.coin {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: #a9efdc;
  color: #18372f;
  font-weight: 800;
}
.market dl {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem clamp(.9rem, 3.5vw, 2.3rem);
  margin: 0;
}
.market dt, .market dd { font-size: .81rem; text-align: left; white-space: nowrap; }
.market dd { margin-top: .15rem; }
.positive { color: var(--green); }
.negative { color: #f4a7b4; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin-bottom: .75rem; }
.metrics > div { display: grid; gap: .2rem; border: 1px solid var(--line); border-radius: .6rem; padding: .52rem .75rem; background: #142a27; }
.metrics span { font-size: .77rem; }
.metrics strong { font-size: clamp(1rem, 2.5vw, 1.24rem); letter-spacing: -.02em; }
.metrics small { font-size: .65em; color: var(--muted); }

.desk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 365px); gap: .75rem; }
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: .72rem;
  padding: .88rem;
  background: linear-gradient(143deg, #1b3431 0%, var(--panel) 65%);
  box-shadow: 0 12px 36px #07131145;
}
.panel-heading { display: flex; align-items: center; gap: .65rem; margin-bottom: 1rem; }
.panel-heading img { width: 1.8rem; height: 1.8rem; object-fit: contain; }
.panel-heading h2 { font-size: 1.12rem; letter-spacing: -.025em; }
.panel-heading p { font-size: .81rem; margin-top: .16rem; }
.metrics span, .panel-heading p, .chart-title > span, .chart-axis, dt, .fine, .empty { color: var(--muted); }

.chart-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .45rem; margin-bottom: .65rem; }
.switcher { display: flex; align-items: center; gap: .18rem; }
.switcher button { background: transparent; border: 1px solid transparent; border-radius: .4rem; padding: .31rem .54rem; font-size: .81rem; color: var(--muted); }
.switcher button:hover { color: var(--text); background: #264340; }
.switcher button[aria-pressed=true] { border-color: #4d827c; color: #d6fff5; background: #284c48; }
.periods button { padding-inline: .39rem; }
.chart-title, .chart-axis, .ratio-label, .order-summary div { display: flex; justify-content: space-between; gap: .5rem; }
.chart-title { align-items: baseline; flex-wrap: wrap; font-size: .81rem; }
.chart-title strong { color: #d6fff5; white-space: nowrap; }
.chart { margin: .45rem 0 .85rem; }
.chart svg { display: block; width: 100%; height: clamp(18rem, 31vw, 29rem); overflow: visible; }
.grid { fill: none; stroke: #325955; stroke-width: .85; }
#chart-line { fill: none; stroke: #96ffe7; stroke-width: 2.4; vector-effect: non-scaling-stroke; }
#chart-dot { fill: #dffff8; }
.chart-axis { padding-top: .24rem; font-size: .76rem; }
.chart-stage, .market-chart { position: relative; min-width: 0; }
.market-chart svg { margin: .35rem 0; overflow: hidden; }
.market-chart text { fill: var(--muted); font: 11px system-ui, sans-serif; }
.market-chart .up { fill: #7bd6bb; stroke: #7bd6bb; }
.market-chart .down { fill: #e48b9f; stroke: #e48b9f; }
.market-chart line { vector-effect: non-scaling-stroke; }
.market-chart .volume { opacity: .36; }
.market-chart .crosshair { stroke: #a0e2d8; stroke-dasharray: 4 3; opacity: .75; pointer-events: none; }
.chart-tooltip {
  position: absolute;
  z-index: 2;
  max-width: calc(100% - .7rem);
  padding: .4rem .55rem;
  border: 1px solid #4d827c;
  border-radius: .38rem;
  background: #142a27ea;
  color: #e6fcf8;
  box-shadow: 0 6px 18px #05100e75;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.chart-status, .chart-readout { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.chart-status { padding-top: .24rem; }
.chart-readout { display: flex; flex-wrap: wrap; gap: .36rem .65rem; }
.inventory { border-color: #47716d; }

.inventory label, .ratio-label { font-size: .87rem; font-weight: 600; }
.inventory-input { display: flex; gap: .55rem; margin-top: .35rem; }
.inventory-input input { width: 100%; min-width: 0; padding: .5rem .65rem; background: #0e211e; border: 1px solid var(--line); border-radius: .45rem; }
.quiet, .presets button { border: 1px solid #456e6a; border-radius: .45rem; background: #1a3431; padding: .46rem .63rem; white-space: nowrap; }
.quiet:hover, .presets button:hover { background: #2b514d; }
.ratio-label output { color: #bffff0; }
#ratio { width: 100%; margin: .65rem 0; accent-color: #91ffe5; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: .38rem; }
.presets button { padding: .36rem .16rem; font-size: .84rem; }
.presets button[aria-pressed=true] { background: #31645e; border-color: #80ffe1; }
.order-summary { display: grid; gap: .55rem; border-top: 1px solid var(--line); margin: .9rem 0 .5rem; padding-top: .76rem; font-size: .87rem; }
dd { margin: 0; font-weight: 600; text-align: right; }
#adjustment { color: #bcffef; }
.primary { border: 1px solid #b7ffee; border-radius: .48rem; background: linear-gradient(110deg, #abffeb, #8affe4); color: #142c29; padding: .63rem .72rem; font-weight: 750; }
.primary:hover:not(:disabled) { filter: brightness(1.12); }
#review { width: 100%; }
.fine, .feedback { font-size: .78rem; line-height: 1.45; margin-top: .5rem; }
.feedback { color: var(--green); min-height: 1.1em; margin-bottom: .3rem; }
.feedback[data-error=true] { color: #ffb9b9; }

.activity { margin-top: .75rem; }
.empty { border-top: 1px solid var(--line); padding-top: .75rem; }
.activity table { border-collapse: collapse; width: 100%; font-size: .84rem; }
.activity th, .activity td { text-align: left; padding: .57rem .3rem; border-top: 1px solid var(--line); }
.activity th { color: var(--muted); font-weight: 500; }
.activity table td:nth-child(2) { color: #bffff0; }
dialog { width: min(30rem, calc(100vw - 2rem)); border: 1px solid #639691; border-radius: .85rem; background: #1a322f; color: var(--text); padding: 1.25rem; }
dialog::backdrop { background: #071513cc; }
dialog h2 { margin-bottom: .6rem; }
dialog p { color: var(--muted); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: 1rem; }

@media (max-width: 760px) {
  .desk-grid { grid-template-columns: 1fr; }
  .topbar { gap: .85rem; }
  .topbar nav { gap: .65rem; }
  .chart svg { height: clamp(15rem, 47vw, 23rem); }
}
@media (max-width: 460px) {
  .topbar { padding-inline: .75rem; }
  .brand img { width: 72px; }
  .topbar nav, .mode { font-size: .71rem; }
  main { padding-inline: .65rem; }
  .market { align-items: flex-start; gap: .65rem; padding: .62rem; }
  .market dl { gap: .38rem .65rem; }
  .market dt, .market dd, .market-symbol small { font-size: .7rem; }
  .market-symbol strong { font-size: .85rem; }
  .metrics { gap: .4rem; }
  .metrics > div { padding: .4rem; }
  .panel { padding: .7rem; }
  .intro { align-items: flex-start; }
  .switcher button { padding-inline: .32rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.ohlc-row{display:flex;align-items:baseline;justify-content:space-between;gap:.5rem;flex-wrap:wrap;margin-top:.4rem;color:var(--muted);font-size:.74rem;font-variant-numeric:tabular-nums}
#market-ohlc{color:#d0e8e5}.market-feed{font-size:.72rem;color:var(--muted);white-space:nowrap}.market dl{flex-wrap:wrap}
@media(max-width:740px){.market{flex-wrap:wrap}.market dl{order:3;width:100%;justify-content:space-between;gap:.55rem}.market-feed{margin-left:auto}}

/* Terminal layout */
:root{--bg:#0c1312;--panel:#121d1c;--line:#263836;--text:#edfaf8;--muted:#a1bdba;--accent:#baffef;--green:#86dfba}
body{background:radial-gradient(ellipse 72% 20rem at 56% -14rem,#254844,transparent),var(--bg)}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.topbar{min-height:54px;background:#101817;border-color:#243432}
.topbar .reset{padding:.35rem .6rem;font-size:.75rem;background:transparent}
main{padding-top:1rem}
.market{justify-content:flex-start;gap:1.45rem;padding:.65rem .85rem;border-radius:.6rem;background:#111b1a}
.market-symbol strong{font-size:.93rem;letter-spacing:.035em}.coin{background:#243e37;color:#aaf4d5}
.market dl{gap:clamp(.8rem,2.6vw,2.3rem)}.market dd{font-variant-numeric:tabular-nums}
.market-feed{margin-left:auto}
.desk-grid{grid-template-columns:minmax(0,1fr) minmax(345px,.37fr);gap:.7rem;align-items:start}
.panel{background:var(--panel);border-color:var(--line);border-radius:.65rem;box-shadow:none}
.inventory{padding:.9rem}.chart-stage svg{height:clamp(19rem,48vh,34rem);margin-top:.55rem}
.chart-stage .grid{opacity:.38}.market-chart text{fill:#9bb8b5}
.metrics{gap:0;padding:.55rem 0;margin:0 0 .7rem;border-block:1px solid var(--line)}
.metrics>div{padding:.25rem .65rem;border:0;border-radius:0;background:transparent}.metrics>div+div{border-left:1px solid var(--line)}
.metrics span{font-size:.75rem}.metrics strong{font-size:1rem;font-variant-numeric:tabular-nums}
.ticket{padding:.85rem;max-height:calc(100dvh - 138px);overflow:auto;scrollbar-width:thin;scrollbar-color:#374846 transparent}
.ticket-modes{display:grid;grid-template-columns:1fr 1fr;margin-bottom:.8rem;padding:.22rem;background:#0f1817;border:1px solid var(--line);border-radius:.5rem}
.ticket-modes button{padding:.48rem .65rem;font-weight:650}.ticket-modes button[aria-pressed=true]{background:#233a38;color:#d6fff5;border-color:#446965}
.ticket .primary{background:#b9ffef;border-color:#b9ffef;color:#11211f}
.activity{margin-top:.7rem}
.option-readiness{margin-bottom:.75rem;border:1px solid var(--line);border-radius:.55rem;padding:.65rem;background:#101a19}
.option-readiness h3,.option-readiness summary{font-size:.8rem;margin:0 0 .4rem;color:var(--text)}
.option-readiness ol,.option-readiness ul{padding-left:1.15rem;margin:.4rem 0 0}
.option-readiness-row{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.38rem 0;font-size:.75rem;color:var(--muted)}
.option-readiness-row+.option-readiness-row{border-top:1px solid var(--line)}
.option-readiness-row a{color:var(--accent);text-decoration:underline;text-underline-offset:.2em;white-space:nowrap}
.option-segment{display:grid;grid-template-columns:1fr 1fr;gap:.3rem;margin:.6rem 0}
.option-segment button{padding:.5rem;background:#162221;border:1px solid var(--line);border-radius:.4rem;color:var(--muted);font-size:.8rem}
.option-segment button[aria-pressed=true]{color:#defff7;background:#24403d;border-color:#528e87}
.option-field{display:block;margin:.8rem 0}.option-field-head{display:flex;align-items:center;justify-content:space-between;gap:.45rem;margin-bottom:.28rem;font-size:.78rem;font-weight:650}
.option-field input[type=number]{width:6.8rem;text-align:right;border:1px solid var(--line);background:#0e1817;border-radius:.35rem;padding:.35rem .45rem;font-variant-numeric:tabular-nums}
.option-field input[type=range]{display:block;width:100%;margin:.35rem 0;accent-color:#9bf1e0}
.option-floor{display:flex;align-items:flex-start;gap:.45rem;padding:.6rem;border:1px solid var(--line);border-radius:.5rem;color:var(--muted);font-size:.75rem}
.option-quote dd{font-variant-numeric:tabular-nums}.option-review{width:100%;margin-top:.65rem}.option-note{margin-top:.55rem}
@media(max-width:790px){.desk-grid{grid-template-columns:1fr}.ticket{max-height:none;overflow:visible}.market-feed{margin-left:0}.chart-stage svg{height:clamp(16rem,54vw,22rem)}}
@media(max-width:440px){.topbar{gap:.65rem}.topbar nav{gap:.55rem}.topbar .reset{padding:.3rem .38rem}.market{gap:.5rem}.market dl{gap:.55rem}}
.option-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
fieldset.option-segment{min-width:0;border:0;padding:0}
.option-segment label{position:relative;display:flex;justify-content:center;align-items:center;min-height:2.25rem;padding:.35rem .55rem;border:1px solid var(--line);border-radius:.4rem;background:#172322;color:var(--muted);font-size:.78rem;font-weight:650;cursor:pointer}
.option-segment label:has(input:checked){background:#223836;border-color:#517e79;color:#dcfff7}
.option-segment input{position:absolute;width:1px;height:1px;opacity:0}
.option-segment label:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}
.option-readiness dl{margin:0}.option-readiness-row dd{font-size:.7rem;color:#c4efe8}.option-readiness summary{cursor:pointer;margin:0}.option-readiness[open] summary{margin-bottom:.35rem}
.option-floor{display:block}.option-floor label{color:var(--text);font-weight:600}.option-floor p{margin:.24rem 0 0}
.option-field-head output{margin-left:auto;color:var(--muted);font-size:.72rem;font-weight:500}

.wallet-connect-top{padding:.35rem .55rem;font-size:.75rem}
.wallet-setup{margin-bottom:.85rem;border:1px solid var(--line);border-radius:.55rem;padding:.7rem;background:#101a19}
.wallet-setup summary{cursor:pointer;font-size:.82rem;font-weight:700;display:flex;justify-content:space-between}
.wallet-setup summary span{font-size:.75rem;color:var(--muted);font-variant-numeric:tabular-nums}
.wallet-checks{margin-top:.4rem}
.wallet-row{display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:.48rem 0;border-bottom:1px solid var(--line)}
.wallet-row strong,.wallet-row small{display:block}.wallet-row strong{font-size:.77rem}.wallet-row small{color:var(--muted);font-size:.7rem;margin-top:.12rem;overflow-wrap:anywhere}
.wallet-row button,.wallet-row a,.wallet-links button,.wallet-links a,#wallet-choices button{background:none;border:0;color:var(--accent);padding:.15rem 0;font-size:.72rem;white-space:nowrap;text-decoration:underline;text-underline-offset:.2em}
.wallet-links,#wallet-choices{display:flex;gap:.65rem;justify-content:space-between;margin-top:.4rem}
#wallet-choices{justify-content:flex-start;flex-wrap:wrap}
.wallet-status{font-size:.72rem;color:var(--muted);margin-top:.35rem;overflow-wrap:anywhere}.wallet-status[data-error="true"]{color:#ffb1bd}.wallet-status:empty{display:none}
#wallet-dialog label{display:block;font-size:.85rem;font-weight:600;margin:.8rem 0 .3rem}
#wallet-dialog input{width:100%;padding:.55rem;border:1px solid var(--line);border-radius:.4rem;background:#101e1c}
@media(max-width:450px){.topbar nav{display:none}.wallet-connect-top{font-size:.7rem}.topbar .mode{margin-left:auto}}
.wallet-connect-top{margin-left:auto}

.mcp-settings-button {
  flex: none;
  padding: .35rem .6rem;
  font-size: .75rem;
  white-space: nowrap;
}
#mcp-settings {
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  border-color: #517e79;
  background: var(--panel);
}
.mcp-steps {
  margin: .65rem 0 .8rem;
  padding-left: 1.3rem;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
}
.mcp-steps code { color: var(--accent); overflow-wrap: anywhere; }
.mcp-config {
  margin: 0 0 .75rem;
  padding: .75rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--bg);
  color: var(--text);
  font-size: clamp(.69rem, 3.3vw, .84rem);
  line-height: 1.6;
}
.mcp-actions { align-items: center; flex-wrap: wrap; }
#mcp-copy-status { margin-right: auto; color: var(--green); font-size: .77rem; }
@media (max-width: 640px) {
  .mcp-settings-button span { display: none; }
}
