/* ==========================================================================
   SetYourPlan: design system
   Light "paper", the plan studio's look on every page: ink and greys for text, one accent (cobalt) for focus,
   links and the main action, numbers in mono. Plan-line colours appear only as small markers that match the
   lines on the studio chart (cobalt = trigger, red = stop, dark red = emergency stop, green = target, amber =
   second buy). Solid line = an order resting on Binance; dashed = checked by SetYourPlan on every candle close.
   The studio's own components (chart, rule sentences, plan card) are in studio.css, loaded on every page.
   Everything lives in stylesheets because the Content-Security-Policy forbids inline styles.

    0. Tokens
    1. Reset and base
    2. Typography
    3. Layout primitives
    4. App shell (sidebar, mobile bar, account menu, tab bar)
    5. Public header and footer
    6. Buttons
    7. Forms
    8. Cards and surfaces
    9. Chips and status pills
   10. Stat tiles
   11. Key-value lists and plan levels
   12. Tables
   13. Timeline
   14. Notices and flash messages
   15. Steps, permission list, QR, secret
   16. Brake, danger zone, empty state
   17. Landing page
   18. Auth pages
   19. Utilities and motion
   ========================================================================== */

/* 0. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: light;

  --bg: #f6f4ee;
  --bg-deep: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1eee6;
  --surface-3: #e9e5da;
  --surface-soft: #fbfaf7;
  --border: #e4e0d6;
  --border-strong: #d3cec1;
  --border-hover: #b5af9f;
  --paper-line: #efece4;

  --text: #101114;
  --text-2: #2a2c31;
  --muted: #5b5e66;
  --faint: #6c6f77;
  --ink: #101114;
  --highlight: #d4f542;

  --accent: #2445f5;
  --accent-hover: #1832c8;
  --accent-press: #1428a8;
  --accent-ink: #ffffff;
  --accent-text: #1832c8;
  --accent-soft: #e8ecff;
  --accent-line: rgba(36, 69, 245, 0.32);

  --up: #18a65e;
  --up-text: #0e7f46;
  --up-strong: #0b5d34;
  --up-soft: #e1f3e8;
  --up-line: rgba(24, 166, 94, 0.35);

  --down: #e5484d;
  --down-text: #b4282e;
  --down-strong: #7d1a1f;
  --down-soft: #fce8e7;
  --down-line: rgba(229, 72, 77, 0.4);

  --warn: #e3960f;
  --warn-text: #8a5200;
  --warn-strong: #5f3a00;
  --warn-soft: #fff0d2;
  --warn-line: rgba(227, 150, 15, 0.42);

  /* plan lines: markers and the numbers that go with them */
  --ln-trigger: #2445f5;
  --ln-stop: #e5484d;
  --ln-estop: #8e1c23;
  --ln-target: #18a65e;
  --ln-scale: #e3960f;
  --ln-entry: #101114;
  --ln-inval: #6c6f77;
  --tx-inval: #4b4e55;
  --tx-trigger: #1832c8;
  --tx-stop: #c42d33;
  --tx-estop: #8e1c23;
  --tx-target: #0e7f46;
  --tx-scale: #8a5200;

  --font-sans: "Geist", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --mono: var(--font-mono); /* old name, kept for existing templates */

  --r-xs: 8px;
  --r-sm: 10px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --radius: var(--r);

  --shadow-1: 0 1px 0 rgba(16, 17, 20, 0.04), 0 10px 30px -18px rgba(16, 17, 20, 0.25);
  --shadow-2: 0 1px 0 rgba(16, 17, 20, 0.05), 0 40px 80px -40px rgba(16, 17, 20, 0.3), 0 16px 32px -24px rgba(16, 17, 20, 0.16);
  --shadow-3: 0 24px 60px -20px rgba(16, 17, 20, 0.3);
  --ring: 0 0 0 3px rgba(36, 69, 245, 0.22);

  --sidebar-w: 248px;
  --page-max: 1480px;
  --measure: 880px; /* one-column pages: left-aligned under the page head */
  --site-max: 1160px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Small icons used by CSS masks (flash messages, permission list, checkboxes). */
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
  --i-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12 2.5 2.5 4.5-5'/%3E%3C/svg%3E");
  --i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
}

/* 1. Reset and base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
svg.icon, .inline-svg { display: inline-block; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 12px; padding-left: 20px; }

hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

::selection { background: var(--highlight); color: var(--ink); }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.skip-link:focus { top: 12px; text-decoration: none; color: var(--accent-ink); }

/* 2. Typography ------------------------------------------------------------ */
h1, h2, h3, h4 {
  margin: 0 0 8px;
  color: var(--text);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
h1 { font-size: clamp(24px, 1.2vw + 16px, 30px); letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: 16px; margin-bottom: 12px; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }

code, kbd, samp, .mono, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
code {
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  overflow-wrap: anywhere;
}

strong, b { font-weight: 600; }
em { color: var(--text-2); }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin: 2px 0 0; }
.lead { color: var(--text-2); font-size: 17px; line-height: 1.6; }
.small, small { font-size: 13px; }

/* The small label above a title (the studio's): mono, uppercase, a short rule before it. */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.kicker::before { content: ""; flex: none; width: 16px; border-top: 1.5px solid currentColor; }

.text-up { color: var(--up-text); }
.text-down { color: var(--down-text); }

/* 3. Layout primitives ----------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 16px;
}

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* Page head, the same on every page: kicker, title, one muted line; actions on the right. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-head .kicker { margin: 0 0 4px; }
.page-head p.muted { margin: 6px 0 0; max-width: 70ch; font-size: 13.5px; }
.page-head > p.muted { flex-basis: 100%; }
.page-head > div > p.muted { flex-basis: auto; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.measure { max-width: var(--measure); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row.between { justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.actions.end { justify-content: flex-end; }
.inline { display: inline; }
.stack > * + * { margin-top: 12px; }
/* A group label between panels (the studio's group title). */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 28px 0 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-title > span { display: inline-flex; align-items: center; gap: 8px; }

@media (min-width: 640px) {
  .container { padding: 0 24px; }
  .page { padding: 28px 24px 56px; }
}
@media (min-width: 960px) {
  .page { padding: 28px 32px 56px; }
}

/* 4. App shell ------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ink);
  color: #f6f4ee;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 12px rgba(16, 17, 20, 0.18);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { white-space: nowrap; }

.shell-main { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.shell-main > main { flex: 1 0 auto; }

/* Sidebar: desktop only. */
.sidebar { display: none; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
  margin: 18px 12px 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-link .icon { color: var(--faint); transition: color 0.15s var(--ease); }
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link:hover .icon { color: var(--text-2); }
.nav-link.is-active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.nav-link.is-active .icon { color: var(--accent); }
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px 10px; }
.user-card > div { min-width: 0; }
.user-email {
  display: block;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta { display: block; color: var(--muted); font-size: 12px; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Mobile top bar. */
.mobile-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 60px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(246, 244, 238, 0.9);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

/* Account menu: a <details> element, works without JavaScript. */
.menu { position: relative; }
.menu > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 6px;
  border-radius: 12px;
  color: var(--muted);
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--surface-2); color: var(--text); }
.menu[open] > summary { background: var(--surface-2); }
.menu[open] .menu-caret { transform: rotate(180deg); }
.menu-caret { width: 16px; height: 16px; transition: transform 0.15s var(--ease); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  width: min(300px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-3);
}
.menu-email {
  margin: 0 0 6px;
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item .icon { color: var(--faint); }
.menu-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.menu-item.is-active { color: var(--text); }
.menu-item.is-active .icon { color: var(--accent); }

/* Bottom tab bar on small screens. */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: rgba(246, 244, 238, 0.94);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab > .icon { width: 22px; height: 28px; }
.tab.is-active { color: var(--text); }
.tab-primary .tab-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 28px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(36, 69, 245, 0.28);
}
.tab-primary .tab-icon .icon { width: 20px; height: 20px; }
.tab-primary:hover .tab-icon { background: var(--accent-hover); }

.is-app .shell-main { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

/* Testnet banner. */
.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn-strong);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}
.banner .icon { width: 16px; height: 16px; }

/* App footer. */
.footer {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px 16px 28px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px !important; }
.footer-links a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); }
.footer-links a:hover { color: var(--text); }

@media (min-width: 960px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    padding: 16px 14px 16px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--surface-2);
  }
  .sidebar .brand { padding: 0 8px; margin-bottom: 10px; }
  .is-app .shell-main { margin-left: var(--sidebar-w); padding-bottom: 0; }
  .mobile-bar, .tabbar { display: none; }
  .footer { padding: 20px 32px 32px; }
}

/* 5. Public header and footer --------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: rgba(246, 244, 238, 0.88);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}
.site-header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.site-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.site-links { display: none; align-items: center; gap: 2px; margin-right: 10px; }
.site-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}
.site-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.site-link[aria-current="page"], .site-nav .button.ghost[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border);
}
@media (min-width: 860px) { .site-links { display: flex; } }
@media (max-width: 380px) { .brand-name { font-size: 15px; } .site-header .brand-mark { width: 28px; height: 28px; } }

.site-footer { margin-top: 40px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.footer-grid { display: grid; gap: 28px; padding-top: 40px; padding-bottom: 28px; }
.footer-legal { max-width: 560px; margin: 14px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 24px; }
.footer-cols h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--text-2);
  font-size: 14px;
}
.footer-cols a:hover { color: var(--text); }
.footer-bottom {
  padding-top: 18px;
  padding-bottom: 28px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}
@media (min-width: 800px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
}

/* 6. Buttons --------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16), 0 8px 20px -12px rgba(36, 69, 245, 0.7);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.08s var(--ease);
}
.button .icon { width: 18px; height: 18px; }
.button:hover { background: var(--accent-hover); color: var(--accent-ink); text-decoration: none; }
.button:active { background: var(--accent-press); transform: translateY(1px); }

.button.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: none;
}
.button.secondary:hover { background: var(--surface); border-color: var(--ink); color: var(--text); }

.button.ghost { background: transparent; color: var(--text-2); box-shadow: none; }
.button.ghost:hover { background: var(--surface-2); color: var(--text); }

.button.danger {
  background: transparent;
  border-color: var(--down-line);
  color: var(--down-text);
  box-shadow: none;
}
.button.danger { background: var(--surface); }
.button.danger:hover { background: var(--down-soft); border-color: var(--down); color: var(--tx-estop); }
.button.danger.solid { background: var(--tx-stop); border-color: var(--tx-stop); color: #fff; }
.button.danger.solid:hover { background: var(--tx-estop); border-color: var(--tx-estop); }

.button.small { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; font-weight: 550; }
.button.small .icon { width: 16px; height: 16px; }
.button.large { min-height: 52px; padding: 0 24px; border-radius: 12px; font-size: 16px; }
.button.full { display: flex; width: 100%; }

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 1;
  border-color: transparent;
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.button:disabled:hover,
.button[aria-disabled="true"]:hover { background: var(--surface-3); color: var(--muted); border-color: transparent; }

@media (pointer: coarse) {
  .button.small { min-height: 44px; padding: 0 14px; }
}

button.link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  cursor: pointer;
}
button.link:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

/* 7. Forms ----------------------------------------------------------------- */
form { margin: 0; }
.form > .button { margin-top: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label { color: var(--text); font-size: 13.5px; font-weight: 550; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  box-shadow: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid transparent;
  border-color: var(--accent);
  background-color: var(--surface); /* the colour only: a select keeps its one arrow where it is */
  box-shadow: var(--ring);
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }

/* Numbers and prices type in mono. */
input[inputmode="decimal"], input[inputmode="numeric"], input[type="number"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b5e66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
  cursor: pointer;
}
select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232445f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
select option { background: var(--surface); color: var(--text); }

textarea { min-height: 104px; resize: vertical; line-height: 1.55; }

.input-code {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.35em;
  text-align: center;
}

/* Error state. */
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--down); }
.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus { border-color: var(--down); box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.22); }
.field-errors { display: flex; flex-direction: column; gap: 2px; }
.field-error {
  position: relative;
  margin: 0;
  padding-left: 20px;
  color: var(--down-text);
  font-size: 13px;
  line-height: 1.45;
}
.field-error::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: var(--i-alert) center / contain no-repeat;
  mask: var(--i-alert) center / contain no-repeat;
}

/* Checkbox row. */
.check {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 12px;
  min-height: 44px;
  margin: 4px 0 16px;
  padding: 10px 0;
}
.check > label { flex: 1 1 0; min-width: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; cursor: pointer; }
.check > .field-error { flex-basis: 100%; margin-left: 32px; }
.check input[type="checkbox"],
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1.5px solid var(--border-hover);
  border-radius: 6px;
  background: var(--surface) center / 14px 14px no-repeat;
  cursor: pointer;
  transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease);
}
input[type="checkbox"]:hover { border-color: var(--accent); }
input[type="checkbox"]:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check.has-error input[type="checkbox"] { border-color: var(--down); }
/* A checkbox row in its own box (the studio's "Before you arm it" column). */
.check.boxed { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); }

/* 8. Cards and surfaces ---------------------------------------------------- */
/* A panel: white on the paper, the studio's border and radius. The page's main object gets .raised. */
.card {
  position: relative;
  margin-bottom: 16px;
  padding: 18px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: none;
}
.card.raised { box-shadow: var(--shadow-2); }
.card > h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 18px; letter-spacing: -0.015em; }
.card > :last-child { margin-bottom: 0; }
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.015em; }
.card-head p { margin: 0; }
.card.tight { padding: 14px 16px; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease); }
a.card:hover { border-color: var(--border-hover); background: var(--surface); text-decoration: none; }

@media (min-width: 640px) {
  .card { padding: 22px 24px; }
}

/* A small mark beside a message or a step; neutral unless it carries a status. */
.icon-badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
}
.icon-badge .icon { width: 20px; height: 20px; }
.icon-badge.up { border-color: var(--up-line); background: var(--up-soft); color: var(--up-strong); }
.icon-badge.down { border-color: var(--down-line); background: var(--down-soft); color: var(--down-text); }
.icon-badge.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-text); }
.icon-badge.large { width: 52px; height: 52px; border-radius: 16px; }
.icon-badge.large .icon { width: 24px; height: 24px; }

.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }

.plan-row { transition: border-color 0.15s var(--ease); }
.plan-row:hover { border-color: var(--border-hover); }

/* 9. Chips and status pills ----------------------------------------------- */
/* A status pill (the studio's state pill): mono, uppercase; colour only for status. A plan state that changes
   on its own (entering, closing) pulses; a fixed label never does. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.chip .icon { width: 13px; height: 13px; }
.chip[class*="chip-"]::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot, currentColor);
}
.chip-armed, .chip-entering { border-color: var(--ink); color: var(--text); --dot: var(--ln-trigger); }
.chip-entering::before { animation: pulse 1.4s ease-in-out infinite; }
.chip-open, .chip-ok { border-color: var(--up-line); background: var(--up-soft); color: var(--up-strong); --dot: var(--up); }
.chip-closing, .chip-warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-text); --dot: var(--warn); }
.chip-closing::before { animation: pulse 1.4s ease-in-out infinite; }
.chip-closed { border-color: var(--border-strong); background: var(--surface-2); color: var(--text-2); --dot: var(--faint); }
.chip-cancelled,
.chip-expired,
.chip-sample { border-style: dashed; border-color: var(--border-hover); background: transparent; color: var(--muted); --dot: var(--faint); }
.chip-missed { border-style: dashed; border-color: var(--warn-line); background: transparent; color: var(--warn-text); }
.chip-failed { border-color: var(--down-line); background: var(--down-soft); color: var(--down-text); --dot: var(--down); }
/* Practice money (paper account, Binance Demo): the studio's paper label. */
.chip-paper { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-text); --dot: var(--warn); }
.chip-plain::before { display: none; }
h1 .chip, h2 .chip { height: 24px; font-size: 11.5px; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

/* 10. Stat tiles ----------------------------------------------------------- */
/* Numbers in one hairline grid (the studio card's tiles): mono label, mono value. */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--border);
  overflow: hidden;
}
@media (max-width: 639.98px) { .tiles > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 640px) { .tiles { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
}
@media (min-width: 640px) { .tile { padding: 14px 16px; } }
.tile > span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tile > strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 550;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tile > strong small { margin-left: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
.tiles.stats .tile > strong { font-size: 24px; }
.card .tiles { border-color: var(--border); border-radius: var(--r); }
.tile.up > strong { color: var(--up-text); }
.tile.down > strong { color: var(--tx-stop); }
.tile.warn > strong { color: var(--warn-text); }
.tile a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-hover); text-underline-offset: 3px; }
.tile a:hover { text-decoration-color: currentColor; }

/* 11. Key-value lists and plan levels ------------------------------------- */
.kv {
  display: grid;
  grid-template-columns: minmax(92px, 128px) minmax(0, 1fr);
  margin: 0 0 16px;
  font-size: 14px;
}
.kv dt, .kv dd { margin: 0; padding: 10px 0; border-top: 1px dashed var(--border); }
.kv > dt:first-child, .kv > dt:first-child + dd { border-top: 0; padding-top: 2px; }
.kv dt { padding-right: 12px; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.9; }
.kv dd { color: var(--text); overflow-wrap: anywhere; }
.kv .mono { color: var(--text); }

/* 12. Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0; }
.card.table-wrap { padding: 0; }
/* Tables as in the studio card: no header fill, mono labels, hairline rows, mono numbers. */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 12px; border-top: 1px solid var(--border); text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
@media (min-width: 640px) {
  th:first-child, td:first-child { padding-left: 24px; }
  th:last-child, td:last-child { padding-right: 24px; }
}
thead th {
  padding-top: 12px;
  padding-bottom: 8px;
  border-top: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody th { color: var(--text-2); font-weight: 500; }
tbody tr { transition: background-color 0.12s var(--ease); }
tbody tr:hover { background: var(--surface-soft); }
td.mono, td .mono { white-space: nowrap; }
td.num, th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
caption { padding: 0 0 8px; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; }

/* 13. Timeline ------------------------------------------------------------- */
.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 9px 0 9px 24px; font-size: 14px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}
.timeline li:first-child::before { top: 17px; }
.timeline li:last-child::before { bottom: calc(100% - 17px); }
.timeline li:only-child::before { display: none; }
.timeline li::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 13px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--border-hover);
  box-shadow: 0 0 0 1px var(--border-hover);
}
.timeline li:last-child::after { background: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.timeline li .muted.mono { font-size: 12px; margin-right: 6px; }

/* 14. Notices and flash messages ------------------------------------------ */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash-stack .flash { margin-bottom: 0; }

.flash, .notice {
  --tone: var(--accent);
  --icon: var(--i-info);
  position: relative;
  margin-bottom: 16px;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
}
.flash::before, .notice::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 12px;
  width: 16px;
  height: 16px;
  background: var(--tone);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.flash p, .notice p { margin: 0 0 4px; }
.flash ul, .notice ul { margin: 4px 0 0; padding-left: 18px; }
.flash a, .notice a { color: inherit; text-decoration: underline; text-decoration-color: currentColor; }
.flash button.link, .notice button.link { color: inherit; font-weight: 600; text-decoration-color: currentColor; }
.flash > p strong, .notice > p strong { color: var(--text); }

.flash-success { --tone: var(--up); --icon: var(--i-ok); border-color: var(--up-line); background: var(--up-soft); color: var(--up-strong); }
.flash-error { --tone: var(--down); --icon: var(--i-alert); border-color: var(--down-line); background: var(--down-soft); color: var(--down-strong); }
.notice.warn { --tone: var(--warn); --icon: var(--i-alert); border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-strong); }
/* A quiet note inside a panel (the studio card's message box). */
.notice.plain { padding: 10px 12px; border: 0; background: var(--bg); color: var(--text-2); }
.notice.plain::before { display: none; }

.notice-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

/* 15. Steps, permission list, QR, secret ---------------------------------- */
.steps { display: grid; gap: 14px; margin: 0 0 20px; padding: 0; list-style: none; counter-reset: step; }
.steps > li {
  position: relative;
  min-height: 28px;
  padding: 3px 0 0 42px;
  color: var(--text-2);
  counter-increment: step;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 24px;
  text-align: center;
}
.steps strong { color: var(--text); }

.perm-list { display: grid; gap: 2px; margin: 0 0 16px; padding: 0; list-style: none; }
.perm-list li {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 36px;
  padding-left: 30px;
  color: var(--text-2);
  font-size: 14px;
}
.perm-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--muted);
  -webkit-mask: var(--i-ok) center / contain no-repeat;
  mask: var(--i-ok) center / contain no-repeat;
}
.perm-list .ok::before { background: var(--up); }
.perm-list .bad { color: var(--down-text); }
.perm-list .bad::before { background: var(--down); -webkit-mask-image: var(--i-alert); mask-image: var(--i-alert); }

.qr {
  width: 220px;
  max-width: 100%;
  margin: 8px auto 16px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: 0 0 0 1px var(--border-strong);
}
.qr svg { display: block; width: 100%; height: auto; }

.secret {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}

/* 16. Brake, danger zone, empty state ------------------------------------- */
/* A panel that asks for attention: only its border carries the tone (no tinted card backgrounds). */
.brake { border-color: var(--warn-line); }
.brake > h2 { color: var(--text); }
.danger-zone { border-color: var(--down-line); }
.danger-zone > h2 { color: var(--down-text); }

/* Nothing here yet: dashed, like everything optional or empty in the studio. */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-xl);
  color: var(--muted);
  text-align: center;
}
.empty h3 { margin: 6px 0 0; color: var(--text); font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.empty p { max-width: 46ch; margin: 0; font-size: 13.5px; }
.empty .actions { justify-content: center; }

/* Long-form text (Terms, Privacy). */
/* Long-form text (Terms, Privacy, Security): a white sheet on the paper. */
.legal {
  max-width: 820px;
  margin: 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.7;
}
.page .legal.container { padding: 24px 18px 28px; }
@media (min-width: 640px) { .page .legal.container { padding: 40px 52px 44px; } }
.legal h1 { margin: 0 0 6px; font-size: clamp(26px, 2vw + 16px, 34px); }
.legal h1 + .muted { margin-bottom: 28px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; }
.legal h2 { margin: 32px 0 10px; color: var(--text); font-size: 18px; letter-spacing: -0.015em; }
.legal p, .legal ul, .legal ol { margin-bottom: 14px; }
.legal li { margin-bottom: 6px; }
.legal li::marker { color: var(--faint); }
.legal a { text-decoration: underline; text-decoration-color: var(--accent-line); }
.legal .lead { color: var(--text); font-size: 17px; }
.legal .callout { margin: 28px 0; padding: 4px 20px 6px; border: 1px solid var(--warn-line); border-radius: var(--r-lg); background: var(--warn-soft); color: var(--warn-strong); }
.legal .callout h2 { color: var(--warn-strong); }
.legal .callout h2 { margin-top: 18px; }
.legal code { overflow-wrap: anywhere; }

/* 17. Landing page --------------------------------------------------------- */
.page-landing { max-width: none; padding: 0; }
.page-landing > .flash-stack,
.page-landing > .notice { max-width: var(--site-max); margin: 16px auto 0; padding-left: 16px; padding-right: 16px; }

.hero { position: relative; padding: 48px 0 56px; overflow: hidden; isolation: isolate; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(16, 17, 20, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 17, 20, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 20%, transparent 75%);
}
.hero-grid { display: grid; gap: 44px; align-items: center; }
.hero-copy { max-width: 620px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.hero h1 {
  margin: 22px 0 18px;
  font-size: clamp(40px, 7.2vw, 66px);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.hero h1 .line { display: block; }
/* The studio's lime marker under the second line. */
.gradient-text {
  width: fit-content;
  padding: 0 0.06em;
  background: linear-gradient(180deg, transparent 60%, var(--highlight) 60%, var(--highlight) 92%, transparent 92%);
  color: var(--text);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hero .lead { max-width: 560px; margin-bottom: 28px; font-size: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-actions .button { flex: 1 1 auto; }
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 28px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 13.5px;
  list-style: none;
}
.trust-row li { display: flex; align-items: center; gap: 8px; }
.trust-row li { color: var(--text-2); }
.trust-row .icon { width: 18px; height: 18px; color: var(--text); }

@media (min-width: 560px) { .hero-actions .button { flex: 0 0 auto; } }
@media (min-width: 1000px) {
  .hero { padding: 80px 0 96px; }
  .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 56px; }
}

/* The sample on the landing page: the studio's own chart and plan card, drawn as static markup. */
.lp-sample { position: relative; min-width: 0; margin: 0; }
.lp-sample .button, .lp-card .button { pointer-events: none; }
.lp-chart { box-shadow: var(--shadow-2); }
.lp-chart .chart-head { padding-right: 14px; }
.lp-chart-box { aspect-ratio: 13 / 8; }
.lp-chart-box .chart-svg { width: 100%; height: 100%; }
.lp-chart .tag, .lp-chart .tag-last { pointer-events: none; }
.lp-ring { fill: none; stroke: var(--warn); stroke-width: 1.2; stroke-dasharray: 2 2; }
.lp-note { fill: var(--warn-text); font-size: 10px; font-weight: 550; }
.lp-sample figcaption { margin-top: 10px; color: var(--muted); font-size: 12.5px; text-align: center; }
@media (max-width: 519.98px) {
  .lp-chart-box { aspect-ratio: auto; height: 300px; }
  .lp-chart .chart-title .muted, .lp-ring, .lp-note { display: none; }
}
.lp-card { margin-top: 0; }
.lp-reason-q { margin: 0 0 6px; color: var(--text); font-size: 14px; font-weight: 550; }
.lp-reason { margin: 0 0 14px; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 14.5px; line-height: 1.5; }
.lp-card .check { align-items: center; color: var(--text-2); font-size: 14px; }
.fake-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
}
.fake-check .icon { width: 14px; height: 14px; stroke-width: 3.2; }

/* Sections. */
.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { max-width: 680px; margin-bottom: 36px; }
.section-head h2 { margin: 0 0 12px; font-size: clamp(26px, 3.4vw, 38px); font-weight: 650; line-height: 1.12; letter-spacing: -0.03em; }
.section-head.center .kicker { justify-content: center; }
.section-head p { color: var(--text-2); font-size: 16.5px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
@media (min-width: 960px) { .section { padding: 96px 0; } }

/* How it works. */
.how { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; counter-reset: how; }
.how-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  counter-increment: how;
}
.how-step::after {
  content: "Step " counter(how) " of 3";
  position: absolute;
  right: 20px;
  top: 22px;
  padding: 1px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}
.how-step h3 { margin: 4px 0 0; font-size: 18px; letter-spacing: -0.015em; }
.how-step p { margin: 0; color: var(--text-2); }
.how-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.how-meta .chip { height: 24px; text-transform: none; letter-spacing: 0; }
@media (min-width: 860px) { .how { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Feature grid with hairline separators. */
.feature-grid {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--border);
}
.feature { display: flex; flex-direction: column; gap: 10px; padding: 26px 24px; background: var(--surface); }
.feature h3 { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 16px; }
.feature h3 .mk { flex: none; width: 18px; height: 14px; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Security section. */
.security-grid { display: grid; gap: 32px; align-items: start; }
.security-copy .section-head { margin-bottom: 20px; }
.security-note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r);
  background: var(--warn-soft);
  color: var(--warn-strong);
  font-size: 14.5px;
}
.security-note .icon { color: var(--warn-text); margin-top: 1px; }
.security-list {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  list-style: none;
  box-shadow: var(--shadow-2);
}
.security-list li { display: flex; gap: 14px; padding: 16px; border-radius: 14px; }
.security-list li + li { border-top: 1px dashed var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.security-list strong { display: block; margin-bottom: 2px; color: var(--text); font-size: 15px; }
.security-list span { color: var(--muted); font-size: 14px; }
@media (min-width: 960px) { .security-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 56px; } }

/* FAQ. */
.faq { max-width: 820px; margin: 0 auto; padding: 0 20px; border: 1px solid var(--border-strong); border-radius: var(--r-xl); background: var(--surface); }
.faq details { border-bottom: 1px dashed var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 16px 4px;
  color: var(--text);
  font-size: 15.5px;
  font-weight: 550;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--text); }
.faq summary .icon { color: var(--muted); transition: transform 0.2s var(--ease); }
.faq details[open] summary .icon { transform: rotate(45deg); color: var(--text); }
.faq .answer { padding: 0 4px 20px; color: var(--text-2); max-width: 680px; }

/* Final call to action. */
.cta-band {
  position: relative;
  overflow: hidden;
  padding: 48px 24px;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-3);
  text-align: center;
}
/* The studio's ink guide bar: white text, the lime button. */
.cta-band h2 { margin: 0 0 12px; color: #fff; font-size: clamp(26px, 4vw, 40px); letter-spacing: -0.03em; }
.cta-band p { max-width: 520px; margin: 0 auto 24px; color: rgba(255, 255, 255, 0.78); }
.cta-band .button { background: var(--highlight); color: var(--ink); box-shadow: none; }
.cta-band .button:hover { background: #e2ff5c; color: var(--ink); }
.cta-band .button.secondary { border-color: transparent; background: #fff; color: var(--ink); }
.cta-band .button.secondary:hover { background: var(--surface-2); }
.cta-band .hero-actions { justify-content: center; }
@media (min-width: 640px) { .cta-band { padding: 64px 40px; } }

/* 18. Auth pages ----------------------------------------------------------- */
.page-auth { max-width: 1080px; padding-top: 24px; }
.auth {
  display: grid;
  grid-template-areas: "main" "aside";
  gap: 24px;
  align-items: stretch;
}
.auth-main { grid-area: main; display: flex; flex-direction: column; justify-content: center; }
.auth-aside { grid-area: aside; }
.auth-card {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.auth-head { margin-bottom: 22px; }
.auth-head .icon-badge { margin-bottom: 16px; }
.auth-head h1 { margin: 0 0 6px; font-size: clamp(24px, 1.2vw + 16px, 28px); }
.auth-head p { margin: 0; color: var(--muted); }
.auth-card .button.full { margin-top: 4px; }
.auth-alt { margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; text-align: center; }
.auth-alt a { font-weight: 500; }
.form-link-row { display: flex; justify-content: flex-end; margin: -6px 0 14px; font-size: 13.5px; }
.form-link-row a { display: inline-flex; align-items: center; min-height: 32px; }

.auth-aside {
  position: relative;
  overflow: hidden;
  padding: 24px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface-2);
}
.auth-aside > * { position: relative; }
.auth-aside-title { margin: 0 0 20px; font-size: clamp(22px, 2.6vw, 30px); font-weight: 650; line-height: 1.15; letter-spacing: -0.03em; }
.benefits { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.benefits li { display: flex; gap: 14px; padding: 14px 0; border-top: 1px dashed var(--border-strong); }
.benefits li:first-child { border-top: 0; padding-top: 0; }
.benefits .icon-badge { width: 36px; height: 36px; border-radius: 10px; }
.benefits .icon-badge .icon { width: 18px; height: 18px; }
.benefits strong { display: block; color: var(--text); font-size: 14.5px; }
.benefits span { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.auth-aside-foot { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--border-strong); color: var(--muted); font-size: 12.5px; }

@media (min-width: 640px) {
  .auth-card { padding: 32px; }
  .auth-aside { padding: 32px; }
}
@media (min-width: 900px) {
  .page-auth { padding-top: 48px; }
  .auth {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "aside main";
    gap: 32px;
    min-height: calc(100vh - 64px - 220px);
  }
  .auth-aside { display: flex; flex-direction: column; justify-content: center; padding: 44px 40px; }
  .auth-card { margin: 0 0 0 auto; padding: 36px; }
}

/* 19. Utilities and motion ------------------------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: initial; } .hide-lg { display: none; } }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .sidebar, .mobile-bar, .tabbar, .site-header, .banner { display: none !important; }
  .is-app .shell-main { margin: 0; padding: 0; }
  body { background: #fff; color: #000; }
}

/* ==========================================================================
   20. App pages
   Dashboard, plan detail, journal, activity, exchange, settings and two-step setup, built from the studio's parts
   (studio.css: .st-card/.pc-* plan card, .pc-tiles, .pc-table, .mk markers, .tool-btn, .seg, .reader).

   Two-column app layouts switch on when the content area is wide enough:
   820-959px (no sidebar yet) and from 1100px (sidebar shown).
   ========================================================================== */

/* 20.1 Shared bits --------------------------------------------------------- */
.icon.flip { transform: scaleX(-1); }
.section-title.first { margin-top: 0; }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin: -8px 0 8px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}
.back-link .icon { width: 16px; height: 16px; }
.back-link:hover { color: var(--text); text-decoration: none; }
@media (pointer: coarse) { .back-link { min-height: 44px; } }

.field-short { max-width: 320px; }
.hide-xs { display: none; }
@media (min-width: 520px) { .hide-xs { display: table-cell; } }

/* Quiet links in ink with a soft underline (the studio's). */
.pair-link, .row-link, .entry-pair {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-hover);
  text-underline-offset: 3px;
}
.pair-link:hover, .row-link:hover, .entry-pair:hover { color: var(--text); text-decoration-color: currentColor; }
.pair-link, .row-link { display: inline-flex; align-items: center; min-height: 36px; }
.row-link { font-size: 13.5px; font-weight: 500; }

/* The studio's small buttons, as links and in forms. */
a.tool-btn { color: var(--text); text-decoration: none; }
a.tool-btn:hover { color: var(--text); text-decoration: none; }
.tool-btn.full { display: flex; width: 100%; }
.tool-btn.is-danger { border-color: var(--down-line); color: var(--down-text); }
.tool-btn.is-danger:hover { border-color: var(--down); background: var(--down-soft); color: var(--tx-estop); }
.tool-btn .icon { width: 16px; height: 16px; }

/* Bullet facts with small icons (exchange card, connect form). */
.fact-list { display: grid; gap: 8px; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--border); list-style: none; }
.fact-list li { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.fact-list .icon { margin-top: 1px; color: var(--muted); }

/* Optional or risky steps fold away, dashed like the studio's "write it in your own words". */
.disclosure, .manage-step {
  margin: 10px 0 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--bg);
}
.disclosure > summary, .manage-step > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 550;
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker, .manage-step > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover, .manage-step > summary:hover { color: var(--text); }
.disclosure > summary .icon, .manage-step > summary .icon { color: var(--muted); }
.disclosure-caret { margin-left: auto; transition: transform 0.15s var(--ease); }
.disclosure[open] > summary, .manage-step[open] > summary { border-bottom: 1px dashed var(--border-strong); }
.disclosure[open] .disclosure-caret { transform: rotate(180deg); }
.disclosure-body, .manage-step > form, .manage-step > .stack { padding: 12px; }
.manage-step textarea, .manage-step input:not([type="radio"]):not([type="checkbox"]) { width: 100%; }
form.manage-step { padding: 12px; border-style: solid; border-color: var(--border); background: transparent; }

/* Copy buttons (shown by app.js when the browser can copy): small studio buttons. */
.copy-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.copy-button:hover { border-color: var(--ink); }
.copy-button.is-done { color: var(--up-text); }
.copy-button[hidden] { display: none; }
@media (pointer: coarse) { .copy-button { min-height: 44px; } }

/* The studio's tiles beside other pages' numbers. */
/* Any number of tiles: they wrap and the last row stretches, so no empty grey cell is left. */
.pc-tiles.fit { display: flex; flex-wrap: wrap; }
.pc-tiles.fit > div { flex: 1 1 150px; }
.pc-tiles dt .mk { display: inline-grid; width: 14px; height: 10px; margin: 0 6px 0 0; vertical-align: 1px; }
.pc-tiles dt .mk::before { width: 14px; }
.pc-tiles .pc-note { margin: 1px 0 0; color: var(--muted); font-size: 12px; font-weight: 400; font-family: var(--font-sans); line-height: 1.35; }
.pc-tiles .is-up dd { color: var(--up-text); }
.pc-tiles .is-target dd:not(.pc-note) { color: var(--tx-target); }
.mk-solid::before { border-top-style: solid !important; }
.pc-head-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pc-pair a { color: inherit; }

/* Two-column page grids. */
.dash-grid, .detail-grid, .connect-grid { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 18px; }
.dash-main, .dash-side, .detail-main, .detail-side { min-width: 0; }
@media (min-width: 820px) and (max-width: 959.98px), (min-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); align-items: start; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(290px, 360px); align-items: start; }
  .connect-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

/* 20.2 Dashboard ----------------------------------------------------------- */
.dash-side > .card { margin-bottom: 16px; }
.plan-item .pc-head { margin-bottom: 14px; }
.plan-item .pc-pair { font-size: 20px; }
.plan-item .pc-tiles { margin-bottom: 14px; }
.plan-item .entry-note { margin: 0 0 14px; }
.plan-item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px dashed var(--border); }

@media (max-width: 519.98px) {
  .finished-table th, .finished-table td { padding-left: 12px; padding-right: 12px; }
  .finished-table th:first-child, .finished-table td:first-child { padding-left: 16px; }
  .finished-table th:last-child, .finished-table td:last-child { padding-right: 16px; }
}

.conn-name { margin: 0; color: var(--text); font-weight: 550; }
.connection-card .muted.small { margin: 2px 0 0; }
.connection-card .fact-list { margin: 14px 0 16px; }

.card.review-nudge { display: flex; align-items: center; gap: 14px; border-color: var(--warn-line); background: var(--warn-soft); }
.review-nudge strong { display: block; color: var(--warn-strong); font-size: 14.5px; }
.review-nudge .muted { display: block; color: var(--warn-strong); font-size: 13px; }
.review-nudge .nudge-arrow { margin-left: auto; color: var(--warn-text); transition: transform 0.15s var(--ease); }
.review-nudge:hover { border-color: var(--warn); background: var(--warn-soft); }
.review-nudge:hover .nudge-arrow { transform: translateX(3px); }

.checklist { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--text-2); font-size: 14px; }
.checklist li + li { border-top: 1px dashed var(--border); }
.cl-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-hover);
  border-radius: 50%;
  color: transparent;
}
.cl-mark .icon { width: 13px; height: 13px; stroke-width: 3; }
.checklist .done .cl-mark { border-color: var(--ink); background: var(--ink); color: #fff; }
.checklist .done > span:last-child { color: var(--muted); }
.checklist a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }

/* 20.3 Market check (studio card, /api/market-check) ----------------------- */
.trend { color: var(--text-2); font-weight: 500; }
.trend-up { color: var(--up-text); }
.trend-down { color: var(--down-text); }
.trend-na { color: var(--muted); font-weight: 400; }

/* 20.4 Plan detail --------------------------------------------------------- */
.outcome { margin-bottom: 18px; }
.outcome .pc-tiles { margin-bottom: 12px; }
.outcome-note { margin: 0; }
.arm-checks-line { margin: 10px 0 0; }
.st-card.single { grid-template-columns: minmax(0, 1fr); margin-top: 0; margin-bottom: 16px; }
.pc-tiles .pc-note-lg { margin-top: 3px; color: var(--text); font-size: 14px; font-weight: 500; }
.pc-table .row-entry td:first-of-type { color: var(--text); font-weight: 600; }

.quote {
  margin: 0;
  padding: 10px 14px;
  border-left: 2px solid var(--border-hover);
  border-radius: 0 10px 10px 0;
  background: var(--bg);
  color: var(--text-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.orders-table td { vertical-align: middle; }
.side {
  display: inline-block;
  min-width: 46px;
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}
.side-buy { border-color: var(--up-line); background: var(--up-soft); color: var(--up-strong); }
.side-sell { border-color: var(--down-line); background: var(--down-soft); color: var(--down-text); }

.entry { padding: 12px 0; border-top: 1px dashed var(--border); }
.entry:first-of-type { padding-top: 2px; border-top: 0; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 8px; }
.entry p, .entry-text { margin: 0; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }

.detail-side .timeline li { padding-top: 7px; padding-bottom: 7px; }
.tl-label { display: block; color: var(--text); }
.timeline li .tl-time { display: block; margin: 1px 0 0; font-size: 12px; }

/* 20.5 Journal ------------------------------------------------------------- */
.stats-note { margin: -8px 0 20px; }
.journal-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
/* A row of links that work like the studio's segmented choice (the current one in ink). */
.seg-links { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface-2); font-family: var(--font-sans); letter-spacing: 0; text-transform: none; }
.seg-links a { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px; color: var(--text-2); font-size: 13px; font-weight: 550; text-decoration: none; }
.seg-links a:hover { background: rgba(255, 255, 255, 0.8); color: var(--text); text-decoration: none; }
.seg-links a[aria-current="page"] { background: var(--ink); color: #fff; }
@media (pointer: coarse) { .seg-links a { min-height: 40px; } }
.section-title .seg-links { margin-left: auto; }
.tile .tile-note { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-family: var(--font-sans); font-weight: 400; letter-spacing: 0; text-transform: none; }
.journal-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 18px; }
@media (min-width: 1100px) { .journal-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.journal-grid .pc-tiles { margin-bottom: 12px; }
.grid-2x2 td small { display: block; font-family: var(--font-sans); font-size: 11.5px; }
.r-curve { display: block; width: 100%; height: auto; margin: 0 0 6px; overflow: visible; }
.r-curve .r-zero { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.r-curve .r-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.r-curve .r-dot { fill: var(--ink); }
.planned-line { margin: -6px 0 12px; }
/* Review tags: checkbox pills, chosen = ink (the studio's selected look). */
.tag-pick { grid-column: 1 / -1; min-width: 0; margin: 0 0 14px; padding: 0; border: 0; }
.tag-pick legend { margin: 0 0 6px; padding: 0; color: var(--text); font-size: 13.5px; font-weight: 550; }
.tag-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.tag-group-name { min-width: 110px; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.tag-chip { position: relative; display: inline-flex; cursor: pointer; }
.tag-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tag-chip span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500; }
.tag-chip:hover span { border-color: var(--ink); }
.tag-chip input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.tag-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) { .tag-chip span { min-height: 40px; } }
.tag-pick input[name="own_tags"] { max-width: 420px; margin-top: 4px; }
.tag-label { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.review-card { border-color: var(--warn-line); }
.review-card .pc-head { margin-bottom: 14px; }
.review-card .pc-pair { font-size: 20px; }
.intervention-note { display: flex; gap: 6px; align-items: baseline; margin: 4px 0 0; color: var(--warn-text); }
.r-badge {
  flex: none;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.r-badge.is-up { border-color: var(--up-line); background: var(--up-soft); color: var(--up-strong); }
.r-badge.is-down { border-color: var(--down-line); background: var(--down-soft); color: var(--down-text); }
.review-form .field { margin-bottom: 14px; }
@media (min-width: 720px) {
  .review-form { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  .review-form > .button { grid-column: 1 / -1; justify-self: start; }
}
.entry-feed .entry { padding: 14px 0; }
.entry-feed .entry:first-child { padding-top: 0; border-top: 0; }
.entry-feed .entry:last-child { padding-bottom: 0; }
.entry-pair { font-family: var(--font-mono); font-size: 13.5px; font-weight: 500; }
.entry-time { margin-left: auto; }
@media (max-width: 519.98px) { .entry-time { flex-basis: 100%; margin-left: 0; } }

/* 20.6 Activity ------------------------------------------------------------ */
.log-card { padding: 0; overflow: hidden; }
.log { margin: 0; padding: 0; list-style: none; }
.log-day { padding: 14px 16px 6px; }
.log-day:not(:first-child) { margin-top: 0; border-top: 1px solid var(--border); }
.log-day h2 { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.log-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  grid-template-areas: "dot label plan" "dot time plan";
  align-items: center;
  column-gap: 12px;
  min-height: 48px;
  padding: 7px 16px;
  transition: background-color 0.12s var(--ease);
}
.log-row:hover { background: var(--surface-soft); }
.log-row + .log-row { border-top: 1px dashed var(--border); }
.log-dot { grid-area: dot; width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--faint)); }
.log-time { grid-area: time; color: var(--muted); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.log-label { grid-area: label; color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.log-detail { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 12.5px; }
.log-advice { font-family: inherit; font-size: 13px; }
.log-plan {
  grid-area: plan;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.log-plan:hover { border-color: var(--ink); color: var(--text); text-decoration: none; }
.tone-up { --tone: var(--ln-target); }
.tone-down { --tone: var(--ln-stop); }
.tone-warn { --tone: var(--ln-scale); }
.tone-accent { --tone: var(--ln-trigger); }
.tone-neutral { --tone: var(--border-hover); }
@media (min-width: 640px) {
  .log-day { padding-left: 24px; padding-right: 24px; }
  .log-row { grid-template-columns: 10px 76px minmax(0, 1fr) auto; grid-template-areas: "dot time label plan"; padding: 6px 24px; min-height: 46px; }
}
@media (pointer: coarse) { .log-plan { min-height: 40px; } }

/* 20.7 Exchange ------------------------------------------------------------ */
.conn-status { border-color: var(--up-line); }
.conn-status-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 14px; }
.conn-status-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 18px; letter-spacing: -0.015em; }
.conn-status-text p { margin: 0; overflow-wrap: anywhere; }
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2px 16px;
  margin: 14px 0;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--bg);
}
.conn-remove { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.conn-remove p { flex: 1 1 260px; margin: 0; }
.practice-block + .practice-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.practice-block h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 15px; }
.guide .steps { margin-bottom: 0; }
.ip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ip { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); }
.ip code { padding: 4px 8px; border: 0; background: transparent; color: var(--text); font-size: 13.5px; }
input.mono-input { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.01em; }
textarea.mono-input { min-height: 96px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.connect-facts { margin-top: 18px; }
.key-kinds { display: grid; gap: 6px; margin: 8px 0 0; padding-left: 18px; }
.key-kinds li { list-style: disc; }
.guide-more { display: flex; align-items: flex-start; gap: 8px; margin: 18px 0 0; padding-top: 14px; border-top: 1px dashed var(--border); }
.guide-more .icon { flex: none; margin-top: 1px; color: var(--muted); }
/* Key type: radio cards; the chosen one is outlined in ink. Only its secret field shows (both show without :has). */
.key-type { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.key-type legend { margin: 0 0 6px; padding: 0; color: var(--text); font-size: 13.5px; font-weight: 550; }
.key-type-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}
.key-type-option:hover { border-color: var(--border-hover); }
.key-type-option:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); color: var(--text); }
.key-type-option input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer; }
.key-type-option input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.connect-form:has(input[name$="key_type"][value="ed25519"]:checked) [data-key-field="hmac"],
.connect-form:has(input[name$="key_type"][value="hmac"]:checked) [data-key-field="ed25519"] { display: none; }

/* 20.8 Settings ------------------------------------------------------------ */
.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.settings-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 2px;
  border-radius: 999px;
  background: var(--surface-2);
  scrollbar-width: none;
}
.settings-nav::-webkit-scrollbar { display: none; }
.settings-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.settings-link .icon { color: var(--faint); }
.settings-link:hover { background: rgba(255, 255, 255, 0.8); color: var(--text); text-decoration: none; }
.settings-link.is-danger, .settings-link.is-danger .icon { color: var(--down-text); }
@media (pointer: coarse) { .settings-link { min-height: 44px; } }
@media (min-width: 820px) and (max-width: 959.98px), (min-width: 1100px) {
  .settings { grid-template-columns: 196px minmax(0, 1fr); gap: 18px; align-items: start; }
  .settings-nav { position: sticky; top: 28px; flex-direction: column; gap: 2px; overflow: visible; padding: 0; border-radius: 0; background: transparent; }
  .settings-link { min-height: 40px; border-radius: 10px; }
  .settings-link:hover { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
}

.set-head { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.set-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 18px; letter-spacing: -0.015em; }
.set-head p { margin: 0; font-size: 13.5px; }
.danger-zone .set-head h2 { color: var(--down-text); }
.danger-zone .set-head { border-bottom-color: var(--down-line); }
.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg);
}
.set-row-main { display: flex; flex-direction: column; min-width: 0; }
.set-label { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.set-value { color: var(--text); overflow-wrap: anywhere; }
.set-actions { margin-top: 14px; }
.set-section > p { color: var(--text-2); }
.rules-form .set-sub { margin: 20px 0 8px; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.rules-form .set-sub:first-of-type { margin-top: 4px; }
.rule-level { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-start; }
.rule-level > .field, .rule-level > .field-short { flex: 1 1 220px; max-width: none; }
.lock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }

/* Settings: plan templates; journal: results by template. */
.tpl-list { margin: 0; padding: 0; list-style: none; }
.tpl-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--border); }
.tpl-list li:first-child { border-top: 0; }

/* Error pages. */
.error-card { margin: 24px 0; padding: 28px 24px; border: 1px solid var(--border-strong); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-2); }
.error-card h1 { margin: 0 0 8px; }

/* 20.9 Two-step setup ------------------------------------------------------ */
.setup-card .pc-main .steps { margin-bottom: 18px; }
.setup-qr { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.setup-qr .qr { width: 196px; margin: 0; }
.secret-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 8px; margin: 0; text-align: center; }
.disclosure + .disclosure { margin-top: 8px; }

/* 20.10 Account security: recovery codes, browsers and log-ins, the bot check -- */
.set-section .set-sub { margin: 18px 0 6px; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.set-section .set-head + .set-sub { margin-top: 4px; }
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 16px 0 12px; padding: 0; list-style: none; }
.code-grid li { padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); background: var(--bg); color: var(--text); font-size: 15px; letter-spacing: 0.04em; text-align: center; }
.codes-card .secret-row { justify-content: flex-start; }
.lost-phone { margin-top: 14px; }
.lost-phone p { margin: 0 0 8px; font-size: 13.5px; }
.lost-phone p:last-child { margin-bottom: 0; }
.session-list { margin: 0; padding: 0; list-style: none; }
.session-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-top: 1px dashed var(--border); }
.session-list li:first-child { border-top: 0; }
.session-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.session-meta { color: var(--muted); font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.notice-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.bot-check { min-height: 65px; margin: 4px 0 14px; }
