:root {
  --bg: #0a0a0b;
  --bg-panel: #0e0e10;
  --bg-raise: #141418;
  --bg-hover: #1a1a20;
  --line: #202027;
  --line-soft: #18181d;

  --text: #e6e6ea;
  --muted: #7b7b88;
  --dim: #4e4e58;

  --accent: #e5d5a8;          /* champagne - primary action */
  --accent-hi: #f2e5c2;
  --accent-dim: #6b6045;

  --long: #2ebd85;            /* bids / cheapest tier */
  --long-bg: rgba(46, 189, 133, .09);
  --short: #f0555f;           /* asks / top tier */
  --short-bg: rgba(240, 85, 95, .09);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }

/* ============================ top bar ============================ */

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 46px;
  padding: 0 14px;
  background: #000;
  border-bottom: 1px solid var(--line);
}

.logo {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--text);
}
.logo b { color: var(--accent); font-weight: 800; }

.nav { display: flex; gap: 4px; }
.nav a {
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 3px;
}
.nav a:hover { color: var(--text); background: var(--bg-raise); }

.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ============================ market strip ============================ */

.strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  height: 54px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }

.cell { flex: none; padding-right: 26px; }
.cell .k {
  display: block;
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 2px; white-space: nowrap;
}
.cell .v {
  font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.v.long { color: var(--long); }
.v.short { color: var(--short); }
.v.accent { color: var(--accent); }

/* ============================ buttons ============================ */

button {
  font: inherit;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--text);
  padding: 6px 12px;
  font-size: 12.5px;
  transition: background .12s, border-color .12s, color .12s;
}
button:hover:not(:disabled) { background: var(--bg-hover); border-color: #2c2c35; }
button:disabled { opacity: .4; cursor: not-allowed; }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #16130a;
  font-weight: 650;
}
.btn-accent:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-accent:disabled { background: var(--accent-dim); border-color: var(--accent-dim); color: #100e08; opacity: 1; }

.btn-mono { font-family: var(--mono); font-size: 12px; }

/* ============================ layout ============================ */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1px;
  background: var(--line-soft);
  min-height: calc(100vh - 100px);
}
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }

.panel { background: var(--bg-panel); display: flex; flex-direction: column; min-width: 0; }

.panel-head {
  display: flex; align-items: center; gap: 2px;
  height: 36px; padding: 0 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.panel-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 600;
}

.body { padding: 14px 12px; }

/* ============================ compose ============================ */

.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-bottom: 5px;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  background: var(--bg-raise);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 9px 10px;
  font: inherit;
  font-size: 13.5px;
}
textarea::placeholder { color: var(--dim); }
textarea:focus { outline: none; border-color: var(--accent-dim); }

.meter { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.meter .track { flex: 1; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.meter .fill { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
.count { font-family: var(--mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.over { color: var(--short); }
.meter.over .fill { background: var(--short); }

/* dotted-underline stat rows, like the order summary in the reference */
.summary { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 11px; }
.row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 4px 0; font-size: 12px;
}
.row .k { color: var(--muted); border-bottom: 1px dotted var(--dim); line-height: 1.1; }
.row .v { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.cost {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 11px 12px; margin-top: 4px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.cost-k {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.cost-v {
  font-family: var(--mono); font-size: 19px; font-variant-numeric: tabular-nums;
  color: var(--accent); line-height: 1;
}
.cost-v.short { color: var(--short); }

/* ---------------------------- contract address ---------------------------- */

.ca-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(229, 213, 168, .13), rgba(229, 213, 168, .04));
  border-bottom: 1px solid var(--line);
  border-top: 1px solid rgba(229, 213, 168, .18);
}

.ca-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  font-weight: 700;
  flex: none;
}

.ca-value {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: .01em;
  color: var(--text);
  overflow-wrap: anywhere;
  min-width: 0;
  user-select: all;
}

.ca-copy {
  margin-left: auto;
  flex: none;
  background: var(--accent);
  border-color: var(--accent);
  color: #16130a;
  font-weight: 650;
  font-size: 12px;
  padding: 7px 16px;
}
.ca-copy:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
.ca-copy.done { background: var(--long); border-color: var(--long); color: #04170f; }

@media (max-width: 640px) {
  .ca-bar { flex-wrap: wrap; gap: 8px; }
  .ca-value { font-size: 12.5px; width: 100%; order: 3; }
  .ca-copy { margin-left: auto; }
}

.status { margin-top: 11px; font-size: 12.5px; min-height: 18px; color: var(--muted); }
.status.err { color: var(--short); }
.status.ok { color: var(--long); }

.notice {
  margin: 0; padding: 8px 12px;
  font-size: 11.5px; font-family: var(--mono);
  color: var(--accent); background: rgba(229, 213, 168, .06);
  border-bottom: 1px solid var(--line);
}
.notice code { color: var(--accent-hi); }

/* ============================ feed (order-book styling) ============================ */

.cols {
  display: grid;
  grid-template-columns: 1fr auto 92px;
  gap: 10px;
  padding: 6px 12px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.cols span:last-child { text-align: right; }
.cols[hidden] { display: none; }

.list { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: var(--line); }

.empty { padding: 40px 16px; text-align: center; color: var(--dim); font-size: 12.5px; }

.row-msg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 92px;
  gap: 10px;
  align-items: baseline;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft);
  animation: rowin .22s ease-out;
}
.row-msg:hover { background: var(--bg-hover); }

/* depth bar, sized by burn amount */
.row-msg .depth {
  position: absolute; inset: 0 auto 0 0;
  background: var(--accent);
  opacity: .08;
  pointer-events: none;
}

.row-msg .txt {
  position: relative;
  font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap;
  border-left: 2px solid var(--accent);
  padding-left: 9px;
}
.row-msg .who {
  position: relative;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.row-msg .amt {
  position: relative;
  font-family: var(--mono); font-size: 12px; text-align: right;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.row-msg .time { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }

@keyframes rowin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }


/* ============================ footer ============================ */

.statusbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  height: 30px; padding: 0 14px;
  background: #000; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.statusbar code { color: var(--text); }
.statusbar .sep { color: var(--dim); }

.live { display: inline-flex; align-items: center; gap: 6px; }
.live .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--short); }
.live.on .pip { background: var(--long); box-shadow: 0 0 6px var(--long); }
