/* ---------------------------------------------------------------------------
   Sanctum - design tokens (from design 5a). Palette is deliberately abstract:
   retint by editing this block only.
--------------------------------------------------------------------------- */
:root {
  --paper: #faf9f5;        /* main surface */
  --panel: #f2f0e9;        /* sidebar / recessed surfaces */
  --card: #ffffff;
  --card-soft: rgba(255, 255, 255, 0.72);
  --topbar: #fdfcf9;
  --wash: #f4f1e9;         /* hover wash, notes */

  --ink: #3b372f;          /* warm graphite, the main color */
  --ink-2: #6b6558;        /* secondary text */
  --ink-3: #8b8578;        /* muted text */
  --ink-4: #948e81;        /* fainter */
  --ink-5: #a29c8e;        /* faintest labels */

  --line: #e6e3da;         /* card borders */
  --line-2: #e8e5dc;       /* section rules */
  --line-3: #f0ede4;       /* row rules */
  --line-soft: #ece9df;

  --pos: oklch(0.62 0.09 155);
  --pos-soft: oklch(0.94 0.035 150);
  --pos-deep: oklch(0.42 0.09 155);
  --neg-dot: #c4bfb2;
  --neg-amt: #8d8779;

  --tone-1: var(--ink);
  --tone-2: #a39d8e;
  --tone-3: #d5cfc0;

  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Newsreader", Georgia, serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --shadow-card: 0 1px 2px rgba(59, 55, 47, 0.04);
  --shadow-pop: 0 24px 48px -24px rgba(59, 55, 47, 0.45), 0 4px 12px -6px rgba(59, 55, 47, 0.12);
  --ring: 0 0 0 2px rgba(59, 55, 47, 0.14), 0 10px 24px -20px rgba(59, 55, 47, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
button {
  font: inherit; color: inherit; background: none; border: none; padding: 0;
  cursor: pointer; text-align: left;
}
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 6px;
}
input { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ shell */
.app {
  display: flex;
  min-height: 100vh;
  min-width: 1080px;
}

/* sidebar */
.side {
  width: 236px; flex: none;
  background: var(--panel);
  border-right: 1px solid #e4e1d8;
  display: flex; flex-direction: column;
  padding: 18px 14px; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 9px; padding: 0 8px; }
.side-brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); flex: none; }
.side-brand .name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.side-brand .kbd {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px; color: var(--ink-5);
  border: 1px solid rgba(59, 55, 47, 0.14); border-radius: 4px; padding: 2px 5px;
  transition: color 140ms ease, border-color 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .side-brand .kbd:hover { color: var(--ink-2); border-color: rgba(59, 55, 47, 0.3); }
}
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side .nav-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-5); padding: 0 9px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: 7px;
  font-size: 13.5px; color: var(--ink-2); width: 100%;
  transition: background 140ms ease, color 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { background: rgba(255, 255, 255, 0.6); color: var(--ink); }
}
.nav-item[aria-current="page"] {
  background: var(--card); color: var(--ink);
  font-weight: 600; box-shadow: var(--shadow-card);
}
.side .rm {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line);
  width: 100%;
  transition: border-color 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .side .rm:hover { border-color: #c9c4b6; }
}
.rm .avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--ink); color: #f6f4ef;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px;
}
.rm .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rm .who b { font-size: 12.5px; font-weight: 600; }
.rm .who span { font-size: 11px; color: var(--ink-3); }

/* main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; flex: none;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: var(--topbar);
  position: sticky; top: 0; z-index: 20;
}
.search {
  flex: 1; max-width: 380px;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #f6f4ef;
  color: #9c9688; font-size: 12.5px;
  transition: border-color 140ms ease, color 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .search:hover { border-color: #c9c4b6; color: var(--ink-2); }
}
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .who span { font-size: 12.5px; color: #7d786d; }
.topbar .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: #e4e1d8;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; color: var(--ink-2);
}

.view { padding: 26px 28px 32px; display: flex; flex-direction: column; gap: 18px; }

/* view transition: quiet fade/rise */
.view > * { animation: rise 280ms var(--ease-out) both; }
.view > *:nth-child(2) { animation-delay: 30ms; }
.view > *:nth-child(3) { animation-delay: 60ms; }
.view > *:nth-child(4) { animation-delay: 90ms; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------ page header */
.page-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; letter-spacing: -0.025em; }
.page-head .figure { font-size: 25px; font-weight: 400; color: var(--ink-2); }
.page-head .note { font-size: 12.5px; color: var(--ink-4); align-self: center; }

/* buttons */
.btn {
  font-size: 12.5px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid #e0ddd3; background: var(--card);
  display: inline-flex; align-items: center; gap: 7px;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: #c9c4b6; }
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  font-weight: 500; background: var(--ink); color: #f6f4ef; border-color: var(--ink);
  box-shadow: 0 6px 14px -10px rgba(59, 55, 47, 0.9);
}
@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover { background: #2c2921; }
}
.btn.quiet { color: var(--ink-2); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:active { transform: none; }
.actions { display: flex; gap: 9px; position: relative; flex-wrap: wrap; }

/* --------------------------------------------------------- balance cards */
.asset-grid { display: grid; grid-template-columns: repeat(4, 1fr) 150px; gap: 12px; }
.asset-card {
  border-radius: 11px; padding: 15px 16px;
  display: flex; flex-direction: column; gap: 11px;
  background: var(--card-soft); border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transition: box-shadow 150ms ease, border-color 150ms ease, background 150ms ease, transform 140ms var(--ease-out);
  text-align: left; width: 100%;
}
.asset-card:active { transform: scale(0.985); }
.asset-card.selected { background: var(--card); border-color: var(--ink); box-shadow: var(--ring); }
.asset-card .row { display: flex; align-items: center; justify-content: space-between; }
.asset-card .id { display: flex; align-items: center; gap: 8px; }
.asset-card .glyph {
  width: 21px; height: 21px; border-radius: 6px;
  background: rgba(59, 55, 47, 0.06);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9.5px; color: var(--ink-2);
}
.asset-card .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--ink-3); transition: color 150ms ease; }
.asset-card.selected .label { color: var(--ink); }
.asset-card .alloc { font-family: var(--mono); font-size: 10.5px; color: #a8a294; }
.asset-card .amount { font-size: 22px; font-weight: 500; letter-spacing: -0.03em; }
.asset-card .sub { font-size: 11.5px; color: var(--ink-3); }
.add-cell {
  border-radius: 11px; border: 1px dashed #d8d4c8;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: var(--ink-3); text-align: center; padding: 0 12px;
  transition: border-color 140ms ease, color 140ms ease;
  width: 100%;
}
@media (hover: hover) and (pointer: fine) {
  .add-cell:hover { border-color: #b8b3a4; color: #5f5a50; }
}

/* ------------------------------------------------------------- two-column */
.columns { display: grid; grid-template-columns: 1fr 336px; gap: 24px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.col-rail { display: flex; flex-direction: column; gap: 16px; }

.block { display: flex; flex-direction: column; gap: 14px; }
.block-head { display: flex; align-items: baseline; gap: 10px; }
.block-head h2 { font-size: 15px; letter-spacing: -0.01em; }
.block-head .sub { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }

/* stacked summary bar */
.stack-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; gap: 2px; }
.stack-bar div { border-radius: 3px; transition: width 320ms var(--ease-in-out); }
.summary-rows { display: flex; flex-direction: column; }
.summary-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.summary-row .id { display: flex; align-items: center; gap: 9px; }
.summary-row .swatch { width: 8px; height: 8px; border-radius: 3px; }
.summary-row .label { font-size: 13px; }
.summary-row .amt { font-family: var(--mono); font-size: 13px; }

/* tabs */
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.tab {
  font-size: 13px; padding-bottom: 9px; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 140ms ease, border-color 140ms ease;
}
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-color: var(--ink); }
.tabs .end { margin-left: auto; font-size: 12.5px; color: #7d786d; padding-bottom: 9px; transition: color 140ms ease; }
@media (hover: hover) and (pointer: fine) {
  .tabs .end:hover { color: var(--ink); }
  .tab:hover { color: var(--ink); }
}

/* transaction rows */
.tx-list { display: flex; flex-direction: column; }
.tx-row {
  display: grid; grid-template-columns: 1fr 96px 74px 148px; gap: 14px; align-items: center;
  padding: 12px 10px; margin: 0 -10px; border-radius: 8px;
  border-bottom: 1px solid var(--line-3);
  transition: background 140ms ease;
  width: calc(100% + 20px); text-align: left;
}
@media (hover: hover) and (pointer: fine) {
  .tx-row:hover { background: var(--wash); }
}
.tx-row .id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tx-row .dot { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.tx-row .dot.in { background: var(--pos); }
.tx-row .dot.out { background: var(--neg-dot); }
.tx-row .what { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tx-row .name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-row .meta { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; color: #6f6a5f;
  border: 1px solid rgba(59, 55, 47, 0.14);
  padding: 3px 8px; border-radius: 20px; justify-self: start;
}
.tx-row .date { font-family: var(--mono); font-size: 12px; color: var(--ink-4); }
.tx-row .amt { font-family: var(--mono); font-size: 14px; text-align: right; }
.tx-row .amt.in { color: var(--ink); }
.tx-row .amt.out { color: var(--neg-amt); }
.tx-row.fresh { animation: fresh-in 420ms var(--ease-out) both; }
@keyframes fresh-in {
  from { opacity: 0; transform: translateY(-6px); background: var(--pos-soft); }
  to { opacity: 1; transform: translateY(0); background: transparent; }
}
.empty {
  padding: 28px 0; text-align: center; color: var(--ink-4); font-size: 12.5px;
}

/* ------------------------------------------------------------- rail cards */
.card-box {
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 17px 19px 19px; display: flex; flex-direction: column; gap: 15px;
  box-shadow: var(--shadow-card);
}
.card-box .head { display: flex; align-items: center; justify-content: space-between; }
.card-box .head h2 { font-size: 14px; letter-spacing: -0.01em; }
.card-box .tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--ink-5); }
.big-figure { display: flex; align-items: baseline; gap: 8px; }
.big-figure .cur { font-size: 16px; color: #928c7f; font-weight: 500; }
.big-figure .val { font-weight: 500; font-size: 34px; line-height: 1; letter-spacing: -0.03em; }
.fine { font-size: 12px; color: #7d786d; }
.fine .mono { color: var(--ink); font-size: 12px; }
.hr { height: 1px; background: #eeebe1; }

.yield-rows { display: flex; flex-direction: column; gap: 11px; }
.yield-row { display: flex; flex-direction: column; gap: 6px; }
.yield-row .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.yield-row .src { font-size: 12.5px; }
.yield-row .amt { font-family: var(--mono); font-size: 12.5px; }
.yield-row .meter { display: flex; align-items: center; gap: 8px; }
.yield-row .track { flex: 1; height: 3px; background: rgba(59, 55, 47, 0.10); border-radius: 2px; overflow: hidden; }
.yield-row .fill { height: 100%; background: var(--ink-2); border-radius: 2px; }
.yield-row .rate { font-family: var(--mono); font-size: 11px; color: #928c7f; width: 44px; text-align: right; }

.list-box {
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 17px 19px 8px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-card);
}
.list-box h2 { font-size: 14px; letter-spacing: -0.01em; margin-bottom: 8px; }
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-top: 1px solid var(--line-3);
  width: 100%;
  transition: color 140ms ease;
}
.list-row .name { font-size: 13px; }
.list-row .when { font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); }
@media (hover: hover) and (pointer: fine) {
  button.list-row:hover .name { color: var(--ink-2); }
}

.note-box {
  border-radius: 12px; border: 1px solid var(--line); background: var(--wash);
  padding: 15px 18px; display: flex; flex-direction: column; gap: 6px;
}
.note-box b { font-size: 12.5px; font-weight: 600; }
.note-box span { font-size: 11.5px; color: #7d786d; line-height: 1.55; }

/* --------------------------------------------------------------- dropdown */
.menu {
  position: absolute; top: calc(100% + 6px); z-index: 40;
  min-width: 224px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 5px; display: flex; flex-direction: column;
  transform-origin: top left;
  animation: pop-in 150ms var(--ease-out) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(-2px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 7px; font-size: 12.5px; width: 100%;
  transition: background 120ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .menu button:hover { background: var(--wash); }
}
.menu .when { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }

/* ----------------------------------------------------------------- modal */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(59, 55, 47, 0.32);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 20px 20px;
  opacity: 1;
  transition: opacity 180ms ease;
  @starting-style { opacity: 0; }
}
.overlay.closing { opacity: 0; }
.modal {
  width: 440px; max-width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  transform: scale(1) translateY(0); opacity: 1;
  transition: transform 220ms var(--ease-out), opacity 180ms ease;
  @starting-style { transform: scale(0.96) translateY(8px); opacity: 0; }
}
.overlay.closing .modal { transform: scale(0.97) translateY(4px); opacity: 0; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
.modal-head h2 { font-size: 15px; letter-spacing: -0.01em; }
.modal-head .close { color: var(--ink-4); font-size: 16px; line-height: 1; padding: 4px; border-radius: 6px; transition: color 120ms ease; }
@media (hover: hover) and (pointer: fine) {
  .modal-head .close:hover { color: var(--ink); }
}
.modal-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-body .lead { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin: 0; }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; text-align: center; font-size: 12.5px; padding: 8px 0;
  border: 1px solid #e0ddd3; border-radius: 8px; color: var(--ink-2);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms var(--ease-out);
}
.seg button:active { transform: scale(0.97); }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #f6f4ef; font-weight: 500; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--ink-5); }
.field .input {
  display: flex; align-items: baseline; gap: 8px;
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px;
  background: #fdfcf9;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field .input:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(59, 55, 47, 0.08); }
.field .input .cur { font-family: var(--mono); font-size: 12.5px; color: var(--ink-4); }
.field .input input {
  border: none; outline: none; background: none; flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 17px; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; padding: 0;
}
.field .hint { font-size: 11.5px; color: var(--ink-4); }
.field .hint button { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }

.kv { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kv-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 13px; background: #fdfcf9;
  border-top: 1px solid var(--line-3); font-size: 12.5px;
}
.kv-row:first-child { border-top: none; }
.kv-row .k { color: var(--ink-3); flex: none; }
.kv-row .v { font-family: var(--mono); font-size: 12px; text-align: right; word-break: break-all; }
.kv-row .copy {
  flex: none; font-family: var(--mono); font-size: 10px; color: var(--ink-4);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px;
  transition: color 120ms ease, border-color 120ms ease, transform 140ms var(--ease-out);
}
.kv-row .copy:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .kv-row .copy:hover { color: var(--ink); border-color: #c9c4b6; }
}

.quote-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); }
.quote-line .v { font-family: var(--mono); color: var(--ink); }

.modal-foot { display: flex; gap: 9px; justify-content: flex-end; padding-top: 2px; }

/* confirmation state */
.confirm-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 4px; text-align: center; }
.confirm-mark {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--pos-soft); color: var(--pos-deep);
  display: flex; align-items: center; justify-content: center;
  animation: mark-in 360ms var(--ease-out) both;
}
@keyframes mark-in {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
.confirm-mark svg { width: 20px; height: 20px; }
.confirm-mark svg path {
  stroke-dasharray: 24; stroke-dashoffset: 24;
  animation: draw 320ms 160ms var(--ease-out) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.confirm-wrap h3 { font-size: 15px; }
.confirm-wrap p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.confirm-wrap .ref { font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); }

/* ----------------------------------------------------------------- toast */
.toasts {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: var(--ink); color: #f6f4ef;
  font-size: 12.5px; padding: 10px 14px; border-radius: 9px;
  box-shadow: 0 12px 28px -12px rgba(59, 55, 47, 0.7);
  display: flex; align-items: center; gap: 9px;
  max-width: 360px;
  opacity: 1; transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms var(--ease-out);
  @starting-style { opacity: 0; transform: translateY(10px); }
}
.toast.leaving { opacity: 0; transform: translateY(6px); }
.toast .mono { font-size: 11px; color: #b8b2a4; }

/* --------------------------------------------------------- command palette */
.palette-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(59, 55, 47, 0.24);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 14vh 20px 20px;
}
.palette {
  width: 480px; max-width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; overflow: hidden;
}
.palette input {
  border: none; outline: none; background: none;
  padding: 14px 16px; font-size: 14px;
  border-bottom: 1px solid var(--line-3);
}
.palette-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 11px; border-radius: 7px; font-size: 13px; width: 100%;
}
.palette-item .kind { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-5); }
.palette-item.active { background: var(--wash); }
.palette-empty { padding: 18px; text-align: center; font-size: 12.5px; color: var(--ink-4); }

/* ------------------------------------------------------------ page: home */
.hero-figure { display: flex; align-items: baseline; gap: 12px; }
.hero-figure .cur { font-size: 22px; color: #928c7f; font-weight: 500; }
.hero-figure .val { font-weight: 500; font-size: 56px; line-height: 1; letter-spacing: -0.038em; }
.hero-figure .delta {
  display: flex; align-items: center; gap: 6px; margin-left: 6px;
  padding: 5px 11px; border-radius: 20px;
  background: var(--pos-soft); color: var(--pos-deep);
  font-size: 12.5px; font-family: var(--mono);
}
.spark { height: 54px; display: flex; align-items: flex-end; gap: 4px; width: 300px; }
.spark div {
  flex: 1; border-radius: 3px 3px 1px 1px;
  background: linear-gradient(rgba(59, 55, 47, 0.42), rgba(59, 55, 47, 0.16));
}
.shortcut-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.shortcut {
  border-radius: 11px; border: 1px solid var(--line); background: var(--card);
  padding: 15px 16px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-card); text-align: left; width: 100%;
  transition: border-color 140ms ease, transform 140ms var(--ease-out), box-shadow 140ms ease;
}
.shortcut:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) {
  .shortcut:hover { border-color: #c9c4b6; box-shadow: 0 10px 24px -20px rgba(59, 55, 47, 0.5); }
}
.shortcut b { font-size: 13px; font-weight: 600; }
.shortcut span { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }

/* --------------------------------------------------------- page: activity */
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-pill {
  font-size: 12px; padding: 6px 12px; border-radius: 20px;
  border: 1px solid #e0ddd3; background: var(--card); color: var(--ink-2);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.filter-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #f6f4ef; }
.filter-row .search-inline {
  margin-left: auto; display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; background: #fdfcf9;
  padding: 6px 11px; width: 220px;
  transition: border-color 140ms ease;
}
.filter-row .search-inline:focus-within { border-color: var(--ink); }
.filter-row .search-inline input { border: none; outline: none; background: none; width: 100%; font-size: 12.5px; padding: 0; }

/* ------------------------------------------------------------ page: cards */
/* card: 3D flip scene. Click turns the card over to reveal the number. */
.card-scene { perspective: 1200px; width: 340px; flex: none; }
.card-flip {
  position: relative; display: block; width: 340px; height: 208px;
  border-radius: 16px;
  transform-style: preserve-3d;
  transition: transform 700ms cubic-bezier(0.3, 1.18, 0.44, 1), filter 260ms ease;
  box-shadow: 0 24px 44px -22px rgba(59, 55, 47, 0.75);
  cursor: pointer;
}
.card-flip.flipped { transform: rotateY(180deg); }
.card-flip.frozen { filter: grayscale(0.9) brightness(1.06); }
.card-face {
  position: absolute; inset: 0; border-radius: 16px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}
.card-face.card-back { transform: rotateY(180deg); }

.bank-card {
  background:
    radial-gradient(440px 230px at 18% 0%, rgba(255, 255, 255, 0.17), transparent 62%),
    radial-gradient(480px 260px at 88% 115%, rgba(255, 255, 255, 0.06), transparent 62%),
    linear-gradient(135deg, #4b463d 0%, #332f27 48%, #232019 100%);
  color: #efece3;
  padding: 20px 22px; display: flex; flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  text-align: left;
}
.bank-card::before {
  /* brushed-metal grain */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px);
}
.bank-card::after {
  /* specular sheen, sweeps on hover */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.13) 50%, transparent 60%);
  transform: translateX(-70%);
  transition: transform 900ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card-flip:hover .card-face::after { transform: translateX(70%); }
}
.bank-card .net { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; color: #b6b0a2; }
.bank-card .brand-row { display: flex; justify-content: space-between; align-items: center; }
.bank-card .brand-row b { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.emv-row { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.emv {
  width: 36px; height: 27px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, #dbcb96 0%, #b8a76e 55%, #cdbc85 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), inset 0 -1px 1px rgba(59, 55, 47, 0.4);
  position: relative;
}
.emv::before {
  content: ""; position: absolute; inset: 4px 6px;
  border: 1px solid rgba(59, 55, 47, 0.35); border-radius: 3px;
}
.emv::after {
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 50%;
  width: 1px; background: rgba(59, 55, 47, 0.35);
}
.wave { color: #b6b0a2; }
.bank-card .foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; }
.bank-card .foot .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: #a29c8e; display: block; margin-bottom: 3px; }
.bank-card .foot .v { font-size: 12px; }

/* card back */
.card-back { padding: 0; display: flex; flex-direction: column; }
.card-back .stripe { height: 34px; flex: none; background: #191712; margin-top: 20px; }
.card-back .back-body { padding: 18px 22px 0; display: flex; flex-direction: column; gap: 12px; }
.card-back .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: #a29c8e; display: block; margin-bottom: 3px; }
.card-back .pan { font-family: var(--mono); font-size: 17.5px; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.card-back .back-row { display: flex; gap: 26px; align-items: flex-end; }
.card-back .back-row .v { font-family: var(--mono); font-size: 12.5px; }
.card-back .back-row .net { margin-left: auto; }
.card-back .fineprint {
  margin-top: auto; padding: 0 22px 14px;
  font-size: 8.5px; line-height: 1.5; color: #8f897b;
}
.frozen-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  padding: 4px 9px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.16); color: #efece3;
  border: 1px solid rgba(255, 255, 255, 0.25);
  animation: badge-in 200ms var(--ease-out) both;
}
@keyframes badge-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.card-layout { display: flex; gap: 26px; align-items: flex-start; }
.card-side { display: flex; flex-direction: column; gap: 14px; }
.spend-meter { display: flex; flex-direction: column; gap: 8px; }
.spend-meter .track { height: 5px; border-radius: 3px; background: rgba(59, 55, 47, 0.10); overflow: hidden; }
.spend-meter .fill { height: 100%; border-radius: 3px; background: var(--ink-2); transition: width 420ms var(--ease-in-out); }

/* switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch-row .txt b { display: block; font-size: 13px; font-weight: 600; }
.switch-row .txt span { font-size: 11.5px; color: var(--ink-3); }
.switch {
  width: 38px; height: 22px; border-radius: 12px; flex: none;
  background: #d8d4c8; position: relative;
  transition: background 180ms ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(59, 55, 47, 0.3);
  transition: transform 180ms var(--ease-out);
}
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* -------------------------------------------------------- page: portfolio */
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--ink-5); font-weight: 400; text-align: right;
  padding: 0 10px 9px; border-bottom: 1px solid var(--line-2);
}
.table th:first-child { text-align: left; }
.table td {
  padding: 11px 10px; border-bottom: 1px solid var(--line-3);
  font-family: var(--mono); font-size: 12.5px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.table td:first-child { text-align: left; font-family: var(--sans); font-size: 13px; }
.table td .sym { font-family: var(--mono); font-size: 11px; color: var(--ink-4); margin-right: 9px; }
.table .pl-pos { color: var(--pos-deep); }
.table .pl-neg { color: var(--neg-amt); }
.table tr { transition: background 140ms ease; }
@media (hover: hover) and (pointer: fine) {
  .table tbody tr:hover { background: var(--wash); }
}

/* --------------------------------------------------------------- page: fx */
.fx-box {
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 19px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-card); width: 440px;
}
.rate-strip { display: flex; gap: 12px; }
.rate-tile {
  flex: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  padding: 13px 15px; display: flex; flex-direction: column; gap: 5px;
  box-shadow: var(--shadow-card);
}
.rate-tile .pair { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--ink-5); }
.rate-tile .rate { font-family: var(--mono); font-size: 19px; letter-spacing: -0.01em; }
.rate-tile .drift { font-size: 11px; color: var(--ink-4); }

/* ----------------------------------------------------------- page: stocks */
.stocks-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.watchlist { border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 8px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 2px; }
.watch-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; width: 100%;
  transition: background 130ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .watch-row:hover { background: var(--wash); }
}
.watch-row[aria-current="true"] { background: var(--wash); box-shadow: inset 0 0 0 1px #ddd8c9; }
.watch-row .id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.watch-row .id b { font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em; }
.watch-row .id span { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-row .px { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.watch-row .px .p { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chg {
  font-family: var(--mono); font-size: 10.5px; font-variant-numeric: tabular-nums;
  padding: 1.5px 6px; border-radius: 10px;
}
.chg.up { color: var(--pos-deep); background: var(--pos-soft); }
.chg.down { color: #8d8779; background: #f0efeb; }
.stock-head { display: flex; align-items: flex-start; gap: 14px; }
.stock-head .who { flex: 1; }
.stock-head .who h2 { font-size: 17px; letter-spacing: -0.01em; }
.stock-head .who .sub { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.tok-badge {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em;
  border: 1px solid #d9cfae; background: #f3edd9; color: #85763f;
  border-radius: 4px; padding: 2px 6px;
}
.stock-price-row { display: flex; align-items: baseline; gap: 10px; }
.stock-price { font-size: 30px; font-weight: 500; letter-spacing: -0.03em; }
.ticket-pos { font-size: 11.5px; color: var(--ink-4); }

/* -------------------------------------------------------- page: referrals */
.ref-code-box {
  border: 1px dashed #cfc9ba; border-radius: 12px; background: #fdfcf9;
  padding: 18px 20px; display: flex; align-items: center; gap: 16px;
}
.ref-code {
  font-family: var(--mono); font-size: 21px; letter-spacing: 0.14em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.ladder { display: flex; gap: 10px; }
.rung {
  flex: 1; border: 1px solid var(--line); border-radius: 11px;
  padding: 13px 14px; display: flex; flex-direction: column; gap: 3px;
  background: var(--card); position: relative;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.rung .amt { font-family: var(--mono); font-size: 18px; letter-spacing: -0.01em; }
.rung .who { font-size: 11px; color: var(--ink-4); }
.rung.done { background: var(--wash); }
.rung.done .amt::after { content: " \2713"; color: var(--pos-deep); font-size: 13px; }
.rung.next { border-color: var(--ink); box-shadow: var(--ring); }
.rung .tag-next {
  position: absolute; top: -8px; right: 10px;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
  background: var(--ink); color: #f6f4ef; border-radius: 4px; padding: 2px 6px;
  animation: pop-in 200ms var(--ease-out) both;
}
.ref-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--line-3);
}
.ref-row .avatar2 {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; color: var(--ink-2);
}
.ref-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ref-row .who b { font-size: 13px; font-weight: 600; }
.ref-row .who span { font-size: 11px; color: var(--ink-4); }
.ref-row .amt { font-family: var(--mono); font-size: 13.5px; color: var(--pos-deep); }
.ref-row.pending .amt { color: var(--ink-4); }

/* ------------------------------------------------------------- page: data */
.data-layout { display: grid; grid-template-columns: 236px 1fr; gap: 20px; align-items: start; }
.data-rail { display: flex; flex-direction: column; gap: 16px; }
.data-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tpl-btn { display: flex; flex-direction: column; gap: 2px; padding: 9px 0; border-top: 1px solid var(--line-3); width: 100%; }
.tpl-btn b { font-size: 12.5px; font-weight: 600; transition: color 120ms ease; }
.tpl-btn span { font-size: 11px; color: var(--ink-4); }
@media (hover: hover) and (pointer: fine) {
  .tpl-btn:hover b { color: var(--ink-2); }
}
.schema-t { border-top: 1px solid var(--line-3); }
.schema-t > button {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 0;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink);
}
.schema-t .n { color: var(--ink-5); font-size: 10px; }
.schema-cols { display: flex; flex-direction: column; padding: 0 0 8px; }
.schema-cols button {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  padding: 2.5px 0 2.5px 12px; text-align: left;
  transition: color 120ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .schema-cols button:hover { color: var(--ink); }
}

.sql-box { border: 1px solid var(--line); border-radius: 10px; background: #fdfcf9; overflow: hidden; transition: border-color 140ms ease, box-shadow 140ms ease; }
.sql-box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(59, 55, 47, 0.08); }
.sql-wrap { display: flex; }
.sql-gutter {
  flex: none; padding: 12px 0 12px 0; width: 40px; text-align: right;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  color: #c5bfae; background: var(--wash); border-right: 1px solid var(--line-3);
  user-select: none;
}
.sql-gutter span { display: block; padding-right: 10px; }
#sql-editor {
  flex: 1; border: none; outline: none; background: none; resize: vertical;
  padding: 12px 14px; min-height: 132px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  color: var(--ink); white-space: pre; overflow-x: auto;
}
.sql-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-top: 1px solid var(--line-3); background: #fdfcf9;
}
.sql-status { font-family: var(--mono); font-size: 11px; color: var(--ink-4); margin-left: auto; }
.sql-error {
  border: 1px solid #e0c9b8; border-radius: 10px; background: #f9f0e8;
  padding: 11px 14px; font-size: 12.5px; color: #7a4a33;
}
.sql-error .mono { font-size: 11.5px; }
.data-figure { display: flex; align-items: baseline; gap: 8px; padding: 4px 0 8px; }
.data-figure .val { font-size: 34px; font-weight: 500; letter-spacing: -0.03em; }
.data-figure .lbl { font-size: 12px; color: var(--ink-3); }
.result-scroll { overflow-x: auto; }
.result-note { font-size: 11.5px; color: var(--ink-4); padding-top: 8px; }

/* ------------------------------------------------------------ home charts */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-card .head .end { display: flex; align-items: center; gap: 14px; }
.leg { display: flex; gap: 14px; }
.leg span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-toggle {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-4);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px;
  transition: color 120ms ease, border-color 120ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .chart-toggle:hover { color: var(--ink); border-color: #c9c4b6; }
}
.chart-hit { outline-offset: -2px; }
.chart-hit:focus-visible { outline: 2px solid var(--ink); border-radius: 0; }
.chart-tip {
  position: fixed; z-index: 300; pointer-events: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: var(--shadow-pop);
  padding: 8px 11px; display: none; min-width: 120px;
}
.chart-tip .t-title { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-4); margin-bottom: 5px; }
.chart-tip .t-row { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.chart-tip .t-key { width: 10px; height: 2.5px; border-radius: 1px; flex: none; }
.chart-tip .t-val { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); }
.chart-tip .t-name { font-size: 11px; color: var(--ink-3); }

/* -------------------------------------------------- live rolling numbers */
/* NumberFlow-style odometer: each digit is a clipped column of 0-9 strips
   that rolls upward as the value climbs. Non-digit characters stay static. */
.live-num { white-space: nowrap; }
.live-num .od-roll {
  display: inline-block; overflow: hidden;
  height: 1em; line-height: 1;
  vertical-align: -0.15em;
}
.od-strip {
  display: block;
  transition: transform 320ms var(--ease-out);
  will-change: transform;
}
.od-strip span { display: block; height: 1em; line-height: 1; }

.live-dot {
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: var(--pos);
  animation: live-pulse 2.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .od-strip { transition: none; }
  .live-dot { animation: none; }
}

/* ------------------------------------------------------------ page: agent */
.agent-composer {
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 16px 17px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-card); max-width: 720px;
}
.agent-composer .row { display: flex; gap: 9px; }
.agent-input {
  flex: 1; display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: #fdfcf9;
  padding: 9px 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.agent-input:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(59, 55, 47, 0.08); }
.agent-input input { border: none; outline: none; background: none; width: 100%; font-size: 13.5px; padding: 0; }
.suggest-row { display: flex; gap: 8px; flex-wrap: wrap; }
.suggest {
  font-size: 12px; padding: 6px 12px; border-radius: 20px;
  border: 1px solid #e0ddd3; background: var(--card); color: var(--ink-2);
  transition: border-color 140ms ease, color 140ms ease, transform 140ms var(--ease-out);
}
.suggest:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .suggest:hover { border-color: #c9c4b6; color: var(--ink); }
}

/* thinking skeleton */
.agent-thinking { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.skel {
  height: 40px; border-radius: 10px;
  background: linear-gradient(100deg, var(--panel) 40%, #faf8f1 50%, var(--panel) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skel:nth-child(2) { width: 82%; }
.skel:nth-child(3) { width: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* proposal card + block stack */
.proposal {
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 17px 19px 19px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-card); max-width: 720px;
}
.proposal .head { display: flex; align-items: center; justify-content: space-between; }
.proposal .head h2 { font-size: 14px; letter-spacing: -0.01em; }
.proposal .summary { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin: 0; }

.blocks { display: flex; flex-direction: column; position: relative; padding-left: 14px; }
.blocks::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 2px; border-radius: 1px; background: var(--line);
}
.blk {
  border-radius: 11px; padding: 10px 14px 11px;
  display: flex; flex-direction: column; gap: 5px;
  border: 1px solid transparent;
  align-self: flex-start; min-width: 320px; max-width: 100%;
  animation: rise 280ms var(--ease-out) both;
}
.blk + .blk { margin-top: 7px; }
.blk:nth-child(2) { animation-delay: 50ms; }
.blk:nth-child(3) { animation-delay: 100ms; }
.blk:nth-child(4) { animation-delay: 150ms; }
.blk-eyebrow { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; }
.blk-body { font-size: 13px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; line-height: 1.9; }
.blk-when { background: #efe9d8; border-color: #e3dbc4; }
.blk-when .blk-eyebrow { color: #96895f; }
.blk-if { background: #ece9df; border-color: #ddd8c9; }
.blk-if .blk-eyebrow { color: #948e75; }
.blk-then { background: var(--ink); color: #f6f4ef; border-color: var(--ink); }
.blk-then .blk-eyebrow { color: #a8a294; }

/* editable parameter chips inside blocks */
.pchip {
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
  border-radius: 7px; padding: 2px 8px;
  border: 1px solid rgba(59, 55, 47, 0.18); background-color: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  transition: border-color 120ms ease, background 120ms ease;
}
select.pchip { cursor: pointer; appearance: none; -webkit-appearance: none; padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%236b6558' fill='none' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
input.pchip { width: 76px; text-align: right; }
input.pchip.narrow { width: 46px; }
.pchip:focus { outline: none; border-color: var(--ink); background-color: #fff; }
.blk-then .pchip {
  border-color: rgba(255, 255, 255, 0.28); background-color: rgba(255, 255, 255, 0.12); color: #f6f4ef;
}
.blk-then select.pchip {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23c9c4b6' fill='none' stroke-width='1.4'/%3E%3C/svg%3E");
}
.blk-then select.pchip option { color: var(--ink); background: #fff; }
.blk-then .pchip:focus { border-color: rgba(255, 255, 255, 0.65); background-color: rgba(255, 255, 255, 0.18); }
.blk .static { color: inherit; }

/* inline confirmation (expands inside the card that triggered it) */
.inline-confirm-wrap {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows 220ms var(--ease-out);
  @starting-style { grid-template-rows: 0fr; }
}
.inline-confirm-inner { overflow: hidden; min-height: 0; }
.inline-confirm {
  margin-top: 11px; padding: 12px 0 1px;
  border-top: 1px solid var(--line-3);
  display: flex; align-items: center; gap: 16px;
  opacity: 1;
  transition: opacity 200ms 60ms ease;
  @starting-style { opacity: 0; }
}
.inline-confirm p { margin: 0; flex: 1; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
@media (prefers-reduced-motion: reduce) {
  .inline-confirm-wrap, .inline-confirm { transition: none; }
}

/* automations list */
.automation {
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  padding: 15px 17px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-card);
}
.automation .top { display: flex; align-items: center; gap: 12px; }
.automation .top b { font-size: 13.5px; font-weight: 600; flex: 1; }
.automation.paused .top b { color: var(--ink-3); }
.automation .mini { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-chip {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--ink-2); background: #fdfcf9;
}
.mini-chip.when { background: #efe9d8; border-color: #e3dbc4; }
.mini-chip.then { background: var(--ink); border-color: var(--ink); color: #f6f4ef; }
.automation.paused .mini-chip { opacity: 0.55; }
.automation .foot { display: flex; align-items: center; gap: 12px; }
.automation .foot .log { font-size: 11.5px; color: var(--ink-4); flex: 1; }
.automation .foot .act { font-size: 12px; color: var(--ink-2); transition: color 120ms ease; }
@media (hover: hover) and (pointer: fine) {
  .automation .foot .act:hover { color: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .blk { animation: none; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1240px) {
  .columns { grid-template-columns: 1fr 300px; gap: 18px; }
  .asset-grid { grid-template-columns: repeat(4, 1fr) 130px; }
}

/* --------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .card-flip { transition: filter 260ms ease; }
  .bank-card::after { transition: none; }
  .view > *, .tx-row.fresh, .confirm-mark, .menu, .frozen-badge { animation: none; }
  .confirm-mark svg path { animation: none; stroke-dashoffset: 0; }
  .modal, .overlay, .toast { transition-property: opacity; }
  .modal { transform: none; }
  .stack-bar div, .spend-meter .fill { transition: none; }
}
