/* PaymentAgent — a mobile money counter: graphite with a little warmth, and
   one ochre accent taken from the stamp ink. Colour lives in the ledger
   figures (money in, money out, status); the chrome stays quiet. */
:root {
  --bg: #131312;
  --surface: #1a1a19;
  --surface-2: #212120;
  --surface-3: #2a2a28;
  --text: #ecebe7;
  --text-2: #a8a6a0;
  --muted: #7a7872;
  --accent: #d6a54a;
  --accent-ink: #1c1608;
  --good: #6cbf93;
  --bad: #e2806f;
  --border: rgba(236, 235, 231, 0.08);
  --border-strong: rgba(236, 235, 231, 0.14);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 120ms;
  --slow: 200ms;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Line icons (lucide paths), one size and stroke everywhere. */
.i {
  width: 16px; height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----------------------------------------------------------------- header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  /* Without this the title slides under the balances on a phone
     instead of shortening. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand .sub {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

/* The mark carries its own shape and colour (public/logo.svg) — this only
   sizes it. A replacement logo of any aspect ratio fits inside the box
   rather than distorting. */
.logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.header-right { display: flex; align-items: center; gap: 16px; min-width: 0; flex-shrink: 0; }
#status { white-space: nowrap; }

/* Shown only when the server reports no passcode is configured. A deployment
   anyone can read should not look identical to a secured one. */
.unprotected-flag { display: none; }
body.unprotected .unprotected-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--accent);
  border: 1px solid rgba(214, 165, 74, 0.32);
  cursor: help;
}

/* Balances read as figures on the counter, not as chips. */
.balances {
  display: flex;
  align-items: center;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.balances::-webkit-scrollbar { display: none; }

.bal {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.bal + .bal { padding-left: 20px; border-left: 1px solid var(--border); }
.bal .bal-label { color: var(--muted); font-size: 12px; }
.bal .bal-value {
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.bal.zero .bal-value { color: var(--muted); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.small {
  width: 32px;
  padding: 0;
  justify-content: center;
}
.icon-btn.small.spin .i { animation: spin 0.6s var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.icon-btn.ok .dot { background: var(--good); }
.icon-btn.warn .dot { background: var(--accent); }
.icon-btn.bad .dot { background: var(--bad); }

/* ------------------------------------------------------------------ layout */
main {
  height: calc(100% - 60px);
}

.panels { display: flex; height: 100%; }
.panels .panel-chat { flex: 1; }

.panel {
  background: var(--bg);
  min-height: 0;
}

.panel-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* Activity and How to live in a drawer, opened from the chat bar. They used
   to sit permanently beside the chat, which on a phone left the conversation
   a few lines tall and fetched the ledger on every page load whether anyone
   wanted it or not. */
.panel-history {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100vw);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.32);
  transform: translateX(100%);
  transition: transform var(--slow) var(--ease);
  visibility: hidden;
}
body.drawer-open .panel-history {
  transform: none;
  visibility: visible;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(10, 10, 9, 0.6);
  opacity: 0;
  transition: opacity var(--slow) var(--ease);
}
.drawer-backdrop[hidden] { display: none; }
body.drawer-open .drawer-backdrop { opacity: 1; }

.chat-bar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
/* One label, two lengths — the long one costs more than a phone row has. */
.new-chat-short { display: none; }
@media (max-width: 560px) {
  .new-chat-long { display: none; }
  .new-chat-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .panel-history, .drawer-backdrop { transition: none; }
}

/* -------------------------------------------------------------------- chat */
.chat {
  flex: 1;
  overflow-y: auto;
  /* Cap the reading column rather than letting a line run the width of a
     desktop monitor. Padding rather than a max-width wrapper, so messages
     keep hugging their own side. */
  padding: 24px max(20px, calc((100% - 760px) / 2));
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.welcome { margin: auto 0; text-align: center; padding: 0 4px 48px; }
.welcome h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 500;
  line-height: 32px;
  letter-spacing: -0.01em;
}
.welcome p { margin: 0 auto 24px; color: var(--text-2); font-size: 14px; max-width: 44ch; }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.suggestions button {
  font: inherit;
  font-size: 13px;
  height: 32px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0 12px;
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.suggestions button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.msg {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: rise var(--slow) var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.msg.user {
  align-self: flex-end;
  background: var(--surface-3);
  color: var(--text);
}
.msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
}
.msg.assistant strong { font-weight: 500; color: var(--text); }
.msg.assistant code,
.msg.user code {
  font-family: var(--mono);
  font-size: 0.87em;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--surface-3);
}
.msg ul { margin: 8px 0 4px; padding-left: 20px; }
.msg li { margin: 4px 0; }
.msg li::marker { color: var(--muted); }
.msg p { margin: 0 0 8px; }
.msg p:last-child { margin-bottom: 0; }

/* Waiting on the model is a live state, so the dots fade in turn — opacity
   only, nothing bounces. */
.msg.thinking {
  display: flex; gap: 4px; align-items: center;
  padding: 16px;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
}
.msg.thinking .d {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-2);
  animation: wait 1.2s var(--ease) infinite;
}
.msg.thinking .d:nth-child(2) { animation-delay: 0.16s; }
.msg.thinking .d:nth-child(3) { animation-delay: 0.32s; }
@keyframes wait {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.event {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 90%;
  font-size: 13px;
  color: var(--text-2);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  animation: rise var(--slow) var(--ease) both;
}
.event .tick { color: var(--good); display: inline-flex; }
.event.error { color: var(--bad); border-color: rgba(226, 128, 111, 0.28); }
.event.error .tick { color: var(--bad); }

.msg.error {
  align-self: center;
  background: transparent;
  color: var(--bad);
  border: 1px solid rgba(226, 128, 111, 0.28);
  font-size: 13px;
}

/* ---------------------------------------------------------------- composer */
.composer {
  /* Lines up with the conversation column above it. */
  padding: 12px max(16px, calc((100% - 760px) / 2)) 16px;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 8px 8px 8px 16px;
  transition: border-color var(--fast) var(--ease);
}
.composer-row:focus-within { border-color: rgba(236, 235, 231, 0.28); }

.composer textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  resize: none;
  max-height: 140px;
  padding: 4px 0;
  line-height: 1.5;
}
.composer textarea::placeholder { color: var(--muted); }

/* The primary action is off-white on graphite; the accent is kept for the
   selected rail. */
.send-btn {
  width: 32px; height: 32px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border: none;
  border-radius: var(--r-sm);
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.send-btn .i { stroke-width: 2; }
.send-btn:active:not(:disabled) { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.32; cursor: not-allowed; }

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.segmented button {
  font: inherit;
  font-size: 12px;
  height: 24px;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.on {
  color: var(--accent);
  background: var(--surface-2);
}

.composer-actions { display: flex; align-items: center; gap: 12px; }
.counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.near { color: var(--accent); }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 13px;
  height: 32px;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  padding: 0 12px;
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.ghost-btn:hover { color: var(--text); background: var(--surface-2); }
.composer .ghost-btn { font-size: 12px; height: 24px; padding: 0 8px; color: var(--muted); }

/* ----------------------------------------------------------------- history */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
/* Filters and refresh belong to Activity only, on their own row so the
   tabs and the close button always fit, even on a phone. */
.panel-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
/* display:flex would otherwise win over the hidden attribute. */
.panel-sub[hidden] { display: none; }

/* The side panel switches between Activity and How to. */
.tabs { display: inline-flex; gap: 4px; margin-left: -8px; }
.tabs button { white-space: nowrap; }
.tabs button {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  height: 32px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  padding: 0 8px;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); }

.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane[hidden] { display: none; }

.filters {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-right: 4px;
}
.filters button {
  font: inherit;
  font-size: 12px;
  height: 24px;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0 8px;
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.filters button:hover { color: var(--text); }
.filters button.on { color: var(--text); background: var(--surface-3); }

/* The ledger: one line per movement, figures in a right-aligned column. */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 16px;
  display: flex;
  flex-direction: column;
}

.txn {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background-color var(--fast) var(--ease);
}
.txn:hover { background: var(--surface-2); }
.txn.updated { animation: flash 1.2s var(--ease); }
@keyframes flash {
  0% { background: rgba(214, 165, 74, 0.12); }
  100% { background: transparent; }
}

.txn-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.txn-who { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }

.arrow {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
}
.arrow.collect { color: var(--good); }

.txn .amount {
  font-size: 16px;
  line-height: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.txn .amount .cur { font-size: 11px; font-weight: 400; color: var(--muted); margin-right: 4px; }
.txn .amount.in { color: var(--good); }
.txn .peer {
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txn .peer .phone { color: var(--text-2); font-variant-numeric: tabular-nums; }
.txn .sub-line {
  color: var(--text-2);
  font-size: 12px;
  line-height: 16px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-left: 40px;
}
.txn-tags { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 24px; }
.txn-tags .icon-btn.small { width: 24px; height: 24px; margin-left: -4px; }
.txn-tags .icon-btn.small .i { width: 14px; height: 14px; }

/* Status: a dot and one word. Only pending moves, because it is live. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.pill.success::before { background: var(--good); }
.pill.failed { color: var(--bad); }
.pill.failed::before { background: var(--bad); }
.pill.pending { color: var(--accent); }
.pill.pending::before { display: none; }

.pill.pending .live {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.wallet-tag {
  font-size: 12px;
  color: var(--muted);
}

.txn .time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* The signature: the provider reference, set like a stamped slip number. */
.ref {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 4px 0 0 40px;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--fast) var(--ease);
}
.ref::before { content: "Ref "; color: var(--muted); opacity: 0.7; }
.ref:hover { color: var(--text-2); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  padding: 48px 24px;
}
.empty .big { display: inline-flex; color: var(--muted); }
.empty .big .i { width: 24px; height: 24px; }

.skeleton {
  height: 92px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(var(--surface-2), var(--surface-2)) 16px 20px / 40% 12px no-repeat,
    linear-gradient(var(--surface-2), var(--surface-2)) 16px 44px / 24% 12px no-repeat;
}

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  padding: 8px 16px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--slow) var(--ease), transform var(--slow) var(--ease);
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Shown above the activity list when the ledger could not be read, so a
   partial list is never mistaken for the whole picture. */
.degraded-banner {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent);
  border: 1px solid rgba(214, 165, 74, 0.28);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin: 12px 16px 4px;
}

/* ---------------------------------------------------------------- chats */
.chat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 max(12px, calc((100% - 776px) / 2));
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
}

.chat-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 32px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  padding: 0 8px;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease);
}
.chat-picker:hover { background: var(--surface-2); }
.chat-picker #chat-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 44vw;
}
.chat-picker .caret { color: var(--muted); display: inline-flex; }

.chats-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: max(12px, calc((100% - 776px) / 2));
  z-index: 20;
  width: min(340px, calc(100% - 24px));
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chats-menu[hidden] { display: none; }

.chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--r-sm);
  padding: 2px 2px 2px 12px;
}
.chat-row:hover { background: var(--surface-3); }
.chat-row.on { background: var(--surface-3); }

.chat-row .open {
  flex: 1;
  min-width: 0;
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 8px 0;
  cursor: pointer;
}
.chat-row .open .when {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 0;
}
.chat-row .open .name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-row .drop {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.chat-row .drop:hover { color: var(--bad); background: rgba(226, 128, 111, 0.12); }

.chats-empty { padding: 12px; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ how to */
.howto {
  overflow-y: auto;
  padding: 16px 16px 32px;
  gap: 32px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
.howto-block > h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.howto-block .free {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.howto p { margin: 0 0 8px; }
.howto p:last-child { margin-bottom: 0; }
.howto b { color: var(--text); font-weight: 500; }
.howto em { color: var(--text); font-style: normal; font-weight: 500; }
.howto .muted { color: var(--muted); font-size: 12px; }

.howto .steps,
.howto .plain {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.howto .steps li::marker { color: var(--muted); }
.howto .plain { list-style: none; padding-left: 0; }
.howto .plain li { padding-left: 12px; position: relative; }
.howto .plain li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

/* One capability: what it is, which rails carry it, and a phrase to try. */
.cap {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
.cap:last-child { padding-bottom: 0; }
.cap-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.cap-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.rails { display: flex; gap: 4px; flex-shrink: 0; }
.rail {
  font-size: 12px;
  color: var(--muted);
}
.rail + .rail::before { content: "· "; }
.cap.soon h4 { color: var(--text-2); }
.soon-tag { font-size: 12px; color: var(--muted); }

/* Examples load into the composer rather than sending — these are real
   money commands, so the operator edits the number before it goes. */
.ex {
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-top: 4px;
  cursor: pointer;
  width: 100%;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.ex:hover { color: var(--text); border-color: var(--border-strong); }
.ex-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ex-grid .ex { margin-top: 0; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  header { padding: 0 16px; }
  .brand-text .sub { display: none; }
  .panels { flex-direction: column; }
  .msg { max-width: 88%; }
  .balances { max-width: 42vw; }
}

/* On a phone the balances and status need the whole header row, so the
   wordmark drops to the logo alone rather than being squeezed to an ellipsis.
   header-right may shrink here: with it pinned, the balances pushed the logo
   off the row instead of scrolling within it. */
@media (max-width: 560px) {
  .brand-text { display: none; }
  .header-right { min-width: 0; flex-shrink: 1; gap: 8px; }
  .balances { max-width: none; gap: 12px; }
  .bal + .bal { padding-left: 12px; }
  .bal .bal-value { font-size: 14px; }
  #status span:not(.dot) { display: none; }
  #status { padding: 0 8px; }
  /* The warning keeps its icon; the word costs more than the row has. */
  body.unprotected .unprotected-flag .flag-text { display: none; }
  body.unprotected .unprotected-flag { padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(236, 235, 231, 0.08);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(236, 235, 231, 0.16); background-clip: content-box; }

/* -------------------------------------------------------------------- lock */
.lock {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.lock[hidden] { display: none; }
.lock-card {
  width: min(360px, calc(100vw - 40px));
  padding: 32px 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-align: center;
}
.lock-logo { display: block; margin: 0 auto 16px; border-radius: 12px; }
.lock-card h2 { margin: 0 0 8px; font-size: 18px; font-weight: 500; }
.lock-card p { margin: 0 0 20px; color: var(--text-2); font-size: 13px; }
.lock-card input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  outline: none;
  margin-bottom: 12px;
  transition: border-color var(--fast) var(--ease);
}
.lock-card input:focus { border-color: rgba(236, 235, 231, 0.32); }
.lock-card button,
.dev-form button {
  width: 100%;
  height: 40px;
  font: inherit;
  font-weight: 500;
  color: var(--bg);
  background: var(--text);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.lock-card button:hover { opacity: 0.92; }
.lock-card button:active { transform: scale(0.98); }
.lock-error { margin: 12px 0 0 !important; color: var(--bad); font-size: 13px; }
.lock-error[hidden] { display: none; }

/* Developer tab */
.dev-form { display: grid; gap: 4px; margin-top: 12px; }
.dev-form label { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.dev-form label:first-child { margin-top: 0; }
.dev-form input {
  height: 40px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--fast) var(--ease);
}
.dev-form input:focus { border-color: rgba(236, 235, 231, 0.32); }
.dev-form button { margin-top: 12px; }
.dev-secret { margin-top: 16px; display: grid; gap: 4px; }
.dev-secret[hidden] { display: none; }
.dev-secret label { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.dev-secret code {
  display: block;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  word-break: break-all;
  user-select: all;
}
.howto a { color: var(--accent); }
