:root {
  /* "The Crossing" — the Shipyard Inference design language from the
     landing page: deep night navy, Playfair serif headings, JetBrains
     Mono kickers, a single blue accent, hairline glass, film grain. */
  --night: #050a18;
  --deep: #0a1226;
  --bg: var(--night);
  --bg-2: var(--deep);
  --glass: rgba(185, 201, 222, .04);
  --glass-2: rgba(185, 201, 222, .07);
  --hair: rgba(110, 130, 156, .16);
  --hair-2: rgba(110, 130, 156, .3);
  --text: #e8eef6;
  --muted: #b9c9de;
  --faint: #8fa3bd;
  --accent: #6b9ce0;
  --accent-2: #6ea88e;
  --violet: #9d8ec7;
  --amber: #d4b576;
  --danger: #d47a7a;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.25, .8, .25, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

/* ---------- aurora backdrop ---------- */
.aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(55% 45% at 15% -12%, rgba(107, 156, 224, .07), transparent 60%),
    radial-gradient(50% 45% at 85% 2%, rgba(61, 111, 181, .06), transparent 60%);
  filter: saturate(100%);
}
.aurora::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, transparent 40%, rgba(5, 10, 24, .5) 100%);
}

/* Film grain — the landing page's signature texture, over everything. */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- shell ---------- */
.app {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 300px 1fr; height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .012));
  border-right: 1px solid var(--hair);
  backdrop-filter: blur(18px);
  padding: 22px 20px;
  display: flex; flex-direction: column; gap: 22px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 21px;
  background: var(--bg-2);
  border: 1px solid var(--hair-2);
}
.brand-name {
  font-family: var(--mono); font-weight: 400; font-size: 12px;
  letter-spacing: 0.24em; text-transform: uppercase; color: #cdd9e8;
}
.brand-sub {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--faint);
}

.card {
  background: var(--glass); border: 1px solid var(--hair);
  border-radius: 16px; padding: 14px;
}

/* wallet */
.btn.block { width: 100%; }
.connect { display: flex; flex-direction: column; gap: 12px; }
.wallet-choice { display: flex; align-items: center; justify-content: center; gap: 8px; }
.wc-icon { font-size: 15px; line-height: 1; }
.connect-sub { font-size: 12px; line-height: 1.5; color: var(--faint); text-align: center; }
.connect-status { font-size: 12px; line-height: 1.45; text-align: center; color: var(--faint); }
.connect-status:empty { display: none; }
.connect-status.error { color: var(--danger); }
.connect-or {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px;
  margin: 2px 0;
}
.connect-or::before, .connect-or::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
.wallet-options { display: flex; gap: 8px; }
.wallet-options .wallet-choice { flex: 1; }

.wallet-card {
  margin-top: 4px;
  background: var(--glass); border: 1px solid var(--hair);
  border-radius: 16px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.wallet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wallet-head-right { display: flex; align-items: center; gap: 8px; }
#disconnect { color: var(--muted); }
#disconnect:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.wallet-label { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; }
.wallet-addr { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-balance { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.wallet-balance .mono { font-size: 22px; font-weight: 600; letter-spacing: -.5px; }
.wallet-sub { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.wallet-sub .mono { color: var(--muted); }
.topup { display: flex; gap: 6px; padding-top: 2px; }
.topup .topup-amt { flex: 1; }

.pill {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent-2) 38%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  border-radius: 999px; padding: 3px 9px;
}

/* savings */
.savings {
  border: 1px solid var(--hair); border-radius: 18px; padding: 16px;
  background: var(--glass);
}
.savings-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
.savings-big {
  font-size: 27px; font-weight: 700; font-family: var(--mono); letter-spacing: -1px;
  margin: 8px 0 6px; color: var(--text);
}
.savings-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.savings-meta #saved-pct { color: var(--accent-2); font-weight: 700; }
.savings-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px;
  border-top: 1px solid var(--hair); padding-top: 12px;
}
.cell-k { font-size: 11px; color: var(--faint); }
.cell-v { font-size: 14px; margin-top: 2px; }

.sidebar-foot { margin-top: auto; font-size: 12px; line-height: 1.6; color: var(--faint); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100vh; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 26px; border-bottom: 1px solid var(--hair);
  backdrop-filter: blur(12px);
}
.topbar #new-chat { margin-left: auto; }

/* model picker */
.model-pick { position: relative; }
.model-trigger {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass-2); color: var(--text);
  border: 1px solid var(--hair); border-radius: 999px;
  padding: 9px 16px; font-size: 13px; cursor: pointer; min-width: 250px;
  transition: border-color .15s ease, background .15s ease;
}
.model-trigger:hover { border-color: var(--hair-2); background: rgba(255, 255, 255, .08); }
.model-trigger .caret { margin-left: auto; color: var(--muted); font-size: 10px; }
.model-trigger-label { font-weight: 600; }

.model-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  width: 360px; max-width: 84vw;
  background: rgba(16, 18, 24, .92); border: 1px solid var(--hair-2);
  border-radius: 16px; padding: 7px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column; gap: 3px;
}
.model-row {
  display: flex; align-items: center; gap: 11px; text-align: left;
  background: transparent; border: 0; border-radius: 11px;
  padding: 10px 11px; cursor: pointer; color: var(--text); width: 100%;
  transition: background .12s ease;
}
.model-row:hover { background: var(--glass-2); }
.model-row.active { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.model-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.model-row-name { font-size: 13.5px; font-weight: 600; }
.model-row-price { font-size: 11.5px; color: var(--faint); }
.model-save {
  font-size: 11px; font-weight: 700; white-space: nowrap;
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  border-radius: 999px; padding: 3px 9px;
}
.tier-badge {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border-radius: 7px; padding: 4px 7px; flex: none; color: var(--muted);
  border: 1px solid var(--hair); background: var(--glass); min-width: 66px; text-align: center;
}
.tier-badge.economy { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); }
.tier-badge.standard { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tier-badge.frontier { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 40%, transparent); }
.tier-badge.auto { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }

.mode-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  border-radius: 999px; padding: 4px 11px; border: 1px solid var(--hair);
  color: var(--muted); cursor: default; white-space: nowrap;
}
.mode-badge.usepod, .mode-badge.paybox {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 40%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}
.mode-badge.demo {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 40%, transparent);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
}

/* Demo ⇄ Production inference toggle (segmented control). */
.infmode {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--glass);
}
.infmode-opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.infmode-opt:hover:not(.active):not([disabled]) { color: var(--text); }
.infmode-opt.active { background: var(--glass-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-2); }
.infmode-opt[data-infmode="production"].active { color: var(--accent-2); }
.infmode-opt[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------- thread ---------- */
.thread { flex: 1; overflow-y: auto; padding: 30px 0 8px; display: flex; flex-direction: column; }
.msg, .empty { width: 100%; max-width: 60rem; margin: 0 auto; padding: 0 26px; }

/* empty / hero — vertically centered in the thread so whitespace splits
   evenly above/below instead of pooling in a dead band above the composer.
   Speaks in the landing page's voice: mono kicker, Playfair serif with
   blue italic emphasis, quiet mist body copy. */
.empty { text-align: center; margin-top: auto; margin-bottom: auto; }
.empty-mark {
  width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 18px;
  display: grid; place-items: center; font-size: 32px;
  background: var(--glass); border: 1px solid var(--hair);
  backdrop-filter: blur(8px);
}
.empty-kicker {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--faint);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 20px;
}
.empty-kicker::before, .empty-kicker::after { content: ""; width: 34px; height: 1px; background: var(--hair-2); }
.empty h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 4.6vw, 44px);
  line-height: 1.08; letter-spacing: -0.015em; margin: 0 0 14px;
}
.empty h1 .grad { font-style: italic; font-weight: 400; color: var(--accent); }
.empty p { color: var(--muted); line-height: 1.7; max-width: 520px; margin: 0 auto; font-size: 15px; }
.empty p b { color: #fff; font-weight: 500; }

.examples {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  max-width: 600px; margin: 28px auto 0;
}
.example {
  text-align: left; background: var(--glass); border: 1px solid var(--hair);
  border-radius: 14px; padding: 13px 15px; cursor: pointer; color: var(--text);
  font-size: 13.5px; line-height: 1.4; transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.example:hover { border-color: var(--hair-2); background: var(--glass-2); transform: translateY(-1px); }
.example-k { display: block; font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }

/* messages */
.msg { display: flex; gap: 16px; padding: 18px 26px; }
.msg .avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 15px;
}
.msg.user .avatar { background: var(--glass-2); border: 1px solid var(--hair); }
.msg.assistant .avatar {
  background: var(--bg-2);
  border: 1px solid var(--hair);
}
.msg .body { min-width: 0; flex: 1; }
.msg .role { font-size: 12px; color: var(--faint); margin-bottom: 5px; font-weight: 600; }
.msg .content { line-height: 1.7; font-size: 15px; word-wrap: break-word; }
.msg .content.streaming { white-space: pre-wrap; }
.msg .content .cursor { animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* rendered markdown */
.msg .content p { margin: 0 0 11px; }
.msg .content p:last-child { margin-bottom: 0; }
.msg .content h3, .msg .content h4, .msg .content h5 { margin: 16px 0 7px; line-height: 1.3; }
.msg .content h3 { font-size: 18px; }
.msg .content h4 { font-size: 16px; }
.msg .content ul, .msg .content ol { margin: 0 0 11px; padding-left: 22px; }
.msg .content li { margin: 4px 0; }
.msg .content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg .content code {
  font-family: var(--mono); font-size: .88em;
  background: var(--glass-2); border: 1px solid var(--hair);
  border-radius: 6px; padding: 1px 5px;
}
.msg .content .code {
  margin: 12px 0; border: 1px solid var(--hair); border-radius: 12px;
  overflow: hidden; background: #07090d;
}
.msg .content .code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--glass); border-bottom: 1px solid var(--hair);
}
.code-lang { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); }
.code-copy {
  background: transparent; border: 1px solid var(--hair); color: var(--muted);
  border-radius: 7px; padding: 3px 9px; font-size: 11px; cursor: pointer; transition: all .12s ease;
}
.code-copy:hover { color: var(--text); border-color: var(--accent); }
.msg .content .code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.msg .content .code pre code {
  background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.6; color: #d8deea;
}

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip {
  font-size: 11.5px; font-family: var(--mono); font-variant-numeric: tabular-nums;
  background: var(--glass); border: 1px solid var(--hair);
  border-radius: 999px; padding: 4px 11px; color: var(--muted);
}
.chip b { color: var(--text); font-weight: 600; }
.chip.saved {
  color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 35%, transparent);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
}
.chip.settle {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); text-decoration: none;
}
a.chip.settle:hover { filter: brightness(1.2); }
.chip.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* message actions */
.actions { display: flex; gap: 6px; margin-top: 12px; opacity: 0; transition: opacity .14s ease; }
.msg.assistant:hover .actions { opacity: 1; }
.act {
  background: transparent; border: 1px solid transparent; color: var(--faint);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; transition: all .12s ease;
}
.act:hover { color: var(--text); border-color: var(--hair); background: var(--glass); }

/* ---------- composer ---------- */
/* Tender — sponsored placement chrome (a slim bar above the composer). Lives
   outside the message thread: surface chrome only, never the model context. */
.placement-bar {
  max-width: 60rem;
  margin: 0 auto 8px;
  width: 100%;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--hair);
  border-radius: 12px;
  animation: placement-in .22s ease both;
}
@keyframes placement-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.placement-tag {
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--hair-2);
  border-radius: 6px;
  padding: 2px 6px;
  flex: none;
}
.placement-line { flex: 1; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placement-attest { flex: none; font-size: 11px; font-weight: 600; white-space: nowrap; }
.placement-attest.ok { color: var(--accent-2); }
.placement-attest.bad { color: var(--amber); }
.wallet-sub .pos { color: var(--accent-2); }
.placement-cta {
  flex: none;
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  border-radius: 8px;
  padding: 3px 9px;
}
.placement-cta:hover { filter: brightness(1.15); }

.composer-wrap { max-width: 60rem; margin: 0 auto; width: 100%; padding: 8px 26px 20px; }
.composer {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--glass-2); border: 1px solid var(--hair-2);
  border-radius: 20px; padding: 10px 10px 10px 18px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .4);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--hair-2)); box-shadow: 0 16px 50px rgba(91, 140, 255, .18); }
textarea {
  flex: 1; resize: none; max-height: 200px;
  background: transparent; color: var(--text);
  border: 0; padding: 9px 0; font: inherit; font-size: 15px; line-height: 1.5;
}
textarea:focus { outline: none; }
textarea::placeholder { color: var(--faint); }
.composer-hint { text-align: center; font-size: 11.5px; color: var(--faint); margin-top: 10px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--hair); background: var(--glass-2); color: var(--text);
  border-radius: 11px; padding: 9px 15px; font-size: 14px; cursor: pointer;
  transition: filter .14s ease, opacity .14s ease, border-color .14s ease, background .14s ease;
}
.btn:hover { border-color: var(--hair-2); background: rgba(255, 255, 255, .08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border: 0; color: #0b0b12; font-weight: 600;
  box-shadow: 0 4px 14px rgba(139, 139, 240, .2);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--glass); }
.btn.tiny { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn.send {
  width: 44px; height: 44px; padding: 0; font-size: 19px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
}
.btn.send:disabled { box-shadow: none; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .examples { grid-template-columns: 1fr; }
}

/* ---------- beautifului-inspired primitives ---------- */

/* Loading State — pixel-grid shimmer + elapsed time */
.pay-loader { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.pay-grid { display: grid; grid-template-columns: repeat(3, 4px); grid-auto-rows: 4px; gap: 3px; }
.pay-grid i { border-radius: 1px; background: var(--faint); opacity: .35; animation: paycell 1.2s infinite; }
.pay-grid i:nth-child(2) { animation-delay: .08s } .pay-grid i:nth-child(3) { animation-delay: .16s }
.pay-grid i:nth-child(4) { animation-delay: .24s } .pay-grid i:nth-child(5) { animation-delay: .32s }
.pay-grid i:nth-child(6) { animation-delay: .40s } .pay-grid i:nth-child(7) { animation-delay: .48s }
.pay-grid i:nth-child(8) { animation-delay: .56s } .pay-grid i:nth-child(9) { animation-delay: .64s }
@keyframes paycell { 0%, 100% { opacity: .25; background: var(--faint); } 50% { opacity: 1; background: var(--accent); } }
.pay-elapsed { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--faint); }

/* Payment Trace — expandable, thinking-style */
.paytrace { margin-top: 8px; border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; background: var(--glass); }
.paytrace > summary {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer;
  list-style: none; font-size: 12px; color: var(--muted); user-select: none;
}
.paytrace > summary::-webkit-details-marker { display: none; }
.paytrace > summary:hover { background: var(--glass-2); }
.paytrace > summary .caret { transition: transform .15s ease; color: var(--faint); font-size: 10px; }
.paytrace[open] > summary .caret { transform: rotate(90deg); }
.paytrace-body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 5px; }
.paytrace-step {
  display: flex; align-items: baseline; gap: 10px; font-size: 12px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.paytrace-step .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); flex: none; transform: translateY(-2px); }
.paytrace-step .k { color: var(--faint); min-width: 92px; }
.paytrace-step .v { color: var(--text); }
.paytrace-step a { font-size: 12px; }

/* Tool-chip row polish (receipts) */
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 10px; }
.chips .chip {
  border: 1px solid var(--hair); border-radius: 999px; padding: 2px 9px;
  font-size: 11px; font-family: var(--mono); font-variant-numeric: tabular-nums;
  background: var(--glass); color: var(--muted);
}
.chips .chip.settle { border-color: rgba(47, 224, 172, .35); color: var(--accent-2); }
.chips a.chip:hover { border-color: var(--hair-2); color: var(--text); }

/* Error-recovery actions — one-tap escapes from a payment wall. */
.chips .err-actions { display: inline-flex; gap: 5px; margin-left: 2px; }
.chips button.chip.act {
  cursor: pointer; color: var(--text); border-color: var(--hair-2);
  transition: border-color .15s, color .15s, transform .15s;
}
.chips button.chip.act:hover { border-color: var(--accent-2); color: var(--accent-2); }
.chips button.chip.act:active { transform: scale(.96); }
.chips button.chip.act.primary {
  border-color: color-mix(in srgb, var(--accent-2) 55%, transparent);
  color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, transparent);
}

/* ---------- Prompt Bar (composer with model pill + dictation) ---------- */
.composer { gap: 6px; }
.promptbar-side { display: flex; align-items: center; flex: none; }
.composer .model-pick { position: relative; }
.composer .model-trigger {
  border: 1px solid var(--hair); border-radius: 999px; background: var(--glass);
  color: var(--muted); font-size: 12px; padding: 4px 10px; display: inline-flex;
  align-items: center; gap: 6px; cursor: pointer; max-width: 180px;
}
.composer .model-trigger:hover { border-color: var(--hair-2); color: var(--text); }
.composer .model-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .model-menu { top: calc(100% + 6px); bottom: auto; }
.btn.mic { font-size: 15px; line-height: 1; flex: none; padding: 6px 10px; }
.btn.mic.rec { color: var(--danger); border-color: rgba(255, 111, 115, .45); animation: micpulse 1.2s infinite; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,111,115,.25); } 50% { box-shadow: 0 0 0 6px rgba(255,111,115,0); } }

/* ---------- Insight Cards ---------- */
.insights { margin-top: 14px; }
.insights-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.insights-pager { display: flex; align-items: center; gap: 4px; }
.insights-pager .mono { font-size: 11px; color: var(--faint); }
.insight-k { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 8px; }
.insight-chart { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.insight-bar {
  flex: 1; min-width: 0; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--accent), rgba(91,140,255,.25));
  position: relative; cursor: crosshair; transition: opacity .15s;
}
.insight-bar:hover { opacity: .8; }
.insight-bar .tip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--glass-2); border: 1px solid var(--hair); border-radius: 6px; padding: 3px 8px;
  font-family: var(--mono); font-size: 10px; white-space: nowrap; z-index: 3; pointer-events: none;
}
.insight-bar:hover .tip { display: block; }
.insight-foot { font-size: 10px; color: var(--faint); margin-top: 6px; }
.insight-models { display: flex; flex-direction: column; gap: 6px; }
.insight-model { font-size: 12px; }
.insight-model .row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.insight-model .bar { height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--violet), rgba(183,139,255,.2)); }

/* ---------- view nav (chat ⇄ decisions) — beautifului Sidebar Nav ---------- */
.viewnav {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  margin-top: 14px; padding: 4px;
  background: var(--glass); border: 1px solid var(--hair); border-radius: 12px;
}
.viewnav-opt {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-family: inherit;
  font-size: 13px; cursor: pointer; text-align: left;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.viewnav-opt:hover { color: var(--text); transform: translateX(2px); }
.viewnav-opt .nav-icon { font-size: 15px; width: 20px; text-align: center; flex: none; }
.viewnav-opt.active { color: var(--text); }
/* gliding hover pill — sits behind the options, glides between them */
.viewnav .glider {
  position: absolute; z-index: 0; border-radius: 8px;
  background: var(--glass-2); border: 1px solid var(--hair);
  transition: top .28s var(--ease), height .28s var(--ease);
  pointer-events: none;
}
.viewnav-collapsed .viewnav-opt { justify-content: center; padding: 9px 0; }
.viewnav-collapsed .viewnav-opt .nav-label { display: none; }
.viewnav-collapsed { width: 52px; }
.viewnav-toggle {
  align-self: flex-end; margin-top: 2px; font-size: 10px; color: var(--faint);
  background: transparent; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.viewnav-toggle:hover { color: var(--muted); background: var(--glass); }

/* ---------- decisions view ---------- */
main.dec { display: flex; flex-direction: column; }
.dec.hidden, main.dec.hidden { display: none !important; }
.dec-sub { font-size: 11.5px; color: var(--faint); flex: 1; margin-left: 10px; }
.dec-scroll { flex: 1; overflow-y: auto; padding: 20px 22px; }

.dec-empty { max-width: 640px; margin: 9vh auto 0; text-align: center; }
.dec-empty .empty-mark { font-size: 30px; margin-bottom: 10px; opacity: .9; }
.dec-empty h1 { font-size: 27px; letter-spacing: -.02em; margin: 0 0 10px; }
.dec-empty p { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.dec-empty .examples { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.dec-grid { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; max-width: 1080px; margin: 0 auto; }
.dec-builder { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; }

.dec-card { background: var(--glass); border: 1px solid var(--hair); border-radius: 12px; padding: 12px; }
.dec-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dec-card-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.dec-q-add { display: flex; gap: 4px; }
#dec-state { width: 100%; resize: vertical; min-height: 86px; background: var(--bg-2); border: 1px solid var(--hair); border-radius: 8px; padding: 8px 10px; color: var(--text); font-family: inherit; font-size: 12.5px; line-height: 1.5; }
#dec-state:focus { outline: none; border-color: rgba(91,140,255,.45); }

.dec-q { background: var(--bg-2); border: 1px solid var(--hair); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.dec-q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.qtype-row { display: flex; gap: 3px; background: var(--glass); border-radius: 7px; padding: 2px; }
.qtype { border: 0; background: transparent; color: var(--faint); font-family: inherit; font-size: 10.5px; padding: 3px 8px; border-radius: 5px; cursor: pointer; }
.qtype.active { background: rgba(91,140,255,.18); color: var(--text); }
.q-instr, .noul-clarify { width: 100%; background: var(--glass); border: 1px solid var(--hair); border-radius: 7px; padding: 6px 9px; color: var(--text); font-family: inherit; font-size: 12px; margin-bottom: 6px; }
.q-instr:focus, .noul-clarify:focus, .crit-row input:focus { outline: none; border-color: rgba(91,140,255,.45); }
.dec-criteria { display: flex; flex-direction: column; gap: 4px; }
.crit-row { display: flex; gap: 4px; align-items: center; }
.crit-k { width: 84px; flex: none; }
.crit-idx { width: 18px; flex: none; text-align: center; color: var(--faint); font-size: 10px; }
.crit-row input { background: var(--glass); border: 1px solid var(--hair); border-radius: 6px; padding: 4px 8px; color: var(--text); font-family: inherit; font-size: 11.5px; min-width: 0; }
.crit-v { flex: 1; }
.crit-del, .crit-add { flex: none; }
.crit-add { align-self: flex-start; margin-top: 2px; }

.dec-results { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dec-answer { background: var(--glass); border: 1px solid var(--hair); border-radius: 14px; padding: 14px; }
.dec-ans-state { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.dec-cards { display: flex; flex-direction: column; gap: 10px; }

.dec-ans-card { background: var(--bg-2); border: 1px solid var(--hair); border-radius: 11px; padding: 12px 14px; }
.dec-ans-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.dec-ans-key { font-size: 10.5px; color: var(--faint); }
.dec-ans-type { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.dec-ans-instr { font-size: 12px; margin-bottom: 10px; }

/* choice — recommendation card */
.dec-choice { font-size: 19px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 10px; color: var(--text); }
.pbar-row { display: grid; grid-template-columns: minmax(70px, 130px) 1fr 38px; gap: 8px; align-items: center; margin-bottom: 5px; }
.pbar-k { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar-row.winner .pbar-k { color: var(--text); font-weight: 600; }
.pbar { height: 7px; border-radius: 4px; background: var(--glass-2); overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--violet)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.pbar-row.winner .pbar-fill { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.pbar-v { font-size: 11px; color: var(--faint); text-align: right; }

/* confidence meter */
.dec-conf { margin-top: 10px; }
.meter { height: 6px; border-radius: 4px; background: var(--glass-2); overflow: hidden; max-width: 240px; }
.meter-fill { height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.meter-label { font-size: 10.5px; color: var(--faint); margin-top: 4px; }

/* score — ladder */
.dec-score-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.dec-score { font-size: 22px; font-weight: 600; color: var(--text); }
.ladder { position: relative; height: 7px; border-radius: 4px; background: linear-gradient(90deg, var(--danger), var(--amber), var(--accent-2)); margin-bottom: 10px; }
.ladder-mark { position: absolute; top: -3px; width: 13px; height: 13px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--bg-2); transform: translateX(-50%); transition: left .5s cubic-bezier(.2,.8,.2,1); }
.levels { display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
.level { font-size: 11.5px; color: var(--muted); }
.level.active { color: var(--text); font-weight: 600; }
.level-idx { color: var(--faint); margin-right: 6px; }

/* noul — gauge */
.noul-row { display: flex; align-items: center; gap: 10px; }
.noul-gauge { flex: 1; height: 12px; border-radius: 7px; background: var(--glass-2); overflow: hidden; }
.noul-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.noul-pct { font-size: 14px; font-weight: 600; }
.noul-verdict { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }

/* task-row cost chips */
.dec-taskrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hair); }
.dec-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); background: var(--glass-2); border: 1px solid var(--hair); border-radius: 999px; padding: 3px 9px; }
.dec-chip-k { color: var(--faint); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.dec-chip.pos { color: var(--accent-2); border-color: rgba(47,224,172,.3); }

@media (max-width: 960px) {
  .dec-grid { grid-template-columns: 1fr; }
  .dec-builder { position: static; }
}

/* ---------- thinking — routing trace ---------- */
.rt-trace { margin: 0 0 6px; }
.rt-trace summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--faint); padding: 3px 9px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--hair); user-select: none;
}
.rt-trace summary:hover { color: var(--muted); }
.rt-trace summary::-webkit-details-marker { display: none; }
.rt-trace .caret { font-size: 8px; transition: transform .15s; display: inline-block; }
.rt-trace[open] summary .caret { transform: rotate(90deg); }
.rt-body { margin-top: 8px; padding: 10px 12px; background: var(--glass); border: 1px solid var(--hair); border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.rt-step { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.rt-dot { width: 14px; text-align: center; color: var(--faint); font-size: 9px; }
.rt-k { width: 68px; flex: none; color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.rt-v { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-won { margin-left: auto; flex: none; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); background: rgba(47,224,172,.1); border: 1px solid rgba(47,224,172,.25); border-radius: 999px; padding: 1px 7px; }
.rt-served .rt-k, .rt-served .rt-v { color: var(--text); }
.rt-served .rt-dot { color: var(--accent-2); }
.rt-warn .rt-dot, .rt-warn .rt-k { color: var(--amber); }
.rt-warn .rt-v { color: var(--amber); opacity: .8; }

/* ---------- selection actions ---------- */
.selbar {
  position: fixed; z-index: 60; display: flex; align-items: center; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: 10px;
  padding: 5px 8px; box-shadow: 0 8px 28px rgba(0,0,0,.45);
  animation: selbar-in .12s ease-out;
}
@keyframes selbar-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.selbar-sep { width: 1px; height: 14px; background: var(--hair); }
.selbar-quote { font-size: 10.5px; color: var(--faint); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 2px; }

/* ---------- ⌘K command palette ---------- */
#palette { position: fixed; inset: 0; z-index: 100; }
#palette.hidden { display: none; }
.palette-scrim { position: absolute; inset: 0; background: rgba(3,4,7,.6); backdrop-filter: blur(3px); }
.palette-card {
  position: absolute; left: 50%; top: 16vh; transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px)); background: var(--bg-2);
  border: 1px solid var(--hair-2); border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); animation: pal-in .14s ease-out;
}
@keyframes pal-in { from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(.985); } to { opacity: 1; transform: translateX(-50%); } }
#palette-input {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--hair);
  padding: 13px 16px; color: var(--text); font-family: inherit; font-size: 14px;
}
#palette-input:focus { outline: none; }
.palette-list { max-height: 300px; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 11px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.palette-item.active { background: var(--glass-2); }
.palette-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { flex: none; font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); background: var(--glass); border: 1px solid var(--hair); border-radius: 999px; padding: 2px 8px; }
.palette-empty { padding: 22px 16px; text-align: center; color: var(--faint); font-size: 12.5px; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--hair); font-size: 10px; color: var(--faint); }

/* ---------- economy: spend ticker (mempool) ---------- */
.ticker {
  /* Docked ABOVE the composer (which spans up to 60rem centered): a viewport-
     corner position put the ticker's corner inside the composer's top-right —
     it collided and looked clipped. bottom clears the full composer row
     (input + hint ≈ 110px) on any window width. */
  position: fixed; right: 20px; bottom: 136px; z-index: 50; width: 218px;
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: 12px;
  padding: 9px 10px; box-shadow: 0 10px 34px rgba(0,0,0,.4);
  font-size: 11px; pointer-events: auto;
}
.ticker-head { display: flex; align-items: center; gap: 6px; font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin-bottom: 7px; }
.ticker-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(47,224,172,.5); animation: ticker-pulse 2s infinite; margin-left: auto; }
@keyframes ticker-pulse { 0% { box-shadow: 0 0 0 0 rgba(47,224,172,.45); } 70% { box-shadow: 0 0 0 7px rgba(47,224,172,0); } 100% { box-shadow: 0 0 0 0 rgba(47,224,172,0); } }
.ticker-list { display: flex; flex-direction: column; gap: 4px; }
.ticker-item {
  display: flex; align-items: center; gap: 7px; padding: 4px 7px;
  background: var(--glass); border: 1px solid var(--hair); border-radius: 8px;
  animation: ticker-in .25s ease-out;
}
@keyframes ticker-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.ticker-icon { flex: none; font-size: 11px; }
.ticker-label { color: var(--muted); flex: none; }
.ticker-amt { margin-left: auto; color: var(--text); font-size: 10.5px; }
.ticker-item.t-credit .ticker-amt { color: var(--accent-2); }
.ticker-item.t-refund .ticker-amt { color: var(--accent-2); }
.ticker-item.t-settle .ticker-icon { color: var(--accent-2); }
.ticker-link { flex: none; color: var(--faint); font-size: 10px; text-decoration: none; }
.ticker-link:hover { color: var(--accent); }
.ticker-empty { color: var(--faint); text-align: center; padding: 6px 0; }
.ticker-more { color: var(--faint); text-align: center; margin-top: 3px; font-size: 9.5px; }
@media (max-width: 960px) { .ticker { display: none; } }

/* ---------- economy: route preview ---------- */
.route-preview {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  padding: 4px 10px; font-size: 10.5px; color: var(--muted);
  background: var(--glass); border: 1px dashed var(--hair-2); border-radius: 8px;
  animation: ticker-in .18s ease-out; width: fit-content;
}
.route-preview.hidden { display: none; }
.rp-model { color: var(--text); font-weight: 600; font-size: 10.5px; }
.rp-tier { font-size: 9px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); background: var(--glass-2); border-radius: 999px; padding: 1px 7px; }
.rp-cost { color: var(--amber); }
.rp-saved { color: var(--accent-2); }
.rp-note { margin-left: auto; color: var(--faint); font-size: 9px; letter-spacing: .05em; }

/* ---------- economy: latency waterfall ---------- */
.wf { display: flex; align-items: center; gap: 2px; margin: 8px 0 2px; max-width: 420px; }
.wf-seg { height: 6px; border-radius: 3px; position: relative; min-width: 14px; transition: flex-grow .4s ease-out; }
.wf-seg:hover::after {
  content: attr(data-label); position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: 6px; padding: 2px 7px;
  font-size: 9.5px; color: var(--muted); white-space: nowrap; z-index: 5;
}
.wf-route { background: var(--violet); opacity: .55; }
.wf-ttft { background: var(--accent); opacity: .75; }
.wf-stream { background: var(--accent-2); opacity: .8; }
.wf-total { font-size: 10px; color: var(--faint); margin-left: 6px; flex: none; }

/* ---------- design sweep: de-slop pass ---------- */

/* Model menu opens UPWARD from the composer (it sits at the viewport floor,
   opening down pushed it off-screen). Capped height with scroll. */
.composer .model-menu {
  bottom: calc(100% + 8px);
  top: auto;
  max-height: 38vh;
  overflow-y: auto;
  min-width: 260px;
}

/* Readable labels: bump the faintest token, tighten label styling. */
:root { --faint: #7e879c; }
.savings-title, .card-label, .mode-badge {
  letter-spacing: .12em;
  font-weight: 600;
  color: var(--muted);
}

/* Softer focus treatment — the full-saturation ring read as harsh. */
.composer-wrap textarea:focus,
.composer-wrap .composer:focus-within {
  outline: none;
  border-color: rgba(91, 140, 255, .45);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .12);
}

/* Chips: quieter, tighter, less "raw log dumped in UI". */
.chip {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--muted);
}
.chip.err { color: var(--amber); border-color: rgba(245, 196, 81, .3); background: rgba(245, 196, 81, .05); }

/* Assistant prose: give dense answers air and a readability measure. */
.msg .content { line-height: 1.65; }
.msg.assistant .content { max-width: 68ch; }
.msg .content p { margin: .6em 0; }
.msg .content ul, .msg .content ol { margin: .6em 0; padding-left: 1.4em; }
.msg .content li { margin: .25em 0; }

/* New chat button: styled ghost, not a default browser button. */
.newchat, #new-chat {
  border: 1px solid var(--hair);
  background: var(--glass);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.newchat:hover, #new-chat:hover { border-color: var(--hair-2); color: var(--text); }

/* Wallet card: address + balance on one calm line, less casino jackpot. */
.wallet-balance { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }

/* Insights: give the chart room to breathe. */
.insights { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hair); }
.insight-chart { height: 72px; }
.insight-k { margin-bottom: 10px; }

/* Payment trace: quieter until expanded. */
.paytrace summary { font-size: 11.5px; color: var(--muted); }
.paytrace[open] summary { color: var(--text); border-bottom: 1px solid var(--hair); }

/* ---------- delight: savings toast ---------- */
.savings-toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 70;
  transform: translateX(-50%) translateY(16px);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--hair-2); border-radius: 14px;
  padding: 11px 18px; box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.savings-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.st-icon { font-size: 19px; }
.st-line { font-size: 13.5px; color: var(--text); }
.st-amt { color: var(--accent-2); font-weight: 700; }
.st-sub { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* ---------- professional pass: neutral, hairline, quiet ---------- */
.msg .content, .dec-ans-card, .dec-card, .ticker, .palette-card, .selbar { border-radius: 12px; }
.pbar-fill { background: var(--accent); }
.pbar-row.winner .pbar-fill { background: var(--accent-2); }
.ladder { background: linear-gradient(90deg, var(--danger), var(--amber), var(--accent-2)); }
.noul-fill { background: var(--accent); }
.wf-route { background: var(--violet); opacity: .55; }
.wf-ttft { background: var(--accent); opacity: .7; }
.wf-stream { background: var(--accent-2); opacity: .75; }
.ticker-live-dot { background: var(--accent-2); animation: ticker-live 2.4s infinite; box-shadow: 0 0 0 0 rgba(110, 168, 142, .4); }
@keyframes ticker-live { 0% { box-shadow: 0 0 0 0 rgba(110, 168, 142, .35); } 70% { box-shadow: 0 0 0 6px rgba(110, 168, 142, 0); } 100% { box-shadow: 0 0 0 0 rgba(110, 168, 142, 0); } }
.ticker-item.t-credit .ticker-amt, .ticker-item.t-refund .ticker-amt { color: var(--accent-2); }
.ticker-item.t-settle .ticker-icon { color: var(--accent-2); }
.rp-cost { color: var(--muted); }
.rp-saved { color: var(--accent-2); }
.savings { background: var(--glass); }
.savings-big { background: none; -webkit-text-fill-color: currentColor; color: var(--text); }
.pill {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 35%, transparent);
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
}
.btn.primary {
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(139, 139, 240, .22);
}
.rt-won { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, transparent); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.rt-served .rt-dot { color: var(--accent-2); }
.qtype.active { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.pbar { background: var(--glass-2); }
.empty h1 .grad, .dec-empty h1 .grad {
  background: none; -webkit-text-fill-color: currentColor;
  color: var(--accent); font-style: italic; font-weight: 400;
}
.dec-empty h1 { font-family: var(--serif); font-weight: 600; }
.savings-toast {
  background: var(--bg-2);
  border: 1px solid var(--hair-2);
}
.st-icon { font-size: 16px; }

/* ---------- wallet sheet — the connect moment ---------- */
#connect-open { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; font-size: 14.5px; }
#connect-open .wc-icon { font-size: 16px; }
.connect-open-hint { position: absolute; top: -9px; right: 10px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: 999px; padding: 2px 8px; font-weight: 500; }

.wsheet { position: fixed; inset: 0; z-index: 90; display: none; }
.wsheet.open { display: block; }
.wsheet-scrim { position: absolute; inset: 0; background: rgba(4, 4, 6, .55); backdrop-filter: blur(4px); opacity: 0; transition: opacity .28s var(--ease); }
.wsheet.open .wsheet-scrim { opacity: 1; }
.wsheet.closing .wsheet-scrim { opacity: 0; }
.wsheet-card {
  position: absolute; left: 50%; top: 50%;
  width: min(420px, calc(100vw - 28px));
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .55);
  transform: translate(-50%, -46%) scale(.96); opacity: 0;
  transition: transform .34s cubic-bezier(.34, 1.3, .5, 1), opacity .24s var(--ease);
}
.wsheet.open .wsheet-card { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.wsheet.closing .wsheet-card { transform: translate(-50%, -47%) scale(.97); opacity: 0; }
.wsheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0 20px; }
.wsheet-title { font-size: 16.5px; font-weight: 650; letter-spacing: -.2px; }
.wsheet-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.wsheet-x { background: transparent; border: 0; color: var(--faint); font-size: 13px; cursor: pointer; padding: 6px; border-radius: 8px; transition: color .15s, background .15s; }
.wsheet-x:hover { color: var(--text); background: var(--glass); }
.wsheet-list { padding: 14px 14px 6px 14px; display: flex; flex-direction: column; gap: 8px; }
.wsheet-wallet {
  display: flex; align-items: center; gap: 13px; text-align: left;
  background: var(--glass); border: 1px solid var(--hair); border-radius: 14px;
  padding: 13px 14px; cursor: pointer; font-family: inherit; color: var(--text);
  transition: transform .22s var(--ease), border-color .2s, background .2s;
  opacity: 1;
}
/* entrance decorates from a hidden start; base state stays visible so a
   cancelled/throttled animation can never leave a card unpainted */
.wsheet.open .wsheet-wallet { animation: wcard-in .4s var(--ease) backwards; animation-delay: calc(var(--i) * 70ms + 60ms); }
@keyframes wcard-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.wsheet-wallet:hover { transform: translateY(-2px); border-color: var(--hair-2); background: var(--glass-2); }
.wsheet-wallet:hover .wsheet-go { transform: translateX(3px); color: var(--text); }
.wsheet-wallet:active { transform: translateY(0) scale(.99); }
.wsheet-icon {
  width: 42px; height: 42px; flex: none; border-radius: 12px; font-size: 19px;
  display: grid; place-items: center; background: var(--bg); border: 1px solid var(--hair);
}
.wsheet-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wsheet-name-row { display: flex; align-items: center; gap: 8px; }
.wsheet-name { font-size: 14px; font-weight: 600; letter-spacing: -.1px; }
.wsheet-badge { font-size: 9px; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent); background: color-mix(in srgb, var(--accent-2) 10%, transparent); border-radius: 999px; padding: 1px 7px; }
.wsheet-promise { font-size: 11.5px; color: var(--muted); }
.wsheet-whisper { font-size: 10.5px; color: var(--faint); line-height: 1.45; }
.wsheet-go { flex: none; color: var(--faint); font-size: 15px; transition: transform .22s var(--ease), color .15s; }
.wsheet-foot { padding: 10px 20px 16px; font-size: 10.5px; color: var(--faint); text-align: center; }

/* old inline wallet options removed */
.connect-or, .wallet-options { display: none !important; }

/* ---------- wallet sheet: two-step panes ---------- */
.wsheet-head-inner { display: flex; align-items: flex-start; gap: 10px; }
.wsheet-back {
  background: var(--glass); border: 1px solid var(--hair); color: var(--muted);
  font-size: 13px; width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; flex: none; margin-top: 1px;
  transition: color .15s, background .15s, border-color .15s;
}
.wsheet-back:hover { color: var(--text); background: var(--glass-2); border-color: var(--hair-2); }
.wsheet-back.hidden { display: none; }
.wsheet-panes { position: relative; }
.wsheet-pane { will-change: transform; }

/* the 'Other wallets' chip — quieter than a wallet card, clearly a door */
.wsheet-other {
  display: flex; align-items: center; gap: 13px; width: calc(100% - 28px);
  margin: 8px 14px 0 14px; padding: 11px 14px; text-align: left;
  background: transparent; border: 1px dashed var(--hair-2); border-radius: 14px;
  cursor: pointer; font-family: inherit; color: var(--muted);
  transition: border-color .2s, color .2s, background .2s, transform .22s var(--ease);
  opacity: 1;
}
.wsheet.open .wsheet-other { animation: wcard-in .4s var(--ease) backwards; animation-delay: calc(var(--i) * 70ms + 60ms); }
.wsheet-other:hover { color: var(--text); border-color: var(--hair-2); background: var(--glass); transform: translateY(-1px); }
.wsheet-other-icon { font-size: 11px; color: var(--faint); width: 42px; text-align: center; flex: none; letter-spacing: 1px; }
.wsheet-other .wsheet-promise { font-size: 10.5px; color: var(--faint); }
.wsheet-other:hover .wsheet-go { transform: translateX(3px); color: var(--text); }

/* ecosystem list — taller, scrolls in place */
.wsheet-list-tall { max-height: 46vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--hair-2) transparent; }

/* state chips */
.wsheet-state {
  font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  border: 1px solid var(--hair); border-radius: 999px; padding: 1px 6px; background: var(--glass);
}
.wsheet-state.on { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); background: color-mix(in srgb, var(--accent-2) 8%, transparent); }

/* 'soon' cards are visibly inert but still explorable */
.wsheet-wallet.soon { cursor: default; }
.wsheet-wallet.soon .wsheet-icon, .wsheet-wallet.soon .wsheet-name, .wsheet-wallet.soon .wsheet-promise { opacity: .55; }
.wsheet-wallet.soon:hover { transform: none; border-color: var(--hair); background: var(--glass); }

/* ---------- wallet sheet: real brand logos ---------- */
.wsheet-logo { width: 24px; height: 24px; display: block; object-fit: contain; }
.wsheet-icon.light-tile { background: #f4f4f5; border-color: #e4e4e7; }
.wsheet-other-icon { display: flex; align-items: center; gap: 2px; }
.wsheet-other-icon img { width: 17px; height: 17px; object-fit: contain; display: block; }
.wsheet-other-icon img + img { margin-left: -6px; } /* slight overlap like a stack */

/* ---------- nav rail (beautifului Sidebar Nav, full) ---------- */
.navrail {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  margin-top: 2px; padding: 5px;
  background: var(--glass); border: 1px solid var(--hair); border-radius: 12px;
}
.navrail .glider {
  position: absolute; z-index: 0; left: 5px; right: 5px; border-radius: 8px;
  background: var(--glass-2); border: 1px solid var(--hair);
  transition: top .28s var(--ease), height .28s var(--ease);
  pointer-events: none;
}
.navrail-section { display: flex; flex-direction: column; gap: 1px; position: relative; z-index: 1; }
.navrail-label { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 2px 10px 5px 10px; }
.navrail-opt {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 7.5px 11px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-family: inherit;
  font-size: 12.5px; cursor: pointer; text-align: left;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.navrail-opt:hover { color: var(--text); transform: translateX(2px); }
.navrail-opt .nav-icon { font-size: 13.5px; width: 18px; text-align: center; flex: none; }
.navrail-opt.active { color: var(--text); }
/* Collapse toggle lives in the label row's free right side (attached to the
   rail's corner, not a dead row under Settings). Collapsed mode re-centers
   it below the icon stack. */
.navrail-toggle {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  font-size: 10px; color: var(--faint);
  background: transparent; border: 0; cursor: pointer; padding: 3px 5px; border-radius: 6px;
}
.navrail-toggle:hover { color: var(--muted); background: var(--glass); }
.navrail-collapsed .navrail-toggle { position: static; align-self: center; margin-top: 6px; }
.navrail-collapsed .navrail-opt { justify-content: center; padding: 7.5px 0; }
.navrail-collapsed .navrail-opt .nav-label, .navrail-collapsed .navrail-label { display: none; }
.navrail-collapsed { width: 52px; }

/* ---------- insight/portal pages ---------- */
main.page { display: flex; flex-direction: column; }
main.page.hidden { display: none !important; }
.page-scroll { flex: 1; overflow-y: auto; padding: 18px 22px; }
.page-body { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.page-loading, .page-empty { color: var(--faint); text-align: center; padding: 40px 0; font-size: 13px; }
.page-note { font-size: 12px; color: var(--muted); background: var(--glass); border: 1px solid var(--hair); border-radius: 10px; padding: 10px 14px; }
.thread-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--glass); border: 1px solid var(--hair); border-radius: 12px;
  cursor: pointer; transition: border-color .18s, background .18s, transform .2s var(--ease);
}
.thread-row:hover { border-color: var(--hair-2); background: var(--glass-2); transform: translateY(-1px); }
.thread-main { flex: 1; min-width: 0; }
.thread-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-preview { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.thread-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 10.5px; flex: none; }
.thread-del { flex: none; opacity: 0; transition: opacity .15s; }
.thread-row:hover .thread-del { opacity: 1; }

.event-row {
  display: grid; grid-template-columns: 22px 64px 1fr 74px 64px 64px; gap: 10px; align-items: center;
  padding: 9px 12px; background: var(--glass); border: 1px solid var(--hair); border-radius: 10px;
  font-size: 12px;
}
.event-icon { text-align: center; }
.event-k { color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.event-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-amt { text-align: right; }
.event-saved { text-align: right; color: var(--accent-2); }
.event-time { text-align: right; font-size: 10.5px; }

.guard-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  background: var(--glass); border: 1px solid var(--hair); border-radius: 10px; font-size: 12px;
}
.guard-row.flagged { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.guard-flag { width: 18px; text-align: center; }
.guard-row.flagged .guard-flag { color: var(--danger); }
.guard-row:not(.flagged) .guard-flag { color: var(--accent-2); }
.guard-detail { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guard-row .muted { font-size: 10.5px; }

.setting-card { background: var(--glass); border: 1px solid var(--hair); border-radius: 14px; padding: 14px 16px; }
.setting-title { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.setting-row { display: flex; justify-content: space-between; gap: 12px; padding: 5.5px 0; font-size: 12.5px; border-bottom: 1px solid var(--hair); }
.setting-row:last-child { border-bottom: 0; }
.setting-k { color: var(--muted); }
.setting-v { color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

/* Jev routing chip — the content judgment behind the model choice */
.chip.jevchip {
  color: var(--accent, #e56d24);
  border-color: color-mix(in srgb, var(--accent, #e56d24) 35%, transparent);
  cursor: help;
}
