/* Hyperjournal — Hyperliquid-ecosystem dark theme (modeled on hl.eco /
   hyperscreener): near-black green surfaces, one mint accent family.
   Self-contained: no external fonts, no JS. Design tokens drive everything.
   Color roles: bright mint = interactive (links, buttons, focus); money keeps
   its own green/red pair, deliberately yellower/warmer than the mint so P&L
   never reads as a link. */

/* Self-hosted webfonts (OFL, no CDN — CSP font-src 'self'). Space Grotesk =
   display (headings, brand, big numbers); Inter = body/UI. font-display:swap
   so text paints immediately in the system fallback while the font loads. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900;
  font-display: swap; src: url("/static/fonts/inter.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700;
  font-display: swap; src: url("/static/fonts/space-grotesk.woff2") format("woff2");
}

:root {
  /* Layered surfaces — elevation by lightness (shadows read weakly on dark) */
  --bg:        #061514;
  --surface:   #0b1d1a;
  --surface-2: #122723;
  --surface-3: #1a342e;
  --border:    #17322c;
  --border-2:  #26483f;

  /* Text ramp */
  --text:   #eafaf4;
  --text-2: #a0c0b6;
  --text-3: #64857b;

  /* Interactive — the Hyperliquid mint family */
  --accent:      #97fce4;
  --accent-2:    #c5fdf1;
  --accent-deep: #50d2c1;
  --accent-ink:  #04231d;
  --focus:       rgba(80,210,193,0.45);

  /* Semantic — P&L only */
  --green: #35d98c; --green-bg: rgba(53,217,140,0.11); --green-bd: rgba(53,217,140,0.28);
  --red:   #ff6b6e; --red-bg:   rgba(255,107,110,0.10); --red-bd:   rgba(255,107,110,0.30);
  --amber: #f0b263; --amber-bg: rgba(240,178,99,0.10);  --amber-bd: rgba(240,178,99,0.30);

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Space Grotesk", var(--sans);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* min-height: the gradients are sized against the body box; on short pages
     (Settings) a body that ends mid-viewport leaves visible banding seams
     where the canvas continues with differently-mapped gradients. */
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 88% -10%, rgba(80,210,193,0.09), transparent 62%),
    radial-gradient(900px 500px at -10% 110%, rgba(80,210,193,0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.1px;
}
::selection { background: rgba(80,210,193,0.35); }

main { max-width: 1120px; margin: 0 auto; padding: var(--s6) var(--s5) var(--s7); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

h1 { font-family: var(--display); font-size: 1.7rem; font-weight: 600; letter-spacing: -0.025em; margin: var(--s3) 0 var(--s4);
     display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
h2 { font-family: var(--display); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em;
     color: var(--text-3); margin: var(--s6) 0 var(--s4); }
/* One louder heading tier: a page full of identical whisper-h2s has no macro
   rhythm — the section that IS the page's point (Analytics → Your leaks)
   gets a real heading; taxonomy tables keep the quiet eyebrow style. */
h2.h2-lead { font-size: 1.05rem; text-transform: none; letter-spacing: -0.01em;
     color: var(--text); margin-top: var(--s7); }

/* Tabular figures so decimal columns line up, but in the UI sans — NOT a
   monospace font. Monospace puts '-', ',' and '.' in full-width digit cells,
   which leaves floaty gaps around them; tabular-nums aligns digits while
   punctuation keeps its natural tight width. */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; letter-spacing: 0; }
/* Money never line-breaks: browsers treat the "-" in -$1,234.56 as a legal
   break point, which split P&L across two lines in the mobile cards. */
table.trades td.num { white-space: nowrap; }
/* Keep wallet addresses / hashes monospace — fixed-width hex is easier to scan. */
.mono { font-family: var(--mono); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.dim { color: var(--text-3); }
.small { font-size: 0.85em; }
.r { text-align: right; }
.c { text-align: center; }

/* ---------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s6);
  background: rgba(6,21,20,0.80);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-family: var(--display);
  font-weight: 600; font-size: 1.02rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand .logo { width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent-ink); }
.brand .logo svg { display: block; }
/* Desktop primary nav, in the topbar (mobile uses the sidebar drawer instead). */
.topbar-brand { margin-left: var(--s2); }
.topnav { display: flex; gap: var(--s5); margin-left: var(--s5); }
.topnav a { font-size: 0.9rem; font-weight: 600; color: var(--text-2); }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--accent); }
.wallet-tags { display: flex; align-items: center; gap: var(--s2); margin-right: var(--s3); }
.wallet-tag { font-size: 0.72rem; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); padding: 3px var(--s2); border-radius: var(--r-pill); white-space: nowrap; }

/* App shell: on desktop, nav is the topbar's .topnav and content is full-width.
   The sidebar is hidden and only appears on mobile as an off-canvas drawer
   toggled by #navtoggle (CSS-only, no JS). */
.sidebar {
  display: none;
  position: fixed; top: 0; left: 0; bottom: 0; width: 212px; z-index: 40;
  flex-direction: column; gap: var(--s5); padding: var(--s4);
  background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar .brand { font-size: 1.05rem; padding: var(--s2); }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a { display: flex; align-items: center; gap: var(--s3);
  padding: 0.6rem var(--s3); border-radius: var(--r-sm);
  color: var(--text-2); font-size: 0.92rem; font-weight: 600; }
.sidenav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--surface-3); color: var(--text); }
.sidenav a svg { color: var(--text-3); flex: none; }
.sidenav a.active svg, .sidenav a:hover svg { color: var(--accent); }

.app { margin-left: 0; }
.topbar-spacer { flex: 1 1 auto; }
.hamburger { display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); cursor: pointer; }
.hamburger:hover { color: var(--text); }
.nav-overlay { display: none; }

@media (max-width: 760px) {
  .topnav, .topbar-brand { display: none; }
  .sidebar { display: flex; transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  #navtoggle:checked ~ .sidebar { transform: none; }
  .hamburger { display: inline-flex; }
  #navtoggle:checked ~ .nav-overlay { display: block; position: fixed; inset: 0;
    z-index: 39; background: rgba(0,0,0,0.55); }
}

/* ---------------------------------------------------------------- buttons */
/* Two-tier hierarchy: primary = filled mint (one per view, the main action);
   ghost = quiet outline for everything else (Sync, Dismiss, Apply, Sign out). */
button, .btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  background: linear-gradient(180deg, var(--accent), #7cf0d4);
  color: var(--accent-ink);
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 0.5rem 1rem; font: inherit; font-weight: 650; line-height: 1;
  cursor: pointer; transition: filter .12s ease, transform .04s ease, background .12s ease;
  box-shadow: 0 0 18px rgba(80,210,193,0.14);
}
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border-2);
  box-shadow: none; font-weight: 600; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-3); filter: none; }
.btn svg, button svg { display: block; }

/* ---------------------------------------------------------------- pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.76rem; font-weight: 650; letter-spacing: 0.01em;
  padding: 0.18rem 0.6rem; border-radius: var(--r-pill); line-height: 1.4;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  text-transform: capitalize; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.long  { color: var(--green); }
.pill.short { color: var(--red); }
.pill.open  { color: var(--accent); }
.pill.open::before { animation: pulse 1.8s ease-in-out infinite; }
.pill.closed { color: var(--text-3); }
.pill.closed::before { background: var(--text-3); }
@keyframes pulse { 0%,100%{opacity:.3} 50%{opacity:1} }

.badge {
  display: inline-flex; align-items: center;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-bd);
  border-radius: 5px; padding: 0.1rem 0.45rem; vertical-align: middle;
}

/* ---------------------------------------------------------------- notices */
.notice, .warn {
  border-radius: var(--r); padding: var(--s3) var(--s4); margin-bottom: var(--s4);
  display: flex; align-items: center; gap: var(--s2); font-size: 0.92rem;
}
.notice { background: var(--green-bg); border: 1px solid var(--green-bd); color: var(--green); }
.warn   { background: var(--amber-bg); border: 1px solid var(--amber-bd); color: var(--amber); }
.notice svg, .warn svg { flex: none; }

/* ---------------------------------------------------------------- open positions strip */
.open-strip { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  background: none; border: none; border-left: 2px solid var(--accent-deep);
  border-radius: 0; padding: var(--s1) var(--s4); margin: var(--s4) 0 var(--s6); }
.open-strip-label { font-size: 0.8rem; color: var(--text-2); font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: var(--s2); }
.open-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.open-chip { display: inline-flex; align-items: center; gap: var(--s2); background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: var(--r-pill); padding: 0.25rem 0.7rem; color: var(--text); }
.open-chip:hover { background: var(--surface-3); text-decoration: none; border-color: var(--accent-deep); }
.open-chip .coin { font-weight: 650; font-size: 0.86rem; }
.pill.sm { font-size: 0.66rem; padding: 0.08rem 0.45rem; }
.pill.sm::before { width: 5px; height: 5px; }

/* ---------------------------------------------------------------- trade-closed nudge */
/* Amber on purpose (restored 2026-07-05, Benjamin's call): the reminder should
   read as a gentle flag, not blend into the neutral surfaces. Copy stays soft. */
.nudge { background: var(--amber-bg); border: 1px solid var(--amber-bd); border-radius: var(--r);
  padding: var(--s3) var(--s4); margin: var(--s4) 0 var(--s5); }
.nudge-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.nudge-title { display: inline-flex; align-items: center; gap: var(--s2); color: var(--amber);
  font-size: 0.86rem; font-weight: 650; }
.nudge-title svg { flex: none; }
.nudge-dismiss { margin: 0; }
.nudge-dismiss button { font-size: 0.75rem; padding: 0.3rem 0.7rem; }
.nudge-items { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.nudge-item { display: inline-flex; align-items: center; gap: var(--s2); background: var(--surface);
  border: 1px solid var(--amber-bd); border-radius: var(--r-pill); padding: 0.25rem 0.7rem; color: var(--text); }
.nudge-item:hover { background: var(--surface-2); text-decoration: none; border-color: var(--amber); }
.nudge-item .coin { font-weight: 650; font-size: 0.86rem; }
.nudge-more { align-self: center; font-size: 0.78rem; color: var(--text-2); font-weight: 600; padding: 0 var(--s2); }

/* ---------------------------------------------------------------- summary metrics */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: var(--s4) 0 var(--s6); }
.metric {
  background: none; border: none; border-radius: 0;
  padding: var(--s5) var(--s5) var(--s5) 0;
  display: flex; flex-direction: column; gap: var(--s2);
}
.metric + .metric { border-left: 1px solid var(--border); padding-left: var(--s5); }
.metric-label { color: var(--text-3); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.metric-value { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1.02; letter-spacing: -0.03em; }
.metric-value.num { font-size: 1.85rem; }
.metric .sub { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }
.metric.flag .metric-value { color: var(--amber); }
.metric.flag.zero .metric-value { color: var(--green); }

/* win-rate meter — money green, not interactive mint: it encodes an outcome,
   and mint is reserved for things you can click. */
.meter { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin-top: var(--s2); }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, rgba(53,217,140,0.75), var(--green)); border-radius: var(--r-pill); }

/* ---------------------------------------------------------------- equity curve */
.chart-card { background: linear-gradient(180deg, rgba(18,39,35,0.5), rgba(11,29,26,0.2));
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s6);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25); margin: var(--s4) 0 var(--s6); }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.chart-title { color: var(--text-3); font-size: 0.74rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; }
.chart-final { font-family: var(--display); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.chart-final .sub { color: var(--text-3); font-size: 0.78rem; font-weight: 600; margin-left: var(--s2); }
.equity-svg { display: block; width: 100%; height: auto; }
.equity-svg .curve { fill: none; stroke: var(--accent-deep); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; }
/* Below breakeven the curve wears the money-loss color (the template clips
   the same path at the zero line) — a negative curve must not read healthy. */
.equity-svg .curve-below { stroke: var(--red); opacity: 0.9; }
.equity-svg .zeroline { stroke: rgba(234,250,244,0.14); stroke-width: 1; stroke-dasharray: 3 4; }
.equity-svg .gridlabel { fill: var(--text-3); font: 600 10px var(--sans); }
.equity-svg .enddot { fill: var(--accent); stroke: rgba(151,252,228,0.25); stroke-width: 5; }
.equity-svg .enddot.neg { fill: var(--red); stroke: rgba(255,107,110,0.25); }
.equity-svg .enddot.pos { fill: var(--green); stroke: rgba(53,217,140,0.25); }
.chart-range { display: flex; justify-content: space-between; color: var(--text-3);
  font-size: 0.76rem; margin-top: var(--s2); }

/* ---------------------------------------------------------------- filters */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s4); margin: var(--s5) 0 var(--s4);
  padding: 0 0 var(--s4); border-bottom: 1px solid var(--border); }
.filters label { display: flex; flex-direction: column; gap: 6px; color: var(--text-3); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.filters .spacer { flex: 1 1 auto; }

select, input[type="text"], input[type="date"], textarea {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  padding: 0.5rem 0.65rem; font: inherit; line-height: 1.25;
  transition: border-color .12s ease, box-shadow .12s ease;
}
/* Native date input: without these it keeps UA chrome (light box, odd height)
   and sits visibly off-theme next to the styled inputs around it. */
input[type="date"] { color-scheme: dark; font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; }
input[type="date"]:focus { outline: none; border-color: var(--accent-deep); box-shadow: 0 0 0 3px var(--focus); }
select { appearance: none; -webkit-appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23a0c0b6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.65rem center; }
select:hover { border-color: var(--text-3); }
input[type="text"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-deep); box-shadow: 0 0 0 3px var(--focus); }

/* ---------------------------------------------------------------- table */
.table-wrap { border: none; border-radius: 0; overflow: visible; background: transparent; margin: var(--s4) 0; }
/* Few short columns stretched across the full content width put half a
   screen between a label and its numbers — cap those tables (Long vs Short,
   ratings) so the eye doesn't walk a tightrope. */
.table-narrow { max-width: 40rem; }
table.trades { width: 100%; border-collapse: collapse; }
table.trades th, table.trades td { padding: 0.85rem 1rem; text-align: left; }
table.trades th.r, table.trades td.r { text-align: right; }
table.trades th.c, table.trades td.c { text-align: center; }
/* Header is NOT sticky: a sticky thead needs a non-clipping scroll-ancestor,
   but the wrap's `overflow: hidden` (for rounded corners) becomes its sticky
   container and shoves the header over the first row, hiding it. Not worth a
   sticky header. */
table.trades thead th {
  background: transparent; color: var(--text-3);
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border); white-space: nowrap; padding-bottom: var(--s3);
}
table.trades tbody td { border-bottom: 1px solid var(--border); }
table.trades tbody tr:last-child td { border-bottom: none; }
table.trades tbody tr { transition: background .1s ease; }
table.trades tbody tr:hover { background: var(--surface-2); }
.coin { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }

/* Sortable by-coin headers: plain links styled to read as table headers, the
   active column shows a small accent arrow. The thead is hidden on mobile
   (rows become cards), so .sort-bar repeats the same links there. */
.th-sort { color: inherit; text-decoration: none; }
.th-sort:hover { color: var(--text); text-decoration: none; }
.th-sort.active { color: var(--text); }
.sort-arrow { color: var(--accent); font-size: 0.55rem; margin-left: 4px; vertical-align: 1px; }
.sort-arrow.sort-hint { color: var(--text-3); }
.th-sort:hover .sort-hint { color: var(--accent); }
.sort-bar { display: none; }

/* "See N more coins" expander under the by-coin table. <details> gives the
   zero-JS toggle (same trick as the share fab); the summary reads as a ghost
   button. When open, flex `order` moves the button BELOW the expanded rows
   and the label swaps to "Show fewer coins" (chevron flips). */
.see-more { margin: calc(-1 * var(--s2)) 0 var(--s4); }
.see-more summary { list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 0.78rem; font-weight: 650; color: var(--text-2);
  border: 1px solid var(--border-2); border-radius: var(--r-pill);
  padding: 0.3rem 0.8rem; }
.see-more summary::-webkit-details-marker { display: none; }
.see-more summary:hover { color: var(--text); border-color: var(--accent-deep); }
.see-more summary svg { transition: transform .1s ease; }
.see-more .when-open { display: none; }
.see-more[open] { display: flex; flex-direction: column; margin-top: 0; }
.see-more[open] summary { order: 2; align-self: flex-start; margin-top: var(--s3); }
.see-more[open] summary svg { transform: rotate(180deg); }
.see-more[open] summary .when-closed { display: none; }
.see-more[open] summary .when-open { display: inline; }
/* Seamless join while open: square off the meeting edges so the top-10 table
   and the continuation read as ONE table (the button sits below, via order). */
.table-wrap:has(+ .see-more[open]) { margin-bottom: 0; border-bottom: none;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.table-wrap:has(+ .see-more[open]) tbody tr:last-child td {
  border-bottom: 1px solid var(--border); }
.see-more[open] .table-wrap { margin: 0; border-top: none;
  border-top-left-radius: 0; border-top-right-radius: 0; }
/* Dex chip: shown after a stripped coin symbol ONLY when the user trades the
   same symbol on more than one dex (xyz:CRCL vs CRCL). Quiet, square-ish. */
.dex-chip { display: inline-flex; align-items: center; vertical-align: middle;
  font-size: 0.62rem; font-weight: 650; letter-spacing: 0.04em;
  color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: 4px;
  padding: 0.06rem 0.32rem; margin-left: 2px; }

.chev { color: var(--text-3); transition: transform .1s ease, color .1s ease; display: inline-block; }
table.trades tbody tr:hover .chev { color: var(--accent); transform: translateX(2px); }

/* stretched link: whole row clickable, no JS. The <tr> is the containing
   block; the absolute anchor paints above the (static) cell content, so a
   click anywhere on the row hits the link. Do NOT give cell content a
   stacking context — that would lift it above the anchor and swallow clicks. */
tr.row-link { position: relative; }
.row-link .stretch { position: absolute; inset: 0; z-index: 1; }
.row-link .stretch:focus-visible { outline-offset: -3px; }

/* surface unjournaled closed trades — the core action lives here.
   Only RECENT closes wear amber (server-scoped); the old backlog keeps a
   quiet dot so the exception color stays exceptional. */
tr.needs-note td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.note-dot { color: var(--amber); font-size: 1.1em; line-height: 0; }
.note-dot.old { color: var(--text-3); }
.check { color: var(--green); }

/* detail fills table */
table.fills tbody tr:nth-child(even) td { background: rgba(255,255,255,0.018); }
.side-buy  { color: var(--green); font-weight: 600; }
.side-sell { color: var(--red); font-weight: 600; }
.role-tag { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------------------------------------------------------------- detail */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: var(--s4); }
.backlink { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 0.88rem; margin-bottom: var(--s2); }
.backlink:hover { color: var(--accent); }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: var(--s5) var(--s4); margin: var(--s4) 0 var(--s6);
  border-top: 1px solid var(--border); padding-top: var(--s5); }
.stat { background: none; border: none; border-radius: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--text-3); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--display); font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }
.stat-value.small { font-family: var(--sans); font-size: 0.82rem; word-break: break-all; font-weight: 500; }
/* Date stats: time on a deliberate second line (dimmer, smaller) instead of
   letting "YYYY-MM-DD HH:MM" wrap raggedly at grid-column width. */
.stat-time { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text-2); margin-top: 1px; }

/* live position callout (open trades) */
.live-card { background: linear-gradient(180deg, rgba(80,210,193,0.08), var(--surface)); border: 1px solid rgba(80,210,193,0.25); border-radius: var(--r-lg); padding: var(--s5); margin: var(--s4) 0 var(--s5); }
.live-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: var(--s3); }
.live-card .entry-extras-hint { margin: var(--s4) 0 0; }

/* P&L equation strip: realized + funding − fees = net */
.pnl-eq { display: flex; flex-wrap: wrap; align-items: stretch; margin: var(--s4) 0 var(--s6);
  border: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  border-radius: 0; overflow: visible; background: none; }
.pnl-eq .term { flex: 1 1 8rem; padding: var(--s4) var(--s5); display: flex; flex-direction: column; gap: 4px; }
.pnl-eq .term + .term { border-left: 1px solid var(--border); }
.pnl-eq .op { flex: 0 0 auto; display: flex; align-items: center; padding: 0 var(--s3); color: var(--text-3); font-size: 1.15rem;
  background: none; border-left: 1px solid var(--border); }
.pnl-eq .term.total { background: none; }
.pnl-eq .term.total .stat-value { font-family: var(--display); font-size: 1.4rem; font-weight: 600; }

/* ---------------------------------------------------------------- journal form */
.entry-card { background: none; border: none; border-radius: 0; padding: 0; margin-top: var(--s3); }
.entry-form { display: flex; flex-direction: column; gap: var(--s5); }
.field-label { display: block; color: var(--text-3); font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
textarea { width: 100%; resize: vertical; min-height: 10rem; line-height: 1.65; font-family: var(--sans); font-size: 0.98rem; }
.entry-extras { border-top: 1px solid var(--border); padding-top: var(--s5); }
.entry-extras-hint { color: var(--text-3); font-size: 0.78rem; margin: 0 0 var(--s4); }
.entry-row { display: flex; flex-wrap: wrap; gap: var(--s4); }
.entry-row label { flex: 1 1 12rem; display: flex; flex-direction: column; }
.entry-actions { display: flex; align-items: center; gap: var(--s4); }

/* ---------------------------------------------------------------- note timeline */
.note-form { display: flex; flex-direction: column; gap: var(--s3); }
.note-form textarea { min-height: 6rem; }
.note-form-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.note-date { display: flex; flex-direction: column; }
.note-date input[type="date"] { color: var(--text); }

.note-timeline { list-style: none; margin: var(--s5) 0 0; padding: 0;
  border-top: 1px solid var(--border); }
.note { position: relative; padding: var(--s4) 0 var(--s4) var(--s5);
  border-bottom: 1px solid var(--border); }
.note:last-child { border-bottom: none; }
/* timeline rail + node */
.note::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px; background: var(--border-2); }
.note::after { content: ""; position: absolute; left: 0; top: calc(var(--s4) + 6px); width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent-deep); box-shadow: 0 0 0 3px var(--bg); }
.note-meta { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: 4px; }
.note-date-label { font-weight: 650; font-size: 0.9rem; color: var(--text); }
.note-body { color: var(--text-2); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

/* ---------------------------------------------------------------- theses */
.thesis-form-card { margin-bottom: var(--s6); }
.thesis-form .entry-row label { flex: 0 1 16rem; }
.thesis-group { background: none; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: var(--s5) 0; margin-bottom: 0; }
.thesis-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.thesis-coin { font-family: var(--display); font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }
.thesis-score { display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 0.8rem; color: var(--text-3); font-weight: 600; }
.thesis-score .sep { color: var(--border-2); }
.thesis-head .spacer { flex: 1 1 auto; }
.thesis-archive { margin: 0; }
.thesis-archive button { font-size: 0.75rem; padding: 0.3rem 0.7rem; }
.thesis-group .note-timeline { margin-top: var(--s4); }
.thesis-hint { color: var(--text-3); font-size: 0.85rem; margin: var(--s2) 0 var(--s5); max-width: 60ch; }

/* ---------------------------------------------------------------- pager */
.pager { display: flex; gap: var(--s3); align-items: center; justify-content: center; margin: var(--s5) 0; }
.pager a { padding: 0.45rem 0.85rem; border: 1px solid var(--border-2); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); }
.pager a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.pager .page-of { color: var(--text-3); font-size: 0.88rem; }

.freshness { color: var(--text-3); font-size: 0.78rem; margin: calc(-1 * var(--s2)) 0 var(--s4); }

/* ---------------------------------------------------------------- empty states */
.empty { text-align: center; color: var(--text-3); padding: var(--s7) var(--s4);
  border: 1px dashed var(--border); border-radius: var(--r-lg);
  background: none; }
.empty .emoji { font-size: 1.6rem; display: block; margin-bottom: var(--s2); opacity: 0.85; }

/* New-user welcome empty state */
.welcome { max-width: 540px; margin: var(--s7) auto; padding: var(--s7) var(--s6); }
.welcome .emoji { font-size: 2.2rem; }
/* Error pages (404 etc.) reuse the welcome card; the big dim code sets tone. */
.error-page .error-code { display: block; font-family: var(--display);
  font-size: 3rem; font-weight: 600; color: var(--text-3);
  letter-spacing: -0.03em; margin-bottom: var(--s2); }
.error-actions { margin-top: var(--s4); }
.welcome-title { color: var(--text); font-size: 1.2rem; font-weight: 650; margin: 0 0 var(--s2); }
.welcome p { margin: 0 auto var(--s3); max-width: 42ch; line-height: 1.6; }
.welcome p:last-child { margin-bottom: 0; }
/* "importing" progress dots — the only loading state a server-rendered app has */
.loading-dots { display: inline-flex; gap: 5px; margin-bottom: var(--s3); }
.loading-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-deep);
  animation: dotpulse 1.2s ease-in-out infinite; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotpulse { 0%,100%{opacity:.25; transform:scale(.85)} 50%{opacity:1; transform:scale(1)} }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  main { padding: var(--s5) var(--s4) var(--s7); }
  .topbar { padding: var(--s3) var(--s4); }
  /* Wallet pills are informational; on a phone their nowrap width pushes the
     Sync/Sign out buttons past the right edge. Identity lives in Settings. */
  .wallet-tags { display: none; }
  .summary { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .metric { padding: var(--s4) var(--s4) var(--s4) 0; }
  .metric:nth-child(odd) { border-left: none; padding-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--border); }
  .metric-value { font-size: 1.55rem; }
  table.trades thead { display: none; }
  /* thead is gone on mobile, so surface the by-coin sort links as a bar */
  .sort-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
    margin: var(--s3) 0; font-size: 0.78rem; }
  .sort-bar-label { color: var(--text-3); font-size: 0.7rem; font-weight: 650;
    text-transform: uppercase; letter-spacing: 0.06em; }
  .sort-bar .th-sort { color: var(--text-2); border: 1px solid var(--border-2);
    border-radius: var(--r-pill); padding: 0.2rem 0.65rem; }
  .sort-bar .th-sort.active { color: var(--text); border-color: var(--accent-deep); }
  .table-wrap { border: none; background: transparent; overflow: visible; }
  table.trades, table.trades tbody, table.trades tr, table.trades td { display: block; width: 100%; }
  table.trades tbody tr { border: 1px solid var(--border); border-radius: var(--r); margin-bottom: var(--s3); background: var(--surface); padding: var(--s2) 0; }
  table.trades tbody td { border: none; display: flex; justify-content: space-between; align-items: center; padding: 0.4rem var(--s4); text-align: right; }
  /* label shrinks and ellipsizes so the money value always keeps one line */
  table.trades tbody td::before { content: attr(data-label); color: var(--text-3); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; margin-right: var(--s4); text-align: left;
    flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* expanded coin cards keep the same card rhythm as the top-10 list */
  .see-more { margin-top: 0; }
  tr.needs-note td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

  /* Compact trade cards (trades list only — analytics tables keep the generic
     stacked layout). Line 1: coin · direction · note-state · P&L right.
     Line 2: the metadata, small and dim. One trade ≈ two lines, not eight —
     the P&L you scan by stays on the first line at full weight. */
  table.trades-main tbody tr { display: flex; flex-wrap: wrap; align-items: center;
    row-gap: 2px; column-gap: var(--s2); padding: var(--s3) var(--s4); }
  table.trades-main tbody td { display: inline-flex; align-items: center;
    width: auto; padding: 0; }
  table.trades-main tbody td::before { display: none; }
  table.trades-main td[data-label="Coin"] { order: 1; font-size: 1rem; }
  table.trades-main td[data-label="Direction"] { order: 2; }
  table.trades-main td[data-label="Notes"] { order: 3; }
  /* margin-left:auto soaks up the free space, so everything after P&L wraps
     to the second line — no extra markup needed. */
  table.trades-main td[data-label="Net P&L"] { order: 4; margin-left: auto;
    font-weight: 650; font-size: 0.95rem; }
  table.trades-main td[data-label="Opened"],
  table.trades-main td[data-label="Closed"],
  table.trades-main td[data-label="Duration"],
  table.trades-main td[data-label="Max size"] { order: 5; gap: 5px;
    font-size: 0.74rem; color: var(--text-3); }
  table.trades-main td[data-label="Opened"]::before,
  table.trades-main td[data-label="Closed"]::before,
  table.trades-main td[data-label="Duration"]::before,
  table.trades-main td[data-label="Max size"]::before {
    display: inline; content: attr(data-label); margin: 0;
    font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-3); opacity: 0.75; }
  table.trades-main td[data-label=""] { display: none; }  /* chevron column */
  table.trades-main tbody tr.needs-note { box-shadow: inset 3px 0 0 var(--amber); }
  table.trades-main tbody tr.needs-note td:first-child { box-shadow: none; }

  /* SVG chart text scales down with the viewBox — bump the user-unit size so
     tick/value labels stay legible at phone card widths. */
  .bars-svg .gridlabel { font-size: 16px; }
  .bars-svg .dimlab { font-size: 12px; }
  .equity-svg .gridlabel { font-size: 15px; }
  .pnl-eq .term { flex-basis: 100%; }
  .pnl-eq .term + .term { border-left: none; border-top: 1px solid var(--border); }
  .pnl-eq .op { display: none; }
  .thesis-group { padding: var(--s4); }
}

/* ---------------------------------------------------- landing + sign-in */
.landing { max-width: 1020px; margin: 0 auto; min-height: 100vh; display: flex;
  align-items: center; gap: var(--s7); padding: var(--s7) var(--s5); flex-wrap: wrap; }
.landing-pitch { flex: 1 1 400px; }
.landing-pitch .brand { font-size: 1.1rem; }
.landing-spark { display: block; color: var(--accent-deep); margin: var(--s5) 0 0; opacity: 0.9; }
.landing-title { display: block; font-size: 2.4rem; line-height: 1.08; font-weight: 720;
  letter-spacing: -0.02em; color: var(--text); margin: var(--s3) 0 var(--s4); }
.landing-sub { color: var(--text-2); font-size: 1.02rem; line-height: 1.6; max-width: 46ch; margin: 0 0 var(--s6); }
.landing-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s4); }
.landing-points li { display: flex; gap: var(--s3); align-items: flex-start; color: var(--text-2);
  line-height: 1.5; max-width: 48ch; }
.landing-points strong { color: var(--text); font-weight: 650; }
.lp-ico { flex: none; width: 34px; height: 34px; border-radius: var(--r-sm); display: inline-flex;
  align-items: center; justify-content: center; color: var(--accent);
  background: rgba(80,210,193,0.12); border: 1px solid rgba(80,210,193,0.28); }

.landing-side { flex: 0 1 380px; align-self: center; display: flex; flex-direction: column; gap: var(--s5); }
.signin-card { background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s6);
  display: flex; flex-direction: column; gap: var(--s3); }
.signin-eyebrow { color: var(--text-3); font-size: 0.72rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.08em; margin: 0; }
.btn-lg { justify-content: center; width: 100%; padding: 0.8rem 1.1rem; font-size: 1rem; }
/* EIP-6963 wallet picker: one row per installed wallet (2026-07-12). */
.wallet-list { display: flex; flex-direction: column; gap: var(--s2); }
.wallet-btn { display: flex; align-items: center; gap: var(--s3); width: 100%;
  padding: 0.7rem var(--s4); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-align: left; }
.wallet-btn:hover { background: var(--surface-3); border-color: var(--border-2); }
.wallet-btn:disabled { opacity: 0.55; cursor: default; }
.wallet-btn img { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.login-status { min-height: 1.2em; margin: 0; color: var(--text-2); font-size: 0.9rem; }
.login-status.err { color: var(--red); }
.login-note { margin: var(--s2) 0 0; line-height: 1.5; }

/* Faint product preview under the sign-in card: a stylized screenshot (pure
   SVG) so a visitor sees what they're signing into. Decorative — hidden from
   screen readers in the markup, fades out at the bottom. */
.preview-shell { border: 1px solid var(--border-2); border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 0 40px rgba(80,210,193,0.07);
  opacity: 0.94;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 98%);
          mask-image: linear-gradient(180deg, #000 55%, transparent 98%); }
.preview-shell svg { display: block; width: 100%; height: auto; }

@media (max-width: 760px) {
  .landing { gap: var(--s5); padding: var(--s6) var(--s4); min-height: 0; }
  .landing-title { font-size: 1.95rem; }
  .landing-side { flex-basis: 100%; width: 100%; order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Footer + privacy page (2026-07-02) --------------------------------- */
.appfooter {
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.82rem;
}
.appfooter a { color: var(--text-2); text-decoration: none; }
.appfooter a:hover { color: var(--accent); }

.login-foot {
  text-align: center;
  padding: var(--s4);
  color: var(--text-3);
  font-size: 0.82rem;
}
.login-foot a { color: var(--text-2); text-decoration: none; }
.login-foot a:hover { color: var(--accent); }

.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s6) var(--s4);
  line-height: 1.65;
  color: var(--text-2);
}
.legal h1 { color: var(--text); margin-bottom: var(--s2); }
.legal h2 { color: var(--text); font-size: 1.05rem; margin-top: var(--s6); }
.legal a { color: var(--accent); }
.legal .legal-meta { color: var(--text-3); font-size: 0.85rem; margin-bottom: var(--s5); }
.legal ul { padding-left: var(--s5); }
.legal .draft-flag {
  border: 1px solid var(--amber-bd);
  background: var(--amber-bg);
  color: var(--amber);
  border-radius: var(--r-sm);
  padding: var(--s3) var(--s4);
  font-size: 0.85rem;
  margin-bottom: var(--s5);
}

/* ---- Thesis auto-attachment (2026-07-02) ------------------------------- */
/* Pre-entry thesis block on the trade page: subtly set apart from the mint
   accents so it reads as "this came from the Thesis log, before you entered". */
.entry-card.pre-thesis { border-left: 2px solid var(--accent-deep); padding-left: var(--s5); }

/* ---- P&L calendar (2026-07-05) ------------------------------------------ */
/* Month grid: each in-month day is one big tap target. Win/loss days tint the
   whole cell with the money colors (never the interactive mint), today gets a
   mint ring, out-of-month cells recede to near-nothing. */
.cal-head { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  margin: var(--s3) 0 var(--s4); }
.cal-title { margin: 0; min-width: 11rem; }
.cal-month-sum { font-size: 0.95rem; font-weight: 650; display: inline-flex; gap: var(--s2); }
.cal-nav { margin-left: auto; display: inline-flex; gap: var(--s2); }
.cal-nav-btn { padding: 0.4rem 0.8rem; font-size: 0.95rem; line-height: 1; }
.cal-today { font-size: 0.8rem; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: var(--s4) 0; }
.cal-dow { text-align: center; font-size: 0.68rem; font-weight: 650; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.07em; padding: var(--s1) 0; }
.cal-cell { min-height: 84px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 6px 8px; color: var(--text-2); }
a.cal-cell:hover { text-decoration: none; border-color: var(--accent-deep); background: var(--surface-2); }
.cal-cell.out { background: transparent; border-color: transparent; }
.cal-cell.win  { background: var(--green-bg); border-color: var(--green-bd); }
a.cal-cell.win:hover  { border-color: var(--green); background: rgba(53,217,140,0.16); }
.cal-cell.loss { background: var(--red-bg); border-color: var(--red-bd); }
a.cal-cell.loss:hover { border-color: var(--red); background: rgba(255,107,110,0.15); }
.cal-cell.is-today { box-shadow: 0 0 0 2px var(--accent-deep); }
.cal-cell-top { display: flex; align-items: center; justify-content: space-between; }
.cal-daynum { font-size: 0.72rem; font-weight: 650; color: var(--text-3); }
.cal-cell.is-today .cal-daynum { color: var(--accent); }
.cal-note { color: var(--accent-deep); display: inline-flex; }
.cal-pnl { font-weight: 680; font-size: 0.95rem; letter-spacing: -0.01em; margin-top: auto; }
.cal-cell.win .cal-pnl { color: var(--green); }
.cal-cell.loss .cal-pnl { color: var(--red); }
.cal-count { font-size: 0.68rem; color: var(--text-3); }

@media (max-width: 760px) {
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 58px; padding: 4px 5px; border-radius: 6px; }
  .cal-pnl { font-size: 0.74rem; }
  .cal-count { display: none; }
  .cal-nav { margin-left: 0; }
}

/* ---- Floating share element (2026-07-05) -------------------------------- */
/* Fixed to the bottom-right corner on every page. <details> gives a zero-JS
   click-toggled pop-up; the menu opens upward, links are share intents. */
.share-fab { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 60; }

/* Donate fab (dormant feature): stacks above the share fab, same idiom —
   <details> summary pill + upward panel. Heart wears the accent on hover. */
.donate-fab { position: fixed; right: var(--s4); bottom: calc(var(--s4) + 44px); z-index: 60; }
.donate-fab summary { list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 0.8rem; font-weight: 650; color: var(--text-2);
  background: rgba(11,29,26,0.92); border: 1px solid var(--border-2);
  border-radius: var(--r-pill); padding: 0.45rem 0.9rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45); }
.donate-fab summary::-webkit-details-marker { display: none; }
.donate-fab summary svg { color: var(--accent); }
.donate-fab summary:hover { color: var(--text); border-color: var(--accent-deep); }
.donate-fab[open] summary { color: var(--accent); border-color: var(--accent-deep); }
.donate-panel { position: absolute; right: 0; bottom: calc(100% + 8px);
  width: min(21rem, calc(100vw - 2 * var(--s4)));
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r); padding: var(--s5);
  box-shadow: 0 16px 44px rgba(0,0,0,0.5); }
.donate-title { font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  margin: 0 0 var(--s3); }
.donate-blurb { color: var(--text-2); font-size: 0.88rem; line-height: 1.55;
  margin: 0 0 var(--s4); }
.donate-hint { color: var(--text-3); font-size: 0.76rem; margin: 0 0 var(--s2); }
.donate-address { display: block; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: var(--s3); font-size: 0.74rem;
  word-break: break-all; user-select: all; margin-bottom: var(--s2); }
.share-fab summary { list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 0.8rem; font-weight: 650; color: var(--text-2);
  background: rgba(11,29,26,0.92); border: 1px solid var(--border-2);
  border-radius: var(--r-pill); padding: 0.45rem 0.9rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45); }
.share-fab summary::-webkit-details-marker { display: none; }
.share-fab summary:hover { color: var(--text); border-color: var(--accent-deep); }
.share-fab[open] summary { color: var(--accent); border-color: var(--accent-deep); }
.share-menu { position: absolute; right: 0; bottom: calc(100% + 8px); min-width: 12.5rem;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r); padding: var(--s2);
  box-shadow: 0 16px 44px rgba(0,0,0,0.5); }
.share-menu a { display: flex; align-items: center; gap: var(--s3);
  padding: 0.5rem 0.7rem; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.share-menu a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.share-menu a svg { flex: none; color: var(--text-3); }
.share-menu a:hover svg { color: var(--accent); }

/* ---- Calendar month jump + day-page outcome (2026-07-05) ----------------- */
.cal-jump { display: inline-flex; align-items: center; gap: var(--s2); }
.cal-jump select { padding: 0.4rem 1.8rem 0.4rem 0.6rem; font-size: 0.85rem; }
.cal-jump button { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
.outcome-note { font-size: 0.82rem; color: var(--text-2); white-space: nowrap; }
.h2-note { text-transform: none; letter-spacing: 0; font-weight: 600; }
.settings-link { padding: 0.45rem 0.55rem; }

/* ---- Token-field tags (2026-07-05, v4) ------------------------------------ */
/* Applied vs available, visually distinct with one purpose each:
   applied = filled token with an inline × (tap = instant remove);
   available = quiet dashed "+ tag" pill (tap = instant add);
   rating = compact square toggles. All are real submit buttons inside tiny
   forms, so everything works with JS off; journal.js makes it seamless. */
.settings-card { max-width: 34rem; }
/* Stacked settings sections separate with the house hairline, not boxes. */
.settings-card + .settings-card { margin-top: var(--s6); border-top: 1px solid var(--border); padding-top: var(--s5); }
.token-create-row { align-items: flex-end; margin-top: var(--s4); }
/* Agent draft cards on the trade page: pending robot text, visibly NOT part
   of the journal yet — dashed edge + explicit save/discard. */
.draft-card { border: 1px dashed var(--border-2); border-radius: var(--r);
  padding: var(--s4); margin: var(--s4) 0; }
.draft-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s2); }
.draft-title { color: var(--text-2); font-size: 0.8rem; font-weight: 650; }
.draft-body { color: var(--text-2); line-height: 1.6; white-space: pre-wrap;
  word-break: break-word; }
.draft-actions { display: flex; gap: var(--s3); margin-top: var(--s3); }
.draft-actions form { margin: 0; }
.tag-field { border-top: 1px solid var(--border); margin-top: var(--s5);
  padding-top: var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
.tag-field-head { display: flex; align-items: baseline; gap: var(--s3); }
.tag-group { display: flex; flex-direction: column; gap: 7px; }
.tag-group-label { color: var(--text-3); font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; }
.token-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tag-field button { box-shadow: none; }
.tag-field button:hover { filter: none; }
.token { background: rgba(80,210,193,0.14); border: 1px solid var(--accent-deep);
  color: var(--accent); border-radius: var(--r-pill); padding: 0.28rem 0.7rem;
  font-size: 0.82rem; font-weight: 600; line-height: 1.4;
  transition: border-color .1s ease, background .1s ease, color .1s ease; }
.token .token-x { margin-left: 7px; opacity: 0.7; font-weight: 700; }
.token:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.token:hover .token-x { opacity: 1; }
.token.mistake { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber); }
.token.mistake:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.token-add { background: transparent; border: 1px dashed var(--border-2);
  color: var(--text-3); border-radius: var(--r-pill); padding: 0.28rem 0.7rem;
  font-size: 0.82rem; font-weight: 600; line-height: 1.4;
  transition: border-color .1s ease, background .1s ease, color .1s ease; }
.token-add::before { content: "+ "; opacity: 0.7; }
.token-add:hover { border-color: var(--accent-deep); color: var(--accent);
  background: rgba(80,210,193,0.08); }
/* .token-new is a hidden stub form; its input/button live inside the pill row
   (form= association) so the add box flows right after the last tag. */
.token-new[hidden] { display: none; }
.token-input { font-size: 0.8rem; padding: 0.3rem 0.7rem; width: 11rem;
  border-radius: var(--r-pill); }
.token-new-btn { font-size: 0.78rem; padding: 0.3rem 0.75rem; }
.token-rate { background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text-2); border-radius: var(--r-sm); min-width: 2.2rem;
  justify-content: center; padding: 0.28rem 0.5rem; font-size: 0.82rem;
  font-weight: 650; line-height: 1.4;
  transition: border-color .1s ease, background .1s ease, color .1s ease; }
.token-rate:hover { border-color: var(--accent-deep); color: var(--accent); }
.token-rate.on { background: rgba(80,210,193,0.16); border-color: var(--accent-deep);
  color: var(--accent); }
.token-rate.clear { border-style: dashed; color: var(--text-3); min-width: auto;
  font-weight: 600; }

/* ---- "Edit list" mode: delete tags from the vocabulary (2026-07-05) ------- */
.tag-field-head .spacer { flex: 1 1 auto; }
.tag-manage-link { color: var(--text-3); }
.tag-manage-link:hover { color: var(--accent); }
a.btn.tag-manage-link { color: var(--text-2); font-size: 0.78rem; padding: 0.3rem 0.75rem; }
.token-pick { position: relative; display: inline-flex; }
.token-pick input { position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; margin: 0; cursor: pointer; }
.token-pick span { display: inline-flex; align-items: center;
  padding: 0.28rem 0.75rem; border-radius: var(--r-pill);
  border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--text-2); font-size: 0.82rem; font-weight: 600; line-height: 1.4;
  transition: border-color .1s ease, background .1s ease, color .1s ease; }
.token-pick:hover span { border-color: var(--text-3); }
.token-pick input:focus-visible + span { outline: 2px solid var(--focus); }
/* selected-for-deletion: red strike-through so the intent is unmistakable */
.token-pick input:checked + span { background: var(--red-bg);
  border-color: var(--red); color: var(--red); text-decoration: line-through; }
.token-purge-btn { font-size: 0.78rem; padding: 0.3rem 0.75rem; }

/* Per-note actions: quiet icons that pick up color on hover. */
.note-actions { display: inline-flex; gap: var(--s2); margin-left: auto; }
.note-actions a { display: inline-flex; align-items: center; color: var(--text-3);
  padding: 2px; border-radius: 5px; }
.note-actions a:hover { color: var(--accent); }
.note-actions a[title="Delete note"]:hover { color: var(--red); }
.note-meta { flex-wrap: wrap; }

/* Two-step delete confirm bar (zero-JS): appears under the note body. */
.note-confirm { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3);
  padding: var(--s2) var(--s3); background: var(--red-bg);
  border: 1px solid var(--red-bd); border-radius: var(--r-sm); }
.note-confirm form { margin: 0; }
.btn-danger { color: var(--red); border-color: var(--red-bd); }
.btn-danger:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.note-confirm .btn, .note-confirm button { font-size: 0.78rem; padding: 0.3rem 0.7rem; }

/* Inline note edit form sits inside the timeline slot. */
.note-edit-form { margin-top: var(--s2); }
.note-edit-form textarea { min-height: 5rem; }
.note-edit-actions { display: inline-flex; gap: var(--s2); align-items: center; }

/* ---- Mobile topbar + settings polish (2026-07-05) ------------------------ */
/* Buttons never wrap ("Sign out" was breaking onto two lines); on mobile the
   Sync / Sign out labels drop and the icons stand alone (title/aria intact). */
button, .btn { white-space: nowrap; }
@media (max-width: 760px) {
  .btn-word { display: none; }
  .sync-form .btn-ghost { padding: 0.45rem 0.55rem; }
}
/* Long wallet addresses wrap inside the settings card instead of overflowing. */
.settings-address { word-break: break-all; overflow-wrap: anywhere; display: block; }

/* ---- Analytics: Edge & Leaks (2026-07-05) -------------------------------- */
/* Leak cards: ranked, quiet-but-flagged. The top dollarized leak gets the red
   edge; the rest amber — same accent grammar as needs-note rows. */
.leak-list { list-style: none; margin: var(--s4) 0; padding: 0;
  display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--border); }
.leak-card { background: none; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: var(--s5) 0 var(--s5) var(--s5);
  box-shadow: inset 3px 0 0 var(--amber); }
.leak-card.worst { box-shadow: inset 3px 0 0 var(--red); }
.leak-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap; }
.leak-title { font-family: var(--display); font-weight: 600; font-size: 1rem; }
.leak-amount { font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
.leak-detail { margin: 4px 0 0; color: var(--text-2); font-size: 0.88rem; line-height: 1.55; }

/* Time-attribution bar charts: polarity encoded twice (money color AND side of
   the zero line); ticks/values wear text tokens, never the series color. */
.charts-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.bars-svg { display: block; width: 100%; height: auto; }
.bars-svg .zeroline { stroke: rgba(234,250,244,0.14); stroke-width: 1; stroke-dasharray: 3 4; }
.bars-svg .bar-pos { fill: var(--green); opacity: 0.85; }
.bars-svg .bar-neg { fill: var(--red); opacity: 0.85; }
.bars-svg rect:hover { opacity: 1; }
.bars-svg .gridlabel { fill: var(--text-3); font: 600 10px var(--sans); }
.bars-svg .barval { fill: var(--text-2); }
.bars-svg .dimlab { opacity: 0.65; font-size: 9px; }

@media (max-width: 760px) {
  .charts-2col { grid-template-columns: 1fr; }
  .leak-card { padding: var(--s3) var(--s4); }
}

/* ================================================================
   Micro-interactions & texture (2026-07-06, EXPERIMENTAL)
   Self-contained, zero-JS, CSP-clean. Roll back by deleting this
   whole block. All motion here is auto-disabled by the global
   prefers-reduced-motion rule above; the grain (static) stays.
   ================================================================ */

/* Snappier transition curve so lift/press read as physical. */
button, .btn {
  transition: filter .12s ease, transform .16s cubic-bezier(.2,.8,.2,1),
    box-shadow .16s ease, background .12s ease, border-color .12s ease;
}
/* Hover lifts "with purpose" (move + deeper shadow); press scales down. */
button:hover, .btn:hover { transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(80,210,193,0.22); }
.btn-ghost:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.32); }
button:active, .btn:active { transform: scale(0.97);
  box-shadow: 0 0 14px rgba(80,210,193,0.16); transition-duration: .05s; }

/* Lift on other interactive blocks (chips, calendar days, pager, nudges). */
.open-chip, .nudge-item, a.cal-cell, .pager a, .token-add {
  transition: transform .14s cubic-bezier(.2,.8,.2,1), background .12s ease,
    border-color .12s ease, color .12s ease, box-shadow .14s ease; }
.open-chip:hover, .nudge-item:hover, a.cal-cell:hover, .pager a:hover {
  transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.28); }

/* Scroll-aware topbar: gains a shadow + a touch more opacity over the first
   140px of scroll. Pure-CSS scroll-driven animation — supporting browsers
   enhance; the rest keep the static sticky bar (already has a blur+border). */
@supports (animation-timeline: scroll()) {
  .topbar { animation: topbarLift linear both;
    animation-timeline: scroll(root); animation-range: 0 140px; }
  @keyframes topbarLift {
    to { background: rgba(6,21,20,0.94); box-shadow: 0 10px 30px rgba(0,0,0,0.34); }
  }
}

/* Stagger: lists rise in instead of popping. Deliberately brief — this is a
   server-rendered app, so the cascade replays on EVERY navigation; by the
   30th page view it must read as texture, never as latency. */
@keyframes riseIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.summary .metric, .leak-card,
table.trades tbody tr:nth-child(-n+8) { animation: riseIn .22s cubic-bezier(.2,.8,.2,1) both; }
.summary .metric:nth-child(2) { animation-delay: .03s; }
.summary .metric:nth-child(3) { animation-delay: .06s; }
.summary .metric:nth-child(4) { animation-delay: .09s; }
.leak-card:nth-child(2) { animation-delay: .04s; }
.leak-card:nth-child(3) { animation-delay: .08s; }
.leak-card:nth-child(4) { animation-delay: .12s; }
.leak-card:nth-child(5) { animation-delay: .16s; }
table.trades tbody tr:nth-child(2){animation-delay:.02s}
table.trades tbody tr:nth-child(3){animation-delay:.04s}
table.trades tbody tr:nth-child(4){animation-delay:.06s}
table.trades tbody tr:nth-child(5){animation-delay:.08s}
table.trades tbody tr:nth-child(6){animation-delay:.10s}
table.trades tbody tr:nth-child(7){animation-delay:.12s}
table.trades tbody tr:nth-child(8){animation-delay:.14s}

/* Subtle film grain over everything (~2.8%) for depth. SVG turbulence as a
   data-URI: no asset, no JS, CSP-safe. Inert (pointer-events:none). */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9;
  opacity: 0.028; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
